当前位置:编程学习 > Matlab >>

如何用matlab绘制球面图形

方程是x^2+y^2+z^2=1,怎么用matlab画出来?
补充:不用参数方程,也不用sphere,能直接绘制x^2+y^2+z^2=1么?
答案:http://apps.hi.zhaoxi.net/share/detail/33611713
其他:plot R=5;r=2; syms u v; ezmesh((R r*cos(u))*cos(v),(R r*cos(u))*sin(v),r*sin(u),[-pi,pi]); hold on; ezmesh(r*cos(u)*cos >> [x,y,z]=sphere;
>> surf(x,y,z)%这是单位球
最简单的画球指令,还可以移动圆心
surf(x+3,y-2,z)
还可以改变半径
surf(2*x,2*y,2*z) 

还有一种画隐函数的方法:而你要的直接是不能的
[x,y,z]=meshgrid(linspace(-1,1));
val=x.^2+y.^2+z.^2;
isosurface(x,y,z,val,1)
 axis equal 
R=5;r=2;
syms u v;
ezmesh((R+r*cos(u))*cos(v),(R+r*cos(u))*sin(v),r*sin(u),[-pi,pi]);
hold on;
ezmesh(r*cos(u)*cos(v),r*cos(u)*sin(v),r*sin(u),[-pi,pi])
axis equal; ellipsoid(0,0,0, .5,.5,.5) 

上一个:请教高手,matlab程序里面的语句:[i,j]=find(bw==0); 表示什么意思?实现什么作用呢? bw是二值图像。
下一个:??? Error using ==> wthresh at 30 Invalid argument value. 请教一下,这个matlab程序的错误应该怎么改

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,