欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    科学计算科学计算 (26).pdf

    • 资源ID:67732226       资源大小:733.81KB        全文页数:15页
    • 资源格式: PDF        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    科学计算科学计算 (26).pdf

    4 4.5 5 3 3-D D SurfaceSurface PlotsPlotsDefining 2-D and 3-D grid coordinatesCreating 3-D surface and mesh plotsCommonly used function for demonstratingCreating 3-D surface plot of expressionIn MATLAB,there are two ways to generate matrix storing 2-D grid coordinates.(1)Generate a matrix by matrix operations x=2:6;y=(3:8);X=ones(size(y)*x;Y=y*ones(size(x);1 1Defining 2Defining 2-D and 3D and 3-D Grid CoordinatesD Grid CoordinatesMatrix X and Y are used to store 2-D grid coordinates of each grid.Matrix X and Y are the 2-D grid coordinate matrices of the gridded surface.(2)Use the meshgrid functionX,Y=meshgrid(x,y);Input arguments x and y are vectors,and output arguments X and Y are matrices.x=2:1:6;y=(3:1:8);X,Y=meshgrid(x,y);The grid matrix generated by the third command is the same as that generated by method 1.1 1Defining 2Defining 2-D and 3D and 3-D Grid CoordinatesD Grid CoordinatesSubstitute the x-coordinate and y-coordinate of each point in function,we obtain matrix z.Each column vector in the matrix x,y,and z corresponds to the coordinates of points on a line.x=2:6;y=(3:8);X,Y=meshgrid(x,y);Z=randn(size(X);plot3(X,Y,Z)grid on;Example 1 Draw a space curve.(1)Basic Syntaxmesh(x,y,z,c)surf(x,y,z,c)The x and y define a grid in the x-y plane.The z specifies the height of the surface plot at each x-y coordinate,and the c specifies the surface color at different heights.The c is according to the z when c is omitted.2 2Creating 3Creating 3-D Surface and Mesh PlotsD Surface and Mesh PlotsExample 2 Create a 3-D surface plot.=2 2t=-2:0.2:2;X,Y=meshgrid(t);Z=X.*exp(-X.2-Y.2);subplot(1,3,1)mesh(X,Y,Z);subplot(1,3,2)surf(X,Y,Z);subplot(1,3,3)plot3(X,Y,Z);grid on(2)Other format of the mesh funtion and the surf functionmesh(z,c)surf(z,c)When the arguments x and y are omitted,the plot use the column indices of the elements in z as the x-coordinates,the row indices of the elements in z as the y-coordinates,t=1:5;z=0.5*t;2*t;3*t;mesh(z);2 2Creating 3Creating 3-D Surface and Mesh PlotsD Surface and Mesh Plots(3)Other functions for plotting surfaceMeshcCreate a mesh plot with a contour plot underneathmeshz Create a mesh plot with curtainsurfc Create a surface plot with a contour plot underneathsurfl Create a surface plot with colormap-based lighting2 2Creating 3Creating 3-D Surface and Mesh PlotsD Surface and Mesh PlotsExample 3 Create 3-D surface plots in four ways.=()+(),x0,2,y1,3x,y=meshgrid(0:0.1:2,1:0.1:3);z=(x-1).2+(y-2).2-1;subplot(2,2,1);meshc(x,y,z);title(meshc(x,y,z)subplot(2,2,2);meshz(x,y,z);title(meshz(x,y,z)subplot(2,2,3);surfc(x,y,z);title(surfc(x,y,z)subplot(2,2,4);surfl(x,y,z);title(surfl(x,y,z)(1)The sphere functionx,y,z=sphere(n)Return the x-,y-,and z-coordinates of a sphere.The returned sphere has a radius equal to 1 and consists of 20-by-20 faces.So The function returns the x-,y-,and z-coordinates as three 21-by-21 matrices.(2)The cylinder functionx,y,z=cylinder(R,n)Return the x-,y-,and z-coordinates of a cylinder.The returned cylinder has a radius equal to 1,20 equally spaced points around its circumference,and bases parallel to the xy-plane.The function returns the x-,y-,and z-coordinates as three 21-by-21 matrices.3 3Commonly Used Function for Demonstrating Commonly Used Function for Demonstrating Example 4 Plots cylinder,vase and conical surface using the returned coordinates of the cylinder function.subplot(1,3,1);x,y,z=cylinder;surf(x,y,z);subplot(1,3,2);t=linspace(0,2*pi,40);x,y,z=cylinder(2+cos(t),30);surf(x,y,z);subplot(1,3,3);x,y,z=cylinder(0:0.2:2,30);surf(x,y,z);Example 5 Create two vertical intersecting plots of the same diameter using the returned coordinates of the cylinder function.x,y,z=cylinder(1,60);z=-1*z(2,:);z(2,:);surf(x,y,z)hold onsurf(y,z,x)axis equal p1=peaks(10);p2=peaks;p3=peaks(-3:0.2:3);x,y=meshgrid(-2:0.1:2,0:0.1:5);p4=peaks(x,y);3 3Commonly Used Function for Demonstrating Commonly Used Function for Demonstrating(3)The peaks functionpeaks(n)Return an n-by-n matrix.peaks(V)Return an n-by-n matrix,where n=length(V).peaks(x,y)Evaluate peaks at the given x and y(which must be the same size)and return a matrix the same size.peaksReturn a 49-by-49 matrix.fsurf(funx,funy,funz,uvlims)fmesh(funx,funy,funz,uvlims)Plot the parametric surface defined by x=funx(u,v),y=funy(u,v),z=funz(u,v)over over the specified interval.Argument uvlims specify the plotting interval for u and v,specified as a vector of form umin umax vmin vmax.The default interval for u and vis-5 5.4 4Creating 3Creating 3-D Surface Plot of ExpressionD Surface Plot of Expressionfunx=(u,v)u.*sin(v);funy=(u,v)-u.*cos(v);funz=(u,v)v;fsurf(funx,funy,funz,-5 5-5-2)hold onfmesh(funx,funy,funz,-5 5-2 2)hold off=sin=uv=v-55 5,5,-55 22Example 6 Plotting a spiral surface.

    注意事项

    本文(科学计算科学计算 (26).pdf)为本站会员(奉***)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开