uniform random variable

  • Follow


Given 2 independent uniform random variables X,Y = U [0,1], consider the random variables Z = g (X,Y) for g (x,y) = sqrt (-2ln(x) ). cos(2piy)..This is the condition.So I need to go for matlab program as the analytic method is tough

1 - 10,000 uniformly distributed random samples for X and Y
2 - For each sample of X and Y, compute Z= g(X,Y)
3 - Draw a histogram over the resulting samples in Z
4 - Estimate the moments mZ for n = 1,2....6.
0
Reply DSPtree 5/5/2010 6:37:26 PM

DSPtree <paulscot45@yahoo.com> wrote in message <2024364947.79076.1273099076053.JavaMail.root@gallium.mathforum.org>...
> Given 2 independent uniform random variables X,Y = U [0,1], consider the random variables Z = g (X,Y) for g (x,y) = sqrt (-2ln(x) ). cos(2piy)..This is the condition.So I need to go for matlab program as the analytic method is tough
> 
> 1 - 10,000 uniformly distributed random samples for X and Y
> 2 - For each sample of X and Y, compute Z= g(X,Y)
> 3 - Draw a histogram over the resulting samples in Z
> 4 - Estimate the moments mZ for n = 1,2....6.

Surely you have tried something? If not, why not?

John
0
Reply John 5/5/2010 11:01:07 PM


DSPtree wrote:
> Given 2 independent uniform random variables X,Y = U [0,1], consider the random variables Z = g (X,Y) for g (x,y) = sqrt (-2ln(x) ). cos(2piy)..This is the condition.So I need to go for matlab program as the analytic method is tough
> 
> 1 - 10,000 uniformly distributed random samples for X and Y
> 2 - For each sample of X and Y, compute Z= g(X,Y)
> 3 - Draw a histogram over the resulting samples in Z
> 4 - Estimate the moments mZ for n = 1,2....6.

Okay, go ahead, we give you permission to write such a program. If you 
should happen to come up with a _specific_ Matlab question, then if you 
indicate what you are having trouble with, we may be able to assist you.
0
Reply Walter 5/5/2010 11:16:49 PM

clear all;
n=10000;
x=randn(1,n);
y=randn(1,n);
subplot(221);bar(x);subplot(222);bar(y);
z=sqrt(-2*log(x))*cos(2*pi*y');
t=hist(z,100);
subplot(212);plot(t);


This is what i have done till now. But I am not sure whether i could take z like that and plot it.
0
Reply DSPtree 5/6/2010 5:54:37 AM

the plot shows a normal distribution i guess. shall i have to take some arbitary mean and sigma . this  output looks little weird.
0
Reply DSPtree 5/6/2010 5:59:14 AM

On 5/6/2010 5:54 AM, DSPtree wrote:
> clear all;
> n=10000;
> x=randn(1,n);
> y=randn(1,n);
> subplot(221);bar(x);subplot(222);bar(y);
> z=sqrt(-2*log(x))*cos(2*pi*y');
> t=hist(z,100);
> subplot(212);plot(t);

Consider the following:

1) "Given 2 independent uniform random variables X,Y"

Check your code, and type "help rand" and "help randn"

2) "For each sample of X and Y, compute Z= g(X,Y)"

Type "help times", and "help mtimes", and then check your code.  In 
particular, what should the size of z be, and what is it?  What does the 
transpose on y do (hint: that's why your code does not give you an error 
that would help you figure out where you're going wrong)?

3) "Draw a histogram over the resulting samples in Z"

What does "plot(t)" do?  It does not create a histogram.

Hope this helps.
0
Reply Peter 5/6/2010 1:14:29 PM

Thank you so much for the help.

x=randn(1,10000);
y=randn(1,10000);
z=sqrt(-2*log(x)).*cos(2*pi*y);
hist(z,100);


I have made it shorter again.But still the shape of 'z' doesn't look familiar. So I guess I still have something wrong with this small program..

Well I m just a starter in matlab. expecting support.
0
Reply DSPtree 5/6/2010 4:05:39 PM

6 Replies
408 Views

(page loaded in 0.156 seconds)

Similiar Articles:













7/13/2012 4:41:09 AM


Reply: