Last change
on this file since 17 was
17,
checked in by zhangj, 10 years ago
|
To have a stable version on the server.
|
-
Property svn:executable set to
*
|
File size:
854 bytes
|
Line | |
---|
1 | function pass = bvptest |
---|
2 | |
---|
3 | % Rodrigo Platte Jan 2009 |
---|
4 | % This routine tests BVP solvers bvp4c and bvp5c |
---|
5 | |
---|
6 | [d,x] = domain(0,4); |
---|
7 | y0 = [ x.^0, 0 ]; |
---|
8 | |
---|
9 | solinit = bvpinit([0 1 2 3 4],[1 0]); |
---|
10 | |
---|
11 | % Test bvp4c using default tolerance (RelTol = 1e-3) |
---|
12 | y = bvp4c(@twoode,@twobc,y0); % Chebfun solution |
---|
13 | sol = bvp4c(@twoode,@twobc,solinit); % Matlab's solution |
---|
14 | pass = max(max(abs(sol.y' - feval(y,sol.x')))) < 2e-2; |
---|
15 | |
---|
16 | %% Test bvp5c using new tolerance |
---|
17 | |
---|
18 | % Only test if Matlab ver > 7.4 |
---|
19 | matlabver = ver('matlab'); |
---|
20 | if str2double(matlabver.Version) > 7.45 |
---|
21 | |
---|
22 | % Set new tolerance: |
---|
23 | opts = odeset('RelTol', 1e-6); |
---|
24 | |
---|
25 | % Test bvp5c |
---|
26 | y = bvp5c(@twoode,@twobc,y0,opts); % Chebfun solution |
---|
27 | sol = bvp5c(@twoode,@twobc,solinit,opts); % Matlab's solution |
---|
28 | pass2 = max(max(abs(sol.y' - feval(y,sol.x')))) < 1e-4; |
---|
29 | pass = pass && pass2; |
---|
30 | |
---|
31 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.