p=patch(isosurface(x,y,z,f,0.patch xiexie
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 17:58:43
p=patch(isosurface(x,y,z,f,0.patchxiexiep=patch(isosurface(x,y,z,f,0.patchxiexiep=patch(isosurface(x
p=patch(isosurface(x,y,z,f,0.patch xiexie
p=patch(isosurface(x,y,z,f,0.patch xiexie
p=patch(isosurface(x,y,z,f,0.patch xiexie
f=@(x,y,z)x.^2+y.^2+z.^2-10;%定义函数f=x^2+y^2+z^2-10
[x,y,z]=meshgrid(linspace(-4,4,25));%设定格子大小和范围
val=f(x,y,z);
[p,v]=isosurface(x,y,z,val,0);%用isosurface得到函数f=0图形的点和面
patch('faces',p,'vertices',v,'facevertexcdata',jet(size(v,1)),'facecolor','w','edgecolor','flat');%用patch绘制三角网格图并设定色彩
view(3);grid on;axis equal
上面就是一个画三维图的例子.利用isosurface和patch可以画隐函数的图.
p=patch(isosurface(x,y,z,f,0.5));
f=f(x,y,z),现在需要画f(x,y,z)=0.5这样一个隐函数.
首先用isosurface生成网格.然后patch用isosurface生成的数据画出图形.
下面你用set再设置一下图形的各种属性就好了.
斑点,补丁。。。