专业软件应用(三)-双语.ppt_第1页
专业软件应用(三)-双语.ppt_第2页
专业软件应用(三)-双语.ppt_第3页
专业软件应用(三)-双语.ppt_第4页
专业软件应用(三)-双语.ppt_第5页
已阅读5页,还剩41页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

西华大学 XIHUAUNIVERSITY 交通与汽车工程学院SchoolofTransportaionAndAutomotiveEngineering 第三讲Matlab图形基础 三维 ThebasisofMatlabGraph 2 dimension 专业软件应用ProfessionalSoftwareApplication 课程名称CourseName 3 D绘图及专用绘图程序3 Ddrawingandspecialdrawingprograms图像处理 imageprocessing Contents 三维绘图 3 Ddrawing 三维绘图的主要功能 Mainfunctions 绘制三维线图 3 Dlineplot 绘制等高线图 contourplot 绘制伪彩色图 Paletteplot 绘制三维网线图 3 Dmeshplot 绘制三维曲面图 3 Dsurfaceplot 柱面图 Cylinderplot 和球面图 Sphericalplot 等 一 三维线图 3 Dlineplot plot3 基本的三维图形指令 Thebasic3 Ddrawinginstruction 调用格式 syntax plot3 x y z x y z是长度相同的向量 samelengthvectors plot3 X Y Z X Y Z是维数相同的矩阵 samedimensionmatrix plot3 x y z s 带开关量 propertyname plot3 x1 y1 z1 s1 x2 y2 z2 s2 二维图形的所有基本特性对三维图形全都适用 定义三维坐标轴大小Allthebasiccharactersin2 Ddrawingisavailabletothe3 Ddrawing Forexamplesettingtheaxissize axis xminxmaxyminymaxzminzmax gridon off 绘制三维网格markthegridonthe3 Dplottext x y z string 三维图形标注labelthe3 Dplot子图和多窗口也可以用到三维图形中Subplotandmultiplewindowcanbeusedinthe3 Dplot 例3 1 绘制三维线图 3 Dlineplot t 0 pi 50 10 pi plot3 t sin t cos t r 二 三维饼图 3 Dpieplot 例3 2pie3 43689 三 三维网格图 3 Dmeshplot mesh 三维网线绘图函数调用格式 Syntax mesh z z为n m的矩阵 以矩阵元素下标为x和y值Zisamatrixforn m usingthesubscriptsofmatrixelementstoserveasthexandyvalue mesh x y z x y z分别为三维空间的坐标位置X yandZseparatelypresentthepositionofthe3 Dspace 例3 3 矩阵的三维网线图 3 Dmeshplot z rand 6 0 88080 07290 41680 76940 37750 47760 33810 71010 09640 63520 38260 70860 18950 87910 67470 89650 68760 23800 74310 35940 56260 87840 12170 39100 71890 08990 81300 48650 07680 97590 87920 16100 87820 11310 14330 6288z round z 100100010101011110101100101001101001mesh z mesh z 例3 4 8阶hadamard矩阵的网线图 h2 11 1 1 h4 h2h2 h2 h2 h8 h4h4 h4 h4 111111111 11 11 11 111 1 111 1 11 1 111 1 111111 1 1 1 11 11 1 11 1111 1 1 1 1111 1 11 111 1mesh h8 三维网线图作图要领 DrawingEssentials 生成坐标 X Y meshgrid x y Createthecoordinate transformsthedomainspecifiedbyvectorsxandyintomatrixXandY表达式点运算 Z X 2 Y 2X Y是n m的矩阵 维数可任定X nY mZ 默认方位角 37 5 俯角30 Defaultviewangle 37 5 depressionangle30 n m维 meshgrid 网线坐标值计算函数z f x y 根据x y坐标找出z的高度BasedonthexandycoordinatetofindtheheightofZ例3 5 绘制z x2 y2的三维网线图形x 5 5 y x X Y meshgrid x y Z X 2 Y 2mesh X Y Z 坐标矩阵 Coordinatematrix 坐标向量 Coordinatevector 纵坐标矩阵 Longitudinalmatrix 绘图函数 Drawingfunction colormap R G B 色图设定函数 Colorsettingfunction matlab的颜色数据集合为红 绿 蓝三颜色矩阵 R G B 维数m 3 ThecolordatacollectionisactuallyamatrixconcludingtheRed GreenandBluecolor thedemissionofthematrixism 3 R G B在 01 区间连续取值 理论上颜色种类可达无穷多种 TheR GandBvaluerangefrom0to1 sothekindsofcolormaybeuptoinfinite matlab使用三维向量表示一种颜色 常用颜色数据见下表 Thefollowsaresomecommon3 Dvectordatatopresentacertaincolor 饱和色 saturatedcolor 000 黑色 001 蓝色 010 绿色 011 浅蓝 100 红色 101 粉红 110 黄色 111 白色 调和色 compoundcolor 0 50 505 灰色 Grey 0 500 暗红色 Dullred 10 620 4 铜色 Coppery 0 4910 8 浅绿 Lightgreen 0 4910 83 宝石蓝 Stoneblue 四 三维曲面图 3 Dsurfaceplot surf 三维曲面绘图函数 与网格图看起来一样3 Dsurfaceplotfunction lookslikethemeshplot与三维网线图的区别 Thedifferencewiththemeshplot 网线图 线条有颜色 空挡是无颜色 Meshplot lineswithcolor whiletheemptybetweenthelineshasnocolor 曲面图 线条是黑色的 空挡有颜色 把线条之间的空挡填充颜色 沿z轴按每一网格变化 Surfaceplot linesareblack whiletheemptyiscolored variedwiththeZdirectionforeverymesh 调用格式 Callingformat surf x y z 绘制三维曲面图 x y z为图形坐标向量 Thex y zarethecoordinatevectors 例3 6 X Y Z peaks 30 peaks为matlab自动生成的三维测试图形 Thepeaksistheautoinstructionofmatlab3 Dtestingplot surfc X Y Z 带等高线的曲面图 Surfaceplotwithcontourlines 例3 7 X Y Z peaks 30 surfc X Y Z surfl X Y Z 被光照射带阴影的曲面图 Surfaceplotshadedbylightirradiation 例3 8 X Y Z peaks 30 surfl X Y Z cylinder r n 三维柱面绘图函数 generatesx y andz coordinatesofaunitcylinder r为半径 n为柱面圆周等分数 Ristheradius andnistheequallyspacedpointsarounditscircumference 例 绘制三维陀螺锥面 topcone t1 0 0 1 0 9 t2 1 0 1 2 r t1 t2 2 x y z cylinder r 30 surf x y z grid sphere为球面等分数 缺省为20 generatesthex y andz coordinatesofaunitsphere thedefaultvalueis20 例 绘制三维球面 x y z sphere 30 surf x y z 五 图形修饰方法 Chartdecorationmethods 1 图形颜色的修饰 Colordecoration matlab有极好的颜色表现功能 其颜色数据又构成了一维新的数据集合 也可称为四维图形Thematlabhasexcellentcolorexpressivefunction thecolordataisanothernewdataset sothechartcanbecalledthe4 Dfigure colormap MAP 色图设定函数 MAP为m 3维色图矩阵Thecolorsettingfunction MAPisacolordatamatrixwithdemissionofm 3 图形颜色可根据需要任意生成 也可用matlab配备的色图函数Youcanfreelytosetthefigurecolor ortousethebuilt incolorfunctioninmatlab matlab的色图函数 built incolorfunctionhsv 饱和值色图huesaturationvaluegray 线性灰度色图hot 暖色色图cool 冷色色图bone 蓝色调灰色图copper 铜色色图pink 粉红色图prism 光谱色图flag 红 白 蓝交替色图 shadingfaceted 网格修饰 默认或缺省的修饰方式Defaultcolordecoration例3 9 shadingflat 去掉黑色线条 根据小方块的值确定颜色deletetheblackline anddeterminethecoloraccordingtotheflagvalue例3 10 shadinginterp 颜色整体改变 根据小方块四角的值差补过度点的值确定颜色 Hereinterpmeanstheinterpolate Accordingtofourcornervaluesoftheflagtointerpolatethetransitionpointtodeterminethecolor whichwillbewhollychangedonthefigure 例3 11 peaks 30 shadinginterp colormap hot 例3 12 X Y Z peaks 30 surfl X Y Z shadinginterp colormap cool axisoff例3 13 peaks 30 colormap hot colorbar horiz figure 2 surf peaks 30 colormap cool 例3 14 2 图形效果修饰 Figureeffectdecoration 透视与消隐 用于网线图 Perspectiveandblankingformeshplot 裁剪修饰 用于网线图 曲面图 Reductiondecorationformeshandsurfaceplots 视角修饰 观察不同角度的三维视图 viewdecorationtoviewthe3 Dfigurefromdifferentangle 其它修饰 a 水线修饰 Waterfulldecoration b 等高线修饰 Contourdecoration 透视与消隐 Perspectiveandblanking 例3 15p peaks 30 mesh p hiddenon p peaks 30 mesh p hiddenoff例3 16 裁减修饰 Reductiondecoration 例3 17p peaks p 30 40 20 30 nan p 30 40 20 30 surf p 例3 18p peaks p 30 40 20 30 nan p 30 40 20 30 mesh peaks p 视角修饰 函数view az el viewdecoration az 方位角 azimuthangle el 俯视角 depressionangle Defaultvalueis az 37 5 el 30例3 19 观察不同视角的波峰图形z peaks 40 subplot 2 2 1 mesh z subplot 2 2 2 mesh z view 15 60 subplot 2 2 3 mesh z view 90 0 subplot 2 2 4 mesh z view 7 10 其它修饰 otherdecoration例3 20a 水线修饰 waterfalldecoration waterfall peaks 30 b 等高线修饰 Contourdecoration 二维 2 D contour Z n 绘制n条等高线C contourc Z n 计算n条等高线的坐标clabel c 给等高线加标注例3 21在二维平面上绘制peaks函数的10条等高线contour peaks 10 C contourc peaks 10 clabel

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论