Storing values from a loop into an array
Show older comments
Coding:
for t = 1:24
OT(t,1) = (((Tmax + Tmin)/2)+((Tmax - Tmin)/2)*sin(((t - 9)/12)*PI));
ST(t,1) = OT(t)-5;
B(5,1) = (-1)*Ae*(Hco*ST(t,1) + Qse(t,1));
B(10,1) = (-1)*Aw*(Hco*ST(t,1) + Qsw(t,1));
B(15,1) = (-1)*As*(Hco*ST(t,1) + Qss(t,1));
B(20,1) = (-1)*An*(Hco*ST(t,1) + Qsn(t,1));
B(27,1) = (-1)*Ar*(Hcr*ST(t,1) + Qsr(t,1));
B(28,1) = (-1)*(Qse(t,1)*Awe + Qsw(t,1)*Aww + Qss(t,1)*Aws);
B(29,1) = (-1)*(Qt(t,1))-(V*ACH*RHO*CP*1000*OT(t,1));
X = A\B;
end
I want to be able to store the values of the X matrix (29,1) of each interation into an a table of (29,24) so that i can plot the results over hour of the day.. each iteration represents the hour of the day.
Please Help!!
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!