clear all
% mostra che epsilon troppo piccolo potrebbe portare in minimi locali
format short e
n = 10;
x = linspace(pi/2,2*pi,n);
H = x.^2.*sin(3*x);
plot(1:n,H,'*')
set(gca,'xtick',1:n)
axis([0,n+1,-40,30])
xlabel('stato')
ylabel('H')
for epsilon = [20,10,1,0.1,0.001]
    v = 1./sum(exp(-(repmat(H',1,n)-repmat(H,n,1))/epsilon));
    metropolis(v,ones(n)/n)
    disp('guarda P(5,5) e P(9,9)')
    pause
end
