how can i convert 2d plot in to 3d surface ??
Mostrar comentarios más antiguos
I have this small code that plots ogive shape nose in 2d.
I want to develop 3d surface from this code !!! please help and guide....
I am using surf command and tried to turn vector in to matrix....
L = 500;
R = 79;
n= 0.4;
x = 0:0.01:50;
y= R*(x/L).^n;
z= 1.*(x/L).^n;
plot(x,y,'r','linewidth',2)
hold on
plot(x,-y,'r','linewidth',2)
xlabel('Length')
ylabel('Radius')
title('Nose Profile')
axis('equal');
5 comentarios
Walter Roberson
el 25 de Abr. de 2024
For the third dimension, do you want change over L, or R, or n ?
John D'Errico
el 25 de Abr. de 2024
Editada: John D'Errico
el 25 de Abr. de 2024
My wild guess is you want to find the rotational surface, inplied by a rotation around the axis of symmetry. At least that stems from your comment about a nose profile.
But there are multiple other ways you could create a surface from that curve. You could extend it along the third dimension, creating a surface of infinite extent in z. You could rotate it around some other axis, or around any general line.
Dr Sohaib Khan
el 25 de Abr. de 2024
@Dr Sohaib Khan, As @Walter Roberson & @John D'Errico mentioned you could create multple surfaces depending on the which dimension is taken to rotate the 2D line plot. Since you dont want to change L, R, & n, you can use commands like surf or mesh as shown below
L = 500;
R = 79;
n= 0.4;
x = 0:0.01:50;
y = R*(x/L).^n;
z = 1.*(x/L).^n;
[X, Th] = meshgrid(linspace(1,50,100),linspace(0,2*pi,100));
Y = (R*(X/L).^n).*cos(Th);
Z = (1.*(X/L).^n).*sin(Th);
subplot(211)
plot(x,y,'r','linewidth',2)
hold on
plot(x,-y,'r','linewidth',2)
xlabel('Length')
ylabel('Radius')
title('Nose Profile')
axis([-10 50 -40 40]);
subplot(212)
s=surf(X,Y,Z);shading interp;view([30 15])
Dr Sohaib Khan
el 28 de Abr. de 2024
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


