Technical discussion about Matlab and issues related to Digital Signal Processing.
|
Hi, I am modelling a wireless channel, I want to model the channel as mixture of two guassians which is suitable for my applications. i.e. f= a*f1+b*f2; where f is the pdf of the noise signal. f1 and f2 are gaussian pdfs with mean 0 and variance =1, a and b are some constants>0, Now i want to generate a random variable in matlab whose pdf is f(=a*f1+b*f2). But how to genearte a random variable with pdf of f. Help in this regard is highly appreciated. Regards, -SaiRamesh. _______________________________ |
|
|
|
Hi Are the 2 rvs are independent? I assume you are generating a new rv by linear combination of the 2 rvs. When pdf of 2 independent rvs are added, the resultant pdf is convolution of the 2 pdfs. Hence, you should be able to calculate closed form of the resultant pdf. I guess(I may be wrong) that the resultant pdf also may be a guassian rv. Regards arun -----Original Message----- From: nammi sairamesh [mailto:] Sent: Saturday, October 23, 2004 8:29 AM To: Subject: [matlab] random variable of desired pdf Hi, I am modelling a wireless channel, I want to model the channel as mixture of two guassians which is suitable for my applications. i.e. f= a*f1+b*f2; where f is the pdf of the noise signal. f1 and f2 are gaussian pdfs with mean 0 and variance =1, a and b are some constants>0, Now i want to generate a random variable in matlab whose pdf is f(=a*f1+b*f2). But how to genearte a random variable with pdf of f. Help in this regard is highly appreciated. Regards, -SaiRamesh. _______________________________ _____________________________________ /groups.php3 Yahoo! Groups Links |
|
Arun, Sairamesh, Graduate Student Wireless Networking Lab University of Texas at Arlington. |
|
|
|
Hi, Thanks for your responses.! But I guess, u misunderstood my problem! My problem is to generate a random variable whose pdf is given! not the other way! for example: we know normal distribution so with randn we can generate a random variable with normal distribution! In similar way, i want to write a function which generates a random varibale with the desired pdf (f_desired= a*f1+b*f2, where f1 and f2 are the given pdfs not random numbers). I hope now u understood the actual problem! Regards, -SaiRamesh. --- tArAng <> wrote: > Arun, Sairamesh, > > I think Arun you are correct. The resultant pdf will > be Gaussian by Central Limit Theorum. > > I think what Sairamesh is doing is adding two > Gaussian Random Variables with different variances ( > var1 = a^2 and var2 = b^2). > Correct me if I am wrong. > Tarang > On Mon, 25 Oct 2004 wrote : > >Hi > >Are the 2 rvs are independent? I assume you are > generating a new rv by > >linear combination of the 2 rvs. > >When pdf of 2 independent rvs are added, the > resultant pdf is > >convolution of the 2 pdfs. Hence, you should be > able to calculate closed > >form of the resultant pdf. I guess(I may be wrong) > that the resultant > >pdf also may be a guassian rv. > >Regards > >arun > >-----Original Message----- > > From: nammi sairamesh > [mailto:] > >Sent: Saturday, October 23, 2004 8:29 AM > >To: > >Subject: [matlab] random variable of desired pdf > >Hi, > > I am modelling a wireless channel, I want to > >model the channel as mixture of two guassians which > is > >suitable for my applications. > >i.e. f= a*f1+b*f2; > >where f is the pdf of the noise signal. > >f1 and f2 are gaussian pdfs with mean 0 and > variance > >=1, a and b are some constants>0, > >Now i want to generate a random variable in matlab > >whose pdf is f(=a*f1+b*f2). > >But how to genearte a random variable with pdf of > f. > >Help in this regard is highly appreciated. > >Regards, > >-SaiRamesh. > > > >_______________________________ > > > >/groups.php3 > >Yahoo! Groups Links > >_____________________________________ > >/groups.php3 > >Yahoo! Groups Sponsor > >ADVERTISEMENT > >Yahoo! Groups Links > >To br> > >. > > Tarang Dadia > Graduate Student > Wireless Networking Lab > University of Texas at Arlington. |
|
Sai
I think had understood your requirements.
I vaguely remember that the convolution of two guassian functions is also a guassian(but I
am not confirming this; please refer to papoulis's book).
If the two rvs are independent, the variance of the sum of 2 rvs is given by sum of
variances. hence in your case var = a1^2*sigma1+a2^2*sigma2.
If the facts in the above 2 paras are true it can help you to make use of randn in your
case.
Hope I understood your requirements correctly and this helps you.
regadrs
arun
|
|
|
|
Hi Sai
A few clarifications:
Please see the 2 paras below:
1. > >i.e. f= a*f1+b*f2;
> >where f is the pdf of the noise signal. > >f1 and f2 are gaussian pdfs with mean 0 and > variance > >=1, a and b are some constants>0, > >Now i want to generate a random variable in matlab > >whose pdf is f(=a*f1+b*f2). 2.In similar way, i want to write a function which
generates a random varibale with the desired pdf (f_desired= a*f1+b*f2, where f1 and f2 are the given pdfs not random numbers). There is some discrepancy here. Since the mean of the two pdfs are same and variance is
also same, the only way you can have f(x) = a1*f1(x)+a2*f2(x), where f1(x) and f2(x) are
normally distributed, is that a2+a1 =1. In other words, since both components have same
variance and mean, the resultant should be a a normal distribution. Hence, this is a trivial
case.
In other words, if f1(x)
= 1/sqrt(2*pi*sigma1^2)*exp(-(x-mu1)^2/(2*sigma1^2)) and
f2(x)=1/sqrt(2*pi*sigma2^2)*exp(-(x-mu2)^2/(2*sigma2^2)), where mu1!=mu2 and/or variances
are different, the pdf f(x)=a1*f1(x)+a2*f2(x) should be such that total area under the
composite curve should be 1. If this is what you are referring to, then I don't know how to
simulate the pdf for such a case(when mu1!=mu2 and/or sigma1 != sigma2)
regards
arun
|
|
|
|
hi sai, could u be a little specific about the pdf of the random sequences u want to generate... do u have any particular pdf's(f1 and f2) in mind? - Hemanth --- wrote: > Sai > I think had understood your requirements. > I vaguely remember that the convolution of two > guassian functions is also a guassian(but I am not > confirming this; please refer to papoulis's book). > If the two rvs are independent, the variance of the > sum of 2 rvs is given by sum of variances. hence in > your case var = a1^2*sigma1+a2^2*sigma2. > If the facts in the above 2 paras are true it can > help you to make use of randn in your case. > Hope I understood your requirements correctly and > this helps you. > regadrs > arun > -----Original Message----- > From: nammi sairamesh > [mailto:] > Sent: Mon 10/25/2004 22:04 > To: tArAng; arun d naik (WT01 - EMBEDDED & PRODUCT > ENGINEERING SOLUTIONS) > Cc: ; > Subject: Re: RE: [matlab] random variable of > desired pdf > Hi, > Thanks for your responses.! But I guess, u > misunderstood my problem! > My problem is to generate a random variable whose > is given! not the other way! > for example: we know normal distribution so with > randn > we can generate a random variable with normal > distribution! > In similar way, i want to write a function which > generates a random varibale with the desired pdf > (f_desired= a*f1+b*f2, where f1 and f2 are the > given > pdfs not random numbers). > I hope now u understood the actual problem! > Regards, > -SaiRamesh. > --- tArAng <> wrote: > > > Arun, Sairamesh, > > > > I think Arun you are correct. The resultant pdf > will > > be Gaussian by Central Limit Theorum. > > > > I think what Sairamesh is doing is adding two > > Gaussian Random Variables with different > variances ( > > var1 = a^2 and var2 = b^2). > > Correct me if I am wrong. > > > > > > Tarang > > > > > > On Mon, 25 Oct 2004 wrote : > > >Hi > > >Are the 2 rvs are independent? I assume you are > > generating a new rv by > > >linear combination of the 2 rvs. > > >When pdf of 2 independent rvs are added, the > > resultant pdf is > > >convolution of the 2 pdfs. Hence, you should be > > able to calculate closed > > >form of the resultant pdf. I guess(I may be > wrong) > > that the resultant > > >pdf also may be a guassian rv. > > >Regards > > >arun > > >-----Original Message----- > > > From: nammi sairamesh > > [mailto:] > > >Sent: Saturday, October 23, 2004 8:29 AM > > >To: > > >Subject: [matlab] random variable of desired pdf > > >Hi, > > > I am modelling a wireless channel, I want > to > > >model the channel as mixture of two guassians > which > > is > > >suitable for my applications. > > >i.e. f= a*f1+b*f2; > > >where f is the pdf of the noise signal. > > >f1 and f2 are gaussian pdfs with mean 0 and > > variance > > >=1, a and b are some constants>0, > > >Now i want to generate a random variable in > matlab > > >whose pdf is f(=a*f1+b*f2). > > >But how to genearte a random variable with pdf > of > > f. > > >Help in this regard is highly appreciated. > > >Regards, > > >-SaiRamesh. > > > > > >_______________________________ > > > > > >_____________________________________ > > >/groups.php3 > > >Yahoo! Groups Links > > >_____________________________________ > > >/groups.php3 > > >Yahoo! Groups Sponsor > > >ADVERTISEMENT > > >Yahoo! Groups Links > > >To br> > > >. > > > > > > > > > Tarang Dadia > > Graduate Student > > Wireless Networking Lab > > University of Texas at Arlington. > > > > ------------------------ Yahoo! Groups Sponsor > > _____________________________________ > Note: If you do a simple "reply" with your email > client, only the author of this message will receive > your answer. You need to do a "reply all" if you > want your answer to be distributed to the entire > group. > > _____________________________________ > About this discussion group: === message truncated === ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony |
|
|
|
Hi, For my problem f1 and f2 are normal distributions ! As Arun wrote they have different mean and variance,! if they have same mean and variance , the f is not a pdf! at all! -SaiRamesh. --- hemanth kumar <> wrote: > hi sai, > could u be a little specific about the pdf of the > random sequences u want to generate... > > do u have any particular pdf's(f1 and f2) in mind? > > - Hemanth > --- wrote: > > Sai > > I think had understood your requirements. > > I vaguely remember that the convolution of two > > guassian functions is also a guassian(but I am not > > confirming this; please refer to papoulis's book). > > > If the two rvs are independent, the variance of > the > > sum of 2 rvs is given by sum of variances. hence > in > > your case var = a1^2*sigma1+a2^2*sigma2. > > If the facts in the above 2 paras are true it can > > help you to make use of randn in your case. > > Hope I understood your requirements correctly and > > this helps you. > > regadrs > > arun > > > > > > -----Original Message----- > > From: nammi sairamesh > > [mailto:] > > Sent: Mon 10/25/2004 22:04 > > To: tArAng; arun d naik (WT01 - EMBEDDED & > PRODUCT > > ENGINEERING SOLUTIONS) > > Cc: ; > > > Subject: Re: RE: [matlab] random variable of > > desired pdf > > > > > > > > > > > > Hi, > > Thanks for your responses.! But I guess, u > > misunderstood my problem! > > My problem is to generate a random variable > whose > > is given! not the other way! > > for example: we know normal distribution so with > > randn > > we can generate a random variable with normal > > distribution! > > In similar way, i want to write a function which > > generates a random varibale with the desired pdf > > (f_desired= a*f1+b*f2, where f1 and f2 are the > > given > > pdfs not random numbers). > > I hope now u understood the actual problem! > > Regards, > > -SaiRamesh. > > > > > > --- tArAng <> wrote: > > > > > Arun, Sairamesh, > > > > > > I think Arun you are correct. The resultant pdf > > will > > > be Gaussian by Central Limit Theorum. > > > > > > I think what Sairamesh is doing is adding two > > > Gaussian Random Variables with different > > variances ( > > > var1 = a^2 and var2 = b^2). > > > Correct me if I am wrong. > > > > > > > > > Tarang > > > > > > > > > On Mon, 25 Oct 2004 wrote : > > > >Hi > > > >Are the 2 rvs are independent? I assume you > are > > > generating a new rv by > > > >linear combination of the 2 rvs. > > > >When pdf of 2 independent rvs are added, the > > > resultant pdf is > > > >convolution of the 2 pdfs. Hence, you should > be > > > able to calculate closed > > > >form of the resultant pdf. I guess(I may be > > wrong) > > > that the resultant > > > >pdf also may be a guassian rv. > > > >Regards > > > >arun > > > >-----Original Message----- > > > > From: nammi sairamesh > > > [mailto:] > > > >Sent: Saturday, October 23, 2004 8:29 AM > > > >To: > > > >Subject: [matlab] random variable of desired > > > >Hi, > > > > I am modelling a wireless channel, I > want > > to > > > >model the channel as mixture of two guassians > > which > > > is > > > >suitable for my applications. > > > >i.e. f= a*f1+b*f2; > > > >where f is the pdf of the noise signal. > > > >f1 and f2 are gaussian pdfs with mean 0 and > > > variance > > > >=1, a and b are some constants>0, > > > >Now i want to generate a random variable in > > matlab > > > >whose pdf is f(=a*f1+b*f2). > > > >But how to genearte a random variable with pdf > > of > > > f. > > > >Help in this regard is highly appreciated. > > > >Regards, > > > >-SaiRamesh. > > > > > > > >_______________________________ > > > > > > > >_____________________________________ > > > >/groups.php3 > > > >Yahoo! Groups Links > > > >_____________________________________ > > > >/groups.php3 > > > >Yahoo! Groups Sponsor > > > >ADVERTISEMENT > > > >Yahoo! Groups Links > > > >To br> > > > >. > > > > > > > > > > > > > Tarang Dadia > > > Graduate Student > > > Wireless Networking Lab > > > University of Texas at Arlington. > > > > > > > > > > === message truncated === __________________________________ |
|
|
|
Hi Sai,
Let me write an anology of GMM first then I will mention How
to generate the sequence.
Let us assume that there are 2 machines producing same type of toys
with the hieght of the toys as random variable
(For example
Machine1 - Mean 4 and variance 3
Machine 2 - mean 5 and variance 2)
and the probability that machine 1 is selected machine 1 is 'a'
and machine 2 is 'b' (Where a and b are the same as the constants
in the equation f = a*f1+b*f2)
So If you want to generate total 1000 toys (samples).
1. Generate 'a' times 1000 toys using random varaible f1
(for example a =0.6 this becomes 600)
2. Generate 'b' times 1000 toys using randome variable f2
(for example b =0.4 this becomes 400)
I hope this helps
nammi sairamesh <s...@yahoo.com> wrote: Hi, |
|
|
|
Hi, Thanks for your response! But if f= a*f1+b*f2, then is x= a*x1+b*x2??? No know! where x has a pdf of f, x1 has pdf of f1, and x2 has pdf of f2. -SaiRamesh. --- hemanth kumar <> wrote: > Hi Sai, > Let me write an anology of GMM first then I will > mention How > to generate the sequence. > > Let us assume that there are 2 machines producing > same type of toys > with the hieght of the toys as random variable > (For example > Machine1 - Mean 4 and variance 3 > Machine 2 - mean 5 and variance 2) > and the probability that machine 1 is selected > machine 1 is 'a' > and machine 2 is 'b' (Where a and b are the same as > the constants > in the equation f = a*f1+b*f2) > > So If you want to generate total 1000 toys > (samples). > 1. Generate 'a' times 1000 toys using random > varaible f1 > (for example a =0.6 this becomes 600) > 2. Generate 'b' times 1000 toys using randome > variable f2 > (for example b =0.4 this becomes 400) > > I hope this helps > nammi sairamesh <> wrote: > Hi, > For my problem f1 and f2 are normal distributions > ! As Arun wrote they have different mean and > variance,! > if they have same mean and variance , the f is not a > pdf! at all! > -SaiRamesh. > --- hemanth kumar wrote: > > > hi sai, > > could u be a little specific about the pdf of the > > random sequences u want to generate... > > > > do u have any particular pdf's(f1 and f2) in mind? > > > > - Hemanth > > > > > > --- wrote: > > > Sai > > > I think had understood your requirements. > > > I vaguely remember that the convolution of two > > > guassian functions is also a guassian(but I am > not > > > confirming this; please refer to papoulis's > book). > > > > > If the two rvs are independent, the variance of > > the > > > sum of 2 rvs is given by sum of variances. hence > > in > > > your case var = a1^2*sigma1+a2^2*sigma2. > > > If the facts in the above 2 paras are true it > can > > > help you to make use of randn in your case. > > > Hope I understood your requirements correctly > and > > > this helps you. > > > regadrs > > > arun > > > > > > > > > -----Original Message----- > > > From: nammi sairamesh > > > [mailto:] > > > Sent: Mon 10/25/2004 22:04 > > > To: tArAng; arun d naik (WT01 - EMBEDDED & > > PRODUCT > > > ENGINEERING SOLUTIONS) > > > Cc: ; > > > > > > Subject: Re: RE: [matlab] random variable of > > > desired pdf > > > > > > > > > > > > > > > > > > Hi, > > > Thanks for your responses.! But I guess, u > > > misunderstood my problem! > > > My problem is to generate a random variable > > whose > > > is given! not the other way! > > > for example: we know normal distribution so with > > > randn > > > we can generate a random variable with normal > > > distribution! > > > In similar way, i want to write a function which > > > generates a random varibale with the desired pdf > > > (f_desired= a*f1+b*f2, where f1 and f2 are the > > > given > > > pdfs not random numbers). > > > I hope now u understood the actual problem! > > > Regards, > > > -SaiRamesh. > > > > > > > > > --- tArAng wrote: > > > > > > > Arun, Sairamesh, > > > > > > > > I think Arun you are correct. The resultant > > > will > > > > be Gaussian by Central Limit Theorum. > > > > > > > > I think what Sairamesh is doing is adding two > > > > Gaussian Random Variables with different > > > variances ( > > > > var1 = a^2 and var2 = b^2). > > > > Correct me if I am wrong. > > > > > > > > > > > > Tarang > > > > > > > > > > > > On Mon, 25 Oct 2004 wrote > : > > > > >Hi > > > > >Are the 2 rvs are independent? I assume you > > are > > > > generating a new rv by > > > > >linear combination of the 2 rvs. > > > > >When pdf of 2 independent rvs are added, the > > > > resultant pdf is > > > > >convolution of the 2 pdfs. Hence, you should > > be > > > > able to calculate closed > > > > >form of the resultant pdf. I guess(I may be > > > wrong) > > > > that the resultant > > > > >pdf also may be a guassian rv. > > > > >Regards > > > > >arun > > > > >-----Original Message----- > > > > > From: nammi sairamesh > > > > [mailto:] > > > > >Sent: Saturday, October 23, 2004 8:29 AM > > > > >To: > > > > >Subject: [matlab] random variable of desired > > > > >Hi, > > > > > I am modelling a wireless channel, I > > want > > > to > > > > >model the channel as mixture of two guassians > > > which > > > > is > > > > >suitable for my applications. > > > > >i.e. f= a*f1+b*f2; > > > > >where f is the pdf of the noise signal. > > > > >f1 and f2 are gaussian pdfs with mean 0 and > > > > variance > > > > >=1, a and b are some constants>0, > > > > >Now i want to generate a random variable in > > > matlab > > > > >whose pdf is f(=a*f1+b*f2). > > > > >But how to genearte a random variable with > > > of > > > > f. > > > > >Help in this regard is highly appreciated. > > > > >Regards, > > > > >-SaiRamesh. > > > > > > > > > >_______________________________ > > > > >">http://mail.yahoo.com |
|
Hi, yes, thats right.. try this small peice of code, x1 = randn(1,600); x2 = randn(1,400; % here modifide the mean and std dev of x1 and x2. % x1 = 0.5*x1 + 1; x2 = 0.25*x2 - 1; x = [ x1 x2]; h = hist(x,100); n = min(x):(max(x) - min(x))/100:max(x); n = n(1:100); plot(n,h); hope it helps. - Hemanth --- nammi sairamesh <> wrote: > Hi, > Thanks for your response! But > if f= a*f1+b*f2, then is x= a*x1+b*x2??? No know! > where x has a pdf of f, x1 has pdf of f1, and x2 has > pdf of f2. > -SaiRamesh. > --- hemanth kumar <> wrote: > > > Hi Sai, > > Let me write an anology of GMM first then I will > > mention How > > to generate the sequence. > > > > Let us assume that there are 2 machines producing > > same type of toys > > with the hieght of the toys as random variable > > (For example > > Machine1 - Mean 4 and variance 3 > > Machine 2 - mean 5 and variance 2) > > and the probability that machine 1 is selected > > machine 1 is 'a' > > and machine 2 is 'b' (Where a and b are the same > as > > the constants > > in the equation f = a*f1+b*f2) > > > > So If you want to generate total 1000 toys > > (samples). > > 1. Generate 'a' times 1000 toys using random > > varaible f1 > > (for example a =0.6 this becomes 600) > > 2. Generate 'b' times 1000 toys using randome > > variable f2 > > (for example b =0.4 this becomes 400) > > > > I hope this helps > > > > > > nammi sairamesh <> wrote: > > Hi, > > For my problem f1 and f2 are normal distributions > > ! As Arun wrote they have different mean and > > variance,! > > if they have same mean and variance , the f is not > a > > pdf! at all! > > -SaiRamesh. > > > > > > --- hemanth kumar wrote: > > > > > hi sai, > > > could u be a little specific about the pdf of > the > > > random sequences u want to generate... > > > > > > do u have any particular pdf's(f1 and f2) in > mind? > > > > > > - Hemanth > > > > > > > > > --- wrote: > > > > Sai > > > > I think had understood your requirements. > > > > I vaguely remember that the convolution of two > > > > guassian functions is also a guassian(but I am > > not > > > > confirming this; please refer to papoulis's > > book). > > > > > > > If the two rvs are independent, the variance > of > > > the > > > > sum of 2 rvs is given by sum of variances. > hence > > > in > > > > your case var = a1^2*sigma1+a2^2*sigma2. > > > > If the facts in the above 2 paras are true it > > can > > > > help you to make use of randn in your case. > > > > Hope I understood your requirements correctly > > and > > > > this helps you. > > > > regadrs > > > > arun > > > > > > > > > > > > -----Original Message----- > > > > From: nammi sairamesh > > > > [mailto:] > > > > Sent: Mon 10/25/2004 22:04 > > > > To: tArAng; arun d naik (WT01 - EMBEDDED & > > > PRODUCT > > > > ENGINEERING SOLUTIONS) > > > > Cc: ; > > > > > > > > > Subject: Re: RE: [matlab] random variable of > > > > desired pdf > > > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > Thanks for your responses.! But I guess, u > > > > misunderstood my problem! > > > > My problem is to generate a random variable > > > whose > > > > is given! not the other way! > > > > for example: we know normal distribution so > with > > > > randn > > > > we can generate a random variable with normal > > > > distribution! > > > > In similar way, i want to write a function > which > > > > generates a random varibale with the desired > > > > (f_desired= a*f1+b*f2, where f1 and f2 are the > > > > given > > > > pdfs not random numbers). > > > > I hope now u understood the actual problem! > > > > Regards, > > > > -SaiRamesh. > > > > > > > > > > > > --- tArAng wrote: > > > > > > > > > Arun, Sairamesh, > > > > > > > > > > I think Arun you are correct. The resultant > > > > will > > > > > be Gaussian by Central Limit Theorum. > > > > > > > > > > I think what Sairamesh is doing is adding > two > > > > > Gaussian Random Variables with different > > > > variances ( > > > > > var1 = a^2 and var2 = b^2). > > > > > Correct me if I am wrong. > > > > > > > > > > > > > > > Tarang > > > > > > > > > > > > > > > On Mon, 25 Oct 2004 > wrote > > : > > > > > >Hi > > > > > >Are the 2 rvs are independent? I assume you > > > are > > > > > generating a new rv by > > > > > >linear combination of the 2 rvs. > > > > > >When pdf of 2 independent rvs are added, > the > > > > > resultant pdf is > > > > > >convolution of the 2 pdfs. Hence, you > should > > > be > > > > > able to calculate closed > > > > > >form of the resultant pdf. I guess(I may be > > > > wrong) > > > > > that the resultant > > > > > >pdf also may be a guassian rv. > > > > > >Regards > > > > > >arun > > > > > >-----Original Message----- > > > > > > From: nammi sairamesh > > > > > [mailto:] > > > > > >Sent: Saturday, October 23, 2004 8:29 AM > > > > > >To: > > > > > >Subject: [matlab] random variable of > desired > > > > > >Hi, > > > > > > I am modelling a wireless channel, I > > > want > > > > to > > > > > >model the channel as mixture of two > guassians > > > > which > > > > > is > > > > > >suitable for my applications. > > > > > >i.e. f= a*f1+b*f2; > > > > > >where f is the pdf of the noise signal. > > > > > >f1 and f2 are gaussian pdfs with mean 0 and > > > > > variance > > > > > >=1, a and b are some constants>0, > > > > > >Now i want to generate a random variable in > > > > matlab > > > > > >whose pdf is f(=a*f1+b*f2). > > > > > >But how to genearte a random variable with > > > > of > > > > > f. > > > > > >Help in this regard is highly appreciated. > > > > > >Regards, > === message truncated === ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony |
|
Sai Hemant is right. The fact that we can easily decompose f as a linear combination of f1 and f2 (where each is a normally distributed rv), can be made use of in simulating the composite pdf by means of individual normally distributed rvs. Hemant is not suggesting x = ax1+bx2. It is actually a switch between the two rvs at any instant. Remember the two hypothesis problem. Suppose X1 and X2 are 2 rvs. And you generate a new rv, Z by picking one of the two rvs and let the probability of X1 being selected is a and X2 being selected is b=1-a. Then Prob(Z=x0) = Prob(X=x0|X1)Prob(Z=X1)+ Prob(X=x0|X2)Prob(Z=X2). This is intuitively(to me) easiest way of generating your random variable. Regards arun -----Original Message----- From: nammi sairamesh [mailto:] Sent: Wednesday, October 27, 2004 1:53 PM To: hemanth kumar Cc: Subject: RE: RE: [matlab] random variable of desired pdf Hi, Thanks for your response! But if f= a*f1+b*f2, then is x= a*x1+b*x2??? No know! where x has a pdf of f, x1 has pdf of f1, and x2 has pdf of f2. -SaiRamesh. --- hemanth kumar <> wrote: > Hi Sai, > Let me write an anology of GMM first then I will > mention How > to generate the sequence. > > Let us assume that there are 2 machines producing > same type of toys > with the hieght of the toys as random variable > (For example > Machine1 - Mean 4 and variance 3 > Machine 2 - mean 5 and variance 2) > and the probability that machine 1 is selected > machine 1 is 'a' > and machine 2 is 'b' (Where a and b are the same as > the constants > in the equation f = a*f1+b*f2) > > So If you want to generate total 1000 toys > (samples). > 1. Generate 'a' times 1000 toys using random > varaible f1 > (for example a =0.6 this becomes 600) > 2. Generate 'b' times 1000 toys using randome > variable f2 > (for example b =0.4 this becomes 400) > > I hope this helps > nammi sairamesh <> wrote: > Hi, > For my problem f1 and f2 are normal distributions > ! As Arun wrote they have different mean and > variance,! > if they have same mean and variance , the f is not a > pdf! at all! > -SaiRamesh. > --- hemanth kumar wrote: > > > hi sai, > > could u be a little specific about the pdf of the > > random sequences u want to generate... > > > > do u have any particular pdf's(f1 and f2) in mind? > > > > - Hemanth > > > > > > --- wrote: > > > Sai > > > I think had understood your requirements. > > > I vaguely remember that the convolution of two > > > guassian functions is also a guassian(but I am > not > > > confirming this; please refer to papoulis's > book). > > > > > If the two rvs are independent, the variance of > > the > > > sum of 2 rvs is given by sum of variances. hence > > in > > > your case var = a1^2*sigma1+a2^2*sigma2. > > > If the facts in the above 2 paras are true it > can > > > help you to make use of randn in your case. > > > Hope I understood your requirements correctly > and > > > this helps you. > > > regadrs > > > arun > > > > > > > > > -----Original Message----- > > > From: nammi sairamesh > > > [mailto:] > > > Sent: Mon 10/25/2004 22:04 > > > To: tArAng; arun d naik (WT01 - EMBEDDED & > > PRODUCT > > > ENGINEERING SOLUTIONS) > > > Cc: ; > > > > > > Subject: Re: RE: [matlab] random variable of > > > desired pdf > > > > > > > > > > > > > > > > > > Hi, > > > Thanks for your responses.! But I guess, u > > > misunderstood my problem! > > > My problem is to generate a random variable > > whose > > > is given! not the other way! > > > for example: we know normal distribution so with > > > randn > > > we can generate a random variable with normal > > > distribution! > > > In similar way, i want to write a function which > > > generates a random varibale with the desired pdf > > > (f_desired= a*f1+b*f2, where f1 and f2 are the > > > given > > > pdfs not random numbers). > > > I hope now u understood the actual problem! > > > Regards, > > > -SaiRamesh. > > > > > > > > > --- tArAng wrote: > > > > > > > Arun, Sairamesh, > > > > > > > > I think Arun you are correct. The resultant > > > will > > > > be Gaussian by Central Limit Theorum. > > > > > > > > I think what Sairamesh is doing is adding two > > > > Gaussian Random Variables with different > > > variances ( > > > > var1 = a^2 and var2 = b^2). > > > > Correct me if I am wrong. > > > > > > > > > > > > Tarang > > > > > > > > > > > > On Mon, 25 Oct 2004 wrote > : > > > > >Hi > > > > >Are the 2 rvs are independent? I assume you > > are > > > > generating a new rv by > > > > >linear combination of the 2 rvs. > > > > >When pdf of 2 independent rvs are added, the > > > > resultant pdf is > > > > >convolution of the 2 pdfs. Hence, you should > > be > > > > able to calculate closed > > > > >form of the resultant pdf. I guess(I may be > > > wrong) > > > > that the resultant > > > > >pdf also may be a guassian rv. > > > > >Regards > > > > >arun > > > > >-----Original Message----- > > > > > From: nammi sairamesh > > > > [mailto:] > > > > >Sent: Saturday, October 23, 2004 8:29 AM > > > > >To: > > > > >Subject: [matlab] random variable of desired > > > > >Hi, > > > > > I am modelling a wireless channel, I > > want > > > to > > > > >model the channel as mixture of two guassians > > > which > > > > is > > > > >suitable for my applications. > > > > >i.e. f= a*f1+b*f2; > > > > >where f is the pdf of the noise signal. > > > > >f1 and f2 are gaussian pdfs with mean 0 and > > > > variance > > > > >=1, a and b are some constants>0, > > > > >Now i want to generate a random variable in > > > matlab > > > > >whose pdf is f(=a*f1+b*f2). > > > > >But how to genearte a random variable with > > > of > > > > f. > > > > >Help in this regard is highly appreciated. > > > > >Regards, > > > > >-SaiRamesh. > > > > > > > > > >_______________________________ > > > > >">http://mail.yahoo.com _____________________________________ /groups.php3 Yahoo! Groups Links |
|
Hi arun, This is the only and actual definition of GMM. regards -Hemanth --- wrote: > > Hi > A small correction: > Prob(Z=x0) = Prob(X1=x0|X1)Prob(X1)+ > Prob(X2=x0|X2)Prob(X2). > Regards > arun > > -----Original Message----- > From: arun d naik (WT01 - EMBEDDED & PRODUCT > ENGINEERING SOLUTIONS) > Sent: Wednesday, October 27, 2004 5:55 PM > To: 'nammi sairamesh'; hemanth kumar > Cc: > Subject: RE: RE: [matlab] random variable of desired > > Sai > Hemant is right. > The fact that we can easily decompose f as a linear > combination of f1 > and f2 (where each is a normally distributed rv), > can be made use of in > simulating the composite pdf by means of individual > normally distributed > rvs. > > Hemant is not suggesting x = ax1+bx2. It is actually > a switch between > the two rvs at any instant. > > Remember the two hypothesis problem. > Suppose X1 and X2 are 2 rvs. And you generate a new > rv, Z by picking one > of the two rvs and let the probability of X1 being > selected is a and X2 > being selected is b=1-a. > Then Prob(Z=x0) = Prob(X=x0|X1)Prob(Z=X1)+ > Prob(X=x0|X2)Prob(Z=X2). > This is intuitively(to me) easiest way of generating > your random > variable. > > Regards > arun > > -----Original Message----- > From: nammi sairamesh [mailto:] > Sent: Wednesday, October 27, 2004 1:53 PM > To: hemanth kumar > Cc: > Subject: RE: RE: [matlab] random variable of desired > pdf > > Hi, > Thanks for your response! But > if f= a*f1+b*f2, then is x= a*x1+b*x2??? No know! > where x has a pdf of f, x1 has pdf of f1, and x2 has > pdf of f2. > -SaiRamesh. > --- hemanth kumar <> wrote: > > > Hi Sai, > > Let me write an anology of GMM first then I will > > mention How > > to generate the sequence. > > > > Let us assume that there are 2 machines producing > > same type of toys > > with the hieght of the toys as random variable > > (For example > > Machine1 - Mean 4 and variance 3 > > Machine 2 - mean 5 and variance 2) > > and the probability that machine 1 is selected > > machine 1 is 'a' > > and machine 2 is 'b' (Where a and b are the same > as > > the constants > > in the equation f = a*f1+b*f2) > > > > So If you want to generate total 1000 toys > > (samples). > > 1. Generate 'a' times 1000 toys using random > > varaible f1 > > (for example a =0.6 this becomes 600) > > 2. Generate 'b' times 1000 toys using randome > > variable f2 > > (for example b =0.4 this becomes 400) > > > > I hope this helps > > > > > > nammi sairamesh <> wrote: > > Hi, > > For my problem f1 and f2 are normal distributions > > ! As Arun wrote they have different mean and > > variance,! > > if they have same mean and variance , the f is not > a > > pdf! at all! > > -SaiRamesh. > > > > > > --- hemanth kumar wrote: > > > > > hi sai, > > > could u be a little specific about the pdf of > the > > > random sequences u want to generate... > > > > > > do u have any particular pdf's(f1 and f2) in > mind? > > > > > > - Hemanth > > > > > > > > > --- wrote: > > > > Sai > > > > I think had understood your requirements. > > > > I vaguely remember that the convolution of two > > > > guassian functions is also a guassian(but I am > > not > > > > confirming this; please refer to papoulis's > > book). > > > > > > > If the two rvs are independent, the variance > of > > > the > > > > sum of 2 rvs is given by sum of variances. > hence > > > in > > > > your case var = a1^2*sigma1+a2^2*sigma2. > > > > If the facts in the above 2 paras are true it > > can > > > > help you to make use of randn in your case. > > > > Hope I understood your requirements correctly > > and > > > > this helps you. > > > > regadrs > > > > arun > > > > > > > > > > > > -----Original Message----- > > > > From: nammi sairamesh > > > > [mailto:] > > > > Sent: Mon 10/25/2004 22:04 > > > > To: tArAng; arun d naik (WT01 - EMBEDDED & > > > PRODUCT > > > > ENGINEERING SOLUTIONS) > > > > Cc: ; > > > > > > > > > Subject: Re: RE: [matlab] random variable of > > > > desired pdf > > > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > Thanks for your responses.! But I guess, u > > > > misunderstood my problem! > > > > My problem is to generate a random variable > > > whose > > > > is given! not the other way! > > > > for example: we know normal distribution so > with > > > > randn > > > > we can generate a random variable with normal > > > > distribution! > > > > In similar way, i want to write a function > which > > > > generates a random varibale with the desired > > > > (f_desired= a*f1+b*f2, where f1 and f2 are the > > > > given > > > > pdfs not random numbers). > > > > I hope now u understood the actual problem! > > > > Regards, > > > > -SaiRamesh. > > > > > > > > > > > > --- tArAng wrote: > > > > > > > > > Arun, Sairamesh, > > > > > > > > > > I think Arun you are correct. The resultant > > > > will > > > > > be Gaussian by Central Limit Theorum. > > > > > > > > > > I think what Sairamesh is doing is adding > two > > > > > Gaussian Random Variables with different > > > > variances ( > > > > > var1 = a^2 and var2 = b^2). > > > > > Correct me if I am wrong. > > > > > > === message truncated === ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony |
|
|
|
Hi all, I think random variable Sai is talking about is defined as Gaussian Mixture random Variable having pdf which is combination of weighted sum of two Gaussian PDF's. The Characteristic of weights in Gaussian Mixture is that Addition of it is 1. ( so here a+b =1). Now as far as generation of it has concern,what u can do is generate two Gaussina Pdf's with their means and variance... Add them point by point.. I am sure when u would see this for only two pdf's your curve would not be guassian anymore ,but having some different shape depending on the values of coefficients. Also, this is gaussian Mixture.. Does anyone has think.. how u can defined mutlivariable Gaussian Mixrture Random Vector having its pdf as addition of two Multivariate Gaussian vector once again weighted by some values whose addition is 1. Interesting problem to look at and this has application in every wireless projects, if u want to dump few assumptions we make every time.. I hope this helps sai.. and would, like to know your thoughts about Multivariate case of Gaussian Mixture. Regards, Nilay ----- Ph.D Student Stevens Institute of Technology. --- hemanth kumar <> wrote: > Hi arun, > > This is the only and actual definition of GMM. > > regards > -Hemanth > > --- wrote: > > > > Hi > > A small correction: > > Prob(Z=x0) = Prob(X1=x0|X1)Prob(X1)+ > > Prob(X2=x0|X2)Prob(X2). > > Regards > > arun > > > > -----Original Message----- > > From: arun d naik (WT01 - EMBEDDED & PRODUCT > > ENGINEERING SOLUTIONS) > > Sent: Wednesday, October 27, 2004 5:55 PM > > To: 'nammi sairamesh'; hemanth kumar > > Cc: > > Subject: RE: RE: [matlab] random variable of > desired > > > > Sai > > Hemant is right. > > The fact that we can easily decompose f as a > linear > > combination of f1 > > and f2 (where each is a normally distributed rv), > > can be made use of in > > simulating the composite pdf by means of > individual > > normally distributed > > rvs. > > > > Hemant is not suggesting x = ax1+bx2. It is > actually > > a switch between > > the two rvs at any instant. > > > > Remember the two hypothesis problem. > > Suppose X1 and X2 are 2 rvs. And you generate a > new > > rv, Z by picking one > > of the two rvs and let the probability of X1 being > > selected is a and X2 > > being selected is b=1-a. > > Then Prob(Z=x0) = Prob(X=x0|X1)Prob(Z=X1)+ > > Prob(X=x0|X2)Prob(Z=X2). > > This is intuitively(to me) easiest way of > generating > > your random > > variable. > > > > Regards > > arun > > > > -----Original Message----- > > From: nammi sairamesh > [mailto:] > > Sent: Wednesday, October 27, 2004 1:53 PM > > To: hemanth kumar > > Cc: > > Subject: RE: RE: [matlab] random variable of > desired > > > > > > > > Hi, > > Thanks for your response! But > > if f= a*f1+b*f2, then is x= a*x1+b*x2??? No know! > > where x has a pdf of f, x1 has pdf of f1, and x2 > has > > pdf of f2. > > -SaiRamesh. > > --- hemanth kumar <> wrote: > > > > > Hi Sai, > > > Let me write an anology of GMM first then I will > > > mention How > > > to generate the sequence. > > > > > > Let us assume that there are 2 machines > producing > > > same type of toys > > > with the hieght of the toys as random variable > > > (For example > > > Machine1 - Mean 4 and variance 3 > > > Machine 2 - mean 5 and variance 2) > > > and the probability that machine 1 is selected > > > machine 1 is 'a' > > > and machine 2 is 'b' (Where a and b are the same > > as > > > the constants > > > in the equation f = a*f1+b*f2) > > > > > > So If you want to generate total 1000 toys > > > (samples). > > > 1. Generate 'a' times 1000 toys using random > > > varaible f1 > > > (for example a =0.6 this becomes 600) > > > 2. Generate 'b' times 1000 toys using randome > > > variable f2 > > > (for example b =0.4 this becomes 400) > > > > > > I hope this helps > > > > > > > > > nammi sairamesh <> wrote: > > > Hi, > > > For my problem f1 and f2 are normal > distributions > > > ! As Arun wrote they have different mean and > > > variance,! > > > if they have same mean and variance , the f is > not > > a > > > pdf! at all! > > > -SaiRamesh. > > > > > > > > > --- hemanth kumar wrote: > > > > > > > hi sai, > > > > could u be a little specific about the pdf of > > the > > > > random sequences u want to generate... > > > > > > > > do u have any particular pdf's(f1 and f2) in > > mind? > > > > > > > > - Hemanth > > > > > > > > > > > > --- wrote: > > > > > Sai > > > > > I think had understood your requirements. > > > > > I vaguely remember that the convolution of > two > > > > > guassian functions is also a guassian(but I > am > > > not > > > > > confirming this; please refer to papoulis's > > > book). > > > > > > > > > If the two rvs are independent, the variance > > of > > > > the > > > > > sum of 2 rvs is given by sum of variances. > > hence > > > > in > > > > > your case var = a1^2*sigma1+a2^2*sigma2. > > > > > If the facts in the above 2 paras are true > it > > > can > > > > > help you to make use of randn in your case. > > > > > Hope I understood your requirements > correctly > > > and > > > > > this helps you. > > > > > regadrs > > > > > arun > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: nammi sairamesh > > > > > [mailto:] > > > > > Sent: Mon 10/25/2004 22:04 > > > > > To: tArAng; arun d naik (WT01 - EMBEDDED & > > > > PRODUCT > > > > > ENGINEERING SOLUTIONS) > > > > > Cc: ; > > > > > > > > > > > > Subject: Re: RE: [matlab] random variable of > > > > > desired pdf > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > Thanks for your responses.! But I guess, u > > > > > misunderstood my problem! > > > > > My problem is to generate a random variable > > > > whose > > > > > is given! not the other way! > > > > > for example: we know normal distribution so > > with > > > > > randn > > > > > we can generate a random variable with > normal > > > > > distribution! > > > > > In similar way, i want to write a function > === message truncated === ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony |
|
|
|
Thanks Nilay! Infact i would like say thanks for Arun and Hemanth for their excellent ideas. I generated the random variable with pdf f= a*f1+b*f2, where a+b = 1; So i got the sequence(with the pdf as GMM) as Hemanth suggested, Now my problem is how to verify this, the pdf is equal to f? I mean mathematically? Is there any book talks about this? Thanks, -SaiRamesh. __________________________________ |
|
Hi Sai I tried to post this proof to you earlier, but it bounced due. Hemant, What do you say about this? The proof is very simple and there is not much jugglery required. Regards arun
-----Original Message-----
Hi Sai Here is my explanation: Let Z be the RV which is an experiment in which we choose Z = {-(inf<=X1<=+inf) or (inf<=X2<=+inf)}. Let U be another RV, P(U=X1) = alpha and P(X2=x)=(1-alpha).
pdf fZ(z) = partial derivative wrt z of {P(Z<=z)} = partial derivative wrt z of {P(Z<=z|(U=X1)P(U=X1)+ P(Z<=z|(U=X2)P(U=X2)} (This follows from the fact that X1 and X2 are mutually exclusive events and hence in such a case, the respective probabilities can be added. P(AUB) = P(A) + P(B) when intersection of A and B is null.)
= partial derivative wrt z of {FX1(x1)*alpha+ FX2(x2)*(1-alpha)} ( for first term z=x1 and second term, z=x2) = alpha* fX1(x1) + (1-alpha)*fX2(x2)
I am afraid, there may be lack of some rigour in this explanation. I feel that I might have hurried through steps?
By the way, how did you verify the experiment statistically?
Regards arun
-----Original Message-----
Thanks Nilay! Infact i would like say thanks for Arun and Hemanth for their excellent ideas. I generated the random variable with pdf f= a*f1+b*f2, where a+b = 1; So i got the sequence(with the pdf as GMM) as Hemanth suggested, Now my problem is how to verify this, the pdf is equal to f? I mean mathematically? Is there any book talks about this?
Thanks, -SaiRamesh.
__________________________________
|
|
Hi Ashok, Thank you very much for response. Yes, the proof is correct and makes sense. I also did in the same manner with little more steps involved. Thanks for your help. Regards, -SaiRamesh. --- wrote: > Hi Sai > > I tried to post this proof to you earlier, but it > bounced due. > > Hemant, > > What do you say about this? The proof is very simple > and there is not > much jugglery required. > > Regards > > arun > > -----Original Message----- > From: arun d naik (WT01 - EMBEDDED & PRODUCT > ENGINEERING SOLUTIONS) > Sent: Tuesday, November 16, 2004 6:28 PM > To: 'nammi sairamesh'; Nilay Shah; hemanth kumar > Cc: > Subject: RE: RE: [matlab] random variable of desired > pdf > > Hi Sai > > Here is my explanation: > > Let Z be the RV which is an experiment in which we > choose Z = > {-(inf<=X1<=+inf) or (inf<=X2<=+inf)}. > > Let U be another RV, P(U=X1) = alpha and > P(X2=x)=(1-alpha). > pdf fZ(z) = partial derivative wrt z of {P(Z<=z)} > > = partial derivative wrt z of {P(Z<=z|(U=X1)P(U=X1)+ > P(Z<=z|(U=X2)P(U=X2)} > > (This follows from the fact that X1 and X2 are > mutually exclusive events > and hence in such a case, the respective > probabilities can be added. > P(AUB) = P(A) + P(B) when intersection of A and B is > null.) > > = partial derivative wrt z of {FX1(x1)*alpha+ > FX2(x2)*(1-alpha)} > > ( for first term z=x1 and second term, z=x2) > > = alpha* fX1(x1) + (1-alpha)*fX2(x2) > I am afraid, there may be lack of some rigour in > this explanation. I > feel that I might have hurried through steps? > > By the way, how did you verify the experiment > statistically? > > Regards > > arun > -----Original Message----- > From: nammi sairamesh [mailto:] > Sent: Thursday, November 04, 2004 1:06 PM > To: Nilay Shah; hemanth kumar; arun d naik (WT01 - > EMBEDDED & PRODUCT > ENGINEERING SOLUTIONS) > Cc: > Subject: RE: RE: [matlab] random variable of desired > pdf > > > Thanks Nilay! Infact i would like say thanks for > Arun > > and Hemanth for their excellent ideas. > > I generated the random variable with pdf > > f= a*f1+b*f2, where a+b = 1; > > So i got the sequence(with the pdf as GMM) as > Hemanth > > suggested, Now my problem is how to verify this, the > > pdf is equal to f? > > I mean mathematically? > > Is there any book talks about this? > > Thanks, > > -SaiRamesh. > > __________________________________ > > ">http://mail.yahoo.com |