function x=normmixrnd(n,mu,sig,p)
%these vectors are all of the same length. simulates a mixure of normal
%with these parameters sample size n
m=multinomrnd(n,p); x=[];
for i=1:length(m)
x=[x normrnd(mu(i),sig(i),1,m(i))];
end

