当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

北京化工大学:《数学建模》课程教学资源(PPT课件)第八章 Matlab与建模常用计算方法 第二节 MATLAB图形操作

资源类别:文库,文档格式:PPT,文档页数:11,文件大小:1.02MB,团购合买
点击下载完整版文档(PPT)

20 第二节MATLABI图形处理 款学建模

第二节 MATLAB图形处理

一.二维图形显示 1.基本二维图形绘制语句 p1ot(x1,Y1,选项1,x2,Y2,选项2,,·.) 线型选项 标记符号选项 -1 实线 颜色选项 -- 虚线 红 点虚线 g' 绿 点划线 > 6' 蓝 m 红紫 none'无线 黄 蓝绿 diamond k 黑 [g,b] square! 24位真彩 'pentagram' 数学建模 hexagram

一. 二维图形显示 plot(x1,y1,选项1, x2,y2,选项2,...) 线型选项 ’-’ 实线 ’--’ 虚线 ’ :’ 点虚线 ’-.’ 点划线 ’ none’无线 颜色选项 ’ r’ 红 ’ g’ 绿 ’b’ 蓝 ’ y’ 黄 ’k’ 黑 ’w’ 白 ’ m’ 红紫 ’ c’ 蓝绿 [r, g, b] 24位真彩 标记符号选项 ’*’ ’ v’  ’.’ ’^’  ’x’ ’’  ’diamond’ ’square’  ’pentagram’ ’hexagram’ 1. 基本二维图形绘制语句

2.二维曲线的标注 axisaxis (min,Xmax,Jmin,max ] gridgrid on off title:tit1e('标题) x1abe1:x1abel('x轴标题) y1 label:y1abel('J轴标题′) 款学建模

axis: grid: title: xlabel: ylabel: axis([ xmin , xmax , ymin , ymax ]) grid on|off title(’标题’) xlabel(’x轴标题’) ylabel(’y轴标题’) 2. 二维曲线的标注

3.绘图模式下鼠标的应用 ginput:[x,y,button]ginput (n) line:line (x,y) text text (x,y,s) text (x,y,s,'s') gtext:gtext(s) 数学建模 00

ginput: line: text: gtext: [x,y,button] = ginput(n) line(x,y) text(x,y,s) text(x,y,s,’s’) gtext(s) 3. 绘图模式下鼠标的应用

4.图形窗口的分割:subplot subplot n,m,k subplot (2,2,1),fplot ('humps',[0 1]) subplot (2,2,2),fplot (abs (exp ( *x*(0:9))*ones(10,1))',[02*pi]) subplot (2,2,3),fplot ([tan (x),sin (x), cos(x)]',2*pi*[-11-11]) sbp1ot(2,2,4),fp1ot('sin(1./x)',[0.0 10.1],1e-3) 数学建模 00

4. 图形窗口的分割: subplot subplot( n, m, k ) %==================================== subplot(2,2,1),fplot('humps',[0 1]) subplot(2,2,2),fplot('abs(exp(- j*x*(0:9))*ones(10,1))',[0 2*pi]) subplot(2,2,3),fplot('[tan(x),sin(x), cos(x)]',2*pi*[-1 1 -1 1]) subplot(2,2,4),fplot('sin(1./x)',[0.0 1 0.1],1e-3) %====================================

5.极坐标曲线绘制函数 polar(theta,rho,选项) rho0=1; theta=0:pi/20:4*pi; rho=rho0+theta*rho0; polar (theta,rho,:') 数学建模 00

5. 极坐标曲线绘制函数 polar(theta,rho,选项) rho0=1; theta=0:pi/20:4*pi; rho=rho0+theta*rho0; polar(theta,rho,':')

图 二.三维图形显示 1.三维曲线的绘制 t=0:p1/50:10*pi: plot3(sin (t),cos(t),t) tit1e(‘He1ix’) 25 xlabe.1(‘sin(t)’) ylabel('cos (t)'),zlabel('t') text (0,0,0,Origin') grid O 数学建模

二. 三维图形显示 1. 三维曲线的绘制 %========================== t=0:pi/50:10*pi; plot3(sin(t),cos(t),t) title(‘Helix’) xlabel(‘sin(t)’) ylabel('cos(t)'),zlabel('t') text(0,0,0,'Origin') grid %==========================

2.标准三维曲面绘制 [x,y,z]=sphere (n) [x,y,z]=cylinder (R,n) [x0,y0,z0]=sphere(30); x=2*x0:Y=2*Y0;z=2*z0月 surf (x0,0,z0); shading interp hold on mesh (x,y,z) colormap (hot) hold off hidden off 号产生透视效果 axis equal axis off 教学建模

2. 标准三维曲面绘制 [x,y,z]=sphere(n) [x,y,z]=cylinder(R,n) [x0,y0,z0]=sphere(30); x=2*x0;y=2*y0;z=2*z0; surf(x0,y0,z0); shading interp hold on mesh(x,y,z) colormap(hot) hold off hidden off %产生透视效果 axis equal axis off

3.一般三维曲面绘制 mesh (x,y,z,c) [x,y]=meshgrid (x1:dx:x2,yl:dy:y2) === x=-8:0.5:8; y=x; [X,Y]=meshgrid(x,y); R=sqrt (X.2+Y.2)+eps; z=sin (R)./R; mesh (z) 号===三 pause 05 subplot (2,2,1);meshc(z) 0.5 subplot (2,2,3);meshz(z) 款学建模

3.一般三维曲面绘制 mesh(x,y,z,c) [x,y]=meshgrid(x1:dx:x2, y1:dy:y2) %====================== x=-8:0.5:8; y=x; [X,Y]=meshgrid(x,y); R=sqrt(X.^2+Y.^2)+eps; z=sin(R)./R; mesh(z) %====================== pause subplot(2,2,1);meshc(z) subplot(2,2,3);meshz(z) %======================

三.视角变换与三视图 1.三维图形的视角与变换矩阵 view (az,el) [az,el]=view view([az,el]) view (2);view (3) view (T) T=view 2.三维图形的三视图 mesh(x,Y,z) view(az,el) 数学建模

三. 视角变换与三视图 2.三维图形的三视图 view(az,el) view([az,el]) view(T) mesh(x,y,z) view(az,el) [az,el]=view view(2); view(3) T=view 1.三维图形的视角与变换矩阵

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共11页,试读已结束,阅读完整版请下载
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有