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:
577 bytes
|
Rev | Line | |
---|
[4] | 1 | function pass = resampletest |
---|
| 2 | |
---|
| 3 | % Test if the resampling option is working by counting the number of |
---|
| 4 | % function evaluations |
---|
| 5 | % Rodrigo Platte, June 2009. |
---|
| 6 | |
---|
| 7 | global count % counts the number of evaluations |
---|
| 8 | |
---|
| 9 | count = 0; |
---|
| 10 | fon = chebfun(@myfun,'resampling','on'); |
---|
| 11 | counton = count; |
---|
| 12 | |
---|
| 13 | count = 0; |
---|
| 14 | foff = chebfun(@myfun,'resampling','off'); |
---|
| 15 | countoff = count; |
---|
| 16 | |
---|
| 17 | % Number of evaluations |
---|
| 18 | pass(1) = counton > 1.9*countoff; |
---|
| 19 | % Chebfun representations must match |
---|
| 20 | pass(2) = norm(fon-foff,inf) < chebfunpref('eps')*1e3; |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | function y = myfun(x) |
---|
| 24 | |
---|
| 25 | global count |
---|
| 26 | count = count + length(x); |
---|
| 27 | y = sin(100*x); |
---|
| 28 | |
---|
| 29 | |
---|
Note: See
TracBrowser
for help on using the repository browser.