how to store MATRIX in each iteration
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
veeresh g
am 2 Apr. 2020
Kommentiert: Ameer Hamza
am 3 Apr. 2020
i want to store matrix " A" data for each iteration for verification purpose only
Ca=[ca1 ca2;ca3 ca4]; Cb=[cb1 cb2;cb3 cb4]; Cd=[cd1 cd2;cd3 cd4]; Cc=[cc1 cc2;cc3 cc4];
Ka=[ka1 ka2;ka3 ka4]; Kb=[kb1 kb2;kb3 kb4]; Kd=[kd1 kd2;kd3 kd4]; Kc=[kc1 kc2;kc3 kc4];
Ma=[ma 0;0 ma]; Mb=[mb 0;0 mb];
w=[2 4 6];
for i=1:54
s(i)=w(i);
A=[Ma*(s(i)^2)+(Ca+Cb)*s(i)+(Ka+Kb) -(Cb*s(i)+Kb) zeros(2);
-(Cb*s(i)+Kb) Mb*(s(i)^2)+(Cb+Cc+Cd)*s(i)+(Kb+Kc+Kd) -(Cc*s(i)+Kc);
zeros(2) -(Cc*s(i)+Kc) Mc*(s(i)^2)+Cc*s(i)+Kc];
end
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 2 Apr. 2020
Bearbeitet: Ameer Hamza
am 2 Apr. 2020
Store it as cell array
A{i}=[Ma*(s(i)^2)+(Ca+Cb)*s(i)+(Ka+Kb) -(Cb*s(i)+Kb) zeros(2);
-(Cb*s(i)+Kb) Mb*(s(i)^2)+(Cb+Cc+Cd)*s(i)+(Kb+Kc+Kd) -(Cc*s(i)+Kc);
zeros(2) -(Cc*s(i)+Kc) Mc*(s(i)^2)+Cc*s(i)+Kc];
You can then access the stored matrices with
A{1} % A matrix for i=1
A{2} % A matrix for i=2
A{3} % A matrix for i=3
.
.
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!