No BSD License  

Highlights from
ChebyshevTools

from ChebyshevTools by Michael Watson
Tool box for solving ODE/PDEs using spectral Chebyshev differentiation matrices.

y=definite_integral_cart(F,X1,X2)
function y=definite_integral_cart(F,X1,X2)

% Calculate the definite integral of a function defined by spectral
% coefficients F, between X1 and X2

% assume on [-1,1] if no interval given
if nargin==1
    X1=-1;
    X2=1;
end

% stretching coefficient for interval [X1,X2]->[-1,1]
F1=(X2-X1)/2;

M=length(F);
%create coefficient mutliplier
%create inner product vector
prod=zeros(1,M);
for j=1:2:M-2
   prod(j)=(-1/(j*(j-2))); 
end
prod(M)=(-1/(2*(M-1)));

prod=2*prod;

y=dot(prod,F)*F1;

Contact us at files@mathworks.com