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!