- #1

- 296

- 0

## Main Question or Discussion Point

Hi

I'm working on a matlab simulation of the 2D Ising model, and would like to verify my code and its results. One thing I'd like to try and observe is the transition from anti-ferromagnet to ferromagnet, but I'm not sure how to create the initial lattice in Matlab. I've already made a (pseudo)random lattice of spins and one that starts as a ferromagnet.

In other words, how can I create a lattice with alternating elements (1s and -1s)?

Also, is there a way to plot or graph my matrix as a colour/greyscale grid, so that -1s are black and +1s are black say? Currently I've used a surface plot but have to rotate the 3D image to a plan view.

I'm working on a matlab simulation of the 2D Ising model, and would like to verify my code and its results. One thing I'd like to try and observe is the transition from anti-ferromagnet to ferromagnet, but I'm not sure how to create the initial lattice in Matlab. I've already made a (pseudo)random lattice of spins and one that starts as a ferromagnet.

In other words, how can I create a lattice with alternating elements (1s and -1s)?

Also, is there a way to plot or graph my matrix as a colour/greyscale grid, so that -1s are black and +1s are black say? Currently I've used a surface plot but have to rotate the 3D image to a plan view.