- 1
- 0
- 约1.44千字
- 约 19页
- 2018-05-16 发布于河南
- 举报
第十二讲 绘图
第十七讲 二维图形的绘制 主讲:王永龙 临 沂 大 学 理 学 院 Ⅰ. Plot 1. Plot的语法形式 Plot (x ,y) x=-2*pi:pi/20:2*pi; y=sin(x); plot(x,y) 2.Plot的输入参数 x=-2*pi:pi/20:2*pi; y=sin(x); plot(x,y,‘g’) (1) 线的颜色 b blue蓝色 g green绿色 r red红色 c cyan青色 m magenta 紫色 y yellow黄色 k black黑色 . point 点 o circle 圆 x x-mark + plus加号 * star星号 s square正方形 d diamond钻石 v triangle (down) ^ triangle (up) triangle (left) triangle (right) p pentagram五角星 h hexagram六角星 x=-2*pi:pi/20:2*pi; y=sin(x); plot(x,y,’o’) (2)数据点的设置(点符号的设置) 实线 :虚线 -. 点虚线 -- 段虚线 (none) 没有线 x=-2*pi:pi/20:2*pi; y=sin(x); plot(x,y,’-.’) (3)线的表现形式 (线形的设置) (4)点和线的其他参数 LineWidth: 定义线条的宽度 MarkerEdgeColor: 定义点边框颜色的颜色 MarkerFaceColor: 定义点符号填充颜色 MarkerSize: 定义标记的大小 3.背景参数 (1)坐标轴的设置 xlabel(‘ ’) ylabel(‘ ’) zlabel(‘ ’) axis on axis off axis([xmin xmax ymin ymax]) (2)背景网格的设置 grid on grid off axis([-8,8,-2,2]) xlabel(\alpha) ylabel(sin(\alpha)) grid on (3)关闭窗格背景的命令 box on box off (4) Text x=0:pi/20:2*pi; plot(x,sin(x)); box on text(pi,sin(pi),\leftarrowsin(x)=0) text(3*pi/4,sin(3*pi/4),\rightarrowsin(x)=0.707) text(x,y,’\leftarrow …’) text(x,y,’\rightarrow …’) 4、Title Tittle的语法形式: title( ‘ ‘) \bf黑色粗体 \it倾斜粗体 \rm返回默认值 \fontname{fontname}定义字体的名称\fontsize{fontsize}定义字体大小 title(\bfThe figure of sine) 常用特殊符号 title(\bfThe figure of sin(\alpha)) 谢 谢 观 赏! * *
原创力文档

文档评论(0)