matlab画图设置(坐标轴、曲线、颜色)

上传人:平*** 文档编号:14759655 上传时间:2017-11-02 格式:DOC 页数:11 大小:61.72KB
返回 下载 相关 举报
matlab画图设置(坐标轴、曲线、颜色)_第1页
第1页 / 共11页
matlab画图设置(坐标轴、曲线、颜色)_第2页
第2页 / 共11页
matlab画图设置(坐标轴、曲线、颜色)_第3页
第3页 / 共11页
matlab画图设置(坐标轴、曲线、颜色)_第4页
第4页 / 共11页
matlab画图设置(坐标轴、曲线、颜色)_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《matlab画图设置(坐标轴、曲线、颜色)》由会员分享,可在线阅读,更多相关《matlab画图设置(坐标轴、曲线、颜色)(11页珍藏版)》请在金锄头文库上搜索。

1、matlab 画图设置(坐标轴、曲线、颜色) a=linspace(1,2,10)plot(a,-pr,linewidth,1.5,MarkerEdgeColor,r,MarkerFaceColor,m,MarkerSize,10)legend(a,Location,best)title(a,FontName,Times New Roman,FontWeight,Bold,FontSize,16)xlabel(T,FontName,Times New Roman,FontSize,14)ylabel(a,FontName,Times New Roman,FontSize,14,Rotation

2、,0)axis auto equalset(gca,FontName,Times New Roman,FontSize,14)1.曲线线型、颜色和标记点类型plot(X1,Y1,LineSpec, ) 通过字符串 LineSpec 指定曲线的线型、颜色及数据点的标记类型。线型 颜色 数据点标记类型标识符 意义 标识符意义 标识符 意义- 实线 r 红色 + 加号-. 点划线 g 绿色 o 圆圈- 虚线 b 蓝色 * 星号: 点线 c 蓝绿色 . 点m 洋红色 x 交叉符号y 黄色 square(或 s) 方格k 黑色 diamond(或 d) 菱形w 白色 向上的三角形 v 向下的三角形 向左

3、的三角形triangle (right)p pentagramh hexagram在使用 Matlab 时,经常需要将得到的数值表达成二维或三维图像。plot(vector1,vector2)可以用来画两个矢量的二维图,例如x=1:0.1:2*pi;plot(x,sin(x)可以画正弦函数在 0-2pi 的上的图像。plot 函数可以接一些参数,来改变所画图像的属性(颜色,图像元素等)。下面是一些属性的说明b blue(蓝色) . point(点) - solid(实线)g green(绿色) o circle(圆圈) : dotted(点线)r red(红色) x x-mark(叉号) -.

4、 dashdot (点画线)c cyan(墨绿色) + plus(加号) - dashed(虚线)m magenta(紫红色) * star(星号) (none) no liney yellow(黄色) s square(正方形)k black(黑色) d diamond(菱形)v triangle (down) triangle (up)triangle (right) p pentagramh hexagram例如,plot(x,y,.r)表示用点来画图,点的颜色是红色。plot 函数可以接一些参数,来改变所画图像的属性(颜色,图像元素等)。下面是一些属性的说明b blue(蓝色) . p

5、oint(点) - solid(实线)g green(绿色) o circle(圆圈) : dotted(点线)r red(红色) x x-mark(叉号) -. dashdot (点画线)c cyan(墨绿色) + plus(加号) - dashed(虚线)m magenta(紫红色) * star(星号) (none) no liney yellow(黄色) s square(正方形)k black(黑色) d diamond(菱形)v triangle (down) triangle (up)triangle (right)p pentagramh hexagramExamplex =

6、-pi:pi/10:pi;y = tan(sin(x) - sin(tan(x);plot(x,y,-rs,LineWidth,2,.MarkerEdgeColor,k,.MarkerFaceColor,g,.MarkerSize,10)xlabel(x);ylabel(y); 用 Matlab 画图时,有时候需要对各种图标进行标注,例如,用“+”代表 A 的运动情况,“*” 代表 B 的运动情况。 legend 函数的基本用法是LEGEND(string1,string2,string3, .)分别将字符串 1、字符串 2、字符串 3标注到图中,每个字符串对应的图标为画图时的图标。例如:pl

7、ot(x,sin(x),.b,x,cos(x),+r)legend(sin,cos)这样可以把.标识为sin,把+标识为cos还可以用 LEGEND(.,Location,LOC) 来指定图例标识框的位置这些是 Matlab help 文件。后面一段是对应的翻译和说明North inside plot box near topSouth inside bottomEast inside rightWest inside left NorthEast inside top right (default)NorthWest inside top leftSouthEast inside botto

8、m rightSouthWest inside bottom leftNorthOutside outside plot box near topSouthOutside outside bottomEastOutside outside rightWestOutside outside leftNorthEastOutside outside top rightNorthWestOutside outside top leftSouthEastOutside outside bottom rightSouthWestOutside outside bottom leftBest least

9、conflict with data in plot BestOutside least unused space outside plotNorth 图例标识放在图顶端South 图例标识放在图底端East 图例标识放在图右方West 图例标识放在图左方NorthEast 图例标识放在图右上方(默认)NorthWest 图例标识放在图左上方SouthEast 图例标识放在图右下角SouthWest 图例标识放在图左下角(以上几个都是将图例标识放在框图内)NorthOutside 图例标识放在图框外侧上方SouthOutside 图例标识放在图框外侧下方EastOutside 图例标识放在图框

10、外侧右方 WestOutside 图例标识放在图框外侧左方NorthEastOutside 图例标识放在图框外侧右上方NorthWestOutside 图例标识放在图框外侧左上方SouthEastOutside 图例标识放在图框外侧右下方SouthWestOutside 图例标识放在图框外侧左下方(以上几个将图例标识放在框图外)Best 图标标识放在图框内不与图冲突的最佳位置BestOutside 图标标识放在图框外使用最小空间的最佳位置还是用上面的例子legend(sin,cos,location,northwest)可以将标识框放置在图的左上角。Examples:x = 0:.2:12;p

11、lot(x,bessel(1,x),x,bessel(2,x),x,bessel(3,x); legend(First,Second,Third);legend(First,Second,Third,Location,NorthEastOutside)b = bar(rand(10,5),stacked); colormap(summer); hold onx = plot(1:10,5*rand(10,1),marker,square,markersize,12,.markeredgecolor,y,markerfacecolor,.6 0 .6,.linestyle,-,color,r,linewidth,2); hold offlegend(b,x,Carrots,Peas,Peppers,Green Beans,.Cucumbers,Eggplant)

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号