week08 - Rutgers University School of Engineering Spring...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Rutgers University School of Engineering Spring 2012 14:440:127 - Introduction to Computers for Engineers Sophocles J. Orfanidis ECE Department [email protected] week 8 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) – Exam 1 Week 6 - Input-output formatting – fprintf, fscanf (ch. 7) Week 7 - Relational & logical operators, if, switch statements (ch. 8) Week 8 - For-loops, while-loops (ch. 9) Week 9 - Matrix algebra – solving linear equations (ch. 10) Week 10 - Cell arrays and structures (ch. 11) – Exam 2 Week 11 - Numerical methods – part I (ch. 13) Week 12 - Numerical methods – part II (ch. 13) Week 13 - Symbolic toolbox (ch. 12) Week 14 - Exam 3 Weekly Topics Textbook: H. Moore, MATLAB for Engineers , 3 d ed., Prentice Hall, 2011 Topics Relational and logical operators Logical indexing find function Program flow control for- loops while- loops break, continue Examples: series calculations, square-root algorithm, piece-wise functions, unit-step function, indicator functions, sinc function, echoes 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 OR, e.g., A|B ~ logical NOT, e.g., ~A && logical AND for scalars w/ short-circuiting || logical OR for scalars w/ short-circuiting 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 Operator Precedence in MATLAB (from highest to lowest): 1. transpose ( .' ), power ( .^ ), conjugate transpose ( ' ), matrix power ( ^ ) 2. unary plus ( + ), unary minus (- ), logical negation ( ~ ) 3. multiplication ( .* ), right division ( ./ ), left division ( .\ ), matrix multiplication ( * ), matrix right division ( / ), matrix left division ( \ ) 4. addition ( + ), subtraction (- ) 5. colon operator ( : ) 6. less than ( < ), less than or equal to ( <= ), greater than ( > ), greater than or equal to ( >= ), equal to ( == ), not equal to ( ~= ) 7. element-wise logical AND ( & ) 8. element-wise logical OR ( | ) 9. short-circuit logical AND ( && ) 10. short-circuit logical OR ( || ) >> help precedence Program flow is controlled by the following control structures: 1. for . . . end % loops 2. while . . . end 3. break, continue 4. if . . . end % conditional 5. if . . . else . . .end if ....
View Full Document

{[ snackBarMessage ]}

Page1 / 58

week08 - Rutgers University School of Engineering Spring...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online