How to use integral when limits are anonymous functions
4 次查看(过去 30 天)
显示 更早的评论
Greetings
I am evaluating an integral wherein the limits are functions themselves and symbolic variables are involved. I can't use int because it does not yield a complete answer (some of the integrals couldn't be solved symbollically), hence I am using integral with ArrayValued enabled.
My code is something like this:
syms x y(x) f(x,y)
dx = 1e-8;
I = @(x) integral( @y f(x,y), y1(x), y2(x), 'ArrayValued', true)
dI = (I(x=x_0+dx) - I(x))/dx + other leibniz terms as limits are functions of x
When I run this code, I get that A and B ( the limits in the integral function must be floating point scalars)
How do I overcome this?
0 个评论
采纳的回答
Walter Roberson
2024-4-25
Your problem is unsolvable (in the form stated)
You cannot use integral() with symbolic limits: integral() is strictly a numeric integrator, and cannot handle symbolic limits.
You need to use int(), and just live with the fact that int() is unable to find a solution.
3 个评论
Walter Roberson
2024-4-25
I = @(x) integral( @y f(x,y), y1(x), y2(x), 'ArrayValued', true)
is not valid syntax. Perhaps you meant
I = @(x) integral( @(y) f(x,y), y1(x), y2(x), 'ArrayValued', true)
Walter Roberson
2024-4-25
integral() does not support functions for its limits.
For any one numeric x, you can calculate y1(x), y2(x) and use those constants in integral(). However, you cannot do this for generic symbolic x.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!