Code covered by the BSD License  

Highlights from
Chebfun V4

image thumbnail

Chebfun V4

by

 

30 Apr 2009 (Updated )

Numerical computation with functions instead of numbers.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

interp1test
function pass = interp1test
% Check that the Chebfun-overloaded INTERP1 
% function is accurate.
%
% Nick Trefethen March 2009

d = domain(-2,1.5);
ff = @(x) 1./(1+25*x.^2);
x = linspace(-2,1.5,11);
f = chebfun(ff,d);
p = interp1(x,ff(x),d);
pass(1) = (abs(min(p)-(-2.439))<0.01);

x = chebfun('x');
f = max(0,1-2*abs(x-.2));
xk = [0 .5 1];
p = interp1(xk,f);
pass(2) = (abs(p(-1)-0.4)<0.01);

Contact us