Displaying for loop iterations as a matrix
Show older comments
for R=0.6:0.05:0.95;
A=[(1.5*R-1.59), 0.5*R, 0; 0.5, -21.75, 0; 0, 0, 0];
B=[-0.7; -38; 0];
a=Guass(A,B);
Ci= a(2,2)/a(2,4)
Cu= (a(1,4)-a(1,2)*Ci)/a(1,1)
Liver= [R;Ci]
Lung= [R;Cu]
end
So this code will display Ci and Cu as its individual outputs for each iterations, but I want it displayed as a matrix but when I try displaying Liver and Lung it only displays the last iterations. How can I make it display all the iterations?
Answers (1)
Star Strider
on 18 Feb 2019
I am guessing here:
Rv=0.6:0.05:0.95;
for k1 = 1:numel(Rv)
R = Rv(k1);
A=[(1.5*R-1.59), 0.5*R, 0; 0.5, -21.75, 0; 0, 0, 0];
B=[-0.7; -38; 0];
a=Guass(A,B);
Ci= a(2,2)/a(2,4)
Cu= (a(1,4)-a(1,2)*Ci)/a(1,1)
Liver{k1}= [R;Ci]
Lung{k1}= [R;Cu]
end
I am using cell arrays for ‘Liver’ and ‘Lung’ because I have no idea what they are, much less their dimensions.
Categories
Find more on Structural Mechanics 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!