Solve function is unable to find an explicit solution

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!

Respuestas (1)

Torsten
Torsten el 3 de Abr. de 2024
Editada: Torsten el 3 de Abr. de 2024
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 comentarios

Hi, I need to get all the possible solutions, and the assumptions here are also needed. In this case, the matlab is unable to find explicit solutions.
Torsten
Torsten el 4 de Abr. de 2024
Editada: Torsten el 4 de Abr. de 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)
x = struct with fields:
T1_1: z T2_1: z1 T1_2: z2 T2_2: z3 L1_1: conj(z2)*((3973518972162105*z)/9007199254740992 - (175580345583681*z2)/140737488355328) - (8353311061136183*z5)/23623227723860540 - (1591643986987335*z6)/118116... L2_1: z4 L1_2: z5 L2_2: z6 parameters: [z z1 z2 z3 z4 z5 z6] conditions: symtrue
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
Thank you, Torsten! You inspired me to solve the problem. I have already got some solutions using your method.

Iniciar sesión para comentar.

Productos

Versión

R2021b

Preguntada:

el 3 de Abr. de 2024

Comentada:

el 4 de Abr. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by