for loop plotting problem
이전 댓글 표시
i cannot seem to get my plot to work, i am trying to plot(x,z) the for loop final results (a list of x and z values)
i am not sure as to how to store the x,z values in an array or vector form.
a=0.551;
k=1.889;
e1=0.0222;
n1=1;
%t=0.349;
nn=(2*pi()/360);
for theta=0:nn:(2*pi())
theta1=(atan((a*sin(theta))/(a*cos(theta)-a)))+pi();
theta2=(atan((a*sin(theta))/(a*cos(theta)-a*e1)))+n1*pi();
r1=sqrt((a*cos(theta)-a)^2+(a^2*sin(theta)*sin(theta)));
r2=sqrt((a*cos(theta)-a*e1)^2+(a^2*sin(theta)*sin(theta)));
x=((r1^k)/(r2^(k-1)))*(cos(k*theta1)*cos(k-1)*theta2+sin(k*theta1)*sin(k-1)*theta2)
z=((r1^k)/(r2^(k-1)))*(sin(k*theta1)*cos(k-1)*theta2-cos(k*theta1)*sin(k-1)*theta2);
plot(x,z)
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!