实验五 MATLAB 绘图-二维
1、在同一坐标系下绘制下面三个函数在t ∈[0,4π]的图象。
)
sin(41.0321t e y t y t
y t -===π
注意此处的sin (t )前面需要用.乘。
t=0:pi/100:4*pi
y1=t;
y2=sqrt(t);
y3=4*pi*exp(-0.1*t).*sin(t);
plot(t,y1,t,y2,t,y3);
2、在0≤x ≤2π区间内,绘制曲线)4cos(5.02x e y π=,要求用红色虚线显示,同时显示
网格,并显示标题为 “My Figure ” ,x 轴为“x-axis ”,y 轴为“y-axis ”。
x=0:pi/100:2*pi;
y=2*exp(0.5.*cos(4*pi*x));
plot(x,y,'r:');
title('My Figure');
xlabel('x-axis');
ylabel('y-axis');
grid on
3、编写程序,选择合适的步距,绘制下面函数在区间[-6,6]中的图象。
??
???>+-≤
0,sin )(x x x x x x x y
x=-6:0.1:0;
y1=sin(x);
plot(x,y1)
hold on
x=0:0.1:3;
y2=x;
plot(x,y2);
hold on
x=3:0.1:6;
y3=-x+6;
plot(x,y3);