Solve Function Doesn't Give All Solutions

2 ビュー (過去 30 日間)
Joey Qi
Joey Qi 2024 年 3 月 31 日
コメント済み: Joey Qi 2024 年 4 月 1 日
% this does not give all the solutions
A = [0.7 0.2;
0.05 0.64];
C = [0.5 -0.8;
0 0.7];
Q = [0.5 0;
0 0.7];
R = [1 0;
0 0.8];
T = sym('T',[2 2]);
L = sym('L',[2 2]);
[Pba,L2,G] = dare(A',C',Q,R);
P = C*Pba*C'+R;
f = trace(P^(-1)*(T*P*T'+L-P));
x = solve(f,[T,L])
The answer(solution) is like that:
x =
struct with fields:
T1_1: 0
T2_1: 0
T1_2: 0
T2_2: 0
L1_1: 1298074214633706853141718390451145/425558238297866865348786096439296
L2_1: 0
L1_2: 0
L2_2: 0
However, there are other solutions, such as T=[1,0;0,1], L=[0,0;0,0];
Why does the code not give me all the reasonable solutions for T and L?
Thanks!

採用された回答

Torsten
Torsten 2024 年 3 月 31 日
移動済み: Torsten 2024 年 3 月 31 日
Using
x = solve(f,[T,L],'ReturnConditions',1)
instead of
x = solve(f,[T,L])
might help.
  1 件のコメント
Joey Qi
Joey Qi 2024 年 4 月 1 日
Yes, it works. Thanks, Torsten!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by