solve a complex second order differential equation

9 Ansichten (letzte 30 Tage)
嘉杰 程
嘉杰 程 am 20 Okt. 2021
Kommentiert: 嘉杰 程 am 22 Okt. 2021
the ode has a form:
and for, given , how could I use ode45 to solve it with plot? thx

Akzeptierte Antwort

Bjorn Gustavsson
Bjorn Gustavsson am 20 Okt. 2021
Bearbeitet: Bjorn Gustavsson am 20 Okt. 2021
The first step is to convert your second-order ODE to two coupled first-order ODEs:
Then you should write that ODE-system as a matlab-function:
function [dphidt_domegadt] = yourODEs(t,phi_w)
phi = phi_w(1);
w = phi_w(2);
dphidt = w;
if t == 0 % Here I assume that domegadt/t goes to zero as t -> 0+, perhaps there are solutions for other finite values of that ratio...
domegadt = phi^3;
else
domegadt = -2/t*dphidt - phi^3;
end
dphidt_domegadt = [dphidt;
domegadt];
This should be possible to integrate with ode45:
phi0w0 = [1 0];
t_span = [0 exp(2)]; % some limits of yours
[t,phi_w] = ode45(@(t,phi_w) yourODEs(t,phi_w),t_span,phi0w0);
HTH
  9 Kommentare
嘉杰 程
嘉杰 程 am 21 Okt. 2021
every t determine certain curvature of phi and eta, when eta=0, phi(eta)=1, phi'(eta)=0, that's one side, another side is determined by t
嘉杰 程
嘉杰 程 am 22 Okt. 2021
actually this is only a specific function when n=3

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 20 Okt. 2021
You cannot use any numeric solver for that. You have initial conditions at η = 0, but at 0 you have a division by 0 which gets you a numeric infinity. That numeric infinity is multiplied by the boundary condition of 0, but numeric infinity times numeric 0 gives you NaN, not 0.
If you work symbolically you might think that the infinity and the 0 cancel out, but that only works if the φ' approaches 0 faster than 1/η approaches infinity, which is something that we do not immediately know to be true.
  3 Kommentare
嘉杰 程
嘉杰 程 am 20 Okt. 2021
If I let to be a quite small number?
Bjorn Gustavsson
Bjorn Gustavsson am 20 Okt. 2021
That is not enough. The ratio of 1/t*dphi/dt has to behave well for t = 0.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by