MATLAb Integration
7 views (last 30 days)
Show older comments
Hello,
I am attempting to integrate a summation of functions over the intervals: (0 to x) and (x to Inf) using MATLAB. The integral is inside a “for” loop, and each function inside the integral is a function of x.
I began by using a separate integral for each interval, but I am wanting to know which MATLAB integration method should I use to integrate.
Please remember the integration is inside a “for” loop, and therefor will run many times; up to 500 times.
0 Comments
Answers (2)
Walter Roberson
on 19 Apr 2011
Sounds like if possible you should use the symbolic toolbox outside the loop to calculate the general integral in the parameter, and then in the loop, subs() the current value of the parameter in to get the current integral; double() the symbolic number that results to get the double precision value.
1 Comment
Mike Hosea
on 8 Jul 2011
Walter's suggestion of symbolic integration might work in some cases. Barring that, the only integration function that works on non-finite intervals is QUADGK, so that's the one you should use. Of course you could also do your own transform to a finite interval, but QUADGK is always the one you should try first, anyway.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!