ECE602 Biomedical Engineering I. Introduction A major challenge in BME: Immense scope of...

Post on 21-Dec-2015

214 views 0 download

Transcript of ECE602 Biomedical Engineering I. Introduction A major challenge in BME: Immense scope of...

ECE602

Biomedical Engineering I

Introduction

A major challenge in BME: Immense scope of biometrically relevant problems

• The molecular and tissue engineering problem (chemical engineers)

• The biomechanics aspects (mechanical engineers)

• The imaging and measurement problems (electrical engineers)

Introduction

A integrated overview of the major bioengineering problems

• Biomedical steady – state behavior

• Biomedical dynamic behavior

• Biomedical data analysis

Introduction

Biomedical steady – state behavior

• Physiological Systems

• Force balance in biomechanics

• Medical image reconstruction

• Cell and Tissue Systems

• Cell migration

• Cell ablation

• Molecular Systems

• Metabolic mass balance

• Receptor-ligand binding

Introduction

Biomedical dynamic behavior

• Physiological Systems

• Arrhythmia detection

• Heart rate variability

• Cell and Tissue Systems

• Membrane and action potentials

• Capillary transport

• Molecular Systems

• Metabolic pathways

• Drug transport

Introduction

Biomedical data analysis

• Physiological Systems

• Heart beat classification

• Cell and Tissue Systems

• The classification of normal and malignant tissue cells

• Molecular Systems

• Gene classification in microarray images

Introduction

Numerical methods

• Biomedical steady – state behavior

• Linear models

• Nonlinear equations

• Biomedical dynamic behavior

• Finite difference, interpolation and integration

• Ordinary differential equations

• Partial differential equations

• Biomedical data analysis

• Machine learning (Support vector machine)

MATLAB Overview

Sequences of statements: first:increment:lastfirst:increment:last

>> x=[32:2:74]>> x=[32:2:74]

x =x =

Columns 1 through 15 Columns 1 through 15

32 34 36 38 40 42 44 46 48 50 52 54 56 58 6032 34 36 38 40 42 44 46 48 50 52 54 56 58 60

Columns 16 through 22 Columns 16 through 22

62 64 66 68 70 72 7462 64 66 68 70 72 74

MATLAB Overview

Condition execution (IF ELSE) IF expression statements ELSEIF expression statements ELSE statements END

MATLAB Overview

Condition execution (IF ELSE) Ex. Write a MATLAB function to compute the following function

01

00

