필터 지우기
필터 지우기

What is the meaning of the error?

조회 수: 2 (최근 30일)
Zeynep Toprak
Zeynep Toprak 2020년 5월 8일
댓글: Zeynep Toprak 2020년 5월 17일
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
Gokberk Yildirim
Gokberk Yildirim 2020년 5월 16일
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 2020년 5월 17일
Gokberk, thanks a lot :)

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by