What is the meaning of the error?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291479/image.jpeg)
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291480/image.png)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291481/image.png)
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 Kommentare
Gokberk Yildirim
am 16 Mai 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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Eigenvalue Problems finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!