当前位置:首页 > matlab函数图像画图教程
Matlab画图教程
1、MATLAB简介:MATLAB语言丰富的图形表现方法,使得数学计算结果可以方便地、多样性地实现了可视化,这是其它语言所不能比拟的。 2、MATLAB的绘图功能: (1)单窗口单曲线绘图
x=[0, 0.58,0.84,1,0.91,0.6,0.14] plot (x)
(2)单窗口多曲线绘图 t=0:pi/100:2*pi;
y=sin(t);y1=sin(t+0.25);y2=sin(t+0.5); plot(t,y,t,y1,t,y2)
(3)单窗口多曲线分图绘图 t=0:pi/100:2*pi;
y=sin(t);y1=sin(t+0.25);y2=sin(t+0.5); plot(t,y,t,y1,t,y2)
subplot(1,3,1); plot(t,y) subplot(1,3,2); plot(t,y1) subplot(1,3,3); plot(t,y2)
t=0:pi/100:2*pi;
y=sin(t);y1=sin(t+0.25);y2=sin(t+0.5); plot(t,y,t,y1,t,y2)
subplot(3,1,1); plot(t,y) subplot(3,1,2); plot(t,y1) subplot(3,1,3); plot(t,y2)
(4)多窗口绘图 t=0:pi/100:2*pi;
y=sin(t);y1=sin(t+0.25);y2=sin(t+0.5); plot(t,y) figure(2) plot(t,y1) figure(3) plot(t,y2)
(5)可任意设置颜色与线型 t=0:pi/100:2*pi;
y=sin(t);y1=sin(t+0.25);y2=sin(t+0.5); subplot(1,3,1);plot(t,y,'r-') subplot(1,3,2);plot(t,y1,'g:') subplot(1,3,3);plot(t,y2,'b*')
(6)图形加注功能 t=0:0.1:10
y1=sin(t);y2=cos(t);plot(t,y1,'r',t,y2,'b--'); x=[1.7*pi;1.6*pi]; y=[-0.3;0.8];
s=['sin(t)';'cos(t)']; text(x,y,s);
title('正弦和余弦曲线'); legend('正弦','余弦')
xlabel('时间t'),ylabel('正弦、余弦') grid
axis square
fill-基本二维绘图函数 x=[1 2 3 4 5];y=[4 1 5 1 4]; fill(x,y,'r')
绘制阶梯曲线
x=0:pi/20:2*pi;y=sin(x); stairs(x,y)
绘制极坐标绘图
t=0:2*pi/90:2*pi;y=cos(4*t);polar(t,y)
共分享92篇相关文档