function Z = plgenerate(D)

  if D == 1
    d1 = randg2(1000)*0.1 + 0.5;
    d2 = randg2(1000)*0.1 + ones(1000,1)*[-.3,.4];
    Z(1:2,:)=d1';
    Z(3:4,:)=d2';
    Z = reshape(Z,2,2000)';
  elseif D == 2
    d1 = randg2(1000)*0.1 + 0.5;
    d2 = randg2(1000)*0.1 + ones(1000,1)*[.3,.5];
    Z(1:2,:)=d1';
    Z(3:4,:)=d2';
    Z = reshape(Z,2,2000)';
  end
