Code covered by the BSD License

Chebpack

Damian Trif (view profile)

15 Jul 2011 (Updated )

The MATLAB package Chebpack solves specific problems for differential or integral equations.

[x,t,solnum]=pde_lin(n,dom, kind,dt,K)
```function [x,t,solnum]=pde_lin(n,dom, kind,dt,K)
% Solves linear evolution partial differential problems
% dt: the time step, K: the number of time steps to be performed
%
x=pd(n,dom,kind);D=deriv(n,dom);T=cpv(n,dom,dom);
myDE;A=speye(n)-dt*A;myINIT;uo=x2t(f,kind);solnum(:,1)=uo;t(1)=0;
for k=1:K
myBC;un=A\uo;t(k+1)=k*dt;
uo=un;solnum(:,k+1)=t2x(uo,kind);
end
myOUT;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myDE
% describes the linear spatial part of the pde
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myBC
% describes the boundary conditions
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myINIT
% describes the initial condition in physical form
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myOUT
% describes the output of the program
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end```