How can I change the radius of the spiral so it varies along the length from 0 to 1?

조회 수: 1 (최근 30일)
How can I change the radius of the spiral so it varies along the length from 0 to 1?
y=0:0.5:100;
n=length(y);
x=cos(y/100*10*pi);
z=sin(y/100*10*pi);
X=[zeros(1,n);x];
Y=[y;y];
Z=[zeros(1,n);z];
surf(X,Y,Z);
alpha(0.5);
view(75,15);

채택된 답변

Star Strider
Star Strider 2020년 5월 21일
Change ‘x’ and ‘z’ to:
x=cos(y/100*10*pi).*(y/100);
z=sin(y/100*10*pi).*(y/100);
so the full code siis now:
y=0:0.5:100;
n=length(y);
x=cos(y/100*10*pi).*(y/100);
z=sin(y/100*10*pi).*(y/100);
X=[zeros(1,n);x];
Y=[y;y];
Z=[zeros(1,n);z];
surf(X,Y,Z);
alpha(0.5);
view(75,15)
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by