Solve function is unable to find an explicit solution

30 views (last 30 days)
Joey Qi
Joey Qi on 3 Apr 2024 at 14:36
Commented: Joey Qi on 4 Apr 2024 at 14:43
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!

Answers (1)

Torsten
Torsten on 3 Apr 2024 at 15:46
Edited: Torsten on 3 Apr 2024 at 15:48
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 Comments
Torsten
Torsten on 4 Apr 2024 at 0:52
Edited: Torsten on 4 Apr 2024 at 9:30
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
Joey Qi
Joey Qi on 4 Apr 2024 at 14:43
Thank you, Torsten! You inspired me to solve the problem. I have already got some solutions using your method.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!