matlab画图
程序员文章站
2022-07-11 11:50:27
...
figure(1)
%画折线图(平衡因子比值)
%x=[0.01 0.1 1 10 100];
x=[0 2 4 6 8 ];
y1=[49006.5 44551.5 24751.6 6684.4 670.1 ];
y2=[60000.5 48551.5 28751.6 6984.4 800.1 ];
y3=[100006.5 55551.5 35751.6 8984.4 1200.1];
%plot(x,y5,'g',x,z5,'g',x,y10,'r',x,z10,'r',x,y15,'b',x,z15,'g');
%plot(x,y5,'g',x,z5,'b');
%plot(x,y1,'g');
plot(x, y1, '-*', x, y2, '-o',x, y3, '-+');
xlabel('Ve/Vt');
ylabel('Total cost,Y');
%设置为%显示
set(gca, 'XTick',0:2:8);
%set(gca, 'YTick',0:1000:50000);
set(gca,'xticklabel', [0.01 0.1 1 10 100]);
legend('HA', 'local','cloud');
title('(a) total cost');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2)
%画条状图(移动设备的数量)
%x=[0.01 0.1 1 10 100];
x=[0 2 4 6 8 ];
y1=[49006.5 44551.5 24751.6 6684.4 670.1 ];
y2=[60000.5 48551.5 28751.6 6984.4 800.1 ];
y3=[100006.5 55551.5 35751.6 8984.4 1200.1];
%plot(x,y5,'g',x,z5,'g',x,y10,'r',x,z10,'r',x,y15,'b',x,z15,'g');
%plot(x,y5,'g',x,z5,'b');
%plot(x,y1,'g');
%plot(x, y1, '-*', x, y2, '-o',x, y3, '-+');
bar([0 2 4 6 8],[y1' y2' y3'])
xlabel('Ve/Vt');
ylabel('Total cost,Y');
%设置为%显示
set(gca, 'XTick',0:2:8);
set(gca,'xticklabel', [0.01 0.1 1 10 100]);
legend('M=4', 'M=5','M=6');
title('(b) total cost');
%方式二
%画条状态图
figure(3)
x=[200 400 600 800 1000];
y=[37.72 37.72 39.87;38.51 38.51 40.78;35.1 35.1 37.26;32.19 32.19 34.19;33.07 33.07 35.09;];
bar(x,y,1);
ylabel('average cloudlet access delay(ms)');
xlabel('network size n');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(4)
%画折线图(cpu的频率)
%x=[0.01 0.1 1 10 100];
x=[0 2 4 6 8 ];
y1=[49006.5 44551.5 24751.6 6684.4 670.1 ];
y2=[60000.5 48551.5 28751.6 6984.4 800.1 ];
y3=[100006.5 55551.5 35751.6 8984.4 1200.1];
%plot(x,y5,'g',x,z5,'g',x,y10,'r',x,z10,'r',x,y15,'b',x,z15,'g');
%plot(x,y5,'g',x,z5,'b');
%plot(x,y1,'g');
plot(x, y1, '-*', x, y2, '-o',x, y3, '-+');
xlabel('Ve/Vt');
ylabel('Total cost,Y');
%设置为%显示
set(gca, 'XTick',0:2:8);
set(gca,'xticklabel', [0.01 0.1 1 10 100]);
legend('r=400*10^6 cycles/sec', 'r=200*10^6 cycles/sec','r=100*10^6 cycles/sec');
title('(c) total cost');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%画饼状图
figure(5)
X=[30 48 36 20 13];%当X中的数值大于1时,转化成100%的比例进行绘制
pie(X);
figure(6)
X2=[0.1 0.2 0.4 0.1 0.1];% 当X中的数值小于1时,表示比例,不足100%的区域空出
pie(X2);
figure(7)
X3=[30 48 36 20 13];
explode=[0 0 1 1 0]; % 0表示不弹出,1表示弹出
pie3(X3,explode);% 如下图对第三、第四部分弹出。
figure(8)
X4=[30 48 36 20 13];
colormap(cool); %通过colormap转换颜色
pie3(X4);
上一篇: SpringMVC
下一篇: C#中CefSharp的简单使用