source: MML/trunk/machine/SOLEIL/common/toolbox/chebfun_v2_0501/chebfun/chebtests/ivptest.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.4 KB
Line 
1function pass = ivptest
2
3% Rodrigo Platte Jan 2009
4% This routine tests IVP solver: ode45, ode113, ode15s
5
6% Test ode113 Using default tolerances (RelTol = 1e-3)
7y = ode113(@vdp1,domain(0,20),[2;0]); % chebfun solution
8[tm,ym] = ode113(@vdp1,[0,20],[2;0]); % Matlab's solution
9
10pass1 = max(max(abs(ym - feval(y,tm)))) < 2e-2;
11
12% Test ode45 Using default tolerances (RelTol = 1e-3)
13%y = ode45(@vdp1,domain(0,20),[2;0]); % chebfun solution
14%[tm,ym] = ode45(@vdp1,[0,20],[2;0]); % Matlab's solution
15%pass2 = max(max(abs(ym - feval(y,tm)))) < 1e-2;
16pass2 = 1;  % commented out to save time -- but
17% ode45 is still tested in ivp_ty_test.m
18
19
20% Test with different tolerance
21opts = odeset('RelTol', 1e-6);
22
23% Test ode113
24%y = ode113(@vdp1,domain(0,20),[2;0],opts); % chebfun solution
25%[tm,ym] = ode113(@vdp1,[0,20],[2;0],opts); % Matlab's solution
26%
27%pass3 = max(max(abs(ym - feval(y,tm)))) < 1e-5;
28pass3 = 1;  % above commented out to save time
29
30% Test ode45
31%y = ode45(@vdp1,domain(0,20),[2;0],opts); % chebfun solution
32%[tm,ym] = ode45(@vdp1,[0,20],[2;0],opts); % Matlab's solution
33%pass4 = max(max(abs(ym - feval(y,tm)))) < 1e-5;
34pass4 = 1;  % above commented out to save time
35
36% Test ode45
37%y = ode15s(@vdp1,domain(0,20),[2;0],opts); % chebfun solution
38%[tm,ym] = ode15s(@vdp1,[0,20],[2;0],opts); % Matlab's solution
39%pass5 = max(max(abs(ym - feval(y,tm)))) < 1e-5;
40pass5 = 1;  % above commented out to save time
41
42pass = pass1 && pass2 && pass3 && pass4 && pass5;
43
44
Note: See TracBrowser for help on using the repository browser.