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,solnum]=volt_eq(n,dom,kind)
```function [x,solnum]=volt_eq(n,dom,kind)
% Solves Volterra integral equations
% y(x)=int_a^x K(x,t)y(t)dt+f(x), x in [a,b]
%
tic;
Vspec=volt(n,dom,kind);
F=x2t(myfun(x),kind);
sol=(eye(n)-Vspec)\F;solnum=t2x(sol,kind);
toc;myOUT
function [Vspec,Vphys]=volt(n,dom,kind)
% Volterra operator with kernel K(x,t)
x=pd(n,dom,kind);T=cpv(n,x,dom);[J,J0]=prim(n,dom);
V=T*J0/T;
[YY,XX]=meshgrid(x,x);KW=mykernel(XX,YY);
Vphys=V.*KW;Vspec=T\Vphys*T;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function res=mykernel(x,t)
% x,t matrices
% describes K(x,t), must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f=myfun(x)
% describes f(x)
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myOUT
% describes the output of the code
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end```