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.

Ex4n0pant.m
% Example 4, p=0
% eigenvalues and eigenfunction for y'(x)+y(x)=\lambda y(2x), 2x in [0,10]
% y(0)=y(10)=0, int_0^10 y(s)ds=1;
%
n=128;q=1/2;
dom=[0,10];kind=2;[csi,w]=pd(n,dom,kind);D=deriv(n,dom);J=prim(n,dom);
S =dev(n,csi,dom,q*csi);T=cpv(n,dom,dom);
    lambda=2;
    A=S*D+S-lambda*eye(n);b=zeros(n,1);
    A(n-2:n-1,:)=T;A(n,:)=(T(2,:)-T(1,:))*J;b(n)=1;   
    sol=A\b;solnum=t2x(sol,kind);
plot(csi,solnum);axis([0 10 -0.1 0.5]);grid;
xlabel('x');ylabel('y_{01}(x)');

Contact us