Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: trapz, numerical integration
Date: Tue, 2 Jun 2009 23:15:04 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 30
Message-ID: <h04bpo$2vo$1@fred.mathworks.com>
References: <h048vl$2v$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1243984504 3064 172.30.248.38 (2 Jun 2009 23:15:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 2 Jun 2009 23:15:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:544356


"leo nidas" <bleonidas25@yahoo.gr> wrote in message <h048vl$2v$1@fred.mathworks.com>...
> 
> Hi there,
> 
> I have a code in a for loop. At the end of each iteration a (matematical) function, let 
> f(x), comes up which is always decreasing. x>0 and f(x)->0 as x->Inf, also f(x)>0. Actually it is going exponentially to zero.
> 
> My goal is to integrate numerically (using the trapz function) the function from 0 to Inf.
> Obviously I cannot insert Inf into the trapz (at least I think so, because it will at least take forever :-)  ).
> 
> The thing is that I do not know a priori the exact form of the function to be integrated so as to insert a logical "large" number as an upper bound in the trapz. Till now I visualized some repetitions of the function that came up and the value 60 seemed more that large. But I want to be 100% sure that none of my functions gets away without proper integration.
> 
> Is there any trick or any other function that "detects" the logical point up to a function should be integrated, if one wants to integrate it till Inf?
> 
> Should I create a condition such as if f(x(i))<0.000001 then x(i) is my number? Or is there any better way?
> 
> 
> Thanx in advance!!
> 
> P.S. Anallytical integration is not possible.

Consider a Gauss-Laguerre or generalized Gauss-Laguerre
quadrature. You can surely find something on the FEX.

Or, transform your problem, using a mapping to a
finite interval.

Then use your favorite quadrature tool.

John