Chebyshev Differentiation Matrix using two methods in MATLAB
显示 更早的评论
I am trying to compare between two ''methods'' or functions that calculate the Chebyshev differentiation matrix. The first method uses the function cheb(N) from Trefethen's textbook and is defined as:
% CHEB compute D = differentiation matrix, x = Chebyshev grid
function [D,x] = cheb(N)
if N==0, D=0; x=1; return, end
x = cos (pi*(0:N)/N)';
c = [2; ones(N-1,1); 2].*(-1).^(0:N)';
X = repmat(x,1,N+1);
dX = X-X';
D = (c*(1./c)')./(dX+(eye(N+1))); % off-diagonal entries
D = D - diag(sum(D')); % diagonal entries
The above function utilizes the equation

for the off-diagonal entries but then obtains the diagonal entries using the identity:
which produces a Chebyshev matrix with better numerical stability properties.
Now, I have another method of calculating the Chebushev derivative using Vandermonde matrix as the following:
N = 10;
ygl = cos(pi*(0:N)/N)'; %Gauss-Lobatto chebyshev points
%Chebyshev matrix: Use the method: Vandermonde Matrices for Gauss-Lobatto
VGL = cos(acos(ygl(:))*(0:N));
dVGL = diag(1./sqrt(1-ygl.^2))*sin(acos(ygl)*(0:N))*diag(0:N);
dVGL(1,:) = (-1).^(1:N+1).*(0:N).^2;
dVGL(Ny+1,:) = (0:N).^2;
%Diferentiation matrix for Gauss-Lobatto points
Dgl = dVGL/VGL;
D = Dgl; %first-order derivative matrix
My question is what is the difference between the two methods above? and does the second method uses the identity:
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!