Matlab Practice
1.
Please use ‘help’ command to learn the following useful matlab build-in functions by
yourself.
abs, min, max, sum, ones, zeros, exp, log, sqrt, disp, input,
load, length, size, trapz, spline, ode45, odeset,reshape,
image, plotyy, linspace, subplot, rand, floor
accelerate key:
stop
ctrl + C
comment
ctrl + R
uncomment
ctrl + T
smart indent
ctrl + I
save and run
F5
2.
2-D plotting
clear
% plot
x = 0:pi/100:2*pi;
y1 = sin(6*x);
y2 = 2*cos(x);
plot(x,y1,x,y2);
Q
: The code above generates a simple plot, can you add or change a few lines of code to make the
plot like the two below?
% add your code to make your plot like the
% one on your right.
0
1
2
3
4
5
6
7
-2.5
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
Plot of f(x)= sin(6*x) and 2*cos(x)
x
y
sin(6*x)
2*cos(x)
0
1
2
3
4
5
6
7
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2

This ** preview** has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*