Code covered by the BSD License

### Highlights from Fast Chebyshev differentiation

Be the first to rate this file! 1 Download (last 30 days) File Size: 1.58 KB File ID: #44034 Version: 1.2

# Fast Chebyshev differentiation

by

### Matt (view profile)

21 Oct 2013 (Updated )

Fast computation of the first derivative of data located along Chebyshev points

File Information
Description

fchd(V) computes the first derivative of the data in V located along the N+1 Chebyshevâ€“Gaussâ€“Lobatto points cos(pi*(0:N)/N).

Example 1:
Use FCHT to differentiate the function f(x) = tan(x) over [-1,1], and
compare with the exact derivate f'(x) = sec(x)^2.

x = cos(pi*(0:10)/10); % create sparse Chebyshev-spaced grid of 11 points
xx = linspace(-1,1); % create dense, linearly spaced grid
plot(xx,sec(xx).^2,x,fchd(tan(x))); % compare Chebyshev derivative to exact

Example 2:
To show the spectral convergence property of the Chebyshev derivative,
compute the error between the Chebyshev derivative and the exact
derivative of f(x) = tan(x) for several N.

N = 1:30;
err = zeros(1,length(N));

for n = N
x = cos(pi*(0:n)/n)'; % establish grid
err(n) = max(sec(x).^2 - fchd(tan(x))); % compute error
end

loglog(N,err); %display

Required Products MATLAB
MATLAB release MATLAB 8.1 (R2013a)