How can I loop through an equation with X different values of length at an angle Y, store coordinates then repeat for different angles
Show older comments
This is a snippet of my code which is to calculate a coordinate system. In this example for these values of N, I should get 500 Y and 500 Z values but the code just saves the last 100 points calculated. Any help would be appreciated!
N=5;
NN=100;
z =linspace(0,pi/2,N);
x = linspace (0.005,0.4,NN);
for k=1:N
for i=1:NN
Hr3(i) = somefunctionofx;
Wr3(i) = somefunctionofx;
Z03(i) = somefunctionofx;
Nr3(i) = somefunctionofx;
Ar3(i) = Hr3(i)/2;Br3(i) = Wr3(i)/2;
r3(i)=(((Ar3(i)*Br3(i))^Nr3(i))/(((Ar3(i).*sin(z(k)))^Nr3(i))+((Br3(i).*cos (z(k))^Nr3(i))))^(1/Nr3(i));
Y3 (:,i) = r3(i) .* sin(z(k));
Z3 (:,i) = (r3(i) .* cos (z(k))) + Z03(i);
end
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!