# Legendre collocation Matlab Code for Solving Volterra–Fredholm Integral Equations

by admin in Boundary Value Problem , Differential Equations , Math, Statistics, and Optimization , MATLAB Family , Numerical Integration on April 25, 2019This code implements new algorithms of Legendre collocation method to compute numerical solution of Volterra-Fredholm integral equations.

The code gives the following results:

- Chart of the numerical solution compared with the exact solution
- Error chart of this method
- Elapsed Time of the calculations
- Upper Bound Error of Lagrange Polynomial method
- The coefficients of Lagrange Polynomial
- The Resultant Lagrange Polynomial itself
- Table contains the following columns (Iter.#, Analytical Solution, Numerical Solution, Absolute Error)

**Required Inputs:**

- The interval of the solution function [a b]
- The constant of the series c
- The power of the supposed series N (N = 1 … 7)
- The constant Lambda 1
- The constant Lambda 2
- A(x) Value
- B(x) Value
- The following functions h(x), h(t), K1(x,t), K2(x,t), f(x) and Yex(x)

Where: h(x): Function is the upper limit of the first integral. h(t): the same as h(x) function, but with substituting t instead of x. f(x): The functions out of the Integrals. K1(x,t): The function inside the first integral. K2(x,t): The function inside the second integral. Yex(x): The Exact solution (it exist for comparison, if not just disable the lines 138,139,142,144,145,146,147,150 and you keep getting the numerical results). The full form of Voltera Fredholm equation is as the following (note: sometimes we use u(t) instead of y(t)):

Implemented in the code six examples you can uncomment any of them and run it, the following values is for the sake of example:

% Constant Inputs

a = 0; b = 1; N = 6;

L1= 1; L2= 1;

c=0;

% Functional Inputs

A = 1; B = 0;

h = x; ht = t;

f = x – 2*exp(x) + exp(-x) + 1;

k1=t*exp(x); k2=exp(x+t);

Yex = exp(-x); % Exact Solution

**Legendre collocation Method:**

approximate the solution of Eq.(1) using shifted Legendre polynomials.

**References:**

S. Nemati, **Numerical solution of Volterra–Fredholm integral equations using Legendre collocation method**, at Department of Mathematics, Faculty of Mathematical Sciences, University of Mazandaran, Babolsar, Iran

Share Now!