1 view (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));

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.