why I try to solve equation in Matlab but get nothing?

Viewed 45

I try to solve P in an equation, P shows up on both sides of the equation. I define other variables as follows.

beta=.95;
r=.95^-1-1;
b=30;
gamma=1;
rho1=1.2;
rho2=-0.3;
Q=1+gamma;
A=[1 0 0 0;0 1 0 0; 0 0 rho1 rho2; 0 0 1 0];
B=[0 1 0 0]';
E=[-b r 1 0]';
H=-E;
R=E'*E;

syms P
eqn=P==R+beta*A'*P*A-(beta*A'*P*B+H')*(Q+beta*B'*P*B)^-1*(beta*B'*P*A+H);
Sp=solve(eqn,P)

But the outcome shows:

Sp =
 
Empty sym: 0-by-1

Mmmmm What mistake did I make?

1 Answers

I run the following code:

beta=.95;
r=.95^-1-1;
b=30;
gamma=1;
rho1=1.2;
rho2=-0.3;
Q=1+gamma;
A=[1 0 0 0;0 1 0 0; 0 0 rho1 rho2; 0 0 1 0];
B=[0 1 0 0]';
E=[-b r 1 0]';
H=-E;
R=E'*E;

syms P
eqn = R+beta*A'*P*A-(beta*A'*P*B+H')*(Q+beta*B'*P*B)^-1*(beta*B'*P*A+H) - P == 0;
Sp=solve(eqn,P)
Sp1=solve(eqn(1,1),P)
var1 = vpa(Sp1)
Sp2=solve(eqn(2,2),P)
var2 = vpa(Sp2)

in MATLAB, and get the following result:

Sp =
 
Empty sym: 0-by-1

and this: output of MATLAB

The reason why this happens is because eqn is 4*4 matrix. You are trying to find a P that satisfies all those 16 equations. As you can see, eqn(1,1)'s and eqn(2,2)'s answers are not equal. Therefore I think there is no answer for your solution.

Related