function y=nmdplot(x,w,sigma,mu,g)

% NMDPLOT     Plot normal mixture density.
%
%             Example: x=-4:0.01:4;
%                      nmdplot(x,[0.75 0.25]',[1 1/3]',[0 3/2]');
%
%             NMDPLOT(X,W,SIGMA,MU,G)
%
%             Christian C. Beardah 1995 

if nargin==4,
  g=1;
end;

y=zeros(size(x));

for i=1:length(w),
  y=y+w(i)*npdf(x,mu(i),sigma(i));
end;

if g~=0,
  plot(x,y,'c')
end;