load nmd3

count=1;

ss=60;
nreps=15;
col='y';

for i=1:nreps,
  i
  S=snmd3(ss,wa,sigmaa,mua);
  h1=hns(S(:,1),'knorm');
  h2=hns(S(:,2),'knorm');
  h3=hns(S(:,3),'knorm');
  h=[h1 h2 h3];
  subplot(221); [Tx,Ty,Tz,X,Y,Z,f,d]=pccont3(20,S(:,1:3),'knorm',32,h,col);
  title('20% contour');
  w=pclevel(40,d); const=w(1);
  subplot(222); [Tx,Ty,Tz]=surfcv(X,Y,Z,f,const,col);
  title('40% contour');
  w=pclevel(60,d); const=w(1);
  subplot(223); [Tx,Ty,Tz]=surfcv(X,Y,Z,f,const,col);
  title('60% contour');
  pause; close;
  count=count+1;
end;
