For Programmers: Free Programming Magazines  


Home > Archive > Matlab > May 2007 > Random numbers with Rice distribution









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Random numbers with Rice distribution
Flavio Eripi

2007-05-25, 4:27 am

I need to generate random numbers with Rice or Rayleigh distribution
(I don't have the Statistic toolbox).
Is it possible to use also other distributions? I mean, to define a
specific distribution and then to generate numbers which have it?
Ken Davis

2007-05-25, 4:27 am

"Flavio Eripi" <didad30@libero.it> wrote in message
news:ef58107.-1@webcrossing.raydaftYaTP...
>I need to generate random numbers with Rice or Rayleigh distribution
> (I don't have the Statistic toolbox).
> Is it possible to use also other distributions? I mean, to define a
> specific distribution and then to generate numbers which have it?


I believe that you can make a Rayleigh variate as the square root of the sum
of the squares of two zero-mean Gaussian variates and a Ricean from a
similar combination of non-zero-mean Gaussians,


Flavio Eripi

2007-05-25, 8:12 am

Yes, the Rayleigh is related to Gaussian distribution, but not the
Rice.
It's related to the Chi-square distribution, which contain the Bessel
function.
Therefore, how to represent the Bessel function in Matlab?
How to create a sequence of number with a certain distribution?
I'm searching for a command like "rand" or "randn" but with other
distributions.
Thanks

> I believe that you can make a Rayleigh variate as the square root
> of the sum
> of the squares of two zero-mean Gaussian variates and a Ricean from
> a
> similar combination of non-zero-mean Gaussians,
>
>
>

Ken Davis

2007-05-25, 8:12 am

"Flavio Eripi" <didad30@libero.it> wrote in message
news:ef58107.1@webcrossing.raydaftYaTP...
[fixed top post][color=darkred]
> Yes, the Rayleigh is related to Gaussian distribution, but not the
> Rice.
> It's related to the Chi-square distribution, which contain the Bessel
> function.
> Therefore, how to represent the Bessel function in Matlab?
> How to create a sequence of number with a certain distribution?
> I'm searching for a command like "rand" or "randn" but with other
> distributions.
> Thanks
>

Actually, I think that you will find that Ricean is as I described. I
presume that you realize that a Rayleigh variate is the square root of a
Chi-squared with 2 d.o.f variate and, I'm pretty sure, a Ricean is the
square root of a non-central Chi squared with 2 d.o.f.


Flavio Eripi

2007-05-25, 8:12 am

And is the Chi-squared defined in Matlab?
Even if I have it, I want to know how to generate a sequence of
number with this distribution
Ken Davis wrote:
>
>
> "Flavio Eripi" <didad30@libero.it> wrote in message
> news:ef58107.1@webcrossing.raydaftYaTP...
square[color=darkred]
> root
Ricean[color=darkred]
> from
> [fixed top post]
> the
> Bessel
other[color=darkred]
> Actually, I think that you will find that Ricean is as I described.
> I
> presume that you realize that a Rayleigh variate is the square root
> of a
> Chi-squared with 2 d.o.f variate and, I'm pretty sure, a Ricean is
> the
> square root of a non-central Chi squared with 2 d.o.f.
>
>
>

Ken Davis

2007-05-25, 8:12 am

"Flavio Eripi" <didad30@libero.it> wrote in message
news:ef58107.3@webcrossing.raydaftYaTP...
> Ken Davis wrote:
> square
> Ricean
> other
[fix ANOTHER top post... please continue the conversation in normal
conversational order][color=darkred]
> And is the Chi-squared defined in Matlab?
> Even if I have it, I want to know how to generate a sequence of
> number with this distribution

Reread my post and you will see that you can generate your variates by
taking the square root to the sum of the squares of two Gaussian variates.
These can be generated with randn. Look at:
hist(sqrt(sum(randn(2,10000).^2)), 20)


Fadzy

2007-05-25, 6:58 pm

http://Pamela-Anderson-in-nylons.in...p?movie=1673286
Davide Imperati

2007-05-31, 7:15 pm

The rice distribution is related to the normal distribution.
Indeed a magnitude signal affected by gauss noise in both channels
has rice distributed noise.

The feature of a rice distribution are related to teh signal
envelope.
GIven the signal intensity you can generate a rice random number
using a uniform distributed phase,
and 2 gauss distributed noise components.
1) generate a phase and separate the signal magnitude envelope in
real and imaginary part.
2)Add Gauss noise to both parts
3) compute the magnitude signal affected by rice noise.

