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.

Réponses (1)

Torsten
Torsten le 9 Nov 2016

1 vote

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.

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by