SpinTool (MATLAB)

Bloch simulations are an essential tool in magnetic resonance, and having a library which can quickly prototype and troubleshoot sequence issues is crucial. Our SpinTool library provides such a framework. It is written for MATLAB and can be downloaded from here:


As an example, consider how easy it is to code a simple (non-spatially selective) spin-echo experiment on a uniform, 10 mm sample with 100 spins on resonance, starting from the z-axis, with a chemical shift of 0 Hz in the rotating frame and T1=1000 ms, T2=200 ms:

spins = InitSpinsRelax(0, 100, 10, [0;0;1], 1000, 200);
seq = {{'hard', 90, 270}, {'delay', 1}, {'hard', 180, 0}, {'delay', 1}, {'acquire', 1000, 1, 0, 0, 0}};
[spinsOut, fid] = ApplySequence(spins, seq);

The cell array fid holds the resulting decaying FID. Plotting it is straightforward:

figure; plot(real(fid{1}));

The resulting plot looks like this:

Spin Echo FID

To get started, type "help ApplySequence" in MATLAB and read the MATLAB Cheat Sheet (in Word format) in the root directory of SpinTool.