필터 지우기
필터 지우기

Extruding a 2D plot to 3D

조회 수: 20 (최근 30일)
Mahmoud Abbas
Mahmoud Abbas 2022년 4월 11일
답변: Star Strider 2022년 4월 12일
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)

채택된 답변

Star Strider
Star Strider 2022년 4월 12일
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!')
.

추가 답변 (1개)

Tala
Tala 2022년 4월 12일
Take a look at this
https://www.mathworks.com/matlabcentral/answers/82917-extend-line-plot-to-a-surface

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by