# MATLAB: Separate Drawing of Gaussian Mixture Model

gaussian distributiongaussian mixture modelgmmnormal distributionnormalizationStatistics and Machine Learning Toolbox

I have a 1D data which need to be separated by two .
So I used
``    fitgmdist(data,2);``
and got
1. mu
2. sigma
3. component proportion
for each of the gaussian distribution.
And here is the graph. (Gray : Data, Blue : psd of GMModel from fitgmdist)
Until here, everything was okay.
So, question.
How can I separate those two gaussian distribution graph?
I tried
1. Using makedist('Normal') to create each gaussian distribution.
2. Multiply by each component proportion
``x = [randn(4000,1)/2; 5+2*randn(6000,1)];f = fitgmdist(x,2);histogram(x,'Normalization','pdf')xgrid = linspace(-4,12,1001)';hold on; plot(xgrid,pdf(f,xgrid),'r-'); hold off``
``n1 = makedist('normal',f.mu(1),sqrt(f.Sigma(1)));n2 = makedist('normal',f.mu(2),sqrt(f.Sigma(2)));p = f.ComponentProportion;y = p(1)*pdf(n1,xgrid) + p(2)*pdf(n2,xgrid);hold on; plot(xgrid,y,'c--'); hold off``