non-linear 2nd ODE
显示 更早的评论
how can I solve this equation?
yp = diff(y,r);
yp2 = diff(y,r,2);
eqn = ( yp2 + yp/r-SH*y^2 == 0 );
回答(1 个)
Star Strider
2020-2-1
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!