How to solve these differential equations?
조회 수: 1 (최근 30일)
이전 댓글 표시
I know how to solve them by hand, but am unable to solve them using Matlab. FYI: I have been through the documentations for both ode45 and bvp4c and that didn't helped at all.

댓글 수: 0
답변 (1개)
Star Strider
2018년 3월 16일
You can set the equations up easily enough using the Symbolic Math Toolbox:
syms C(r) T(r) beta gamma phi Y
dC = diff(C);
dT = diff(T);
Eq1 = 1/r^2 * diff(r^2 * dC) == phi^2 * C * exp(gamma - gamma/T);
Eq2 = 1/r^2 * diff(r^2 * dT) == -beta * phi^2 * C * exp(gamma - gamma/T);
[DE,Subs] = odeToVectorField(Eq1, Eq2); % dC(0) == 0, dC(1) == 1, dT(0) == 0, dT(1) == 1);
odefcn = matlabFunction(DE, 'Vars',{r,Y,beta,gamma,phi});
This creates the anonymous function ‘odefcn’ to use with the ODE solvers. I leave the coding to use bvp4c to you. (Note that ‘Y(1)’ through ‘Y(4)’ are defined in the ‘Subs’ output, so ‘Y(1)’ is ‘Subs(1)’ and so for the others, the reason I always specify it.)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!