function highT = highT(L,N) %L=size of lattice %N=number of Monte Carlo steps %initialize as all ones A=ones(L,L); %randomly populate with +/-1 %for j=1:L % for k=1:L % A(j,k)=-1+2*round(rand(1)); %gives either +1 or -1 % end %end for i=1:N x=ceil(L*rand(1)); y=ceil(L*rand(1)); A(x,y)=-A(x,y); m(i)=sum(sum(A))/L^2; end plot(m)