How do I refine my integration?

5 次查看(过去 30 天)
I am using integral and integral2 functions to numerically integrate, I am however very skeptical about the results. I was wondering how would one make the results more accurate? Any options that can make the answere more accutare.
  1 个评论
Star Strider
Star Strider 2015-1-27
What function are you numerically integrating?
What makes you skeptical about the results?

请先登录,再进行评论。

采纳的回答

Mike Hosea
Mike Hosea 2015-2-1
编辑:Mike Hosea 2015-2-1
I don't disagree with John at all, but here are some things that come to mind that you might do to either lend credence to, or to discredit the results you are getting, as the case may be.
if the region is finite and you are using the 'auto' method, then you can specify the 'iterated' method to perform an independent calculation using a different method.
integral2(f,a,b,c,d,'method','iterated')
Unfortunately, if any of the limits are infinite, it automatically chooses the iterated method, so of course specifying the iterated method won't change anything in that case.
Secondly, you can manipulate the tolerances. E.g.
integral2(f,a,b,c,d,'AbsTol',1e-12,'RelTol',1e-12)
Obviously this is intended to increase the accuracy of the output, but it assumes that the output is already accurate to approximately the degree implied by the default tolerances. If that is not the case, then you should not expect that this will necessarily have any effect. However, it might help the integrator to catch some variability in the integrand that it previously glossed over. This is more of a negative test in the sense that if you tighten the tolerances and they answer changes wildly, then you have problems, but if you tighten the tolerances and nothing changes, it doesn't mean anything.
Third, you can subdivide the region yourself into smaller pieces and add up the integrals over the smaller pieces. Especially try to put any interesting behavior on the boundary of a sub-integral. Getting consistent results no matter how you subdivide the region is a good sign.
Fourth, there are 3rd-party integrators written for MATLAB that can be downloaded from the file exchange. Some of them could provide independently computed results that would either lend credence to the results MATLAB is returning or cast doubt on them. If you have a smooth integrand, some of them can use quite high orders.
  1 个评论
DM
DM 2015-2-1
Thank you Mike you are always helpful and clear for questions regarding integral. I was wondering if you give my other question a look:
I would appreciate it.

请先登录,再进行评论。

更多回答(2 个)

John D'Errico
John D'Errico 2015-1-27
Huh? You have given us NO information to help you, except that you are doing an integration. I find myself left with many questions, any or all of which point to entirely possible factors, including the last one I mention.
- What is the kernel?
- What did you try?
- Are you using the tools improperly?
- Do you just have the tolerances set improperly for the problem you are trying to solve?
- Have you set the limits too wide?
- Is this just a very difficult problem to integrate?
- Is your kernel highly nonlinear? Are there singularities?
- Do you just have no clue as to how to use a numerical integration tool?
I'm sorry, but I have no idea what your capabilities are, so the last is entirely plausible since you have given us no information at all.
So you could read the help for those tools, which would tell you how to use them in great detail, including how one would set tolerances. I know, real men don't need no steenkin help.

Youssef  Khmou
Youssef Khmou 2015-1-27
编辑:Youssef Khmou 2015-1-27
Accurate result is obtained if you use the same sampling rate,as the original function, in integral.

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by