This preview shows pages 1–8. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Rutgers University School of Engineering Spring 2012 14:440:127  Introduction to Computers for Engineers Sophocles J. Orfanidis ECE Department orfanidi@ece.rutgers.edu 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  Userdefined functions (ch. 6) Exam 1 Week 6  Inputoutput formatting fprintf, fscanf (ch. 7) Week 7  Relational & logical operators, if, switch statements (ch. 8) Week 8  Forloops, whileloops (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, squareroot algorithm, piecewise functions, unitstep 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 nonzero 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., AB ~ logical NOT, e.g., ~A && logical AND for scalars w/ shortcircuiting  logical OR for scalars w/ shortcircuiting xor exclusive OR, e.g., xor(A,B) any true if any elements are nonzero all true if all elements are nonzero 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. elementwise logical AND ( & ) 8. elementwise logical OR (  ) 9. shortcircuit logical AND ( && ) 10. shortcircuit 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
This note was uploaded on 03/26/2012 for the course ENGINEERIN 440:127 taught by Professor Blase during the Spring '10 term at Rutgers.
 Spring '10
 blase

Click to edit the document details