
close all
clear all

N = 256;

%
% rank-1 lattice points
%

load ~/finance/unsw/z_d4096_m15_gf1

figure; pos=get(gcf,'pos'); pos(4)=pos(4)*0.75; set(gcf,'pos',pos);
subplot(1,2,1)
x = mod(z(1:2)*(1:N),N)/N;
plot(x(1,:),x(2,:),'*');
axis equal; axis([0 1 0 1]);
xlabel('x_1');
ylabel('x_2');
title('rank-1 lattice')

rng('default');

subplot(1,2,2)
x = rand(2,N);
plot(x(1,:),x(2,:),'*');
axis equal; axis([0 1 0 1]);
xlabel('x_1');
ylabel('x_2');
title('random points')

print('-deps2c','lec5a.eps')

%
% Sobol points
%

rng('default');

figure; pos=get(gcf,'pos'); pos(4)=pos(4)*0.75; set(gcf,'pos',pos);
subplot(1,2,1)
Ps = sobolset(2);   % dimension 2
Ps = scramble(Ps,'MatousekAffineOwen');
x  = net(Ps,N)';    % generate N points
plot(x(1,:),x(2,:),'*'); hold on
x = linspace(0,1,9);
plot([x; x],[0; 1]*ones(size(x)),'k')
plot([0; 1]*ones(size(x)),[x; x],'k')
axis equal; axis([0 1 0 1]);
xlabel('x_1');
ylabel('x_2');
title('Sobol points')

rng('default');

subplot(1,2,2)
x = rand(2,N);
plot(x(1,:),x(2,:),'*');
axis equal; axis([0 1 0 1]);
xlabel('x_1');
ylabel('x_2');
title('random points')

print('-deps2c','lec5b.eps')

