Docsity

Latice-Computational Physics-Codes, Exercises of Computational Physics

Toggle sidebar
bg1
function Mz = avgMagnetization(lattice)
%avgEnergy: Returns the averge magnetization of a single
% site in a lattice
% Input:
% lattice - a matrix representing the lattice of spins
% containing the z component of those spins
% Output:
% Mz - the average magnetization of a site along
% the z-axis
Mz = sum(sum(sum(lattice)))/prod(size(lattice));
return

Partial preview of the text

Download Latice-Computational Physics-Codes and more Exercises Computational Physics in PDF only on Docsity!

function Mz = avgMagnetization(lattice) %avgEnergy: Returns the averge magnetization of a single % site in a lattice % Input: % lattice - a matrix representing the lattice of spins % containing the z component of those spins % Output: % Mz - the average magnetization of a site along % the z-axis Mz = sum(sum(sum(lattice)))/prod(size(lattice)); return