Displaying for loop iterations as a matrix

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?

回答(1 个)

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.

Community Treasure Hunt

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

Start Hunting!

Translated by