Code covered by the BSD License  

Highlights from
Chebpack

image thumbnail

Chebpack

by

 

15 Jul 2011 (Updated )

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

[lam,phi,x]=eig_ode2(n,dom,kind,numeigval)
function [lam,phi,x]=eig_ode2(n,dom,kind,numeigval)
% solves the eigenvalue problems for second order ode
% P2(x)y''(x)+P1(x)y'(x)+P0(x)y(x)=lam R(x)y(x), 
% numeigval: number of eigenvalues to be approximated
% x: the Chebyshev points
% lam, phi: the eigenvalues/eigenvectors in the physical form
%
tic;A=zeros(n);B=zeros(n);phi=zeros(n,numeigval);
x=pd(n,dom,kind);X=mult(n,dom);D=deriv(n,dom);
myDE;myBC;[V,L]=eig(full(A),full(B));
[LL,ind]=sort(diag(L));VV=V(:,ind);
lam=LL(1:numeigval);
for s=1:numeigval
    phi(:,s)=t2x(VV(:,s),kind);
end
toc;myOUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myDE
    % describes the differential operator
    % must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myBC
    % implements the homogeneous boundary conditions
    % must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myOUT
    % describes the output of the code
    % must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end

Contact us