Solve function is unable to find an explicit solution
Mostra commenti meno recenti
Hello,
the code is as follows.
clc;clear all
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));
g = L(1,2)-L(2,1);
assume(L(1,2)==L(2,1) & L(1,1)>=0 & det(L)>=0);
x = solve(f,[T,L],"ReturnConditions",true)
The output is
Warning: Unable to find explicit solution. For options, see help.
> In sym/solve (line 317)
In main_240331 (line 20)
x =
struct with fields:
T1_1: [0×1 sym]
T2_1: [0×1 sym]
T1_2: [0×1 sym]
T2_2: [0×1 sym]
L1_1: [0×1 sym]
L2_1: [0×1 sym]
L1_2: [0×1 sym]
L2_2: [0×1 sym]
parameters: [1×0 sym]
conditions: [0×1 sym]
I already know that the solutions exist, such as T=[1 0;0,1], L=[0,0;0,0]. Why is the solve function here unable to find the explicit solution?
Or, are there any other methods to get the solutions?
Thanks!
Risposte (1)
If you only want one possible solution, use
x = solve(f,[T,L])
If you remove your assumptions, you get the general form of the solution.
3 Commenti
Joey Qi
il 4 Apr 2024
In this case, the matlab is unable to find explicit solutions.
It is unable to find all possible solutions. If you remove "ReturnConditions",1 , it gives you a special solution.
But after generating the general solution without the assumptions, you can simply include your assumptions by demanding L1_1 >= 0, L1_2 = L2_1 and L1_1*L2_2 - L1_2*L2_1 >= 0 where L1_1, L2_2, L1_2 and L2_1 are the representations obtained by the code.
clc;clear all
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],'ReturnConditions',1)
Thus you have 7-parametric solution where the parameters are constrained by the conditions
imag(conj(z2)*(...)) = 0
real(conj(z2)*(...)) >= 0
z4 = z5
imag(conj(z2)*(...)*z6 - z4*z5) = 0
real(conj(z2)*(...)*z6 - z4*z5) >= 0
Joey Qi
il 4 Apr 2024
Categorie
Scopri di più su Assumptions in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!