How to solve a system of integral equations?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (1)
Star Strider
am 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 Kommentare
Star Strider
am 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.
Siehe auch
Kategorien
Mehr zu Systems of Nonlinear Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!