How to solve a system of integral equations?
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Star Strider
2020-2-14
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 个评论
Star Strider
2020-2-14
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!