Question on Initial value problem - error correction

Question
I create a script
function f = exercise711 (t, x)
f = t * x.^2;
end
And on the command window, I wrote
>> [t1, x1] = ode45(@exercise711, [0 1], 1);
>> plot(t1, x1)
>> hold on
>> [t2, x2] = ode45(@exercise711, [0 2], 1);
Warning: Failure at t=1.414192e+00. Unable to meet integration tolerances
without reducing the step size below the smallest value allowed
(3.552714e-15) at time t.
In ode45 (line 308)
>> plot(t2, x2)
here, for the interval [0 2], I get an error and the graph is wrong. Why? How can I correct it? Please help me to do this question in a correct way.
Thanks a lot.

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 24 de Abr. de 2020
Editada: Ameer Hamza el 24 de Abr. de 2020

0 votos

The result is correct, and it was the purpose of the exercise to show that the solution of an ODE can diverge to infinity. If you use symbolic toolbox to solve this equation, you can see that the analytical solution of this ODE is
and at , there is a singularity and the output become infinity. You can see in warning message that the issue also occurs at 1.414... In the interval [0,1] there is no singularity and MATLAB does not give any warning.

6 comentarios

I see. Many thanks :)
Ameer Hamza
Ameer Hamza el 24 de Abr. de 2020
I am glad to be of help.
Dear Ameer Hamza, You solved my questions in very nice and understandable way. I have also a question. You know I try to learn by myself, and I dont know anyone to learn and to ask. please can you help me again?my question is here
Dear Hamza, I will be happy if you help me. Thanks a lot:)
Ameer Hamza
Ameer Hamza el 7 de Mayo de 2020
That question requires a bit of thinking. I will answer it if I get some ideas.
thanks a lot. In fact, very similart question is here
But, I am writing D1 matrix in wrong way. If I can correct it, this solution is valid, i think. Again, thank you for your consideration, and helping.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Preguntada:

el 24 de Abr. de 2020

Comentada:

el 7 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by