Mostrar comentarios más antiguos
how can I solve this equation?
yp = diff(y,r);
yp2 = diff(y,r,2);
eqn = ( yp2 + yp/r-SH*y^2 == 0 );
Respuestas (1)
Star Strider
el 1 de Feb. de 2020
Analytically, it likely does not have a solution since it is nonlinear and most nonlinear differential equations do not have analytic solutions.
You can get some solutions for it numerically, however it quicklly goes to infinity:
syms r SH y(r) y0 y10 Y
yp = diff(y,r);
yp2 = diff(y,r,2);
eqn = ( yp2 + yp/r-SH*y^2 == 0 );
[VF,Subs] = odeToVectorField(eqn);
yfcn = matlabFunction(VF, 'Vars',{r,Y,SH})
SH = 1; % Change To Appropriate Value
rspan = linspace(0.0001, 11, 75);
ic = [1 1]*0.1;
[r,y] = ode45(@(r,y)yfcn(r,y,SH), rspan, ic);
figure
plot(r, y)
grid
legend(string(Subs))
This works, however it will not work for all sets of initial consitions, or all values of ‘r’. Experiment with the initial conditions to see what works.
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!