tutorial

tutorial - % FILE: tutorial.m e echo on % Matlab's...

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

View Full Document Right Arrow Icon
% 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;
Background image of page 1

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

View Full DocumentRight Arrow Icon
a=5+3; pause p % But you look at these values at any time later: % t a pause p % Vector operations: % 2*t
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

tutorial - % FILE: tutorial.m e echo on % Matlab's...

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

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