Exam 3 Review

# X 0 05pi pi 15pi 20pi y sinx y 0 1

This preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: sin(x); % y == [ 0 1 0 1 0 ] 5 Outline Lecture 15 and 16 Intro to MATLAB and Matrices Lecture 17 Script and Function Files Lecture 18 and 19 MATLAB Programming Lecture 20 Subarrays and Vectorization Lecture 21 Plotting in MATLAB Conditional Operators in MATLAB == ~= > >= < <= equal to not equal to greater than greater than or equal to less than less than or equal to These return 1 for true or 0 for false Conditional Operators Conditional operators can be used between arrays 1 5 > 3 1 0 1 3 -1 -1 2 1 0 They can also be used between a scalar and an array 5 > 8 2 0 1 10 -1 0 1 Logical Operators in MATLAB & | xor( ) ~ A 0 0 1 1 B 0 1 0 1 A&B 0 0 0 1 Logical AND Logical OR Logical Exclusive OR Logical NOT A|B 0 1 1 1 xor(A, B) 0 1 1 0 The If Construct in MATLAB The basic form of the if construct in MATLAB is: if control_exp1 statement1 statement2 etc. elseif control_exp2 statement 3 statement 4 etc. else statement 5 statement 6 end The Switch Construct MATLAB also has a switch construct for cases in which you are choosing from a number of alternatives: switch (switch_expr) case case_expr_1 Statement 1 Statement 2 case case_expr_2 Statement 3 Statement 4 otherwise Statement 5 end Every construct must have an if and an end. The other parts are option...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern