MATLAb Integration
显示 更早的评论
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.
回答(2 个)
Walter Roberson
2011-4-19
0 个投票
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 个评论
John
2011-7-7
Is there a way to symbolically integrate without the symbolic toolbox?
Mike Hosea
2011-7-8
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Code Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!