{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# week07 - Rutgers University School of Engineering Fall 2011...

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

Rutgers University School of Engineering Fall 2011 14:440:127 - Introduction to Computers for Engineers Sophocles J. Orfanidis ECE Department [email protected] week 7

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

View Full Document
Week 1 - Basics – variables, arrays, matrices, plotting (ch. 2 & 3) Week 2 - Basics – operators, functions, program flow (ch. 2 & 3) Week 3 - Matrices (ch. 4) Week 4 - Plotting – 2D and 3D plots (ch. 5) Week 5 - User-defined functions (ch. 6) Week 6 - Input-output processing (ch. 7) Week 7 - Program flow control & relational operators (ch. 8) Week 8 - Matrix algebra – solving linear equations (ch. 9) Week 9 - Structures & cell arrays (ch. 10) Week 10 - Symbolic math (ch. 11) Week 11 - Numerical methods – data fitting (ch. 12) Week 12 – Selected topics Weekly Topics Textbook: H. Moore, MATLAB for Engineers , 2 nd ed., Prentice Hall, 2009
Topics Relational and logical operators Logical indexing find function Program flow control for - loops while - loops if – statements switch –statements break, continue Examples: series calculations, square-root algorithm, piece-wise functions, unit-step function, indicator functions, sinc function, echoes

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

View Full Document
Relational and Logical Operators >> doc is* % list of all 'is' functions >> help logical % convert to logical >> help true % logical 1 >> help false % logical 0 >> help relop % relational operators >> help ops % same as help / >> help find % indices of non-zero elements Relational and logical functions find, logical, true, false, any, all ischar, isequal, isfinite, isinf, isinteger islogical, isnan, isreal >> help precedence
& logical AND, e.g., A&B, A,B=expressions && logical AND for scalars w/ short-circuiting | logical OR, e.g., A|B, or A||B || logical OR for scalars w/ short-circuiting ~ logical NOT, e.g., ~A xor exclusive OR, e.g., xor(A,B) any true if any elements are non-zero all true if all elements are non-zero Logical Operators == equal ~= not equal < less than > greater than <= less than or equal >= greater than or equal Relational Operators >> help relop

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

View Full Document
>> a = [1 2 0 -3 7]; >> b = [3 2 4 -1 7]; >> a == b ans = 0 1 0 0 1 >> a == -3 ans = 0 0 0 1 0 >> find(a==-3) % otherwise, empty ans = 4 >> find(a), find(a>=2), find(a<=0) ans = 1 2 4 5 ans = 2 5 ans = 3 4 >> a>=2 ans = 0 1 0 0 1
>> a = [1 2 0 -3 7]; >> b = [3 2 4 -1 7]; >> a < b ans = 1 0 1 1 0 >> a>=2, b<=2 ans = 0 1 0 0 1 ans = 0 1 0 1 0 >> (a>=2) & (b<=2) % logical AND ans = 0 1 0 0 0 >> (a>=2) | (b<=2) % logical OR ans = 0 1 0 1 1

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

View Full Document
>> a = [1 3 4 -3 7];
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 41

week07 - Rutgers University School of Engineering Fall 2011...

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

View Full Document
Ask a homework question - tutors are online