Digital Signal Processing Reference
In-Depth Information
5
0
-5
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
5
0
-5
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
5
0
-5
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
5
0
-5
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
Time (s ec . )
FIGURE A.1
Illustration for the MATLAB plot functions.
A.4 MATLAB SCRIPT FILES
We can create a MATLAB script file using the built-in MATLAB editor (or Windows Notepad) to write
MATLAB source code. The script file is named “filename.m” and can be run by typing the file name at
the MATLAB prompt and hitting the return key. The script file test.m is described here for illustration.
Figure A.2 illustrates the plot produced by test.m.
At MATLAB prompt, run the program
>> which test % show the folder where test.m resides
Go to the folder that contains test.m, and run your script from MATLAB.
>> test % run the test.m
>> type test % display the contents of test.m
test.m
t
0:0.01:1;
¼
x
sin(2*pi*2*t);
y ¼ 0.5*cos(2*pi*5*t-pi/4);
plot(t,x), grid on
title(
¼
Test plots of sinusoids
)
'
'
ylabel(
Signal amplitudes
);
'
'
 
Search WWH ::




Custom Search