Clear Filters
Clear Filters

How to use integral when limits are anonymous functions

2 views (last 30 days)
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?

Accepted Answer

Walter Roberson
Walter Roberson on 25 Apr 2024
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 Comments
Walter Roberson
Walter Roberson on 25 Apr 2024
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
Walter Roberson on 25 Apr 2024
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.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!