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

grammatrix
function pass = grammatrix
% Construct the Gram matrix with chebfuns and 
% compare it to Hilbert matrix.

A = chebfun;
x = chebfun(@(x) x,[0,1]);
for n=1:4
  A(:,n) = x.^(n-1);
end
G = A'*A;
pass = norm(G-hilb(4)) < 10*eps;

end

Contact us