source: MML/trunk/machine/SOLEIL/common/toolbox/chebfun_v2_0501/chebfun/chebtests/testpolyfit.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: 504 bytes
Line 
1function pass = testpolyfit
2% Rodrigo Platte Jan 2009
3% Tests the polyfit commmand
4
5tol = chebfunpref('eps');
6
7x = chebfun('x',[-2 2]);
8g = sign(x);
9f0 = polyfit(g, 0);
10pass0 = norm(f0,inf) < tol;
11f1 = polyfit(g, 1);
12pass1 = norm(f1 - chebfun([-1.5 1.5],[-2 2]) ,inf) < 10*tol;
13f2 = polyfit(g, 2);
14pass2 = norm(f2 - chebfun([-1.5 1.5],[-2 2]) ,inf) < 10*tol;
15f3 = polyfit(g, 3);
16pass3 = norm(f3 - chebfun([-.625 -1.1328125 1.1328125 .625],[-2 2]) ,inf) < 10*tol;
17pass = pass0 && pass1 && pass2 && pass3;
Note: See TracBrowser for help on using the repository browser.