常见的MATLAB绘图程序


y=[3,7,9,1,5,2,8];
subplot(1,2,1),plot(y,'linewidth',2),grid
x=[3,3,9;8,1,2;1,8,5;7,9,1];
subplot(1,2,2),plot(x),xlabel('x'),ylabel('y')
grid on
%极坐标曲线
theta=0:0.1:8*pi;
polar(theta,cos(4*theta)+1/4)
%对数坐标
x=0:0.1:2*pi;
y=sin(x);
semilogx(x,y);
grid on
%各种坐标系中
theta=0:0.1:6*pi;
r=cos(theta/3)+1/9;
subplot(2,2,1),polar(theta,r);
subplot(2,2,2),plot(theta,r);
subplot(2,3,4),semilogx(theta,r);
subplot(2,3,5),semilogy(theta,r);
subplot(2,3,6),loglog(theta,r);
grid on
%双y轴图形
x=0:0.01:5;
y=exp(x);
plotyy(x,y,x,y,'semilogy','plot'),grid
grid on
%复数数据
t=0:0.1:2*pi;
x=sin(t);
y=cos(t);
z=x+i*y;
plot(t,z),grid
plot(z)
grid on
%二维图形处理
x=(0:0.1:2*pi)';
y1=2*exp(-0.5*x)*[1,-1];
y2=2*exp(-0.5*x).*sin(2*pi*x);
x1=(0:12)/2;
y3=2*exp(-0.5*x1).*sin(2*pi

你可能感兴趣的:(MATLAB)