How to solve these differential equations?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Star Strider
am 16 Mär. 2018
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 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!