NMR and MRI physics · Introductory

FID to spectrum with the Fourier transform

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

After a radiofrequency pulse, the transverse magnetization precesses and decays, inducing a signal called the free induction decay (FID) in the receiver coil. The Fourier transform converts this time-domain signal into a frequency-domain spectrum, in which each precessing frequency appears as a peak whose width reflects its decay rate.

Intuition

The FID is a sum of decaying oscillations, one for each chemical environment. In the time domain they overlap and interfere, so the signal looks like a messy wiggle. The Fourier transform acts like a bank of tuning forks: for each test frequency it asks how strongly the signal oscillates at that frequency. Frequencies present in the signal give large responses (peaks), and others cancel to near zero. A fast-decaying signal is short in time and therefore broad in frequency; a slowly decaying one gives a narrow, sharp peak. This is why T2* (decay time) sets the linewidth.

Key equations

s(t)=Aei2πν0te−t/T2∗,t≥0
(1)

Complex FID of a single resonance at offset frequency nu0 with decay time T2*.

S(ν)=∫−∞∞s(t)e−i2πνtdt
(2)

Fourier transform: spectrum S at frequency nu.

S(ν)=A1/T2∗+i2π(ν−ν0)
(3)

Result for one decaying exponential: a Lorentzian line centred at nu0.

Δν1/2=1πT2∗
(4)

Full width at half maximum of the absorption peak.

Derivation

  1. Start with the single-resonance FID s(t)=A exp(i2πν0 t) exp(-t/T2*) for t≥0, and zero for t<0.
  2. Insert into the Fourier integral: S(ν)=A∫0^∞ exp[-(1/T2* + i2π(ν-ν0))t] dt.
  3. Combine the exponents; the integral of exp(-at) from 0 to infinity is 1/a when Re(a)>0, which holds since 1/T2*>0.
  4. So S(ν)=A/(1/T2* + i2π(ν-ν0)).
  5. Multiply top and bottom by the complex conjugate to separate real and imaginary parts: Re S = A(1/T2*)/((1/T2*)²+(2π(ν-ν0))²), the absorption Lorentzian; Im S is the dispersion part.
  6. The real part falls to half its maximum when 2π|ν-ν0|=1/T2*, giving full width Δν=1/(πT2*).

Worked example

Problem

An FID has a single resonance at 100 Hz offset and T2* = 0.10 s. Find the peak position and the full width at half maximum of the spectral line.

  1. The FID is exp(i2π·100·t) exp(-t/0.10).
  2. The Fourier transform peaks at ν0 = 100 Hz.
  3. Use Δν = 1/(π T2*) = 1/(π × 0.10).
  4. 1/(0.314) ≈ 3.18 Hz.

Answer Peak at 100 Hz with a linewidth of about 3.2 Hz.

Common mistakes

  • Thinking the peak height and width are independent: for a fixed amplitude A, a shorter T2* gives a broader and lower peak.
  • Confusing the angular frequency ω (rad/s) with ν (Hz), which introduces errors of 2π in the linewidth.
  • Forgetting that the real part is absorption and the imaginary part is dispersion, so an unphased spectrum looks distorted.
  • Believing the spectrum frequency is the absolute Larmor frequency; it is usually the offset from the receiver reference frequency.
  • Ignoring that sampling limits the spectral range: the width is 1/Δt, so too slow sampling causes aliasing.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

scene.py(89 lines)
import sys
from manim import *
from blocks import *
import numpy as np

# Signal model: two decaying cosines (two chemical shifts), T2 decay
T2 = 0.5
FREQS = [5.0, 12.0]
AMPS = [1.0, 0.6]
N = 1024
DT = 0.01


def fid_signal(t):
    """Free induction decay: sum of damped cosines."""
    s = 0.0
    for f, a in zip(FREQS, AMPS):
        s = s + a * np.cos(2 * np.pi * f * t) * np.exp(-t / T2)
    return s


def compute_spectrum():
    """Real part of FFT of the sampled FID."""
    t = np.arange(N) * DT
    s = fid_signal(t)
    s[0] *= 0.5
    spec = np.fft.rfft(s).real
    freqs = np.fft.rfftfreq(N, DT)
    return t, s, freqs, spec


T_ARR, S_ARR, F_ARR, SPEC = compute_spectrum()


class Main(Scene):
    def construct(self):
        self.camera.background_color = "#101418"
        TitleCard(self, "FID to spectrum", "Fourier transform")

        # Time-domain plot
        tmask = T_ARR <= 1.5
        tt, ss = T_ARR[tmask], S_ARR[tmask]
        ax1 = Axes(x_range=[0, 1.5, 0.5], y_range=[-1.7, 1.7, 1],
                   x_length=5.6, y_length=3.2,
                   axis_config={"color": C_DIM, "include_tip": False})
        ax1.to_edge(LEFT, buff=0.6).shift(0.1 * UP)
        c1 = ax1.plot_line_graph(tt, ss, add_vertex_dots=False,
                                 line_color=C_MAIN, stroke_width=2)
        l1 = Text("FID: signal vs time (s)", font_size=24).next_to(ax1, UP, buff=0.2)
        self.play(Create(ax1), FadeIn(l1))
        self.play(Create(c1), run_time=3)

        # Frequency-domain plot
        fmask = F_ARR <= 20
        ff, sp = F_ARR[fmask], SPEC[fmask]
        ymax = float(sp.max()) * 1.1
        ax2 = Axes(x_range=[0, 20, 5], y_range=[0, ymax, ymax / 2],
                   x_length=5.6, y_length=3.2,
                   axis_config={"color": C_DIM, "include_tip": False})
        ax2.to_edge(RIGHT, buff=0.6).shift(0.1 * UP)
        l2 = Text("Spectrum (Hz)", font_size=24).next_to(ax2, UP, buff=0.2)
        arrow = Arrow(ax1.get_right() + 0.1 * RIGHT, ax2.get_left() + 0.1 * LEFT,
                      buff=0.0, color=C_ACCENT)
        ft = Text("FFT", font_size=24, color=C_ACCENT).next_to(arrow, UP, buff=0.1)
        self.play(GrowArrow(arrow), FadeIn(ft), Create(ax2), FadeIn(l2))
        c2 = ax2.plot_line_graph(ff, np.clip(sp, 0, None), add_vertex_dots=False,
                                 line_color=C_ACCENT, stroke_width=3)
        self.play(Create(c2), run_time=3)

        # Mark peaks
        marks = VGroup()
        for f in FREQS:
            d = Dot(ax2.c2p(f, 0), color=C_GOOD, radius=0.08)
            t = Text(f"{f:g} Hz", font_size=24, color=C_GOOD).next_to(d, DOWN, buff=0.35)
            marks.add(d, t)
        self.play(FadeIn(marks))
        StepCaption(self, "Each frequency in the decaying signal becomes a spectral peak.")
        self.wait(2)


if __name__ == "__main__" and "--selftest" in sys.argv:
    assert abs(fid_signal(0.0) - sum(AMPS)) < 1e-12
    mask = (F_ARR > 1) & (F_ARR < 20)
    top = F_ARR[mask][np.argmax(SPEC[mask])]
    assert abs(top - 5.0) < 0.5, top
    i12 = np.argmin(abs(F_ARR - 12.0))
    assert SPEC[i12] > 5 * abs(SPEC[np.argmin(abs(F_ARR - 8.5))])
    assert SPEC[np.argmin(abs(F_ARR - 5.0))] > SPEC[i12]
    print("ok")

The Manim scene code that draws this lesson's animation in the Signals AI app (Python, Manim Community).

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.