矩阵

时间:2016-09-26 19:45:18

标签: matlab matrix numeric numerical-methods ode

我现在正试图用数字方法解决矩阵ODE,让我们按如下方式简化我的问题:

%{ I don't know the best way to define a 4*4 matrix function%}
syms rho11(t) rho12(t) rho13(t) rho14(t);
syms rho21(t) rho22(t) rho23(t) rho24(t);
syms rho31(t) rho32(t) rho33(t) rho34(t);
syms rho41(t) rho42(t) rho43(t) rho44(t); 
%{ rho is a 4*4 matrix, each element is a function of time %}
rho=[rho11, rho12, rho13, rho14;rho21, rho22, rho23, rho24;rho31, rho32, rho33, rho34;rho41, rho42, rho43, rho44];

%{ define constant matrix %}
s2p=zeros(4,4);s1p=zeros(4,4);
s2p(1,2)=1;s2p(3,4)=1;s1p(1,3)=1;s1p(2,4)=1;
init=zeros(4,4);init(2,2)=1;

%{now we need to solve the following ODE %}
d(rho)/dt=-(rho *s1p - rho *s2p); 
%{initial condition:%} rho(0)=init

我知道一种方法是将矩阵转换为矢量,但我所做的实际方程式太复杂了,无法自行转换。任何人都可以告诉我进行这种转换并解决ODE的代码吗?谢谢!

0 个答案:

没有答案