MATLAb Integration
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Walter Roberson
2011-4-19
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 个评论
Mike Hosea
2011-7-8
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!