for loop plotting problem
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!