赞
踩
示例:
x = logspace(-1,1,100); y = x.^2; subplot(2,2,1); plot(x,y); title('Plot'); subplot(2,2,2); semilogx(x,y); title('Semilogx'); subplot(2,2,3); semilogy(x,y); title('Semilogy'); subplot(2,2,4); loglog(x, y); title('Loglog');
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2);
set(get(AX(1),'Ylabel'),'String','Left Y-axis')
set(get(AX(2),'Ylabel'),'String','Right Y-axis')
title('Labeling plotyy');
set(H1,'LineStyle','--'); set(H2,'LineStyle',':');
官方建议使用yyaxis来绘制双y轴的图形,的确相比而言yyasis更加的简便。
上述例子用yyaxis示例:
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
yyaxis left
plot(x,y1,'--')
ylabel('Left Y-axis')
title('Labeling plotyy')
yyaxis right
plot(x,y2,':')
ylabel('Reft Y-axis')
x = randn(1,1000);
%% randn 生成了 1 * 1000 的符合正太分布数的矩阵
subplot(2,1,1);
hist(x,10);
title('Bins = 10');
subplot(2,1,2);
hist(x,50);
title('Bins = 50');
x = [1 2 5 4 8]; y = [x;1:5];
subplot(1,3,1); bar(x); title('A bargraph of vector x');
subplot(1,3,2); bar(y); title('A bargraph of vector y');
subplot(1,3,3); bar3(y); title('A 3D bargraph');
barh(y); bar3h(y) 能够用来绘制横向放置的图形
a = [10 5 20 30];
subplot(1,3,1); pie(a);
subplot(1,3,2); pie(a, [0,0,0,1]);
subplot(1,3,3); pie3(a, [0,0,0,1]);
而后面[0,0,0,1]就表示饼状图的四个部分的分离情况
当我改成了[1,1,1,1],图像就变成了:
% 螺旋线 x = 1:100; theta = x/10; r = log10(x); subplot(1,4,1); polar(theta,r); % 花瓣 theta = linspace(0, 2*pi); r = cos(4*theta); subplot(1,4,2); polar(theta, r); % 五边形 theta = linspace(0, 2*pi, 6); r = ones(1,length(theta)); subplot(1,4,3); polar(theta,r); % 心形线 theta = linspace(0, 2*pi); r = 1-sin(theta); subplot(1,4,4); polar(theta , r);
极坐标(r ,theta)这两个参数来在极坐标种确定一个点。
x = linspace(0, 4*pi, 40); y = sin(x);
subplot(2,2,1); stairs(y);
subplot(2,2,2); stem(y);
subplot(2,2,3); plot(y);
点与点之间的连接方式。图一,图二方状或者是针状,更加的突出离散的数据
t =(1:2:15)'*pi/8; x = sin(t); y = cos(t);
fill(x,y,'r');
axis square off
%% 不显示坐标轴并且调整距离六边形变成正六边形
text(0,0,'STOP','Color', ...
'w', 'FontSize', 80, ...
'FontWeight','bold', ...
'HorizontalAlignment', 'center');
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。