How to solve a system of integral equations?

9 views (last 30 days)
Pavel M
Pavel M on 14 Feb 2020
Commented: Star Strider on 14 Feb 2020
I want to solve the system of integral equations, but limits on integrals contain an unknown ( x(2) ) which i want to find.
I try this:
function S = Integralsystem(x, t1, t2, n, a, b, Umax1, Umax2);
fun = @(T) x(2) - (Umax1/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)));
t01 = fzero(fun, 0.1);
fun = @(T) x(2) - (Umax2/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)));
t02 = fzero(fun, 1.1);
fun1 = @(T) ((Umax1/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)))) - x(2);
fun2 = @(T) ((Umax1/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)))) - x(2);
S(1) = x(1) - (integral(fun1,t01,t1));
S(2) = x(1) - (integral(fun2,t02,t2));
end
s = fsolve(@(x) Integralsystem(x, t1, t2, n, a, b, Umax1, Umax2),[100 1000])
but Matlab cant find solution.

Answers (1)

Star Strider
Star Strider on 14 Feb 2020
It is probably best to use the more robust fsolve in the function instead of fzero.
Try this:
function S = Integralsystem(x, t1, t2, n, a, b, Umax1, Umax2);
fun1 = @(T) x(2) - (Umax1/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)));
t01 = fsolve(fun1, 0.1);
fun2 = @(T) x(2) - (Umax2/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)));
t02 = fsolve(fun2, 1.1);
fun3 = @(T) ((Umax1/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)))) - x(2);
fun4 = @(T) ((Umax1/n)*(exp(a*(T*1e-6)) - exp(b*(T*1e-6)))) - x(2);
S(1) = x(1) - (integral(fun3,t01,t1));
S(2) = x(1) - (integral(fun4,t02,t2));
end
s = fsolve(@(x) Integralsystem(x, t1, t2, n, a, b, Umax1, Umax2),[100 1000])
This slightly revised code (with random scalar values for the other agruments) ran without error and produced a (1x2) vector for ‘s’.
  2 Comments
Pavel M
Pavel M on 14 Feb 2020
i use fzero because tmin - limit of integral has such condition t0 = f(x(2))
Star Strider
Star Strider on 14 Feb 2020
With the random scalars I supplied to test your function, fzero threw errors. That was the reason I substituted fsolve. Use whatever works best in your application.

Sign in to comment.

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!