from
ChebyshevTools
by Michael Watson Tool box for solving ODE/PDEs using spectral Chebyshev differentiation matrices.
g=cheb2galerkin3(f,typ)
function g=cheb2galerkin3(f,typ)
%this function transforms from the galerkin basis to the chebyshev basis in
%3 dimensions
% 1) Mason Galerkin
% 2) Julien Galerkin
% 3) Trefethen Galerkin
% 4) Shen
if typ==4
S=4;
else
S=2;
end
for p=1:3
[M,N,P]=size(f);
g=zeros(M-S,N,P);
for j=1:N
for k=1:P
g(:,j,k)=cheb2galerkin(f(:,j,k),typ);
end
end
f=permute(g,[2,3,1]);
end
g=f;