Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

numerically integrate to infinity

Status
Not open for further replies.

KaSt

Computer
Jun 1, 2004
5
0
0
DE
Hello!
I have a function f that I would like to integrate numerically. For this purpose I used quad(f,a,b) where a and b are the borders of integration. Now I want to integrate to b=infinity and this doesn't work with quad. Is there any other function I can use to numerically integrate to infinity?
Thank you very much
Katy
 
Replies continue below

Recommended for you

Thank you very much for your smart comment.

Maybe you have missed that Matlab does have rules to calculate with infinity.
So why not implement a numerical integration that takes on the value zero, if the function is numerically zero and infinity if it takes on nonzero equally signed values (for example, I'm not an expert).

Thank you again for you comment, but I really think I didn't need this.
 
Being that you are a computer engineering professional, you should be aware that it's generally not possible to evaluate a numerical integral that way.

Trying to do something like a quadrature Simpson's rule over an infinite interval is simply not feasible, since the nominal error tolerance is too small. In order to get the interval sum to be evaluated within the tolerance requires a small step size, which when summed over infinite results in a stack overflow. If you try to integrate with too large a tolerance, you'll get garbage for an answer.

In general, you need to re-think your need to integrate to infinity. In most cases, if the integral is finite, you can simply integrate over a reasonably large range. The integral of the normal error requires less than 10 sigma to converge to a stable value, and that value is essentially equal to the same integral over infinity.


TTFN
 
Okay, I understand.

I am not exactly an engineer. I come from mathematics and work in image processing right now. So I have heard about the Simpson rule, but I have of course no idea how it is implemented (concerning tolerance and co).

In particular I needed a discrete filter from a Gaussian like function. And putting large bounds 10^16 or 10^17 still made a noticable difference, but higher values made the integration impossible.
So I still don't know what to do...

At the beginning I was close to red-flagging you, but now I am really thankful for this comment.

Thanks
Katy
 
Matlab cannot perform numerical calulations with infinities of any sort (at least according to the documentation). It can only give infinity as an answer. If your function is analytiaclly integrable then you may be able to do it algebraically using the symbolic toolbox.

M

--
Dr Michael F Platten
 
What do you mean by "noticeable difference?" Most sensors and images have nothing meaningful beyond a dynamic range of about 1000:1

In almost everything that's done in non-academic scenarios, we truncate and move on. There is no physical meaning to an integration over infinity in the real world. Everything has real limits.

TTFN
 
Status
Not open for further replies.
Back
Top