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. _______________________________ |
|
random variable of desired pdf
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. _______________________________ _____________________________________ 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: To Join: To Post: To Leave: Archives: http://www.yahoogroups.com/group/matlab More DSP-Related Groups: http://www.dsprelated.com/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. > > > >_______________________________ > > > >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: > >To Join: > >To Post: > >To Leave: > >Archives: > >http://www.yahoogroups.com/group/matlab > >More DSP-Related Groups: > >http://www.dsprelated.com/groups.php3 > >Yahoo! Groups Links > >_____________________________________ > >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: > >To Join: > >To Post: > >To Leave: > >Archives: > >http://www.yahoogroups.com/group/matlab > >More DSP-Related Groups: > >http://www.dsprelated.com/groups.php3 > > > >Yahoo! Groups Links > >To br> > >. > > Tarang Dadia > Graduate Student > Wireless Networking Lab > University of Texas at Arlington. > |
Re: RE: [matlab] random variable of desired pdf
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
|
|
Re: RE: [matlab] random variable of desired pdf
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)*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. > > > > > >_______________________________ > > > > > >_____________________________________ > > >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: > > >To Join: > > >To Post: > > >To Leave: > > >Archives: > > >http://www.yahoogroups.com/group/matlab > > >More DSP-Related Groups: > > >http://www.dsprelated.com/groups.php3 > > >Yahoo! Groups Links > > >_____________________________________ > > >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: > > >To Join: > > >To Post: > > >To Leave: > > >Archives: > > >http://www.yahoogroups.com/group/matlab > > >More DSP-Related Groups: > > >http://www.dsprelated.com/groups.php3 > > > > > >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. > > > > > > > >_______________________________ > > > > > > > >_____________________________________ > > > >Note: If you do a simple "reply" with your > > > 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: > > > >To Join: > > > >To Post: > > > >To Leave: > > > >Archives: > > > >http://www.yahoogroups.com/group/matlab > > > >More DSP-Related Groups: > > > >http://www.dsprelated.com/groups.php3 > > > >Yahoo! Groups Links > > > >_____________________________________ > > > >Note: If you do a simple "reply" with your > > > 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: > > > >To Join: > > > >To Post: > > > >To Leave: > > > >Archives: > > > >http://www.yahoogroups.com/group/matlab > > > >More DSP-Related Groups: > > > >http://www.dsprelated.com/groups.php3 > > > > > > > >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. > > > > > > > > > >_______________________________ > > > > > |