(1)plot(x) 当x 为一向量时,以x元素的值为纵坐标,x的序号为横坐标值绘制曲线。当x为一实矩阵时,则以其序号为横坐标,按列绘制每列元素值相对于其序号的曲线,当x 为m× n 矩阵时,就由n 条曲线。
(2)plot(x,y) 以x 元素为横坐标值,y 元素为纵坐标值绘制曲线。(3)plot(x,y1,x,y2,…) 以公共的x 元素为横坐标值,以y1,y2,… 元素为纵坐标值绘。
x=0:pi/10:2*pi; y1=sin(x); y2=cos(x); plot(x,y1,x,y2)
plot(x,y1,'r+-',x,y2,'k*:')
x=0:pi/10:2*pi;
y1=sin(x);
y2=cos(x);
plot(x,y1,x,y2)
grid on
xlabel('independent variable X')
ylabel('Dependent Variable Y1 & Y2')
title('Sine and Cosine Curve')
text(1.5,0.3,'cos(x)')
gtext('sin(x)')
axis([0 2*pi -0.9 0.9])x=0:pi/10:2*pi; y1=sin(x); y2=cos(x); y3=x; y4=log(x); plot(x,y1,x,y2) hold on plot(x,y3) plot(x,y4) hold off
x=0:pi/10:2*pi; y1=sin(x); y2=cos(x); y3=exp(x); y4=log(x); subplot(2,2,1); plot(x,y1); subplot(2,2,2); plot(x,y2); subplot(2,2,3); plot(x,y3); subplot(2,2,4); plot(x,y4);
clf
x=0:pi/10:2*pi;
y1=sin(x);
y2=cos(x);
plot3(y1,y2,x,'m:p')
grid on
xlabel('Dependent Variable Y1')
ylabel('Dependent Variable Y2')
zlabel('Independent Variable X')
title('Sine and Cosine Curve')
z=peaks(40); mesh(z); surf(z);
x=-7.5:0.5:7.5;y=x;
[X,Y]=meshgrid(x,y);
R=sqrt(X.^2+Y.^2)+eps;
Z=sin(R)./R;
surf(X,Y,Z)
xlabel('X 轴方向')
ylabel('Y 轴方向')
zlabel('Z 轴方向')
z=peaks(40); subplot(2,2,1); mesh(z); subplot(2,2,2); mesh(z); view(-37.5,-30); subplot(2,2,3); mesh(z); view(180,0); subplot(2,2,4); mesh(z); view(0,90);
x=0:pi/10:2*pi; y1=sin(x); subplot(2,2,1); plot(x,y1); subplot(2,2,2); bar(x,y1); subplot(2,2,3); fill(x,y1,'g'); subplot(2,2,4); stairs(x,y1,'k');
y=[5 3 2 9;4 7 2 7;1 5 7 3]; subplot(2,2,1),bar(y) x=[5 9 11]; subplot(2,2,2),bar3(x,y) subplot(2,2,3),bar(x,y,'grouped') subplot(2,2,4),bar(rand(2,3),.75,'stack')
x=-3:3; y=[3 2 5;6 1 8;7 4 9;6 3 7;8 2 9;4 2 9;3 1 7]; area(x,y)
x=[32 58 27 21 16]; explode0=[1 0 0 0 0]; subplot(1,2,1) pie(x,explode0) explode1=[0 0 0 0 1]; subplot(1,2,2) pie(x,explode1)
theta=-pi:pi/80:pi; polar(theta,2*cos(3*theta))
subplot(2,2,1),fplot('humps',[0 1])
subplot(2,2,2),fplot('abs(exp(-j*x*(0:9))*ones(10,1))',[0 2*pi])
subplot(2,2,3),fplot('[tan(x),sin(x),cos(x)]',2*pi*[-1 1 -1 1])
subplot(2,2,4),fplot('sin(1./x)',[0.01 0],1e-3)y='x^2'; subplot(1,2,1) ezplot(y) subplot(1,2,2) y='sin(x)'; ezplot(y,[-pi,pi])
x=[3 5 10 8]; subplot(2,2,1) plot(x) x=[3 5 10 8;7 2 9 4;2 7 2 7]'; subplot(2,2,2) plot(x) x=[3 5 6 8]; y=[1 5 10 4]; subplot(2,2,3) plot(x,y) x=[1 3 5 7;2 4 6 8]'; y=[6 2 5 10;3 5 2 6]'; subplot(2,2,4) plot(x,y,'k:*')
原文地址:http://blog.csdn.net/sin_geek/article/details/41513083