How to generate random numbers in mixture normal distribution (considering weight)?
Show older comments
For a mixture normal distribution the code below is used (for 1000 sample):
x1= mu(1) + std(1)*randn(1000,1)
x2= mu(2) + std(2)*randn(1000,1)
But, I wan to take the respected weight into account, Wi=[0.8 0.2], for instance.
I tried this code, but when I plot the PDFs of them, it gives me wrong curves.
x1= Wi(1)*(mu(1) + std(1)*randn(1000,1));
x2= Wi(2)*(mu(2) + std(2)*randn(1000,1));
I was wondering how I can solve this problem?
Accepted Answer
More Answers (0)
Categories
Find more on Gaussian Mixture Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!