How to solve these differential equations?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 16 de Mzo. de 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 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!