How to solve differential equations that are in matrix form?
조회 수: 46 (최근 30일)
이전 댓글 표시
Hello,
I'm trying to use matlab to solve these differential equations and am struggling to find a method that works.
댓글 수: 0
답변 (1개)
Bjorn Gustavsson
2019년 2월 1일
편집: Bjorn Gustavsson
2019년 2월 1일
This seems to be exactly the type of ODE the odeNN-functions are designed to solve. Just put your ode into a function:
function dp = myode(t,p,A)
dp = A*p;
end
Then integrate your ODE like this:
A = [-lambd mu;lambda -mu];
p0 = [1;0];
t_span = [t_initial,t_final]
P = ode45(@(t,p) myode(t,p,A),t_span,p0);
Or if you want to solve it symbolically:
syms mu lambda t
syms p1(t) p0(t)
Dp1 = diff(p1);
Dp0 = diff(p0);
A = [-lambda mu;lambda -mu];
P = dsolve([Dp0;Dp1] == A*[p0;p1],[p0(0);p1(0)]==[1;0]);
HTH
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!