当前位置:   article > 正文

2021-08-10_分别调用mesh,surf,surfl,surfc函数绘制曲面z =cosxsiny的图像。

分别调用mesh,surf,surfl,surfc函数绘制曲面z =cosxsiny的图像。

绘制三维曲面 z = x e − x 2 − y 2 z= xe^{-x^2-y^2} z=xex2y2的等高线图和梯度场

>> [X,Y]=meshgrid(-2:.2:2);
>> Z=X.*exp(-X.^2-Y.^2);
>> [DX,DY]=gradient(Z,0.2,0.2);
>> contour(X,Y,Z);
>> hold on;
>> quiver(X,Y,DX,DY);
>> h=get(gca,'Children');
>> set(h,'Color','k');
>> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

运行结果图:
在这里插入图片描述

分别调用mesh、surf、surfl、surfc函数绘制曲面 z = c o s x s i n y z=cosxsiny z=cosxsiny( − π -\pi π<=x,y<= π \pi π)

>> t=linspace(-pi,pi,20);
[X,Y]=meshgrid(t);
Z=cos(X).*sin(Y);

subplot(2,2,1);
mesh(X,Y,Z);
title('mesh');
>> 
>> subplot(2,2,2);
>> surf(X,Y,Z);
>> alpha(0.5);
>> title('surf');
>> 
>> subplot(2,2,3);
>> surfl(X,Y,Z);
>> title('surfl');
>> 
>> subplot(2,2,4);
>> surfc(X,Y,Z);
>> title('surfc');
>> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/743208
推荐阅读
  

闽ICP备14008679号