2 views (last 30 days)

For example:

n = 100;

for ii = 1 : n

areatriangle = .5*((ii/2)*ii);

end

In the case above, I want to store all the outcomes/iterations of areatriangle, not just the last one. How do I do this?

Thanks in advance for your help!

Alex Mcaulley
on 30 Oct 2019

n = 100;

areatriangle = zeros(1,n)

for ii = 1 : n

areatriangle(ii) = .5*((ii/2)*ii);

end

or:

areatriangle = .5/2*(1:n).^2;

Alex Mcaulley
on 30 Oct 2019

Ohhh yes, you need to change the following lines in the last loop:

ThetaInDegrees_a(j,pt) = acosd(CosTheta_a(j,pt));

ThetaInDegrees_b(j,pt) = acosd(CosTheta_b(j,pt));

ThetaInDegrees_c(j,pt) = acosd(CosTheta_c(j,pt));

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

Start Hunting!
## 0 Comments

Sign in to comment.