How to draw a cylindrical panel using matlab

I would like to draw a cylindrical panel using matlab code. please help.

댓글 수: 4

darova
darova 2021년 3월 29일
Do you have any attempts? What is the problem?
Twinkle C M
Twinkle C M 2021년 3월 29일
편집: Adam Danz 2021년 3월 29일
clc;
clear all;
close all;
a=1;
b=1;
R=5;
teta=a/R;
theeta=-teta:0.01:teta;
for i=1:length(theeta)
x(i)=R*sin(theeta(i));
z(i)=R*cos(theeta(i));
end
z = repmat(z,length(theeta),1);
y=0:1/40:1;
for i=1:length(x)
for j=1:length(y)
z(i,j)=z(i,j);
end
end
surf(x,y,z);
Adam Danz
Adam Danz 2021년 3월 29일
편집: Adam Danz 2021년 3월 29일
@Twinkle C M I formatted your code using the text-code toggle; please format your code in the future to increase your chances that people will want to read the question/comment.
I also added a semicolon in this line so the command window isn't flooded with outputs: z(i,j)=z(i,j); & z = repmat...
If you add
axis equal
view(30,15)
and change the surf command to
surf(x,y,z, 'faceColor', 'flat','LineStyle', 'none');
you get close to what you want. You may need to increase the width (z).

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

질문:

2021년 3월 28일

댓글:

2021년 3월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by