tutorial

# tutorial - FILE tutorial.m e echo on Matlab's operators are...

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

% FILE: tutorial.m % echo on e % Matlab's operators are what you'd expect them to be: % 5+3 pause 5-3 pause 5*3 pause 5/3 pause 5^3 pause 2^0.5 pause p % Matlab easily handles complex arithmetic (can use either j or i as % sqrt(-1), but Matlab gives its answers using i): % 2+3*i pause (5-10*j)/(-1+7*j) pause exp(pi*i)+1 % note Matlab recognizes the constant "pi" pause abs(1-i) pause 180*angle(1-i)/pi % the angle of this complex number in degrees pause p % Matlab has standard functions (we already saw exp, abs, and angle) % sin(pi/2) cos(pi/2) tan(pi/2) pause p % Matlab prefers to work with vectors, and a vector is easily created: % v=[3 -5 .9 1] pause p % The transpose of a vector (or matrix) is performed with an apostrophe: % v' pause p % Sometimes a vector that is a set of indices is preferred: % t=0:9 pause p % You may suppress Matlab output in any equation with a semicolon: % t=0:9;

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

View Full Document
a=5+3; pause p % But you look at these values at any time later: % t a pause p % Vector operations: % 2*t pause p t + (2:2:20) pause p t.*t pause p t.^2 pause p t.^3 pause p % Plotting is as easy as: % t=0:.1:10*pi;
This is the end of the preview. Sign up to access the rest of the 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