Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Efficient integration between +/- infinity

Subject: Efficient integration between +/- infinity

From: Peter

Date: 19 Mar, 2011 11:13:04

Message: 1 of 7

I am trying to calculate the Voigt profile for absorption line-shapes.

The function requires calculating H(a,u) at each value of u (around a central absorption line):

H(a,u) = a/pi. Integral [exp(-y^2)/((u-y)^2+a^2)] .dy with y from -inf to +inf

I see that Matlab has a function for numerical integral - quadl - but how do I do this between +/- infinity?

And how do I do it efficiently?

Appreciate any help, thanks.

Subject: Efficient integration between +/- infinity

From: Bruno Luong

Date: 19 Mar, 2011 11:17:05

Message: 2 of 7

"Peter " <pgillies3@gmail.com> wrote in message <im2340$cne$1@fred.mathworks.com>...
> I am trying to calculate the Voigt profile for absorption line-shapes.
>
> The function requires calculating H(a,u) at each value of u (around a central absorption line):
>
> H(a,u) = a/pi. Integral [exp(-y^2)/((u-y)^2+a^2)] .dy with y from -inf to +inf
>
> I see that Matlab has a function for numerical integral - quadl - but how do I do this between +/- infinity?
>
> And how do I do it efficiently?

Change the variable to finite interval.

Bruno

Subject: Efficient integration between +/- infinity

From: John D'Errico

Date: 19 Mar, 2011 12:06:04

Message: 3 of 7

"Peter " <pgillies3@gmail.com> wrote in message <im2340$cne$1@fred.mathworks.com>...
> I am trying to calculate the Voigt profile for absorption line-shapes.
>
> The function requires calculating H(a,u) at each value of u (around a central absorption line):
>
> H(a,u) = a/pi. Integral [exp(-y^2)/((u-y)^2+a^2)] .dy with y from -inf to +inf
>
> I see that Matlab has a function for numerical integral - quadl - but how do I do this between +/- infinity?
>
> And how do I do it efficiently?
>
> Appreciate any help, thanks.

As I recall, a Voigt profile is a convolution between a Gaussian
and a Lorentzian (also known as a Cauchy) distribution.

You should be able to decide how far out to look based on
the parameters of the two components. Beyond that point,
the contributions from each of the component distribution
PDFs will be essentially zero anyway.

John

Subject: Efficient integration between +/- infinity

From: Peter

Date: 19 Mar, 2011 20:42:05

Message: 4 of 7

Bruno & John - thanks for helping out.

I was hoping there was a way that Matlab would "figure it out" but I will run a few different tests to see what limits are appropriate.

Subject: Efficient integration between +/- infinity

From: Roger Stafford

Date: 20 Mar, 2011 02:59:06

Message: 5 of 7

"Peter " <pgillies3@gmail.com> wrote in message <im34es$t6$1@fred.mathworks.com>...
> Bruno & John - thanks for helping out.
>
> I was hoping there was a way that Matlab would "figure it out" but I will run a few different tests to see what limits are appropriate.
- - - - - - - - -
  I think Bruno was suggesting you make a change of variable that wouldn't go to infinity at the two integration limits. I would recommend trying

 x = 1/a*atan((u-y)/a)

which is

 y = u - a*tan(a*x)

The integration limits then become finite and the integrand remains finite there, in fact becoming zero, so numerical quadrature should work very well.

Roger Stafford

Subject: Efficient integration between +/- infinity

From: simon

Date: 22 Jul, 2012 10:38:19

Message: 6 of 7

"Roger Stafford" wrote in message <im3qhq$rh8$1@fred.mathworks.com>...
> "Peter " <pgillies3@gmail.com> wrote in message <im34es$t6$1@fred.mathworks.com>...
> > Bruno & John - thanks for helping out.
> >
> > I was hoping there was a way that Matlab would "figure it out" but I will run a few different tests to see what limits are appropriate.
> - - - - - - - - -
> I think Bruno was suggesting you make a change of variable that wouldn't go to infinity at the two integration limits. I would recommend trying
>
> x = 1/a*atan((u-y)/a)
>
> which is
>
> y = u - a*tan(a*x)
>
> The integration limits then become finite and the integrand remains finite there, in fact becoming zero, so numerical quadrature should work very well.
>
> Roger Stafford
suppose, i want to find the E(x) and E(x^2) for continuous distribution like normal,gamma where the values of random variable ranges from (-inf to inf) and (0 to inf) respectively. how would i do it using matlab.. pls help.. i got stuck with it for many days.. any suggestion is appreciated...

Subject: Efficient integration between +/- infinity

From: Torsten

Date: 23 Jul, 2012 06:42:10

Message: 7 of 7

On 22 Jul., 12:38, "simon " <sghosh...@gmail.com> wrote:
> "Roger Stafford" wrote in message <im3qhq$rh...@fred.mathworks.com>...
> > "Peter " <pgilli...@gmail.com> wrote in message <im34es$t...@fred.mathworks.com>...
> > > Bruno & John - thanks for helping out.
>
> > > I was hoping there was a way that Matlab would "figure it out" but I will run a few different tests to see what limits are appropriate.
> > - - - - - - - - -
> > I think Bruno was suggesting you make a change of variable that wouldn't go to infinity at the two integration limits. I would recommend trying
>
> > x = 1/a*atan((u-y)/a)
>
> > which is
>
> > y = u - a*tan(a*x)
>
> > The integration limits then become finite and the integrand remains finite there, in fact becoming zero, so numerical quadrature should work very well.
>
> > Roger Stafford
>
> suppose, i want to find the E(x) and E(x^2) for continuous distribution like normal,gamma where the values of random variable ranges from (-inf to inf) and (0 to inf) respectively. how would i do it using matlab.. pls help.. i got stuck with it for many days.. any suggestion is appreciated...- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -


help quadgk

Best wishes
Torsten.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us