from
ChebyshevTools
by Michael Watson Tool box for solving ODE/PDEs using spectral Chebyshev differentiation matrices.
f=galerkin2cheb3(g,typ)
function f=galerkin2cheb3(g,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(g);
f=zeros(M+S,N,P);
for j=1:N
for k=1:P
f(:,j,k)=galerkin2cheb(g(:,j,k),typ);
end
end
g=permute(f,[2,3,1]);
end
f=g;