Page 85 - Algorithm Collections for Digital Signal Processing Applications using MATLAB
P. 85

2. Probability and Random Process                                 73

           2.3      Matlab Program

              ___________________________________________________________

              gmmmodelgv.m

              %GMM MODEL
              cluster1=clustercol([0.9 0.8],100);
              cluster2=clustercol([0.7 0.6],100);
              cluster3=clustercol([0.5 0.4],150);
              clustertot=[cluster1 cluster2 cluster3];
              %[p,q]=kmeans(clustertot',3);This may be used for initializing the means
              q(1,:)=[0.83 0.79];
              q(2,:)=[0.76 0.74];
              q(3,:)=[0.6 0.3];

              %To Estimate  q ,cov1,cov2,cov3
              [p]=clusterno(clustertot,q);
              [m1,n1]=find(p==1);
              collect1=clustertot(:,n1);
              if(length(n1)~=0)
              cov1=cov(collect1');
              else
                  cov1=diag([1 1]);
              end
              [m1,n1]=find(p==2);
              collect2=clustertot(:,n1);
              cov2=cov(collect2');
              if(length(n1)~=0)
              cov2=cov(collect2');
              else
                  cov2=diag([1 1]);
              end
              [m1,n1]=find(p==3);
              collect3=clustertot(:,n1);
              cov3=cov(collect3');
              if(length(n1)~=0)
              cov3=cov(collect3');
              else
                  cov3=diag([1 1]);
              end
              plot(collect1(1,:),collect1(2,:),'r*')
   80   81   82   83   84   85   86   87   88   89   90