01

)(

x

x

x

xf

function f=myfn1(x) if x<0 f=-1;elseif x==0 f=0;else f=1;end

MATLAB Overview

Condition execution (SWITCH) SWITCH switch_expr CASE case_expr, statement, ..., statement CASE {case_expr1, case_expr2, case_expr3,...} statement, ..., statement ... OTHERWISE, statement, ..., statement END Ex. Write a MATLAB script that reads a character variable (s or c) and an integer (1,2,3) and plots a function on the following chart

1 2 3

s sin(a) exp(-a)sin2(a) sin(3a)/exp(-a)

c cos(a) cos(2a)/exp(-2a) exp(-a) cos3(a)

MATLAB Overview

Condition execution (SWITCH)

% example: Use of the switch statementclc, cleartwopi=2*pi;theta=0:(twopi/100):twopi;letter=input('Please enter either s or c: ');col=input('Please enter either 1, 2 or 3: ');figure(1);switch lettercase 's' switch col case 1 plot(theta,sin(theta)); case 2 plot(theta,exp(-theta).*(sin(theta)).^2); case 3 plot(theta,sin(3*theta)./exp(-theta)); endcase 'c' switch col case 1 plot(theta,cos(theta)); case 2 plot(theta,cos(2*theta)./exp(-2*theta)); case 3 plot(theta,exp(-theta).*(cos(theta)).^3); endend

MATLAB Overview

Condition execution (SWITCH)

Please enter either s or c: 's'Please enter either 1, 2 or 3: 2

0 1 2 3 4 5 6 70

0.05

0.1

0.15

0.2

0.25

0.3

0.35

MATLAB Overview

Iteration (While loops)

WHILE expressionWHILE expression statementsstatements ENDEND

Ex. Write a script that computes the number of random numbers required to add up to 20 or more. Use rand to generate random numbers

MATLAB Overview

Iteration (While loops)

% Whileloop.m: Use of while...end loops clc; clearadd=0;count=0;while add<20 add=add+rand; count=count+1;enddisplay(count);display(add);

count =

40

add =

20.5930

MATLAB Overview

Iteration (For loops)

FOR variable = expr, statement, ..., statement END FOR variable = expr, statement, ..., statement END

Ex. Given the vector x=[1 8 3 9 0 1], create a MATLAB script to add the values of the elements

MATLAB Overview

Iteration (For loops)

% forloop.mclc; clearx=[1 8 3 9 0 1];add=0;for i=1:length(x) add=add+x(i);endaddsum(x)

add =

22

ans =

22

MATLAB Overview

Number representation

• Integers: -3, 5• real number: 0.00004• Scientific notation: 4e-5 • Complex number: 3+5i (3+5j)

realmin: the smallest real numberrealmax:the largest real numberinf: infinity (1/0)NaN: not a number (0/0)

MATLAB Overview

Number representation

>> inv(1+j)

ans =

0.5000 - 0.5000i

>> x=3+5i

x =

3.0000 + 5.0000i

>> conj(x)

ans =

3.0000 - 5.0000i

MATLAB Overview

Arrays

Ex. Create a 5x5 with elements A(i,j)=1/(2i+3j). Print the entire matrix, the first row and the second column. Give two ways of displaying the element A(3,2)

% ArraysRef.m% Indexing arraysfor i=1:5 for j=1:5 A(i,j)=1/(2^i+3^j); endendAA(1,:)A(:,2)A(8)A(3,2)

MATLAB Overview

Arrays>> ArraysRef

A =

0.2000 0.0909 0.0345 0.0120 0.0041 0.1429 0.0769 0.0323 0.0118 0.0040 0.0909 0.0588 0.0286 0.0112 0.0040 0.0526 0.0400 0.0233 0.0103 0.0039 0.0286 0.0244 0.0169 0.0088 0.0036

ans =

0.2000 0.0909 0.0345 0.0120 0.0041

ans =

0.0909 0.0769 0.0588 0.0400 0.0244

ans =

0.0588

ans =

0.0588

MATLAB Overview

Characters and strings

Ex. Create two MATLAB variables with the strings ‘Biomedical’ and ‘Engineering’ Ex. Create two MATLAB variables with the strings ‘Biomedical’ and ‘Engineering’ respectively. Concatenate the two strings, print the combined string and then print respectively. Concatenate the two strings, print the combined string and then print the indices of all occurrences of the letter ‘e’.the indices of all occurrences of the letter ‘e’.

% strings.m% Character strings as arraysclc; clearB='Biomedical';E='Engineering';BME=strcat(B,E)L=length(BME);for i=1:L if(BME(i)=='e') display(i); endend

BME =

BiomedicalEngineering

i =

5

i =

16

i =

17

MATLAB Overview

Logical operations• NOT ~NOT ~• AND &AND &• OR |OR |• Exclusive OR xor(A, B)Exclusive OR xor(A, B)

Ex. Given x = 1:10 and y = [3 1 5 6 8 2 9 4 7 0], execute and interprete the results of the following commands

1. (x>3) & (x<8)2. x(x>5)3. y(x<=4)4. x( (x<2) | (x>=8))5. y( (x<2) | (x>=8))6. x( y<0 )

MATLAB Overview

Logical operations

% Logical indexingclc; clearx = 1:10 y = [3 1 5 6 8 2 9 4 7 0](x > 3) & (x < 8)x(x > 5)y(x <= 4)x( (x < 2) | (x >= 8) )y( (x < 2) | (x >= 8) )x(y < 0)

x =

1 2 3 4 5 6 7 8 9 10

y =

3 1 5 6 8 2 9 4 7 0

ans =

0 0 0 1 1 1 1 0 0 0

ans =

6 7 8 9 10

ans =

3 1 5 6

ans =

1 8 9 10

ans =

3 4 7 0

ans =

Empty matrix: 1-by-0