Extruding a 2D plot to 3D

20 visualizaciones (últimos 30 días)
Mahmoud Abbas
Mahmoud Abbas el 11 de Abr. de 2022
Respondida: Star Strider el 12 de Abr. de 2022
Hello, i want to make the code extrude this curve over the range 0 to 10 units into the z-axis and i want the plot to show it in 3D
i=1;
for k=-5:0.1:5
y(i)=k^2;
x(i)=k;
i=i+1;
end
plot(x,y)

Respuesta aceptada

Star Strider
Star Strider el 12 de Abr. de 2022
Try this —
k = -5:0.1:5;
y = k.^2;
figure
surf([k;k], [y;y], [ones(size(k))*10; zeros(size(k))])
grid on
colormap(turbo)
shading('interp')
axis('equal') % Optional
title('Rainbow!')
.

Más respuestas (1)

Tala
Tala el 12 de Abr. de 2022
Take a look at this
https://www.mathworks.com/matlabcentral/answers/82917-extend-line-plot-to-a-surface

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by