MATLAB Answers

Solving a system of integral equations numerically

78 views (last 30 days)
I'm trying to find the numerical solution to a system, the first problem I have is that I'm given a system of two integrals with two unknowns where the unknowns are in the integrands and the limits of both equations. How do they do this? I've attached the problem below. I've tried just using the built-in solve function but it doesn't work for this integral as I'm guessing its too complicated. I'm not too great on MATLAB, so any help would be appreciated! Thanks

Accepted Answer

Star Strider
Star Strider on 12 Mar 2018
There are several roots, and it doesn’t always converge on the published solutions.
The Code
a2 = @(b) integral(@(y) 1./sqrt(((y.^2 + b(2))./b(1)).^2 - 1), 0, sqrt(b(1)-b(2))) - 1;
b2 = @(b) integral(@(y) ((y.^2 + b(2))./b(1))./sqrt(((y.^2 + b(2))./b(1)).^2 - 1), 0, sqrt(b(1)-b(2))) - pi/2;
B = fsolve(@(b) [a2(b), b2(b)], rand(2,1))
ym = sqrt(B(1) - B(2))
The Solutions
B =
-1.034659029995483 + 0.000000635413460i
-2.290004434974137 + 0.000000465384426i
ym =
1.120421976301188 + 0.000000075877231i
The imaginary parts are vanishingly small, so you can likely just ignore them.

Sign in to comment.

More Answers (2)

Roger Stafford
Roger Stafford on 12 Mar 2018
This is a problem you can solve using Matlab's 'fsolve' function. The fact that your objective function requires two numerical integrations at each evaluation does not change the nature of the problem. It only means that execution time will be longer than with simpler objective functions. Each iteration requires the numerical evaluation of two integrals. You can presumably use Matlab's 'integral' function in evaluating the objective function.
You may have to be careful as to the selection of your initial estimate, x0, since it is easy to run into complex values with your particular integrals, both in the integrand and the integral limits.

Roger Stafford
Roger Stafford on 12 Mar 2018
Edited: Roger Stafford on 12 Mar 2018
@Lewis: I noticed that the integrands in both of your integrals become infinite at the upper limit of integration, and this can result in some inaccurate numerical results from the integration process. However, with the appropriate change of variables these integrals can be converted to complete elliptic integrals of the first and second kinds for which Matlab has functions that you can call on directly and thereby avoid using numerical integration at each step of the iteration.
Here is an outline of that change of variable. You are working in a realm where lambda and c must both be negative with lambda having the greater absolute value. Define A = -c and B = -lambda, so that A and B are positive quantities with A < B. Make the following change of variable:
y = sqrt(B-A)*sin(t)
dy = sqrt(B-A)*cos(t)*dt
(After all the smoke clears away) the first of your integrals becomes the integral with respect to t from 0 to pi/2 of
which can be evaluated in terms of a complete elliptic integral of the first kind. It is easy to show that your second integral will reduce to a combination of complete elliptic integrals of the first and second kinds.
Hence in computing your objective function for 'fsolve' you need not call on Matlab's 'integral' function at all but only on the complete elliptic integral functions.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!