Solve Function Doesn't Give All Solutions

2 vues (au cours des 30 derniers jours)
Joey Qi
Joey Qi le 31 Mar 2024
Commenté : Joey Qi le 1 Avr 2024
% 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!

Réponse acceptée

Torsten
Torsten le 31 Mar 2024
Déplacé(e) : Torsten le 31 Mar 2024
Using
x = solve(f,[T,L],'ReturnConditions',1)
instead of
x = solve(f,[T,L])
might help.
  1 commentaire
Joey Qi
Joey Qi le 1 Avr 2024
Yes, it works. Thanks, Torsten!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by