
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

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