how to store MATRIX in each iteration
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Ameer Hamza
2020-4-2
编辑:Ameer Hamza
2020-4-2
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
.
.
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!