A: signal envelope
sigma: spread measure

phi= 2*pi*rand(size(A));
%%compute real and imaginary components of the signal
Ar=A.*cos(phi);
Ai=A.*sin(phi);
%%computes a realisation of noise
nr=normrnd(0,sigma,size(Ar));
ni=normrnd(0,sigma,size(Ai));

%%Computes noisy signal
ATilde=sqrt((Ar+nr).^2+(Ai+ni).^2);

I recentely found a rice noise, rice pdf toolbox posted by Ged
<http://www.mathworks.com/matlabcent...?objectId=14237>

Ken Davis wrote:
>
>
> "Flavio Eripi" <didad30@libero.it> wrote in message
> news:ef58107.3@webcrossing.raydaftYaTP...
the[color=darkred]
and a[color=darkred]
but not[color=darkred]
contain the[color=darkred]
Matlab?[color=darkred]
distribution?[color=darkred]
with[color=darkred]
> described.
square[color=darkred]
> root
Ricean[color=darkred]
> is
> [fix ANOTHER top post... please continue the conversation in normal
>
> conversational order]
> Reread my post and you will see that you can generate your variates
> by
> taking the square root to the sum of the squares of two Gaussian
> variates.
> These can be generated with randn. Look at:
> hist(sqrt(sum(randn(2,10000).^2)), 20)
>
>
>

Davide Imperati

2007-05-31, 7:15 pm

The rice distribution is related to the normal distribution.
Indeed a magnitude signal affected by gauss noise in both channels
has rice distributed noise.

The feature of a rice distribution are related to teh signal
envelope.
GIven the signal intensity you can generate a rice random number
using a uniform distributed phase,
and 2 gauss distributed noise components.
1) generate a phase and separate the signal magnitude envelope in
real and imaginary part.
2)Add Gauss noise to both parts
3) compute the magnitude signal affected by rice noise.

A: signal envelope
sigma: spread measure

phi= 2*pi*rand(size(A));
%%compute real and imaginary components of the signal
Ar=A.*cos(phi);
Ai=A.*sin(phi);
%%computes a realisation of noise
nr=normrnd(0,sigma,size(Ar));
ni=normrnd(0,sigma,size(Ai));

%%Computes noisy signal
ATilde=sqrt((Ar+nr).^2+(Ai+ni).^2);

I recentely found a rice noise, rice pdf toolbox posted by Ged
<http://www.mathworks.com/matlabcent...?objectId=14237>

the Rayleigh distribution is simply the magnitude of Gauss noise in
quadrature without signal.

nr=normrnd(0,sigma,size(Ar));
ni=normrnd(0,sigma,size(Ai));

noise=sqrt(nr.^2 + ni.^2);

BEst.
Davide

Ken Davis wrote:
>
>
> "Flavio Eripi" <didad30@libero.it> wrote in message
> news:ef58107.3@webcrossing.raydaftYaTP...
the[color=darkred]
and a[color=darkred]
but not[color=darkred]
contain the[color=darkred]
Matlab?[color=darkred]
distribution?[color=darkred]
with[color=darkred]
> described.
square[color=darkred]
> root
Ricean[color=darkred]
> is
> [fix ANOTHER top post... please continue the conversation in normal
>
> conversational order]
> Reread my post and you will see that you can generate your variates
> by
> taking the square root to the sum of the squares of two Gaussian
> variates.
> These can be generated with randn. Look at:
> hist(sqrt(sum(randn(2,10000).^2)), 20)
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com