Latice-Computational Physics-Codes, Exercises of Computational Physics

Main topics for this course are Brownian dynamics, chaos, fluctuation, genetic algorithm, modelling and simulations, moments and variance, Monte Carlo modelling of neutron motion. This is code for assigned task. Its main points are: Lattice, Function, Magnetization, Average, Energy, Return, Single, Site, Input, Matrix, Z-component, Axis

Typology: Exercises

2011/2012

Uploaded on 08/12/2012

laniban
laniban 🇮🇳

4

(1)

78 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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