MATLAB 基础之绘制特殊二维图形绘图

先把代码贴上

 1 clear all;
 2 %%确定横坐标的范围
 3 x=[8 20 36 24 12];
 4 t=0:0.1:3;
 5 t1=randn(1,1000);
 6 x1=[-2+3i,+4j,1-7j];
 7 real=[-2 3 1];
 8 imag=[3 4 -7];
 9 %%绘制二维图形
10 subplot(3,4,1);
11 pie(x,[0 0 0 0 0]);
12 title('饼状图');
13 subplot(3,4,2);
14 bar(x,'group');
15 title('垂直条形图');
16 subplot(3,4,3);
17 bar(x,'stack');
18 title('累加值为纵坐标的垂直条形图');
19 subplot(3,4,4);
20 barh(x,'group');
21 title('水平条形图');
22 subplot(3,4,5);
23 barh(x,'stack');
24 title('累加值为纵坐标的水平条形图');
25 subplot(3,4,6);
26 stairs(t);
27 title('以序号为横坐标的梯形图');
28 subplot(3,4,7);
29 stairs(t,sin(t));
30 title('以X为横坐标的梯形图');
31 subplot(3,4,8);
32 hist(t1,(-4:0.1:4));
33 title('概率分布图');
34 subplot(3,4,9);
35 compass(x1);
36 title('以实部为矢量');
37 subplot(3,4,10);
38 compass(x1,2*x1);
39 title('以复数坐标系的原点为起点');
40 subplot(3,4,11);
41 feather(real);
42 title('以实部为矢量');
43 subplot(3,4,12);
44 feather(real,imag);
45 title('以复数坐标系的原点为起点');
View Code

结果:

posted @ 2016-07-10 17:59  太过随意  阅读(283)  评论(0)    收藏  举报