Solve first order nonlinear ODE

조회 수: 14 (최근 30일)
Missael Hernandez
Missael Hernandez 2020년 9월 8일
댓글: Missael Hernandez 2020년 9월 8일
Hello I am tryin to solve this nonlinear ODE
with the IC
This is my code
tspan = [0 5];
x0 = 3;
[t,x] = ode45(@(t,x) (x^4)-(7*x^2)+6*x, tspan, x0);
plot(t,x,'b')
My problem is that I get the following error: Warning: Failure at t=2.004757e-02. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (5.551115e-17) at time t. What should I do because the graph of the solution looks worng. Thanks.
  댓글 수: 2
J. Alex Lee
J. Alex Lee 2020년 9월 8일
If you have a solution form that you expect, what is it? It's not surprising that the thing explodes for x(0)>1, for which your rate of change increases to produce a snowball effect.
Missael Hernandez
Missael Hernandez 2020년 9월 8일
Well is should be in the form
Wolfram doesn't give the solution Matlab does. Matlab gives this, which I think is wrong

댓글을 달려면 로그인하십시오.

채택된 답변

Alan Stevens
Alan Stevens 2020년 9월 8일
The value of x increases far too quickly, and reaches a value beyond the numerics ability to cope with when x(0) > 2. Works just fine if x(0) = 1.5, or 0.5, say.
  댓글 수: 1
Missael Hernandez
Missael Hernandez 2020년 9월 8일
Thank you for you explanantion!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sam Chak
Sam Chak 2020년 9월 8일
편집: Sam Chak 2020년 9월 8일
The x(t) response rises rapidly. It cannot go pass t = 0.0463782 sec.
The x(t) response diverges for x(0) > 2 and converges to some steady-state points for x(0) < 2.
tspan = [0 0.046378];
x0 = 2.5;
[t, x] = ode45(@(t,x) (x^4) - (7*x^2) + 6*x, tspan, x0);
plot(t, x, 'b')
  댓글 수: 2
J. Alex Lee
J. Alex Lee 2020년 9월 8일
so there you go, taken together with my comment and Alan's answer, looks like you are all set.
Missael Hernandez
Missael Hernandez 2020년 9월 8일
Oh ok I see. Thank you guys so much!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by