Fast Chebyshev second order differentiation

Version 1.1.0.0 (1.65 KB) by Matt
Fast computation of the second derivative of data located along Chebyshev points
288 Downloads
Updated 22 Oct 2013

View License

fchd2(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 fchd2 to find the second derivative of the function f(x) = tan(x)
over [-1,1], and compare with f''(x) = 2 tan(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,2*tan(xx).*sec(xx).^2,x,fchd2(tan(x)));


Example 2:
To show the spectral convergence property of the Chebyshev derivative,
compute the error between the Chebyshev second derivative and the exact
second 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(2*tan(x).*sec(x).^2 - fchd2(tan(x))); % compute error
end

loglog(N,err); %display

Cite As

Matt (2024). Fast Chebyshev second order differentiation (https://www.mathworks.com/matlabcentral/fileexchange/44035-fast-chebyshev-second-order-differentiation), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Polynomials in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

matched usual naming convention

1.0.0.0