多语言展示
当前在线:1044今日阅读:26今日分享:39

用Matlab怎么画面域图直方图饼图

简介很多软件如Excel等都可以话面域图、直方图、饼图等,如果用matlab改如何画呢,下面介绍对应的函数和应用实例。面域图指令:area实例程序:%%%%%%%%%%%%%%%%%%%%%%x=-2:2Y=[3,5,2,4,1;3,4,5,2,1;5,4,3,2,5]%(3*5)的Y数组的CS=flipud(cumsum(Y))area(x',Y',0)legend('因素A','因素B','因素C')grid on,colormap(spring)%%%%%%%%%%%%%%%%%%%%%%%效果:直方图指令:bar, barh, bar3, bar3h实例程序:%%%%%%%%%%%%%%%%%%%%%%x=-2:2;Y=[3,5,2,4,1;3,4,5,2,1;5,4,3,2,5];subplot(1,2,1)bar(x',Y','stacked')xlabel('x'),ylabel('\Sigma y'),colormap(cool)legend('因素A','因素B','因素C')subplot(1,2,2)bar3h(x',Y','grouped')%%%%%%%%%%%%%%%%%%%%%%%效果:饼图指令:pie, pie3实例程序:%%%%%%%%%%%%%%%%%%%%%%a=[1,1.6,1.2,0.8,2.1];subplot(1,2,1)pie(a,[10 1 0 0])axis equallegend({'1','2','3','4','5'},'Location','EastOutside')subplot(1,2,2)pie3(a,double(a==min(a)))colormap(cool)%%%%%%%%%%%%%%%%%%%%%%%效果:有向线图指令:pie, pie3实例程序:compass,feather,pol2cart%%%%%%%%%%%%%%%%%%%%%%t=-pi/2:pi/12:pi/2;r=ones(size(t));[x,y]=pol2cart(t,r);subplot(1,2,1),compass(x,y),title('Compass')subplot(1,2,2),feather(x,y),title('Feather')%%%%%%%%%%%%%%%%%%%%%%%效果:
推荐信息