用matlab画两个曲面的图

时间:2023-03-08 21:05:52
用matlab画两个曲面的图

求助!!用matlab画两个曲面的图

这是我写的程序,但是运行不出来,麻烦帮我修改一下,谢谢!!clearallcloseall[x,y]=meshgrid(0:.1:60);z1=(25*y-25*sqrt(26^2-x^2)+8.5)/(sqrt(26^2-x^2)-7.25);z2=sqrt(3600-120*s...

============================

clear all

close all

[x1,y1,z1]=meshgrid(-26:1:26,-100:5:100,-100:5:100);

v1=(25*y1-25*sqrt(26^2-x1.^2)+8.5)./(sqrt(26^2-x1.^2)-7.25)-z1;

[x2,y2,z2]=meshgrid(-26:1:26,-50:5:70,0:5:60);

v2=sqrt(3600-120*sqrt(26^2-x2.^2)+2*sqrt(26^2-x2.^2).*y2-y2.^2)-z2;

v2(abs(imag(v2))>eps)=0;

p1=patch(isosurface(x1,y1,z1,v1,0));hold on

p2=patch(isosurface(x2,y2,z2,v2,0));hold off

set(p1,'FaceColor','r','FaceAlpha',0.3,'EdgeColor','r');

set(p2,'FaceColor','b','FaceAlpha',0.3,'EdgeColor','b');

%daspect([1 1 1])

view(3);

axis([-30 30 -100 100 -100 100]);

grid on;

xlabel('x');ylabel('y');zlabel('z');

用matlab画两个曲面的图