MATLAB: Solve a complex differential Riccati equation numerically

numericallyodericcati

I want to solve a complex differential Riccati equation numerically. I used ODE45 and ODE15s but The solution has unstable oscillation.
How can I solve a differential Riccati equation with complex values?
For example:
d/dt y(t)=((-1+(0.5*cost)) (y(t)^2) )+1

Best Answer

It is my code for ODE:
y0=[-1i*sqrt(2)];
tspan = [t_curr-h t_curr];
M = [1];
%%% A=[0 -1+0.5*cos(t);
%%% 1 0]
par = [A(1,1);A(1,2);A(2,1);A(2,2)];
options = odeset('Mass',M,'RelTol',1e-6,'AbsTol',[1e-6]);
[T_LL,LL] = ode45(@tabe,tspan,y0,options,par);
%%%%%%%%%%%
function out = tabe(t,y,parameters)
a11=parameters(1);
a12=parameters(2);
a21=parameters(3);
a22=parameters(4);
out = [(-a12*(y(1)^2))+(-(a11-a22)*y(1))+a21];
end
%%%%%%%%%%%%%%%%%%%%%%%%%
It is the answer of ODE45:
answer.png