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
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/10/2009 for the course ECE 340 taught by Professor Djordjevic during the Fall '08 term at Arizona.

### Page1 / 5

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

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

View Full Document
Ask a homework question - tutors are online