将Toric Surfaces排列在彼此之上

时间:2013-09-10 19:50:35

标签: matlab 3d plot

如何在y平面上将这两个表面叠加在一起。我试过这个代码,但它没有用。可以有人提出想法吗?我尝试了几种方法,但它们都无法工作

Cx=1/80;
Cy=1/70;
M=6;
Dr=20;

n=2^(M-1);
Vertex=[0 0 0];
phi = (linspace(-pi,pi,n));
r=(linspace(0,Dr,n))';

x = -r*cos(phi)+Vertex(1);

y = -r*sin(phi)+Vertex(2);

z=(Cx*x.^2+Cy*y.^2)./(1+(1-sqrt(Cx*x.^2+Cy*y.^2).^2)./(x.^2+y.^2))+Vertex(3);

surf(z,x,y)
axis
set(gca, 'YDir','reverse');    
xlabel('X-axis','fontweight','bold');
ylabel('Z-axis','fontweight','bold');
zlabel('Y-axis','fontweight','bold');
hold on
Vertex=[pi pi pi];
phi = (linspace(-pi,pi,n));
r=(linspace(0,Dr,n))';

x = -r*cos(phi)+Vertex(1);

y = -r*sin(phi)+Vertex(2);

z=(Cx*x.^2+Cy*y.^2)./(1+(1-sqrt(Cx*x.^2+Cy*y.^2).^2)./(x.^2+y.^2))+Vertex(3);

surf(z,x,y)
axis 
set(gca, 'YDir','reverse');    
xlabel('X-axis','fontweight','bold');
ylabel('Z-axis','fontweight','bold');
zlabel('Y-axis','fontweight','bold');

编辑

这个想法是产生类似的东西:

M=5;
n=2^(M-1);
c=1/20;
Dr=1/10;
k=-1;
Vertex=[0 0 0];

phi = (linspace(0,2*pi,n));
r=(linspace(0,Dr,n))';

x = r*cos(phi)+Vertex(1);
y = r*sin(phi)+Vertex(2);
z = (c*((r*cos(phi)).^2+(r*sin(phi)).^2))./ ...
    (1+sqrt(1-(1+k)*c^2*((r*cos(phi)).^2+ ...
    (r*sin(phi)).^2)))+Vertex(3);

surf(x,z,y);

set(gcf, 'Renderer', 'ZBuffer')
hold on
Vertex=[0 0.399 0];

phi = (linspace(0,2*pi,n));
r=(linspace(0,Dr,n))';

x = r*cos(phi)+Vertex(1);
y = r*sin(phi)+Vertex(2);
z = (c*((r*cos(phi)).^2+(r*sin(phi)).^2))./ ...
    (1+sqrt(1-(1+k)*c^2*((r*cos(phi)).^2+ ...
    (r*sin(phi)).^2)))+Vertex(3);

surf(x,z,y)

0 个答案:

没有答案