Professional Documents
Culture Documents
Learning Objectives
Introduce Matlab
Open and Close File
Solving Differential Equation in MATLAB
Writing Transfer Functions
Getting step and impulse response
Empirical Modeling
MATLAB
MATLAB is an interactive tool for scientific and
engineering computations
MATLAB stands for Matrix Laboratory
Starting and Exiting MATLAB
Exit or quit on the command line
Help of MATLAB
Documentation
Create a m File
Try:
x=[1 2 3 4];
y=[1 4 6 7];
Find z = x+y;
plot (x,z);
xlabel('X');
ylabel(Z');
4
Important Points
Data Entry
Scalar: =
Vector: Row vector separated by space or comma
Different rows: Separated by Semicolon
f = 2:2:10
Note that any text after % is treated as
comments, and is not executed
Saving File
Use Diary command to save the commands as
well as output in a file
Diary Off
Graphics
Plot x vs. Sin X where x varies from 0 to 1 with
a step size of 0.1
On the same graph plot x vs. Cos x
X vs. tanX
1.6
1.4
1.2
1
0.8
0.6
0.4
0.2
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
+ 4 = 2
0 =1
1
0.95
0.9
0.85
0.8
0.75
0.7
0.65
0.6
0.55
0.5
5
t
10
10
3
3
2
6 2
11
+ 6 = 1
0 = 0 = "(0) = 0
11
12
References
http://www.mathworks.com/help/pdf_doc/m
atlab/getstart.pdf
help control
http://www.mathworks.com/help/pdf_doc/co
ntrol/usingcontrol.pdf
13