ode45 solver loop

4 ビュー (過去 30 日間)
Marco Sammito
Marco Sammito 2016 年 11 月 9 日
回答済み: Torsten 2016 年 11 月 9 日
Hi. I have to solve this equation
where h is defined by:
My idea is to initialize h=1, solve the first equation, calculate a new value for h:
and do this many times because it guarantees that h has converged. In the Run.m file I do not know how to express the second derivative of R, in fact MATLAB says that Rp is undefined.
Plesset.m file
function Rp = Plesset(t, R)
Rp = zeros(2, 1);
Rp(1) = R(2);
h = 1;
h = 1/R(1)*((R(2)/h)^(1/3) + R(2)/h);
Rp(2) = 1/R(1) * (-1.5 * (R(2))^2 + R(2)/h + sin(t));
Run.m file
for i = 1:100
[t, R] = ode45('Plesset', [0,5], [0,0]);
h = R(2)/(R(1)*Rp(2) + 3/2*(R(2))^2 - sin(t));
end
[t, R(:,1)]
plot(t, R(:,1))
Thank you.

回答 (1 件)

Torsten
Torsten 2016 年 11 月 9 日
ODE15S can solve differential-algebraic problems. So just use it to solve the two differential equations for R and the algebraic equation for h simultaneously.
To see how this works, look up the section
Solve Robertson Problem as Semi-Explicit Differential Algebraic Equations (DAEs)
under
https://de.mathworks.com/help/matlab/math/solve-differential-algebraic-equations-daes.html
for an example.
Best wishes
Torsten.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by