收藏 分享(赏)

数学建模常用的Matlab绘图总结.doc

上传人:精品资料 文档编号:10803085 上传时间:2020-01-10 格式:DOC 页数:11 大小:900.02KB
下载 相关 举报
数学建模常用的Matlab绘图总结.doc_第1页
第1页 / 共11页
数学建模常用的Matlab绘图总结.doc_第2页
第2页 / 共11页
数学建模常用的Matlab绘图总结.doc_第3页
第3页 / 共11页
数学建模常用的Matlab绘图总结.doc_第4页
第4页 / 共11页
数学建模常用的Matlab绘图总结.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

1、饼状图Expenses = 20 10 40 12 20 19 5 15; ExpenseCategories = Food,Medical,Lodging,Incidentals,.Transport,Utilities,Gifts,Shopping; MostLeastExpensive = (Expenses=max(Expenses)|Expenses=min(Expenses); h=pie(gca,Expenses,MostLeastExpensive,ExpenseCategories); FoodMedicalLodgingIncidentalsTransportUtiliti

2、esGiftsShoppingExpenses = 20 10 40 12 20 19 5 15; MostLeastExpensive = (Expenses=max(Expenses)|Expenses=min(Expenses); h=pie(gca,Expenses,MostLeastExpensive); legend(Food,Medical,Lodging,Incidentals,.Transport,Utilities,Gifts,Shopping); 14%7%28%9%14%13%4%11%FoodMedicalLodgingIncidentalsTransportUtil

3、itiesGiftsShoppingExpenses = 20 10 40 12 20 19 5 15; MostLeastExpensive = 0 1 0 1 0 1 0 1;%分割h=pie(gca,Expenses,MostLeastExpensive); legend(Food,Medical,Lodging,Incidentals,.Transport,Utilities,Gifts,Shopping); 14%7%28%9%14%13%4%11%FoodMedicalLodgingIncidentalsTransportUtilitiesGiftsShoppingx = 20 1

4、0 40 12 20 19 5 15;explode = 4 2 2 2 2 4 2 2;label = Food,Medical,Lodging,Incidentals,.Transport,Utilities,Gifts,Shopping,;figure(color,w,renderer,openGL);h = pie3(x,explode);h = findobj(h,Type,text);set(h,string,cellfun(strcat,get(h,string),label,un,0),FontName,Times New Roman,FontSize,16);%set(h,s

5、tring,strcat(get(h,string),label);%cm = 72 65 137;143 184 58;193 60 49;41 121 201;.% 60 65 150;189 84 58;193 160 90;241 121 101/255;colormap(jet), shading interpview(18,20), camproj perspectivelight(Position,1 2 3,Style,inf)lighting gouraudx = 20 10 40 12 20 19 5 15;explode = 4 2 2 2 2 4 2 2;label =

6、 14% Food,7% Medical,28% Lodging,9% Incidentals,.14% Transport,13% Utilities,4% Gifts,11% Shopping,;figure(color,w,renderer,openGL);pie3s(x,Explode,explode,Labels,label)%见Matlab_pie3s直方图Y = round(rand(5,3)*10);figure;subplot(2,2,1); bar(Y,grouped); title(Group)subplot(2,2,2); bar(Y,stacked); title(S

7、tack)subplot(2,2,3); bar(Y,histc); title(Histc)subplot(2,2,4); bar(Y,hist); title(Hist)1 2 3 4 50510 Group1 2 3 4 50102030 Stack1 2 3 4 50510 Histc1 2 3 4 50510 Histstream = RandStream(mrg32k3a,Seed,4);y1 = rand(stream,10,5);hb = bar(y1,stacked); colormap(summer); hold ony2 = rand(stream,10,1);set(g

8、ca,FontSize,14,FontName,Times New Roman)hp = plot(1:10,y2,marker,square,markersize,12,.markeredgecolor,y,markerfacecolor,.6,0,.6,.linestyle,-,color,r,linewidth,2); hold offlegend(hb,hp,Carrots,Peas,Peppers,Green Beans,.Cucumbers,Eggplant,Location,SouthEastOutside)1 2 3 4 5 6 7 8 9 1000.511.522.533.5

9、CarrotsPeasPeppersGreen BeansCucumbersEggplantData = 1,-2,3,1,-1,-2 4 2 3;DataP = Data;DataN = Data;DataP(Data 0) = 0;figure;bar(DataP,0.5,k,EdgeColor,k);hold on;bar(DataN,0.5,b,EdgeColor,b);1 2 3 4 5 6 7 8 9-2-101234Y = round(rand(5,3)*10);figure;subplot(2,2,1); bar3(Y,grouped); title(Group,FontSiz

10、e,14,FontName,Times New Roman)subplot(2,2,2); bar3(Y,stacked); title(Stack,FontSize,14,FontName,Times New Roman)subplot(2,2,3); bar3(Y,histc); title(Histc,FontSize,14,FontName,Times New Roman)subplot(2,2,4); bar3(Y,hist); title(Hist,FontSize,14,FontName,Times New Roman)1 2 3 450510 Group1 2 3 4 5010

11、20 Stack1 2 31 2 3 4 50510Histc1231 2 3 4 50510Hist杆状图Data = 1,-2,3,1,-1,-2 4 2 3;DataP = Data;DataN = Data;DataP(Data 0) = NaN;figure;stem(DataP,k);hold on;stem(DataN,b);1 2 3 4 5 6 7 8 9-2-101234Data = 1,-2,3,1,-1,-2 4 2 3;DataP = Data;DataN = Data;DataP(Data 0) = NaN;figure;stem(DataP,k,fill);hol

12、d on;stem(DataN,b,fill);1 2 3 4 5 6 7 8 9-2-101234Data = 1,-2,3,1,-1,-2 4 2 3;DataP = Data;DataN = Data;DataP(Data 0) = NaN;figure;stem(DataP,:diamondk,fill);hold on;stem(DataN,:diamondr,fill);1 2 3 4 5 6 7 8 9-2-101234Data = 1,-2,3,1,-1,-2 4 2 3;DataP = Data;DataN = Data;DataP(Data 0) = NaN;figure;

13、stem(DataP,LineStyle,-.,MarkerFaceColor,k,MarkerEdgeColor,green);hold on;stem(DataN,LineStyle,-.,MarkerFaceColor,red,MarkerEdgeColor,green);1 2 3 4 5 6 7 8 9-2-101234三维图形figure;X,Y = meshgrid(-15:.5:15,-12:.5:12);%X belongs to -15,15 and Y belongs to -12,12.R = sqrt(X.2 + Y.2) + eps;Z = sin(R)./R;me

14、sh(Z); %surf(X,Y,Z)xlabel(X,FontSize,14,FontName,Times New Roman)ylabel(Y,FontSize,14,FontName,Times New Roman)zlabel(Z,FontSize,14,FontName,Times New Roman)title(3-D space,FontSize,16,FontName,Times New Roman)0 10 2030 40 5060 7001020304050-0.500.51X3-D space by meshYZfigure;X=-12:0.5:12;Y=-12:0.5:

15、12;%surf绘图时, X,Y可以是一维向量,也可以是二维矩阵R=ones(length(X),length(Y);for i=1:length(X)for j=1:length(Y)R(i,j) = sqrt(X(i).2 + Y(j).2) +eps;endendZ = sin(R)./R;surf(X,Y,Z);xlabel(X,FontSize,14,FontName,Times New Roman)ylabel(Y,FontSize,14,FontName,Times New Roman)zlabel(Z,FontSize,14,FontName,Times New Roman)t

16、itle(3-D space by surf,FontSize,16,FontName,Times New Roman)-15 -10 -50 5 1015-15-10-5051015-0.500.51X3-D space by surfYZfigure;X,Y = meshgrid(-15:.5:15,-12:.5:12);%X belongs to -15,15 and Y belongs to -12,12.R = sqrt(X.2 + Y.2) + eps;Z = sin(R)./R;plot3(X,Y,Z);xlabel(X,FontSize,14,FontName,Times Ne

17、w Roman)ylabel(Y,FontSize,14,FontName,Times New Roman)zlabel(Z,FontSize,14,FontName,Times New Roman)title(3-D space by plot3,FontSize,16,FontName,Times New Roman)-15 -10 -50 5 1015-15-10-5051015-0.500.51X3-D space by plot3YZ数学公式、符号和希腊字母的输入命令Character SequenceSymbol Character SequenceSymbol Character

18、 SequenceSymbolalpha upsilon sim beta phi leq gamma chi infty delta psi clubsuit epsilon omega diamondsuit zeta Gamma heartsuit eta Delta spadesuit theta Theta leftrightarrow vartheta Lambda leftarrow iota Xi uparrow kappa Pi rightarrow lambda Sigma downarrow mu Upsilon circ nu Phi pm xi Psi geq pi

19、Omega propto rho forall partial sigma exists bullet varsigma ni div tau cong neq equiv approx aleph Im Re wp otimes oplus oslash cap cup supseteq supset subseteq subset int in o rfloor lceil nabla lfloor cdot ldots .perp neg prime wedge times x 0 rceil surd mid |vee varpi copyright langle rangle 图形标

20、注set(gca,FontSize,10, FontName,Arial)xlabel(test,FontSize,10,FontName,Arial)ylabel(test,FontSize,10,FontName,Arial)legend(test,FontSize,10,FontName,Arial)title(test,FontSize,13,FontName,Times New Roman)r(red)红色 G(green) 绿色 b(blue) 蓝色 c(cyan) 青色 M(magenta) 品红 y(yellow) 黄色 k(black) 黑色 w(white) 白色+ 加号 o(字母) 小圆圈 * 星号 . 实点 x 叉号 d 棱形 上三角形 v 下三角形colormap(jet)坐标控制axis 函数 的调用格式为: axis(xmin xmax ymin ymax zmin zmax) axis square:产生正方形坐标系(缺省为矩形)axis auto:使用缺省设置 axis off:取消坐标轴axis on:显示 坐标轴grid on:加网格线

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报