I am new to this so please bear with me. I am trying to generate data points from a mixture of gaussians model with the following parameters:
mixGaussTrue.mean = [-1 1.5];
mixGaussTrue.cov = reshape([0.5 0.25],1,1,2);
Now I have a variable, h that determines which gaussian to use. So h is either 1 (first gaussian) or 2. So say for e.g. if h is 1, how do I generate values from the first gaussian, with mean -1 and covariance 0.5 ?
I cannot use build in functions and meant to be writing the equation for the gaussians.
So I have
data(1,i) = ( 1/( sqrt( 2*pi*mixGaussTrue.cov(:,:,1) ) ) ) * exp( - (((cData -
mixGaussTrue.mean(1,1))^2)/(2* mixGaussTrue.cov(:,:,1))) ) ;