Dear Carl,
Thanks for replying. Apologies for the editing. I have the terminal values but the equation is involving 2*2 matrices.
Solve the following system of ODE's
d/dt Y(t)=-(H(t))^{'}Y(t)
d/dt V(t)=-Y(t)^{'}Q^{'}QY(t)
with the terminal conditions Y(T)=I_{2} and V(T)=0. Y, V, H and Q are 2*2 matrices and ' stands for transpose.
Also
H(t)=H-Q^{'}Q*W(T-t)
where W(T-t)=W(tau) is determined by the matrix Ricatti equation
dW/dtau = W(tau)H+H^{'}W(tau)-2W(tau)Q^{'}QW(tau)+I_{2}
such that at tau=0
W(0)=0.
I am badly stuck up.
I am unable to use ode45 since I want matrix result.
It would be great if you can give a suggestion.
\[
H=
\begin{bmatrix}
-0.5 & 0.4 \\
0.007 & -0.008
\end{bmatrix}
\]
\[
Q=
\begin{bmatrix}
0.06 & -0.0006 \\
-0.06 & 0.006
\end{bmatrix}
\]
Thanks.
Actually I am solving a system of matrix odes where dx/dt, dy/dt, dz/dt are all 2 by 2 matrices and I need to get X,Y,Z which are again 2 by 2 matrices. My code is
function [dXdt, dYdt, dVdt] = mwish7(t, X, Y, V, A, B, R) X = reshape(X, size(A)); Y = reshape(Y, size(A)); V = reshape(V, size(A)); dXdt = -A.'*X - X*A + 2*X*(B.'*B)*X - R; dYdt = -(A-(B.'*B)*X).'*Y; dVdt = -Y.'*(B.'*B)*Y; dXdt = dXdt(:); dYdt = dYdt(:); dVdt = dVdt(:); end
and the ode45 program I use is
A=[-0.5, 0.4; 0.007, -0.008]; B=[0.06 -0.0006; -0.06, 0.006]; R = [1 0; 0 1]; X0 = [0, 0; 0, 0]; Y0 = [1 0; 0 1]; V0 = [0, 0; 0, 0]; [T X Y V] = ode45(@(t,X,Y,V)mwish7(t, X, Y, V, A, B, R), [15 0], X0, Y0, V0)
I get the error: NOT ENOUGH INPUT ARGUMENTS.
Regards, RB