{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

flowchart+posted

# flowchart+posted - TransferofControl...

This preview shows pages 1–18. Sign up to view the full content.

Transfer of Control if if/else if/elseif/else switch/case end Relational operators, Logical operators, Conditionals

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
branching  IF  statement if  condition       action end
RELATIONAL OPERATORS Less than = Less than or equal Greater than = Greater than or equal = Equal = Not equal

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
X and Y are  scalars   X < Y 1 true 0 false logical  varibles
Example:  Calculate y=sin(x)/x But what if x = 0 ? if x ~= 0 y = sin(x)/x; end

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
LOGICAL OPERATORS Not ~ (5>6) (3==3)  (2<1) Or And (3==3)  |   (2<1)
X and Y are  arrays   X > Y [ 1 1 0 . .. 1 0 ] logical  array

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
LOGICAL FUNCTIONS any (x) all (x) find (x) any ( any (A) ) find (x <= 1)
>> x = [ 1 0 1 0 1 0 0 0 1 1 0 0 ]; >> any(x) ans = 1 1 1 0 >> any(any(x)) ans = 1 >> all(x) ans = 1 0 0 0 >> all(all(x)) ans = 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
>> x = [ 1 0 1 0 1 0 0 0 1 1 0 0 ]; >> find(x) ans = 1 2 3 6 7 >> [i,j] = find(x) i = 1 2 3 3 1 j = 1 1 1 2 3
>> x = [ -1 2 8 9 -3 7 0 1 5 4 6 -2 ]; >> find(x > 1) ans = 2 4 5 8 9 10 11

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
branching  IF-ELSE  statement if  condition1       action1 else       action2 end
Example:  Calculate y=sin(x)/x if x ~= 0 y = sin(x)/x; else y = 1; end

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Example:  Calculate y=sin(x)/x if x > 1e-5 y = sin(x)/x; else y = 1-x^2/6; end
branching  IF - ELSEIF - ELSE if       condition1       action1 elseif  condition2       action2 else       action3 end

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MULTIPLE SELECTION switch   expression    case  test_value1         commands1    case  test_value2         commands2    otherwise         commands3 end
MATLAB IMPLEMENTATION gradeA = 0; gradeB = 0; gradeC = 0; gradeD = 0; gradeF = 0;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 32

flowchart+posted - TransferofControl...

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online