首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用matlab绘制椭圆抛物面

用matlab绘制椭圆抛物面
EN

Stack Overflow用户
提问于 2015-10-17 13:37:14
回答 1查看 3.3K关注 0票数 0

如何用surf()函数,用uv两个变量的参数方程,在MATLAB中绘制椭圆抛物面?方程看起来就像

代码语言:javascript
复制
r = {ucos{v}, u^2,5usin{v}}

我知道我需要用uv构建网格,但是接下来怎么办?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-17 20:13:24

你可以这样做:

代码语言:javascript
复制
%// Create three function handles with the components of you function
fx = @(u,v) u.* cos(v);  %// Notice that we use .*
fy = @(u,v) u.^2;        %// and .^ because we want to apply
fz = @(u,v) 5.*u.*sin(v);%// multiplication and power component-wise.

%// Create vectors u and v within some range with 100 points each
u = linspace(-10,10, 100);
v = linspace(-pi,pi, 100);

%// Create a meshgrid from these ranges
[uu,vv] = meshgrid(u, v);

%// Create the surface plot using surf
surf(fx(uu,vv),  fy(uu,vv),  fz(uu,vv));

%// Optional: Interpolate the color and do not show the grid lines
shading interp;

%// Optional: Set the aspect ratio of the axes to 1:1:1 so proportions
%//           are displayed correctly.
axis equal;

我添加了一些注释,因为您似乎是Matlab中的新手。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33187263

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档