Dear all: I want to crat a line plot to produce a truncated pyramid with 45degree inclination. The truncated pyramid has an initial width and length of 50mm,50mm. Hight of 30mm. I want to crat plot3 lines within 0.25mm depth until the final hight is reached(30mm). So how to crat the plot for this truncated pyramid. The sample part is attached. Thank You!

 채택된 답변

KSSV
KSSV 2018년 9월 26일
편집: KSSV 2018년 9월 26일

0 개 추천

L = 50 ; B = 50 ; H = -30 ;
theta = 45 ;
% Bottom rectangle
B = [0 0 0; L 0 0; L B 0; 0 B 0; 0 0 0] ;
mx = mean(B(1:4,1)) ; my = mean(B(1:4,2)) ;
h = 0:-0.25:H ;
figure
hold on
plot3(B(:,1),B(:,2),B(:,3),'r')
for i = 1:length(h)
C = [mx my h(i)] ;
x = h(i)/tand(theta) ;
s = L/2-x ;
% Top rectangele points
T = [mx-s my-s h(i); mx+s my-s h(i) ; mx+s my+s h(i) ; mx-s my+s h(i) ; mx-s my-s h(i)] ;
plot3(T(:,1),T(:,2),T(:,3),'b')
end

댓글 수: 2

adam adam
adam adam 2018년 9월 26일
편집: adam adam 2018년 9월 26일
Thank You very much. let me again kindly add one more question. simply give me some hint if you have time. What to add to the above code if the plot is spiral as attached.
Hi, I want to create similar truncated pyramid. With initial dimensions of 70 X 70 mm. A depth of 25 mm is to be reached and stepsize is 1mm. But the path traced should have equally spaced points at 1mm distance. Can it be done?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

질문:

2018년 9월 25일

댓글:

2022년 3월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by