matlab 解矩阵方程
来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/11/09 09:50:21
matlab 解矩阵方程
A为已知n*n矩阵,At为其转置矩阵,Q为已知正定n*n对角阵,解方程:
AtP + PA = -Q
也就是李亚普诺夫定理
A为已知n*n矩阵,At为其转置矩阵,Q为已知正定n*n对角阵,解方程:
AtP + PA = -Q
也就是李亚普诺夫定理
这个问题俺也感兴趣,提供一种方法,仅供参考.
clc;clear
P=sym('[p11 p12 p13;p21 p22 p23;p31 p32 p33]')
A=rand(3,3)
At=A'
Q=diag(diag(A))
f=At*P+P*A+Q
结果:
P =
[ p11,p12,p13]
[ p21,p22,p23]
[ p31,p32,p33]
A =
0.3311 0.5676 0.1526
0.6586 0.9805 0.8330
0.8636 0.7918 0.1919
At =
0.3311 0.6586 0.8636
0.5676 0.9805 0.7918
0.1526 0.8330 0.1919
Q =
0.3311 0 0
0 0.9805 0
0 0 0.1919
f =
[ .6622*p11+.6586*p21+.8636*p31+.6586*p12+.8636*p13+.3311,1.312*p12+.6586*p22+.8636*p32+.5676*p11+.7918*p13,.5230*p13+.6586*p23+.8636*p33+.1526*p11+.8330*p12]
[ .5676*p11+1.312*p21+.7918*p31+.6586*p22+.8636*p23,.5676*p12+1.961*p22+.7918*p32+.5676*p21+.7918*p23+.9805,.5676*p13+1.172*p23+.7918*p33+.1526*p21+.8330*p22]
[ .1526*p11+.8330*p21+.5230*p31+.6586*p32+.8636*p33,.1526*p12+.8330*p22+1.172*p32+.5676*p31+.7918*p33,.1526*p13+.8330*p23+.3837*p33+.1526*p31+.8330*p32+.1919]
然后用solve解9个方程组,求得P,不过,俺觉着,这方法太笨.
clc;clear
P=sym('[p11 p12 p13;p21 p22 p23;p31 p32 p33]')
A=rand(3,3)
At=A'
Q=diag(diag(A))
f=At*P+P*A+Q
结果:
P =
[ p11,p12,p13]
[ p21,p22,p23]
[ p31,p32,p33]
A =
0.3311 0.5676 0.1526
0.6586 0.9805 0.8330
0.8636 0.7918 0.1919
At =
0.3311 0.6586 0.8636
0.5676 0.9805 0.7918
0.1526 0.8330 0.1919
Q =
0.3311 0 0
0 0.9805 0
0 0 0.1919
f =
[ .6622*p11+.6586*p21+.8636*p31+.6586*p12+.8636*p13+.3311,1.312*p12+.6586*p22+.8636*p32+.5676*p11+.7918*p13,.5230*p13+.6586*p23+.8636*p33+.1526*p11+.8330*p12]
[ .5676*p11+1.312*p21+.7918*p31+.6586*p22+.8636*p23,.5676*p12+1.961*p22+.7918*p32+.5676*p21+.7918*p23+.9805,.5676*p13+1.172*p23+.7918*p33+.1526*p21+.8330*p22]
[ .1526*p11+.8330*p21+.5230*p31+.6586*p32+.8636*p33,.1526*p12+.8330*p22+1.172*p32+.5676*p31+.7918*p33,.1526*p13+.8330*p23+.3837*p33+.1526*p31+.8330*p32+.1919]
然后用solve解9个方程组,求得P,不过,俺觉着,这方法太笨.