Borrar filtros
Borrar filtros

What is the meaning of the error?

2 visualizaciones (últimos 30 días)
Zeynep Toprak
Zeynep Toprak el 8 de Mayo de 2020
Comentada: Zeynep Toprak el 17 de Mayo de 2020
Question is from Tobin's book.
For part (a)'s matlab code and result,
n = 100 ; h = 2/n; %n intervals, width 2/n
x = -1 + h* (1: n-1)'; %node locations
D2 = toeplitz ([-2 1 zeros(1, n-3)]/ h^2); %diff matrix for u_xx
f = @(t, u) (0.2*D2*u ) + u.^2; % discretized du/dt
u0 = (1 - x.^2) ./ (1 + 50*x.^2); %initial condition
[t, u] = ode15s (f, [0 2], u0); %solve
waterfall (x, t, u)
And for part (b),
n = 100 ; h = 2/n; %n intervals, width 2/n
x = -1 + h* (1: n-1)'; %node locations
D2 = toeplitz ([-2 1 zeros(1, n-3)]/ h^2); %diff matrix for u_xx
f = @(t, u) (0.2*D2*u ) + u.^2; % discretized du/dt
u0 = 10 * (1 - x.^2) ./ (1 + 50*x.^2); %initial condition
[t, u] = ode15s (f, [0 2], u0); %solve
waterfall (x, t, u)
I get the following error when I run the code for the part b,
Warning: Failure at t=1.993395e-01. Unable to meet integration tolerances without reducing the step size below the smallest value
allowed (4.440892e-16) at time t.
> In ode15s (line 730)
In exercise_714_part_b (line 13)
I also get the following graph for the part b
Why did I face this error message? What is the meaning of it? and how can I correct it? Where is my mistake? And The graph for the part b is a bit nonsense. I cannot interpret this part and the graph.
  2 comentarios
Gokberk Yildirim
Gokberk Yildirim el 16 de Mayo de 2020
Zeynep if you decrease the tolerance of time t, this graph will work without any warning. For example, you can change this part [t, u] = ode15s (f, [0 2], u0) like this [t, u] = ode15s (f, [0 0.1], u0). It gives us enough tolerance for calculation of integration in ode15s.
Zeynep Toprak
Zeynep Toprak el 17 de Mayo de 2020
Gokberk, thanks a lot :)

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by