function I = gmmcum(X,M,V,C)
% I = gmmcum(X,M,V,C)  Return integral of GMM pdf
%      M, V and C define a (1-D) GMM.  Return the cumulative PDF 
%      sampled at X.
% 2001-03-14 dpwe@ee.columbia.edu

% Just use erf to get integrals of each gaussian

I = 0*X;

nmix = size(M,1);

for mix = 1:nmix;
  I = I + C(mix) * .5*(1+erf((X - M(mix,1))/sqrt(2*V(mix,1))));
end
