{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Matlab Tutorial

# Matlab Tutorial - EPM 381 Matlab Tutorial General commands...

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

EPM 381 Matlab Tutorial General commands used in Classical Control System Analysis and Design: Variable Assignment Commands: a = 5 or a = 5; with or without output A = [1 2 3]; one dimensional array assignment B = [1 2 3; 4 5 6; 7 8 9]; two dimensional array assignment c = B(2,3); one element from an array c = B(1:3,2); c = column 2 of B d = B(3,:); the last row from the array C= [0:2:100] assigns all even numbers up to 100 in vector C D= linspace(5, 50, 1000); generates a 1000 element vector D with equally spaced values from 5 to 50 D= logspace(5, 50, 1000); same as linspace, but with logarithmically, equally spaced values General Command Environment: pwd, cd, ls directory commands <up arrow> last command abc<up arrow> last command starting in abc help command_name help on command_name, better to use the Help menu on the PC m = mean(Y); a function call save data A B C -ascii -double -tab saves the variables A, B, C in the file "data.mat" in double, ASCII form, tab delimited. load data loads the variables stored in the file "data.mat" load data.txt loads an array of numbers stores in ASCII for in the file "data.txt" filename runs the "m" file named "filename.m" which contains Matlab program commands Plotting and Graphing: plot(x,y) plots the vector y versus the vector x plot(y) y is a complex vector, plots Im{y} versus Re{y}

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

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

{[ snackBarMessage ]}

### Page1 / 4

Matlab Tutorial - EPM 381 Matlab Tutorial General commands...

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

View Full Document
Ask a homework question - tutors are online