Sampling, Fourier & LTI systems
The rigorous DSP under every RF line: what sampling does to a spectrum, why a 5 MHz probe can be sampled at 6.75 MHz, what the DFT actually measures, how windows trade mainlobe for sidelobes, why the pulse is the axial point-spread function and the aperture's Fourier transform is the lateral one. Every later step (IQ, delay estimation, ULM localization, sound-speed and phase-screen estimation) assumes these results.
You will be able to
- Predict the alias of any tone and the legal bandpass sampling rates for an RF band
- Separate DFT bin spacing from true frequency resolution, and know what zero padding buys
- Choose a window from its PSL, −3 dB width, ENBW and scalloping loss
- Model an RF line as pulse ∗ reflectivity and compute axial resolution from \(f_{0}\) and bandwidth
- Size FFT convolutions, pick FIR vs IIR, and compute grating-lobe angles
- Treat the beam as the Fourier transform of the aperture: one-way vs two-way, rect vs Hann sidelobes and widths
- Read the 2D k-space of an RF image: axial band at \(\pm 2f_{0}/c\), lateral extent from the transmit–receive aperture autoconvolution
Assumes
- Module 01 · Complex numbers and phasors: phasors, negative frequencies, I and Q
- Module 02 · The DFT and FFT by hand: DFT and inverse, Parseval, leakage, zero padding, FFT (recapped here, not re-derived)
- Module 03 · Convolution, LTI systems and filters: convolution, eigenfunctions and \(H(e^{j\omega})\), the convolution and windowing theorems, circular convolution, group delay, poles and zeros
- DAS beamforming, apodization, grating lobes in practice
- Optional further reading: Module 05 (the DFT as a unitary change of basis) and Module 06 (the SVD clutter filter cited in the filter table)
04.1Continuous ↔ discrete: sampling replicates the spectrum
Model ideal sampling at rate \(f_{s} = 1/T_{s}\) as multiplication by an impulse train. Multiplication in time is convolution in frequency, and the Fourier transform of an impulse train with period \(T_{s}\) is an impulse train with period \(f_{s}\) (Poisson summation). So the sampled spectrum is the original spectrum copied at every multiple of \(f_{s}\):
- \(T_s\)
- sampling period, \(f_s = 1/T_s\)
- \(\delta(t)\)
- Dirac impulse
- \(x_s(t)\)
- ideally sampled signal
- \(x(t)\)
- continuous-time signal
- \(t\)
- time, µs
- \(n\)
- sample index, integer
- \(\sum_n\delta(t-nT_s)\)
- impulse train (sampling comb)
- \(\sum_n\delta(t-nT_s)\)
- impulse train of period \(T_s\), µs
- \(T_s,\ f_s\)
- sampling period (µs) and rate (MHz), \(f_s=1/T_s\)
- \(f\)
- frequency, MHz
- \(k\)
- comb index, integer
- \(\delta\)
- Dirac impulse
- \(\longleftrightarrow\)
- Fourier-transform pair
- \(X(f)\)
- spectrum of the continuous signal x(t)
- \(f_s\)
- sampling rate, MHz
- \(k\)
- replica index, any integer
- \(\ast\)
- convolution
- \(X_s(f)\)
- spectrum of the sampled signal, periodic with period \(f_s\)
- \(f\)
- frequency, MHz
Nyquist–Shannon. If \(X(f) = 0\) for \(|f| \ge B\) and \(f_{s} > 2B\), the replicas do not overlap. An ideal low-pass filter with cutoff \(f_{s}/2\) and gain \(T_{s}\) keeps only the \(k = 0\) copy. Its impulse response is a sinc, so reconstruction is sinc interpolation:
- \(x[n]\)
- samples \(x(nT_s)\)
- \(x(t)\)
- reconstructed continuous signal
- \(t\)
- time, µs
- \(n\)
- sample index
- \(T_s\)
- sampling period, µs
- \(\operatorname{sinc}(u)\)
- normalized sinc, \(\sin(\pi u)/(\pi u)\), \(u\) dimensionless
Aliasing. When the replicas overlap, the reconstruction filter returns whatever copy lands in \([-f_{s}/2, f_{s}/2]\). For a tone at \(f_{0}\), the copy at \(f_{0} - k f_{s}\) with \(k = \operatorname{round} (f_{0}/f_{s})\) lands in band, so
- \(f_0\)
- tone frequency, MHz
- \(f_{\mathrm{alias}}\)
- apparent (aliased) frequency, MHz
- \(f_s\)
- sampling rate, MHz
- \(\operatorname{round}(\cdot)\)
- nearest integer
- \(\lvert\cdot\rvert\)
- absolute value
The sinc sum is not an approximation to the alias: for an infinite sample record it equals it exactly. I checked this numerically (40 001 samples, \(f_{0} = 7\) MHz, \(f_{s} = 10\) MHz): the sinc sum and cos(2π·3 MHz·t − \(\varphi\)) agree to within \(2\times 10^{-5}\) near the record center, which is the truncation error. The samples cannot tell the two waves apart.
Sampling a tone: samples, alias and spectral replicas
Exact formulaClosed-form tone, its samples and the in-band copy \(\cos (2\pi (f_{0} - kf_{s})t + \varphi )\); spectral lines at \(\pm f_{0} + kf_{s}\). The FFT readout is computed (1024 samples, Hann, parabolic peak interpolation).The Nyquist condition is strict: \(f_{s} > 2B\). At \(f_{0} = f_{s}/2\) the samples are \(\cos (\pi n + \varphi ) = (-1)^{n} \cos \varphi\). The amplitude depends on the unknown phase, and a sine \((\varphi = -\pi /2)\) samples to all zeros.
Slow-time sampling at the PRF obeys the same rule. A Doppler shift \(f_{D} = 2v f_{0}/c\) aliases once \(|f_{D}| > \mathrm{PRF}/2\), so \(v_{\mathrm{Nyq}} = c \cdot \mathrm{PRF} / (4 f_{0})\). At 5 MHz and PRF 5 kHz, \(v_{\mathrm{Nyq}} = 1540 \cdot 5000 / (4 \cdot 5\times 10^{6})\) \(= 0.385\) m/s. In ULM, bubble tracking at frame rate F has the same constraint in disguise: the frame-to-frame displacement must stay below the pairing search radius, or tracks link to the wrong bubble.
04.2Bandpass sampling for RF ultrasound
Nyquist needs \(f_{s} > 2B\) for a signal confined to \(|f| < B\). An RF echo is not low-pass: it occupies \([f_{L}, f_{H}]\) and its mirror \([-f_{H}, -f_{L}]\). Replication only fails if a copy of one band lands on the other. The band can therefore be sampled below \(2f_{H}\) as long as it fits entirely inside one Nyquist zone \([(n-1)f_{s}/2, n f_{s}/2]\):
- \(f_L,\ f_H\)
- lower and upper band edges, MHz
- \(n\)
- Nyquist zone index
- \(f_s\)
- sampling rate, MHz
- \(f_L,\ f_H\)
- band edges (here at −6 dB), MHz
- \(B\)
- bandwidth, MHz
- \(n\)
- Nyquist zone that holds the whole band; n = 1 is ordinary Nyquist
- \(f_s\)
- sampling rate, MHz
- \(\lfloor\cdot\rfloor\)
- round down to an integer
Worked example with the band defined at −6 dB: \(f_{0} = 5\) MHz, 60 % fractional bandwidth gives [3.5, 6.5] MHz, \(B = 3\) MHz, \(\lfloor 6.5/3\rfloor = 2\). The legal zones are \(f_{s} \ge 13\) MHz \((n = 1)\) and \(6.5 \le f_{s} \le 7.0\) MHz \((n = 2)\). The second zone is only 0.5 MHz wide. Any clock drift or underestimated bandwidth folds the band onto itself, which is why practical systems leave a guard band.
Quadrature \((4f_{0})\) sampling. At \(f_{s} = 4f_{0}\), consecutive samples of \(\cos (2\pi f_{0}t + \varphi (t))\) fall at carrier phases \(0, \pi /2, \pi ,\ 3\pi /2\), giving I, −Q, −I, Q (sign convention aside). Pairs of samples are already the in-phase and quadrature components, a quarter period apart. Undersampled variants \((f_{s} = 4f_{0}/(2m+1))\) advance the carrier phase by \((2m+1)\cdot \pi /2\) per sample, so they keep the quarter-period interleaving; for odd m the step is \(-\pi /2\) modulo \(2\pi\) and the sign of Q flips (spectral inversion). Module 08 derives the analytic signal and makes this exact.
Bandpass sampling: where the replicas land
Exact formulaReplica positions and legal zones from (04.6)–(04.7); each band is drawn as a flat block between its −6 dB edges.Research scanners expose this choice: Verasonics, for example, offers a 4-samples-per-wavelength receive mode (NS200BW) plus reduced-rate bandpass modes. Channel data used for sound-speed estimation and aberration correction is often stored at these rates. Before any delay-domain processing (Module 11), you must know which Nyquist zone the data sits in, and whether the spectrum is inverted.
04.3The DFT as a measurement: record length, bins and resolution
Recap from Module 02. The DFT \(X[k] = \sum_{n} x[n]\,e^{-j2\pi kn/N}\) correlates the record with N rotating probes (Section 02.2, (02.4)). The probes are orthogonal because the roots of unity sum to zero (Section 02.3, (02.5)), so the inverse (02.13) rebuilds x[n], \(\mathbf{F}/\sqrt{N}\) is unitary and Parseval (02.14) holds. Bins above N/2 are negative frequencies (Section 02.5), and the FFT computes all N bins in \((N/2)\log_2 N\) multiplies (Section 02.8). Those derivations are not repeated here. This section treats the DFT as a measurement of a sampled RF or Doppler record and asks what a record of finite length can resolve.
What the DFT samples. X[k] equals the DTFT \(X(e^{j\omega})\) at \(\omega _{k} = 2\pi k/N\), i.e. at frequencies \(f_{k} = k f_{s}/N\). The record length \(T = N/f_{s}\) fixes what can be resolved. Observing N samples multiplies the signal by a rectangular window, whose DTFT is the Dirichlet kernel \(\lvert W_R(e^{j\omega})\rvert = \lvert \sin(N\omega/2)/\sin(\omega/2)\rvert\) (worked for an off-bin tone in Section 02.7, (02.15)). Its first nulls sit at \(\omega = \pm 2\pi/N\), i.e. \(\pm f_{s}/N = \pm 1/T\): two tones closer than ≈ 1/T merge into one lobe.
| Quantity | Formula | N = 1024, fs = 40 MHz | Changed by zero padding to P·N? |
|---|---|---|---|
| Bin spacing | \(f_{s}/N\) | 39.06 kHz | Yes: \(f_{s}/(PN)\) |
| Observation time | \(T = N/f_{s}\) | 25.6 µs | No |
| Resolution (rect, null-to-peak) | ≈ 1/T | 39.06 kHz | No |
| Resolution (Hann, −3 dB width) | 1.44/T | 56.3 kHz | No |
Zero padding appends zeros, so the padded DFT samples the same DTFT on a finer grid. It interpolates the spectrum (useful for peak location and display) but adds no information about the signal: the kernel width is still set by T.
The DFT matrix as a basis
Exact formulaZero padding interpolates, it does not resolve
Exact formulaDTFT and zero-padded DFT of two unit complex tones evaluated numerically (JS); the relative phase is set at the first sample, \(n = 0\).A Doppler ensemble of 16 pulses at PRF 4 kHz has \(T = 4\) ms, so velocity-spectrum resolution is ≈ 250 Hz, or 3.9 cm/s at 5 MHz, no matter how much you pad. In QUS spectral estimation, the gate length plays the role of T: a 3 mm gate at 1540 m/s is 3.9 µs, so spectral features narrower than ≈ 0.26 MHz cannot be resolved. That is the depth-resolution versus spectral-resolution tradeoff behind backscatter and attenuation estimates.
04.4Windowing and spectral leakage
Multiplying the record by a window w[n] convolves the spectrum with \(W(e^{j\omega})\): the windowing theorem, (03.20) in Section 03.6, whose by-hand leakage example and Hann window are in Section 02.7. A pure tone becomes a copy of W centered on its frequency: a mainlobe plus sidelobes that leak energy into every other bin. What 04 adds is the engineering choice of W, through four figures of merit:
- \(\mathrm{CG}\)
- coherent gain (scales a tone's peak)
- \(\mathrm{ENBW}\)
- equivalent noise bandwidth of one bin, in bins
- \(w[n]\)
- window (taper) samples
- \(n\)
- sample index, 0 … N−1
- \(N\)
- record length, samples
- \(\sum_n\)
- sum over \(n=0\ldots N-1\)
- \(\text{bins}\)
- unit: DFT bin widths, \(f_s/N\)
A tapered window lowers the edge discontinuity of the periodic extension, so the sidelobes fall off faster. The cost is a wider mainlobe, since a taper effectively shortens the record. The table lists DFT-even (periodic) windows, with values computed by this page's own code (\(N = 256\), 64× padding; reproduced by m04_fft_1d_basics.m). They agree with the values tabulated by Harris (1978) to within about 0.05 bin or 0.05 dB, and Harris rounds peak sidelobes to whole dB. Roll-off is the asymptotic far-sidelobe slope; measured from 10 to 40 bins at \(N = 256\) it is −5.7, −17.7, −5.5, −17.5 and −5.7 dB/octave.
| Window | w[n], a = 2πn/N | Peak sidelobe | −3 dB width | First null | ENBW | CG | Scalloping | Rolloff |
|---|---|---|---|---|---|---|---|---|
| Rectangular | 1 | −13.3 dB | 0.89 bin | \(\pm 1\) bin | 1.00 | 1.00 | 3.92 dB | −6 dB/oct |
| Hann | \(0.5 - 0.5 \cos a\) | −31.5 dB | 1.44 bin | \(\pm 2\) bin | 1.50 | 0.50 | 1.42 dB | −18 dB/oct |
| Hamming | \(0.54 - 0.46 \cos a\) | −42.7 dB | 1.30 bin | \(\pm 2\) bin | 1.36 | 0.54 | 1.75 dB | −6 dB/oct |
| Blackman | \(0.42 - 0.5 \cos a + 0.08 \cos 2a\) | −58.1 dB | 1.64 bin | \(\pm 3\) bin | 1.73 | 0.42 | 1.10 dB | −18 dB/oct |
| Kaiser \(\beta = 6\) | \(I_{0}(\beta \sqrt{1-(2n/N-1)^{2}}) / I_{0}(\beta )\) | −43.8 dB | 1.40 bin | \(\pm 2.16\) bin | 1.47 | 0.50 | 1.51 dB | −6 dB/oct |
Hamming chooses its coefficients to cancel the first sidelobe, which gives a lower peak but a slow −6 dB/octave far-out decay. Hann and Blackman are smooth at the edges, so the far sidelobes decay at −18 dB/octave. Kaiser trades continuously through \(\beta\). Two tones are resolvable when the weaker one rises above the stronger one's leakage and sits outside its mainlobe. Strong dynamic range calls for low sidelobes, and close equal tones call for a narrow mainlobe.
Two tones, one window: leakage vs resolution
Exact formulaZero-padded DFT and 32× padded DTFT of two windowed tones, computed (JS).The array factor of a linear array is the DTFT of the apodization weights, evaluated at \(u = (d/\lambda )(\sin \theta - \sin \theta _{0})\). A rectangular receive aperture is the rectangular window: −13.3 dB first sidelobes, narrowest mainlobe. Hann apodization lowers the sidelobes to −31.5 dB and widens the mainlobe by 1.44/0.89 ≈ 1.6×. That is the same tradeoff you already make between lateral resolution and off-axis clutter, with identical numbers. Sections 04.7 and 04.8 make the mapping explicit.
Windowing changes amplitudes. Divide by CG to read tone amplitudes, and by ENBW when converting a noise floor to a per-Hz density. Forgetting the factor 2 (Hann \(\mathrm{CG} = 0.5\)) is a 6 dB error in a backscatter coefficient.
04.5LTI systems: the RF line is pulse ∗ reflectivity
Recap from Module 03. An LTI system is fully described by its impulse response h, and its output is the convolution \(y = h \ast x\) (03.4). Complex exponentials are its eigenfunctions, with eigenvalue \(H(e^{j\omega})\) (03.9), so the convolution theorem (03.19) turns \(y = h \ast x\) into \(Y = HX\). Here the question is which parts of the ultrasound signal chain actually satisfy those two assumptions.
| Block of the receive chain | Linear? | Shift-invariant? | Consequence |
|---|---|---|---|
| Excitation, transmit and receive transducer responses | Yes (small signal) | Yes | Combine into one two-way pulse p(t) |
| Weak scattering (first-order Born) | Yes | Yes, in a homogeneous medium | RF line = p ∗ reflectivity, (04.9) |
| Frequency-dependent attenuation | Yes | No: the filter changes with depth | LTI only within a short depth gate (the downshift callout below) |
| Nonlinear propagation at high pressure | No | n/a | Harmonics appear; exploited in harmonic imaging (Module 15) |
| TGC | Yes | No: a gain that varies with time | Undo it, or keep it out of spectral estimates |
| Anti-alias filter, ADC, digital band-pass | Yes (ADC up to quantization) | Yes | Fold into p(t); the subject of 04.1, 04.2 and 04.6 |
| Dynamic-receive DAS | Yes | Only locally (the PSF varies with depth and angle) | Image = PSF ∗∗ reflectivity holds patch by patch, 04.8 |
| Envelope detection, log compression | No | Yes | Do every Fourier argument on RF or IQ data, before detection |
1D pulse-echo model. Map depth to round-trip time \(t = 2z/c\). With a weakly scattering medium (first-order Born), a pulse-echo impulse response p(t) that does not change with depth, and no attenuation, the received RF line is
- \(p(t)\)
- two-way pulse-echo impulse response (the axial PSF)
- \(\rho(t)\)
- reflectivity along the beam, mapped to round-trip time \(t = 2z/c\)
- \(n(t)\)
- additive noise
- \(R,\ P,\ S\)
- spectra of the RF line, the pulse and the reflectivity
- \(t\)
- time, µs
- \(f\)
- frequency, MHz
- \(\ast\)
- convolution
- \(\mathcal{F}\{\cdot\}\)
- Fourier transform
Gaussian pulse and the time–bandwidth product. Take \(p(t) = e^{-t^{2}/2\sigma _{t}^{2}} \cos (2\pi f_{0}t)\). Its spectrum magnitude is a Gaussian around \(\pm f_{0}\) with amplitude standard deviation \(\sigma _{f} = 1/(2\pi \sigma _{t})\). The −6 dB (half-amplitude) widths are both \(2\sqrt{2 \ln 2} \sigma\):
- \(\sigma_t\)
- standard deviation of the Gaussian envelope, µs
- \(\tau_{-6\,\mathrm{dB}}\)
- pulse duration at half amplitude, µs
- \(B_{-6\,\mathrm{dB}}\)
- bandwidth at half amplitude, MHz
- \(\ln\)
- natural logarithm
- \(\tau\cdot B\)
- time-bandwidth product (dimensionless) of the Gaussian pulse
- \(\tau,\ B\)
- shorthand for \(\tau_{-6\,\mathrm{dB}}\) (µs) and \(B_{-6\,\mathrm{dB}}\) (MHz)
- \(\sigma_t',\ \sigma_f'\)
- rms widths of the energy densities in time and frequency
- \(\lvert p\rvert^2,\ \lvert P\rvert^2\)
- energy densities in time and in frequency
- \(p,\ P\)
- pulse and its Fourier transform
- \(\sigma_t\sigma_f\)
- product in µs·MHz (dimensionless)
- \(c\)
- sound speed, 1.540 mm/µs
- \(\Delta z\)
- axial resolution, mm
- \(\tau_{-6\,\mathrm{dB}}\)
- pulse duration at half amplitude, µs, as in (04.10)
RF line = pulse ∗ reflectivity: time and frequency
SimulationGaussian pulse at \(f_{s} = 100\) MHz convolved with two reflectors or seeded random reflectivity by zero-padded 2048-point FFTs (JS); 1D, no attenuation, no diffraction.Frequency-dependent attenuation multiplies P(f) by \(e^{-2\alpha _{0} f z}\). Completing the square in the Gaussian exponent shifts the center frequency down by \(\Delta f = 2\alpha _{0} z \sigma _{f}^{2}\) (\(\alpha _{0}\) in Np/cm/MHz, \(\sigma _{f}\) the amplitude-spectrum \(\sigma\)). For 0.5 dB/cm/MHz (0.0576 Np/cm/MHz), \(\sigma _{f} = 3/2.355 = 1.27\) MHz and \(z = 4\) cm, the shift is 0.75 MHz. That shift is the basis of spectral-shift attenuation estimators in QUS. It also means the effective pulse, and so the delay-estimation and sound-speed algorithms of Module 11, changes with depth.
ULM exists because of this section. The pulse bandwidth sets \(\Delta z \approx 0.23\) mm and diffraction sets the lateral PSF, so two scatterers closer than the PSF cannot be separated by any linear filter: the information at those spatial frequencies was multiplied by ≈ 0. ULM bypasses the limit by imaging isolated sources one at a time and estimating each center far more precisely than the PSF width (estimation, not resolution).
04.6FFT filtering of RF data, and the filters on the signal chain
The DFT diagonalizes circular convolution, not linear convolution: the N-point inverse of \(X[k]H[k]\) is the linear result aliased in time with period N ((03.8), Section 03.3). It is the dual of 04.1: sampling the spectrum at N points replicates the time signal with period N, exactly as sampling time at \(f_s\) replicates the spectrum.
With x of length L and h of length M, the linear result has length \(L + M - 1\). The circular result equals it only if no replica overlaps, so \(N \ge L + M - 1\). For long RF lines, overlap-add or overlap-save applies the same rule block by block.
Wrap-around: circular convolution with too short an FFT
Exact formulaFilters on the ultrasound signal chain
The filter basics are in Module 03: difference equations, \(H(z)\), poles and stability in Section 03.7 ((03.21), (03.24)), and phase and group delay \(\tau_g = -d\varphi/d\omega\) in Section 03.5 ((03.16)), including the result used below: a symmetric M-tap FIR has exactly linear phase and delays every frequency by \((M-1)/2\) samples. Design methods (windowed and equiripple FIR, IIR prototypes, wall filters, decimation) are the subject of Module 09. What matters at this point is which filter sits where in an ultrasound system, and the delay it adds.
| Property | FIR | IIR |
|---|---|---|
| Stability | Always (no feedback) | Poles must lie inside the unit circle |
| Phase | Exactly linear if symmetric | Nonlinear (zero-phase only offline, forward–backward) |
| Order for a sharp transition | High (tens to hundreds of taps) | Low (4–8) |
| Transient on short records | \(M - 1\) samples, then exact | Long ringing; needs initialization (critical for 8–16-pulse Doppler ensembles) |
| Ultrasound filter | Domain | Typical design | Why |
|---|---|---|---|
| RF bandpass (noise, harmonics) | fast time, \(f_{s}\) 20–62.5 MHz | Symmetric FIR, 32–128 taps | Linear phase keeps echo timing consistent across channels |
| Doppler wall filter | slow time, PRF 0.5–10 kHz | FIR, IIR with initialization, or polynomial regression | Removes tissue clutter at |f| up to tens or hundreds of Hz |
| SVD clutter filter (Module 06) | space × slow time | Data-adaptive projection | Separates tissue from blood or bubbles when their Doppler spectra overlap but their spatial coherence differs. This is the front end of ULM |
A 63-tap symmetric FIR at 40 MHz delays everything by 31 samples = 0.775 µs = 0.60 mm of depth. Compensate it, and apply the identical filter to every channel. A channel-dependent group delay is indistinguishable from an aberration or a sound-speed error, which is exactly what Module 11 delay estimators and phase-screen methods try to measure.
04.7Spatial sampling across the array
The array samples the aperture at pitch d, exactly as the ADC samples time at \(T_{s}\). For far-field (or focal-plane) direction \(\theta\), with steering \(\theta _{0}\) and weights \(w_{n}\):
- \(w_n\)
- apodization weight of element n
- \(d\)
- element pitch, mm
- \(\theta,\ \theta_0\)
- observation and steering angles
- \(\lambda\)
- wavelength c/f, mm
- \(\mathrm{AF}(\theta)\)
- array factor: far-field complex response vs angle
- \(n\)
- element index
- \(k\)
- wavenumber, rad/mm
- \(j\)
- imaginary unit, \(j^2=-1\)
- \(\sum_n\)
- sum over the elements
- \(\theta_g\)
- grating-lobe direction (exists when \(\lvert\sin\theta_g\rvert \le 1\))
- \(m\)
- grating-lobe order
- \(d,\ \lambda\)
- pitch and wavelength, mm
- \(\sin\theta_0\)
- steering direction
- \(\pm\theta_{\max}\)
- largest steering angle needed, deg
| f0 | λ (c = 1540 m/s) | d/λ (d = 0.3 mm) | GL at θ0 = 0° | GL at θ0 = 20° | Max steer, GL-free | Pitch for ±20° |
|---|---|---|---|---|---|---|
| 3 MHz | 0.513 mm | 0.58 | none | none | 45.3° | 0.383 mm |
| 5 MHz | 0.308 mm | 0.97 | none \((|\sin | = 1.03)\) | −43.2° | 1.5° | 0.230 mm |
| 7.5 MHz | 0.205 mm | 1.46 | \(\pm 43.2^{\circ}\) | −20.0° | none | 0.153 mm |
The table is monochromatic and treats elements as points. Two effects soften it in practice: a broadband pulse spreads each grating lobe over a range of angles (its position scales with \(\lambda\), so with 1/f), and the element factor of each finite-width element attenuates lobes far from broadside. Section 04.8 quantifies both and connects the array factor to the focal-plane PSF and to 2D k-space.
Array factor: spatial aliasing and apodization
Approx. modelFar-field (Fraunhofer) array factor of point elements, closed-form sums; optional element factor \(\operatorname{sinc} (w \sin \theta /\lambda ), w = 0.9d\) (rigid baffle); the 60 % option averages two-way power patterns over 25 frequencies of a Gaussian spectrum.04.8The beam is a Fourier transform: aperture, focal plane and 2D k-space
From aperture to beam. Let \(a(\xi )\) be the apodization across the aperture (\(\xi\) along the array, length D). In the paraxial (Fresnel) approximation the narrowband field at lateral position x and depth z is
- \(a(\xi)\)
- apodization across the aperture, ξ along the array
- \(D\)
- aperture length, mm
- \(x,\ z\)
- lateral position and depth, mm
- \(p(x,z)\)
- narrowband complex pressure field
- \(\xi\)
- position along the aperture, mm
- \(\lambda\)
- wavelength, mm
- \(\propto\)
- proportional to
- \(d\xi\)
- integration over the aperture
- \(j\)
- imaginary unit, \(j^2=-1\)
Fraunhofer condition. If the quadratic phase is negligible (the antenna convention is ≤ \(\pi /8\), i.e. \(z \ge 2D^{2}/\lambda\)), the integral is the Fourier transform of a evaluated at spatial frequency \(x/(\lambda z)\), equivalently at \(\sin \theta /\lambda\). For a 128-element, 0.3 mm array at 5 MHz (\(D = 38.4\) mm), \(2D^{2}/\lambda = 9.6\) m, and even the near-field length \(D^{2}/(4\lambda )\) is 1.2 m. Unfocused far-field imaging never happens in tissue.
Focal-plane equivalent. A focusing delay law multiplies the aperture by \(e^{-j\pi \xi ^{2}/(\lambda F)}\), which cancels the Fresnel phase exactly at \(z = F\). In the focal plane, for any F (within the paraxial approximation):
- \(F\)
- focal depth, mm; F# = F/D
- \(k_x\)
- lateral spatial frequency, cycles/mm
- \(A\)
- Fourier transform of the apodization
- \(p(x, F)\)
- narrowband field across the focal plane
- \(\lambda\)
- wavelength, mm
- \(\xi\)
- position along the aperture, mm
- \(x\)
- lateral position, mm
- \(\propto\)
- proportional to
- \(j\)
- imaginary unit, \(j^2=-1\)
Uniform aperture. \(a = \operatorname{rect} (\xi /D)\) gives \(p \propto \operatorname{sinc} (Dx/(\lambda F))\) \(= \operatorname{sinc} (x/(\lambda F\#))\): first null at \(x = \lambda F\#\), first sidelobe at \(1.43 \lambda F\#\). Pulse-echo with the same aperture and focus on transmit and receive multiplies the two patterns (reciprocity), so the two-way amplitude is the square and every dB value doubles. The numbers below are exact for the continuous aperture and match m04_aperture_to_beam.m for 64 elements:
| Aperture | Pattern | First sidelobe | −6 dB width | −3 dB width | First null |
|---|---|---|---|---|---|
| Uniform (rect) | one-way, sinc | −13.26 dB | \(1.207 \lambda F\#\) | \(0.886 \lambda F\#\) | \(\pm 1 \lambda F\#\) |
| Uniform (rect) | two-way, \(\operatorname{sinc} ^{2}\) | −26.52 dB | \(0.886 \lambda F\#\) | \(0.638 \lambda F\#\) | \(\pm 1 \lambda F\#\) |
| Hann | one-way | −31.47 dB | \(2.000 \lambda F\#\) | \(1.441 \lambda F\#\) | \(\pm 2 \lambda F\#\) |
| Hann | two-way | −62.93 dB | \(1.441 \lambda F\#\) | \(1.028 \lambda F\#\) | \(\pm 2 \lambda F\#\) |
The two-way −6 dB width equals the one-way −3 dB width, because squaring maps 0.707 to 0.5. "Lateral resolution ≈ λF#" is a rounded version of these numbers; quote the constant with its convention. At 5 MHz and \(F\# = 2\) (\(\lambda F\# = 0.616\) mm), the rect two-way −6 dB width is 0.546 mm.
Broadband. A pulse contains many wavelengths, and the pattern at frequency f is the narrowband pattern with \(\lambda = c/f\), so it scales with 1/f. The time-integrated (energy) pattern is
- \(A_T,\ A_R\)
- transforms of the transmit and receive apodizations
- \(P(f)\)
- pulse spectrum
- \(E(x)\)
- pulse-echo beam energy at lateral position \(x\)
- \(x\)
- lateral position, mm
- \(f\)
- frequency, MHz
- \(F\)
- focal depth, mm
- \(c\)
- sound speed, 1.54 mm/µs
Depth of field. Along the axis near the focus, the defocus phase \(\pi \xi ^{2}\Delta z/(\lambda F^{2})\) plays the role of the Fresnel term. For a circular aperture (paraxial, Fresnel number \(D^{2}/(4\lambda F) \gg 1\)) the on-axis intensity is \(\operatorname{sinc} ^{2}(\Delta z/(8\lambda F\#^{2}))\), so the full −3 dB (one-way) depth of field is \(2 \times 0.443 \times 8 = 7.09 \lambda F\#^{2}\). A 1D line aperture gives \(6.95 \lambda F\#^{2}\) (numerical Fresnel integral). That is the "7 λF#²" rule. With the same focus on transmit and receive, that is also the two-way −6 dB depth of field. With dynamic receive focusing, the two-way depth of field is set by the transmit alone: −6 dB one-way, \(9.7 \lambda F\#^{2}\). At 5 MHz, \(F\# = 2:\ 0.55\) mm lateral width, 8.7 mm depth of field; at \(F\# = 4:\ 1.09\) mm and 35 mm. Lateral width scales with F#, depth of field with F#².
2D: image ↔ k-space. Under the same first-order Born and shift-invariance assumptions as 04.5, a small RF image is a 2D convolution of the point-spread function with the reflectivity, and the 2D FFT turns it into a product:
- \(h(x, z)\)
- 2D point-spread function
- \(\ast\ast\)
- 2D convolution
- \(k_x,\ k_z\)
- lateral and axial spatial frequencies, cycles/mm
- \(I(x,z)\)
- image
- \(\rho(x,z)\)
- reflectivity (scatterer map)
- \(\hat{I},\ H,\ \hat{S}\)
- 2-D Fourier transforms of \(I,\ h,\ \rho\)
- \(x,\ z\)
- lateral and axial position, mm
- \(\longleftrightarrow\)
- Fourier-transform pair
Plane waves sample the transmit k-space. A plane wave at angle \(\theta\) has wave vector \((\sin \theta , \cos \theta )/\lambda\); an echo received along direction \(\varphi\) adds \((\sin \varphi , \cos \varphi )/\lambda\). The pulse-echo spatial frequency is the sum, so each transmit angle shifts the receive k-space region laterally by \(\sin \theta /\lambda\). Coherent compounding over a uniform step \(\Delta (\sin \theta )\) samples the transmit spectrum, which replicates the synthetic transmit focus laterally with period \(\lambda /\Delta (\sin \theta )\), independent of depth. At 5 MHz, a 1° step gives 17.6 mm, so too coarse an angle set brings back grating-lobe-like artifacts from the side. Fourier-domain plane-wave reconstructions (f-k migration) use exactly this mapping.
Every number in the table assumes narrowband, identical transmit and receive apertures and the same focus. A real B-mode line uses a fixed transmit focus, dynamic receive focus and an expanding receive aperture, so the two-way pattern is the product of two different patterns: levels add in dB angle by angle, not peak by peak. A rect receive with a Hann transmit has its first two-way sidelobe at −24.8 dB, not −13.3 − 31.5 = −44.8 dB, because the wide Hann mainlobe still covers the rect's first sidelobe. Outside the transmit focal zone the transmit pattern is not a sinc at all.
Aberration correction and sound-speed estimation live in this picture. A wrong sound speed adds a residual quadratic phase across the aperture, i.e. a defocus: the focal-plane pattern is no longer \(A(x/(\lambda F))\), its nulls fill and its mainlobe widens, exactly like the Fresnel term above. A phase screen multiplies \(a(\xi )\) by \(e^{j\varphi (\xi )}\), so the PSF becomes the transform of \(a(\xi )e^{j\varphi (\xi )}\). Coherence-based estimators (Module 07) rest on the same transform: by the van Cittert–Zernike theorem, the spatial coherence of echoes from diffuse scatterers across the receive aperture is the Fourier transform of the transmit beam intensity at the focus, i.e. the autocorrelation of the (possibly aberrated) transmit aperture function.
04.9Visual summary
Eleven pictures that carry the module. Each card is a question you should answer in five seconds, the answer with its number, and the figure computed from the formula. The slider rescales the two transform-pair cards (sampling and the two-way aperture): narrowing one side always widens the other.
04.10How experts think about it
Experts carry one picture: every linear stage of the imaging chain is a multiplication in some Fourier domain. The pulse multiplies the reflectivity spectrum in \(k_{z}\), the aperture multiplies it in \(k_{x}\), sampling replicates spectra, and a finite record or aperture convolves them with a sinc-like kernel. Resolution, sidelobes, grating lobes, aliasing and wrap-around are the same few facts seen in time, frequency, space and angle.
In the paraxial integral, the field at x is \(\int a(\xi ) e^{j\pi \xi ^{2}/(\lambda z)} e^{-j2\pi \xi x/(\lambda z)} d\xi\). If the quadratic phase \(\pi D^{2}/(4\lambda z)\) is negligible (Fraunhofer, \(z \ge 2D^{2}/\lambda\) by the \(\pi /8\) convention), what remains is the FT of the apodization at \(k_{x} = x/(\lambda z) = \sin \theta /\lambda\). A focusing delay law \(e^{-j\pi \xi ^{2}/(\lambda F)}\) cancels the quadratic phase exactly at \(z = F\), so the focal plane is a Fraunhofer plane at any depth. \(D = 38.4\) mm at 5 MHz: \(2D^{2}/\lambda = 9.6\) m, so in tissue the statement is always about the focal plane. See (04.16).
The convolution theorem (Module 03, (03.19)) applied to the pulse-echo model. The RF line \(r = p \ast \rho\) becomes R = P·S: the pulse spectrum is the window through which the scatterers are seen. The dual is just as useful: windowing a record, truncating an aperture or sampling (multiplying by a comb) convolves the spectrum with W, a sinc or a comb. m04_rf_convolution.m checks max|R − P·S|/max|R| = \(2\times 10^{-16}\).
A rect aperture transforms to \(\operatorname{sinc} (x/(\lambda F\#))\). Its first sidelobe peak is at \(u = 1.4303\) where |sinc| = 0.2172, i.e. −13.26 dB. Pulse-echo with identical transmit and receive apertures and focus multiplies the two patterns (reciprocity), so amplitude is squared and every dB value doubles: −26.52 dB, with nulls at the same places. m04_aperture_to_beam.m measures −13.25 / −26.51 dB for 64 elements.
The pattern at frequency f is the narrowband one with \(\lambda = c/f\), so its nulls and sidelobes sit at \(x \propto 1/f\). The energy pattern \(\int |P(f)|^{2}|A_{T}A_{R}|^{2}\) df averages patterns whose nulls do not line up, so nulls fill and sidelobe peaks average down into a smooth skirt. For a 60 % Gaussian band (two-way, rect) the first null rises to −24.0 dB and the level at the narrowband sidelobe position falls to −28.8 dB (m04_aperture_to_beam.m, section 5).
The array factor is the DTFT of the weights at \(\psi = 2\pi d(\sin \theta - \sin \theta _{0})/\lambda\), periodic in \(\psi\) with period \(2\pi\). The main beam repeats wherever \(d(\sin \theta - \sin \theta _{0})/\lambda\) is an integer: the spatial version of spectral replication at multiples of \(f_{s}\). Their spacing in \(\sin \theta\) is \(\lambda /d\), so a larger pitch (coarser spatial sampling) brings them closer. \(d = \lambda\) steered to 20°: \(\sin \theta _{g} = 0.342 - 1\) \(= -0.658, \theta _{g}\) = −41.1°; \(d = 2\lambda\) adds −9.1° and +57.4°. See (04.14).
No grating lobe enters the visible region if \(|\sin \theta _{0} \pm \lambda /d| > 1\) for both signs, i.e. \(\lambda /d > 1 + |\sin \theta _{0}|\). For steering up to \(\pm 90^{\circ}\) that needs \(d \le \lambda /2\) (at equality the lobe sits at endfire). For \(\pm 20^{\circ}: d < \lambda /1.342 = 0.745\lambda\), which is 0.230 mm at 5 MHz. A 0.3 mm linear array is GL-free unsteered up to 5.1 MHz \((d < \lambda )\), but steerable to 20° only up to 3.8 MHz.
Each element of width w is itself a small aperture, so its directivity (the FT of a width-w rect) multiplies the array factor: pattern = \(E(\theta ) \cdot \mathrm{AF}(\theta )\). Grating lobes lie far off broadside where E is small. Example: \(d = \lambda , w = 0.9\lambda\), steered to 20°: \(E = -1.40\) dB at the main lobe and −5.76 dB at the −41.1° grating lobe, so the lobe drops to −4.4 dB one-way, −8.7 dB two-way (m04_aperture_to_beam.m, section 4). It also limits useful steering.
\(\operatorname{sinc} (u) = 0.5\) at \(u = 0.603\), so the one-way −6 dB full width is \(1.207 \lambda F\#\). Two-way \(\operatorname{sinc} ^{2} = 0.5\) needs \(\operatorname{sinc} = 0.707\) at \(u = 0.443\), giving \(0.886 \lambda F\#\), which is also the one-way −3 dB width (−3 dB amplitude and −3 dB intensity are the same number in dB). Hann: \(2.00 / 1.44 \lambda F\#\). At 5 MHz, \(F\# = 2\) (\(\lambda F\# = 0.616\) mm): 0.744 mm one-way, 0.546 mm two-way. m04_fft_2d_kspace.m measures 0.549 mm on a 60 % band PSF.
Along the axis, defocus by \(\Delta z\) leaves a residual quadratic phase \(\pi \xi ^{2}\Delta z/(\lambda F^{2})\) across the aperture. For a circular aperture the on-axis intensity becomes \(\operatorname{sinc} ^{2}(\Delta z/(8\lambda F\#^{2}))\); it falls to −3 dB at \(\Delta z = \pm 0.443 \times 8 \lambda F\#^{2}\), a full depth of field of \(7.09 \lambda F\#^{2}\). A 1D line aperture gives \(6.95 \lambda F\#^{2}\) (Fresnel integral). Same focus on Tx and Rx: this is also the two-way −6 dB depth. Lateral width scales with F# and depth of field with F#²: F# 4 gives 1.09 mm width and 35 mm depth.
Apodization is windowing in space. A smooth taper removes the edge discontinuity, so sidelobes start lower and decay at −18 dB/octave instead of −6 dB/octave. The cost is an effectively shorter aperture: −6 dB width 2.00 vs \(1.207 \lambda F\#\) (×1.66), −3 dB width 1.441 vs 0.886 (×1.63), first null at 2 instead of \(1 \lambda F\#\). Two-way Hann: −62.9 dB, \(1.44 \lambda F\#\). The same numbers appear in the window table of 04.4, because it is the same transform.
A Gaussian pulse has −6 dB duration \(\tau\) and −6 dB bandwidth B with \(\tau B = 4 \ln 2/\pi = 0.883\). The Gaussian is the minimum-uncertainty pulse for rms widths (Gabor: \(\sigma _{t}'\sigma _{f}' \ge 1/(4\pi )\) for the energies), not for −6 dB widths, where other shapes reach lower \(\tau B\). Round trip halves the depth: \(\Delta z = c\tau /2 = c \cdot 0.883/(2B)\). \(B = 3\) MHz: \(\tau = 0.294\) µs, \(\Delta z = 0.227\) mm. Center frequency does not enter; it only sets \(\lambda\) and therefore the lateral width \(\lambda F\#\). See (04.10) and (04.12).
Sampling multiplies by a comb, so the spectrum is replicated at every multiple of \(f_{s}\). The copy \(f_{0} - k f_{s}\) with \(k = \operatorname{round} (f_{0}/f_{s})\) lands in \([-f_{s}/2, f_{s}/2]\). 7 MHz at 10 MHz: \(k = 1,\ 7 - 10 = -3\) MHz, so a 3 MHz alias, arriving from the negative image (phase conjugated, \(\cos (2\pi 7t + \varphi ) \to \cos (2\pi 3t - \varphi )\)). Doppler: \(v_{\mathrm{Nyq}} = c\cdot \mathrm{PRF}/(4f_{0}) = 0.385\) m/s at 5 MHz, 5 kHz. See (04.3) and (04.5).
Replicas of \([f_{L}, f_{H}]\) and its mirror must not overlap, which holds when the band sits inside one zone \([(n-1)f_{s}/2, nf_{s}/2], n \le \lfloor f_{H}/B\rfloor\). An \(n \ge 2\) zone needs \(f_{H} \ge 2B\), i.e. \(f_{L} \ge B\), i.e. fractional bandwidth ≤ 2/3. [3.5, 6.5] MHz: 6.5–7.0 MHz works (inverted). [3, 7] MHz (80 %): only \(f_{s} \ge 14\) MHz, unless you demodulate to IQ first and sample each of I and Q at ≥ 4 MHz. See (04.7).
An N-point record is the signal times a rect of length \(T = N/f_{s}\), so its DTFT is the true spectrum convolved with a Dirichlet kernel of null width 1/T. The DFT samples that DTFT at spacing \(f_{s}/N\); padding to PN samples the same DTFT at \(f_{s}/(PN)\). \(N = 1024\) at 40 MHz: 39.1 kHz bins and 39.1 kHz resolution; padded 4×, 9.8 kHz bins, same resolution. m04_fft_1d_basics.m: two equal, in-phase tones 0.6/T apart give one peak at any padding, two peaks with a 4× longer record.
Every window trades mainlobe width for sidelobe level. Close tones of similar level want a narrow mainlobe (rect); a weak tone near a strong one wants low sidelobes (Hann, Blackman). Tones 6.5 bins apart, the second at −40 dB: rect leakage there is −26 dB (buried), Hann −58 dB (visible by 18 dB). Divide amplitudes by CG (Hann 0.5: a 6 dB error otherwise) and noise power by ENBW (1.5 bins for Hann, +1.76 dB).
Image = PSF \(\ast \ast\) reflectivity, so k-space = \(H \cdot \hat{S}\). Axially, H is the pulse spectrum at \(k_{z} = 2f/c\); laterally, Tx and Rx patterns multiply, so their aperture spectra convolve and \(|k_{x}| \le D/(\lambda z) = 1/(\lambda F\#) = 1.62\) c/mm at F# 2: a bow-tie. Energy outside it is noise, which is why a matched k-space mask gained 11.9 dB SNR in m04_fft_2d_kspace.m. Each plane-wave angle \(\theta\) shifts the region by \(\sin \theta /\lambda\); a uniform \(\Delta (\sin \theta )\) samples the transmit spectrum and replicates the focus every \(\lambda /\Delta (\sin \theta )\) (17.6 mm for 1° at 5 MHz).
04.11Cheat sheet
| Concept | Formula | Ultrasound use |
|---|---|---|
| Sampling | \(X_{s}(f) = f_{s} \sum _{k} X(f - kf_{s})\) | RF channel data, slow-time Doppler |
| Alias frequency | \(f_{a} = |f_{0} - f_{s} \operatorname{round} (f_{0}/f_{s})|\) | Doppler aliasing, \(v_{\mathrm{Nyq}} = c\cdot \mathrm{PRF}/(4f_{0})\) |
| Reconstruction | \(x(t) = \sum x[n] \operatorname{sinc} ((t - nT_{s})/T_{s})\) | Fractional delays in DAS and delay estimation |
| Bandpass sampling | \(2f_{H}/n \le f_{s}\) \(\le 2f_{L}/(n - 1), n \le \lfloor f_{H}/B\rfloor\); needs FBW ≤ 2/3 for \(n \ge 2\) | Reduced-rate RF acquisition; \(4f_{0}\) quadrature sampling |
| DFT, Parseval, FFT (recap, Module 02) | \(\mathbf{F}^{H}\mathbf{F} = N\mathbf{I}\), \(\sum |x|^{2} = (1/N) \sum |X|^{2}\), \((N/2)\log _{2}N\) multiplies | Power-spectrum normalization in QUS; FFT beamforming |
| Bin spacing vs resolution | \(f_{s}/(PN)\) vs ≈ 1/T | Doppler ensemble length, QUS gate length |
| Window figures of merit | \(\mathrm{CG} = \sum w/N, \mathrm{ENBW} = N\sum w^{2}/(\sum w)^{2}\) | Spectral estimation; lateral apodization |
| Pulse-echo LTI model (theorem: Module 03) | \(r = p \ast \rho + n \longleftrightarrow R = P\,S\) | RF = pulse ∗ reflectivity; valid within a short depth gate |
| Gaussian pulse | \(\tau _{-6}B_{-6} = 4 \ln 2/\pi\) \(\approx 0.883; \sigma _{t}'\sigma _{f}' = 1/(4\pi )\) | Axial resolution \(\Delta z = c\tau /2\) |
| Circular convolution | \(N \ge L + M - 1\) | FFT filtering of RF lines and images |
| Linear-phase FIR | \(\tau _{g} = (M - 1)/2\) samples | Channel-consistent delays for SoS and aberration estimation |
| Beam = FT of aperture | \(p(x, F) \propto A(x/(\lambda F))\); far field \(z \ge 2D^{2}/\lambda\) | Focal-plane PSF, apodization design |
| Uniform aperture | first sidelobe −13.26 dB one-way, −26.52 dB two-way \((\mathrm{Tx} = \mathrm{Rx})\) | Sidelobe clutter budget |
| Lateral −6 dB width | \(1.207 \lambda F\#\) one-way, \(0.886 \lambda F\#\) two-way (Hann 2.00 / 1.44) | Lateral resolution, PSF checks |
| Depth of field | ≈ \(7 \lambda F\#^{2}\) (−3 dB one-way = −6 dB two-way, same focus) | Transmit focal-zone spacing |
| Grating lobes | \(\sin \theta _{g} = \sin \theta _{0} \pm m\lambda /d\); none if \(d < \lambda /(1 + |\sin \theta _{0}|)\), any steering if \(d \le \lambda /2\) | Pitch selection; plane-wave angle step |
| 2D k-space | \(\hat{I} = H\cdot \hat{S}; k_{z}\) \(= 2f/c, |k_{x}| \le 1/(\lambda F\#)\) | k-space filtering, compounding design, f-k migration |
| Angle sampling | replica period \(\lambda /\Delta (\sin \theta )\) | Number of plane-wave angles |
04.12Interview and qualifying-exam questions
I1Why is the beam pattern the Fourier transform of the aperture? · onsite
Each aperture point radiates a spherical wave; in the paraxial approximation the path length from \(\xi\) to (x, z) is \(z + (x - \xi )^{2}/(2z)\), so the field is \(\int a(\xi ) e^{j\pi \xi ^{2}/(\lambda z)} e^{-j2\pi \xi x/(\lambda z)} d\xi\) times a phase. When the quadratic term is negligible (\(z \ge 2D^{2}/\lambda\), the Fraunhofer region) it is the FT of \(a(\xi )\) at \(x/(\lambda z) = \sin \theta /\lambda\). Focusing applies \(e^{-j\pi \xi ^{2}/(\lambda F)}\), which cancels the quadratic phase at \(z = F\), so the focal plane is a Fraunhofer plane for any F. Rect aperture → sinc with first null at \(\lambda F\#\).
Follow-up: what happens away from focus? The quadratic phase returns (defocus), nulls fill and the mainlobe widens; the depth of field is ≈ \(7 \lambda F\#^{2}\).
I2Why do two-way sidelobes double in dB, and when is that not true? · screen
By reciprocity the receive sensitivity pattern equals the transmit pattern of the same aperture, and the pulse-echo response is their product. With identical apertures and focus the amplitude is squared, so 20 log of the square doubles every level: −13.26 → −26.52 dB for rect, −31.5 → −63 dB for Hann. It fails when Tx and Rx differ (fixed transmit focus with dynamic receive, different apodizations or aperture sizes): levels add in dB angle by angle, and a rect receive with Hann transmit has its first sidelobe at −24.8 dB. It also assumes narrowband; a broadband pulse fills the nulls.
Follow-up: what is the two-way −6 dB width? \(0.886 \lambda F\#\), equal to the one-way −3 dB width.
I3Where do grating lobes appear for pitch = \(\lambda\) at 20° steering? · screen
\(\sin \theta _{g} = \sin \theta _{0} \pm \lambda /d\) \(= 0.342 \pm 1\). The + sign gives 1.342 (invisible); the − sign gives \(-0.658, \theta _{g}\) = −41.1°, at full height for point elements. With element width \(0.9\lambda\), the element factor puts it at −4.4 dB one-way, −8.7 dB two-way relative to the main lobe. To remove it for \(\pm 20^{\circ}: d\) < λ/(1 + sin 20°) = \(0.745\lambda\) (0.230 mm at 5 MHz).
Follow-up: what does a broadband pulse do to it? The grating-lobe angle depends on \(\lambda\), so the lobe spreads over angles and its peak drops, but its energy stays.
I4What sets axial versus lateral resolution? · screen
Axial: the pulse length, i.e. bandwidth: \(\Delta z = c\tau /2\) with \(\tau \approx 0.883/B\) (Gaussian, −6 dB). 5 MHz, 60 %: \(B = 3\) MHz, \(\Delta z = 0.227\) mm, independent of \(f_{0}\). Lateral: diffraction, i.e. aperture and wavelength: −6 dB two-way width \(0.886 \lambda F\# = 0.546\) mm at 5 MHz, F# 2. Raising \(f_{0}\) at fixed bandwidth improves lateral but not axial; widening the band improves axial only; elevation is set by the lens and the elevation aperture.
Follow-up: why does ULM beat both? It localizes isolated sources, which is estimation (precision scales with SNR and PSF width), not resolution.
I5A 7 MHz tone is sampled at 10 MHz. What do you see? · screen
\(k = \operatorname{round} (7/10)\) \(= 1, f_{0} - k f_{s} = -3\) MHz, so a 3 MHz tone. The negative sign means it comes from the −7 MHz image: the spectrum is mirrored and the phase conjugated, \(\cos (2\pi \cdot 7t + \varphi )\) \(\equiv \cos (2\pi \cdot 3t - \varphi )\) at the sample instants. The samples cannot distinguish them; only an anti-alias filter before the ADC can.
Follow-up: the Doppler analogue? \(v_{\mathrm{Nyq}} = c\cdot \mathrm{PRF}/(4f_{0})\); flow faster than that wraps to the opposite sign.
I6Why does zero padding not improve frequency resolution? · screen
Resolution is the width of the kernel the spectrum is convolved with, set by the record length T (\(\approx 1/T\) for rect, 1.44/T −3 dB for Hann). Zero padding appends samples that carry no information, so the DTFT of the padded record is identical; the DFT just samples it more densely (\(f_{s}/(PN)\) instead of \(f_{s}/N\)). Two equal, in-phase tones 0.6/T apart stay one lobe at any padding (other relative phases can split them, Demo 04.4); a 4× longer record separates them.
Follow-up: what does padding buy? Interpolated peak location, less scalloping in display, and the length needed to avoid circular wrap in FFT convolution.
I7What bandpass sampling rate works for a 3–7 MHz band? · onsite
\(B = 4\) MHz, \(\lfloor f_{H}/B\rfloor = \lfloor 7/4\rfloor = 1\), so only the ordinary Nyquist zone exists: \(f_{s} \ge 14\) MHz. Undersampling needs \(f_{L} \ge B\) (fractional bandwidth ≤ 2/3); this band is 80 %. Alternatives: demodulate to baseband IQ and sample I and Q at ≥ 4 MHz each, or narrow the band with a filter first. For [3.5, 6.5] MHz, \(6.5 \le f_{s} \le 7.0\) MHz works, spectrally inverted \((n = 2)\), with only 0.5 MHz of margin.
Follow-up: why \(4f_{0}?\) Consecutive samples fall at carrier phases \(0, \pi /2, \pi ,\ 3\pi /2\) and give I, −Q, −I, Q directly.
I8You filter RF data by multiplying FFTs and see artifacts at the start of each line. Why? · screen
The DFT diagonalizes circular convolution. With an N-point FFT, the output is the linear result folded with period N; if \(N < L + M - 1\), the filter tail past sample N wraps onto the first samples, so late echoes contaminate shallow depths. Fix: \(N \ge L + M - 1\) \((2048 + 63 - 1 = 2110 \to 4096)\), or overlap-add/save. In 2D image filtering the same thing makes edges bleed across the image; pad both dimensions.
Follow-up: and the 63-tap filter's delay? 31 samples = 0.775 µs = 0.60 mm at 40 MHz; compensate it identically on every channel.
I9How does F-number trade lateral resolution against depth of field? · onsite
Lateral −6 dB width (two-way) ≈ \(0.886 \lambda F\#\), linear in F#; depth of field ≈ \(7 \lambda F\#^{2}\), quadratic. At 5 MHz: F# 2 gives 0.55 mm and 8.7 mm; F# 4 gives 1.09 mm and 35 mm. Halving F# doubles resolution but cuts depth of field by 4, which is why systems use multiple transmit foci or dynamic receive focusing with an expanding aperture (constant receive F#).
Follow-up: what limits the smallest F#? Element directivity (acceptance angle) and the number of channels; below \(F\# \approx 1\) the paraxial formulas also degrade.
I10Sketch the 2D spectrum of an RF image and explain how plane-wave compounding fills it. · research
Two lobes at \(k_{z} = \pm 2f/c\) (\(\pm 6.49\) cycles/mm at 5 MHz, width set by the pulse band) forming a bow-tie: at each frequency \(|k_{x}| \le D/(\lambda z) = 1/(\lambda F\#)\), the convolution of Tx and Rx aperture spectra. A single plane wave has no transmit aperture, so the lateral extent comes from receive only; each angle \(\theta\) shifts it by \(\sin \theta /\lambda\). Compounding angles lays these regions side by side and synthesizes a transmit aperture. A uniform step \(\Delta (\sin \theta )\) samples that synthetic aperture, so the focus is replicated every \(\lambda /\Delta (\sin \theta )\) laterally (17.6 mm for 1° at 5 MHz).
Follow-up: how does a sound-speed error show up? The k-space mapping \(k_{z} = 2f/c\) is scaled and the regions from different angles no longer add coherently: defocus, which is what coherence- and phase-based sound-speed estimators detect.
I11For a QUS power-spectrum estimate from a 3 mm gate, which window and which corrections? · onsite
The gate is 3.9 µs, so spectral resolution is ≈ 0.26 MHz with rect and ≈ 0.37 MHz (−3 dB) with Hann. Backscatter spectra are smooth and span tens of dB, so Hann is the usual choice: its −31.5 dB sidelobes and −18 dB/octave roll-off limit leakage from the passband peak into the band edges. Corrections: divide by \(\mathrm{CG}^{2}\) (Hann 0.25) for coherent levels, or by \(\sum w^{2} (\mathrm{ENBW})\) for noise-like power; the same window on the sample and the reference phantom cancels most of it in the ratio. Average over independent gates to reduce the variance of the estimate.
Follow-up: longer gate? Better spectral resolution and lower variance, worse depth resolution, and attenuation within the gate biases the estimate.
I12Your simulated narrowband beam shows deep nulls, the measured beam does not. Why? · research
A real pulse contains many frequencies, and each puts its nulls at \(x \propto 1/f\), so the energy pattern has none: with a 60 % band the rect two-way first null fills to −24 dB while the sidelobe level drops from −26.5 to −28.8 dB. Other contributors: element-to-element gain and delay errors (random phase errors of variance \(\sigma ^{2} \mathrm{rad}^{2}\) add a diffuse sidelobe floor of about \(\sigma ^{2}/N\) relative to the peak, one-way, uniform weights), quantized delays, noise, and sound-speed or aberration-induced defocus. Compare against a broadband simulation before blaming hardware.
Follow-up: how would you measure the beam? Scan a wire or small sphere laterally in a water tank in the focal plane and record the peak or energy of the echo versus offset.
04.13MATLAB lab
Base MATLAB only (no toolboxes); each script runs as-is in MATLAB R2019b+ and GNU Octave 8. Paste into the editor and press Run. The numbers quoted below are what the scripts print.
m04_fft_1d_basics.m1D FFT: frequency axis, aliasing, bandpass zones, zero padding vs record length, Parseval, window table · change fs, N, tones, windows · runtime ≈ 2 s
%% m04_fft_1d_basics.m -- Module 04: frequency axes, aliasing, zero padding, Parseval, windows
% Purpose : build the FFT frequency axis correctly, see aliasing, show that zero padding
% interpolates but does not resolve (a longer record does), check Parseval, and
% measure the figures of merit of the classic windows.
% Change : fs, N, the tone frequencies, the tone separation sepT (in units of 1/T),
% the window list.
% Expect : alias of 7 MHz at fs = 10 MHz -> 3.000 MHz; legal bandpass rates: [3.5, 6.5] MHz ->
% fs >= 13 or 6.5..7.0 MHz, [3, 7] MHz -> only fs >= 14 MHz (band edges at 6.75 MHz
% land at 3.25 and 0.25 MHz); padded short record shows 1 peak,
% 4x longer record shows 2; Parseval gap ~1e-12; window table
% rect -13.3 dB / Hann -31.5 dB / Hamming -42.7 dB / Blackman -58.1 dB,
% roll-off about -6, -18, -6, -18 dB/octave.
% Base MATLAB only; runs in MATLAB R2019b+ and GNU Octave 8.
clear; close all; rng(1);
%% 1. Frequency axis and fftshift
fs = 40; % sampling rate (MHz)
N = 1024; % record length (samples)
T = N/fs; % record duration (us)
df = fs/N; % bin spacing (MHz)
f_unshift = (0:N-1)*df; % bins as returned by fft (0 ... fs)
f_shift = (-N/2:N/2-1)*df; % axis after fftshift (-fs/2 ... fs/2)
n = 0:N-1;
x = cos(2*pi*5*n/fs + 0.3); % 5 MHz tone
X = fftshift(fft(x));
[~, ipk] = max(abs(X(N/2+1:end))); % positive half only
fprintf('--- frequency axis ---\n');
fprintf('fs = %g MHz, N = %d: bin spacing fs/N = %.2f kHz, T = %.1f us, 1/T = %.2f kHz\n', fs, N, df*1e3, T, 1e3/T);
fprintf('5 MHz tone: peak at %.3f MHz (positive half of the fftshifted axis)\n', f_shift(N/2+ipk));
fprintf('unshifted bin k = N-1 is %.4f MHz = -df (negative frequency)\n', f_unshift(end) - fs);
%% 2. Aliasing: a 7 MHz tone sampled at 10 MHz
fsa = 10; Na = 4096; na = 0:Na-1;
w_hann = 0.5 - 0.5*cos(2*pi*na/Na); % periodic Hann, written out (no toolbox)
xa = cos(2*pi*7*na/fsa + 0.6) .* w_hann;
Xa = abs(fft(xa)); [~, ka] = max(Xa(1:Na/2+1));
f_alias_formula = abs(7 - fsa*round(7/fsa));
fprintf('\n--- aliasing ---\n');
fprintf('7 MHz at fs = 10 MHz: formula |f0 - fs*round(f0/fs)| = %.3f MHz, FFT peak = %.3f MHz\n', ...
f_alias_formula, (ka-1)*fsa/Na);
%% 2b. Bandpass sampling: legal rates 2 fH/n <= fs <= 2 fL/(n-1), n = 1..floor(fH/B)
fprintf('\n--- bandpass sampling ---\n');
bands = [3.5 6.5; 3 7]; % [fL fH] in MHz
for ib = 1:size(bands, 1)
fL = bands(ib, 1); fH = bands(ib, 2); Bw = fH - fL; nmax = floor(fH/Bw);
fprintf('band [%.1f, %.1f] MHz, B = %.1f, n_max = %d:', fL, fH, Bw, nmax);
for nz = 1:nmax
if nz == 1, fprintf(' n=1: fs >= %.2f', 2*fH);
else, fprintf(' n=%d: %.2f..%.2f', nz, 2*fH/nz, 2*fL/(nz-1)); end
end
fprintf(' MHz\n');
end
fsb = 6.75; fe = [3.5 6.5]; % band edges sampled at 6.75 MHz (zone n = 2)
fa_e = abs(fe - fsb*round(fe/fsb));
fprintf('fs = %.2f MHz: band edges %.1f / %.1f MHz alias to %.2f / %.2f MHz (zone 2: inverted)\n', fsb, fe, fa_e);
%% 3. Zero padding vs a longer record (complex tones, as IQ data)
f1 = 5.0; sepT = 0.6; % tone separation in units of 1/T
Ns = 64; Ts = Ns/fs; f2 = f1 + sepT/Ts; % 0.6/T apart for the SHORT record
mk = @(Nr) exp(1j*2*pi*f1*(0:Nr-1)/fs) + exp(1j*2*pi*f2*(0:Nr-1)/fs);
countPeaks = @(m) sum( m(2:end-1) > m(1:end-2) & m(2:end-1) >= m(3:end) & m(2:end-1) > 0.5*max(m) );
Npad = 4096;
Xs_pad = abs(fft(mk(Ns), Npad)); % short record, 64x zero padded
Xl_pad = abs(fft(mk(4*Ns), Npad)); % 4x longer record, same display grid
fax = (0:Npad-1)*fs/Npad;
sel = fax > f1 - 1.5 & fax < f2 + 1.5;
fprintf('\n--- zero padding vs longer record ---\n');
fprintf('tones %.3f and %.3f MHz (%.2f/T apart for N = %d)\n', f1, f2, sepT, Ns);
fprintf('N = %3d padded to %d: %d peak(s) (bins of %.4f MHz, resolution 1/T = %.3f MHz)\n', Ns, Npad, countPeaks(Xs_pad(sel)), fs/Npad, 1/Ts);
fprintf('N = %3d padded to %d: %d peak(s) (resolution 1/T = %.3f MHz)\n', 4*Ns, Npad, countPeaks(Xl_pad(sel)), 1/(4*Ts));
%% 4. Parseval
xr = randn(1, N);
gap = sum(abs(xr).^2) - sum(abs(fft(xr)).^2)/N;
fprintf('\n--- Parseval ---\nsum|x|^2 - sum|X|^2/N = %.2e\n', gap);
%% 5. Window figures of merit (DFT-even windows, N = 256, 64x zero padding)
Nw = 256; P = 64; L = Nw*P; m = 0:Nw-1; a = 2*pi*m/Nw;
I0 = @(z) sum( bsxfun(@rdivide, bsxfun(@power, z(:)/2, 2*(0:40)), factorial(0:40).^2), 2 ).'; % Bessel I0 series
names = {'Rectangular', 'Hann', 'Hamming', 'Blackman', 'Kaiser b=6'};
W = [ ones(1, Nw);
0.5 - 0.5*cos(a);
0.54 - 0.46*cos(a);
0.42 - 0.5*cos(a) + 0.08*cos(2*a);
I0(6*sqrt(max(0, 1 - (2*m/Nw - 1).^2))) / I0(6) ];
theoryPSL = [-13.26 -31.47 -42.66 -58.11 NaN];
fprintf('\n--- window table (computed) ---\n');
fprintf('%-12s %8s %8s %8s %8s %6s %6s %8s %10s\n', 'window', 'PSL dB', '-3dB bin', '-6dB bin', 'null bin', 'ENBW', 'CG', 'scal dB', 'roll dB/oct');
figure('Name', 'windows', 'Position', [100 100 760 520]);
cols = lines(5);
for iw = 1:size(W, 1)
w = W(iw, :);
S = abs(fft(w, L)); S = S/S(1);
d = 20*log10(S(1:L/2) + 1e-300);
k = 2; while ~(d(k) < d(k-1) && d(k) <= d(k+1)), k = k + 1; end % first null
psl = max(d(k:end));
w3 = 2*interp1(d(1:k), (0:k-1)/P, -3.0103);
w6 = 2*interp1(d(1:k), (0:k-1)/P, -6.0206);
enbw = Nw*sum(w.^2)/sum(w)^2;
cg = mean(w);
scal = -d(P/2 + 1); % tone half a bin off
env = @(b) max(d(b*P+1:(b+1)*P)); % sidelobe peak near bin b
roll = (env(40) - env(10))/2; % 2 octaves, per octave
fprintf('%-12s %8.2f %8.3f %8.3f %8.3f %6.3f %6.3f %8.2f %10.1f', names{iw}, psl, w3, w6, (k-1)/P, enbw, cg, scal, roll);
if ~isnan(theoryPSL(iw)), fprintf(' (theory PSL %.2f)\n', theoryPSL(iw)); else, fprintf('\n'); end
plot((0:L/2-1)/P, d, 'Color', cols(iw, :), 'LineWidth', 1.1); hold on;
end
hold off; xlim([0 12]); ylim([-110 3]); grid on;
xlabel('frequency offset (bins of N)'); ylabel('|W| (dB re peak)');
title('Window spectra: mainlobe width vs sidelobe level'); legend(names, 'Location', 'northeast');
%% 6. Figure: aliasing and zero padding
figure('Name', 'aliasing and zero padding', 'Position', [100 100 760 600]);
subplot(2, 1, 1);
tc = linspace(0, 1.6, 2000); ts = 0:1/fsa:1.6;
plot(tc, cos(2*pi*7*tc + 0.6), 'Color', [0.6 0.6 0.6]); hold on;
plot(tc, cos(2*pi*3*tc - 0.6), 'r--', 'LineWidth', 1.4);
plot(ts, cos(2*pi*7*ts + 0.6), 'ko', 'MarkerFaceColor', 'k'); hold off;
xlim([0 1.6]); xlabel('time (us)'); ylabel('amplitude');
title('7 MHz tone (gray) sampled at 10 MHz (dots) = 3 MHz alias, phase -\phi (red)');
subplot(2, 1, 2);
plot(fax(sel), Xs_pad(sel)/max(Xs_pad), 'b', 'LineWidth', 1.3); hold on;
plot(fax(sel), Xl_pad(sel)/max(Xl_pad), 'r', 'LineWidth', 1.3);
plot([f1 f1], [0 1.05], 'k:', [f2 f2], [0 1.05], 'k:'); hold off;
xlabel('frequency (MHz)'); ylabel('|X| (norm.)');
title('Zero padding (blue, N = 64) vs 4x longer record (red, N = 256)');
legend('N=64, padded 64x', 'N=256, padded 16x', 'Location', 'northeast');
What to look for. 7 MHz at 10 MHz: formula and FFT peak both 3.000 MHz. Bandpass zones: [3.5, 6.5] MHz → \(f_{s} \ge 13\) or 6.50–7.00 MHz; [3, 7] MHz → only \(f_{s} \ge 14\) MHz. Two equal, in-phase tones 0.6/T apart: 1 peak with \(N = 64\) padded to 4096, 2 peaks with \(N = 256\). Window table: PSL −13.26, −31.47, −42.66, −58.11, −43.79 dB; −3 dB widths 0.886, 1.441, 1.303, 1.644, 1.402 bins (the values in 04.4).
m04_fft_2d_kspace.m2D FFT: RF image and its k-space, PSF and transfer function, separable windows, k-space filtering and envelope · change f0, FBW, Fnum, apod · runtime ≈ 4 s
%% m04_fft_2d_kspace.m -- Module 04: 2D FFT and the k-space of a pulse-echo image
% Purpose : simulate a small RF image (speckle + point targets) with a broadband,
% focal-plane (Fraunhofer) pulse-echo PSF, then look at log|FFT2|: the axial band
% sits at kz = +-2 f0/c, the lateral extent is set by the transmit-receive
% aperture autoconvolution, |kx| <= f/(c F#) at each frequency (a bow-tie).
% Also: 2D FFT of a single PSF, of its envelope (B-mode PSF), and of separable windows.
% Change : f0, FBW, Fnum, apod ('rect' or 'hann'), dx, dz, the scatterer density.
% Expect : 2f0/c = 6.49 cycles/mm at 5 MHz; two-way lateral edge 1/(lambda F#) = 1.62
% cycles/mm at F# 2; >99 % of the image k-space energy inside the bow-tie;
% PSF -6 dB widths close to 0.886 lambda F# (rect) and c tau/2;
% separable rect window: -13.3 dB sidelobes on the axes, -26.5 dB on the diagonal;
% filtering: a k-space mask matched to the PSF passband keeps ~99 % of the signal energy
% and raises the SNR of white noise by ~10 log10(1/mask area); a one-sided kz mask gives
% the analytic image and its envelope (B-mode).
% Model : paraxial, focal plane, Tx = Rx aperture, first-order Born, shift-invariant
% over the small field (circular convolution). Base MATLAB only (R2019b+, Octave 8).
clear; close all; rng(1);
%% Parameters
c = 1.540; % speed of sound (mm/us)
f0 = 5; % center frequency (MHz)
FBW = 0.60; % -6 dB fractional bandwidth of the two-way pulse
Fnum = 2; % F-number z/D (same aperture on transmit and receive)
apod = 'rect'; % 'rect' or 'hann'
Nz = 128; Nx = 128; % image size (axial x lateral)
dz = 0.02; dx = 0.06; % pixel size (mm): axial Nyquist 25 c/mm, lateral 8.33 c/mm
B = FBW*f0; sig_f = B/(2*sqrt(2*log(2))); % amplitude-spectrum std (MHz)
lam0 = c/f0;
sincf = @(u) (sin(pi*u) + (u == 0)) ./ (pi*u + (u == 0));
if strcmp(apod, 'hann')
A1 = @(u) sincf(u) + 0.5*sincf(u - 1) + 0.5*sincf(u + 1); % FT of 0.5+0.5cos(2 pi xi/D), peak 1
else
A1 = @(u) sincf(u); % FT of a uniform aperture
end
%% Axes (fft order: origin at index 1) and shifted axes for display
kz_f = [0:Nz/2-1, -Nz/2:-1]/(Nz*dz); % axial spatial frequency (cycles/mm)
x_f = [0:Nx/2-1, -Nx/2:-1]*dx; % lateral position (mm), origin first
kz_s = (-Nz/2:Nz/2-1)/(Nz*dz); kx_s = (-Nx/2:Nx/2-1)/(Nx*dx);
z_s = (-Nz/2:Nz/2-1)*dz; x_s = (-Nx/2:Nx/2-1)*dx;
%% PSF: for every temporal frequency f = c kz/2, lateral two-way pattern A1(x/(lambda F#))^2
Hz = zeros(Nz, Nx); % axial-FFT x lateral-space representation
for k = 2:Nz/2 % positive kz (skip DC)
f = kz_f(k)*c/2; % MHz
Pf = exp(-(f - f0)^2/(2*sig_f^2)); % two-way pulse amplitude spectrum (on axis)
u = x_f/((c/f)*Fnum); % normalized lateral coordinate x/(lambda F#)
Hz(k, :) = Pf * A1(u).^2; % transmit pattern x receive pattern
end
Hz(Nz:-1:Nz/2+2, :) = Hz(2:Nz/2, :); % Hermitian twin (real, zero-phase PSF)
h = real(ifft(Hz, [], 1)); % RF PSF h(z, x), centered at the origin
ha = ifft([Hz(1, :); 2*Hz(2:Nz/2, :); zeros(Nz/2, Nx)], [], 1); % analytic PSF (axial)
H = fft2(h); % 2D spectrum of the PSF
%% Scatterers: speckle + three point targets; image = PSF (*) scatterers (circular)
S = 0.5*randn(Nz, Nx) .* (rand(Nz, Nx) < 0.2); % ~20 scatterers per resolution cell
pts = [32 30; 64 64; 100 100]; % (iz, ix) of the point targets
for ip = 1:size(pts, 1), S(pts(ip, 1), pts(ip, 2)) = 10; end
K = H .* fft2(S); % k-space of the image (2D convolution theorem)
img = real(ifft2(K));
S1 = zeros(Nz, Nx); S1(Nz/2+1, Nx/2+1) = 1; % single point at the center
psf = real(ifft2(H .* fft2(S1)));
%% Measurements
envc = abs(ha); envc = envc/max(envc(:));
ex = fftshift(envc(1, :)); ez = fftshift(envc(:, 1)).';
cross = @(y, xa, lv, i) xa(i-1) + (lv - y(i-1)).*(xa(i) - xa(i-1))./(y(i) - y(i-1)); % first crossing below lv
xr = x_s(Nx/2+1:end); er = ex(Nx/2+1:end); zr = z_s(Nz/2+1:end); fr = ez(Nz/2+1:end);
lat6 = 2*cross(er, xr, 0.5, find(er < 0.5, 1));
ax6 = 2*cross(fr, zr, 0.5, find(fr < 0.5, 1));
tau = 4*log(2)/(pi*B);
kz0 = 2*f0/c; fL = f0 - B/2; fH = f0 + B/2;
kedge = 1/(lam0*Fnum);
[~, ir] = min(abs(kz_f - kz0)); % row nearest 2 f0/c
row = abs(H(ir, :)); row = fftshift(row/max(row)); rdB = 20*log10(row + 1e-300);
pos = Nx/2+1:Nx;
k30 = cross(rdB(pos), kx_s(pos), -30, find(rdB(pos) < -30, 1)); % -30 dB half-width
[KX, KZ] = meshgrid(kx_s, kz_s);
inside = abs(KX) <= abs(KZ)/(2*Fnum) + 1/(Nx*dx); % bow-tie (+1 bin)
E = abs(fftshift(K)).^2;
fprintf('--- k-space of a pulse-echo image (f0 = %.1f MHz, FBW = %.0f %%, F# = %.1f, %s) ---\n', f0, 100*FBW, Fnum, apod);
fprintf('axial band center 2 f0/c = %.3f cycles/mm (RF period lambda/2 = %.4f mm)\n', kz0, lam0/2);
fprintf('axial -6 dB band 2fL/c .. 2fH/c = %.3f .. %.3f cycles/mm\n', 2*fL/c, 2*fH/c);
fprintf('lateral edge at f0: two-way 1/(lambda F#) = %.3f c/mm, one-way %.3f c/mm\n', kedge, kedge/2);
fprintf('measured |H| -30 dB lateral half-width at kz = %.2f c/mm: %.3f c/mm (rect triangle: %.3f)\n', kz_f(ir), k30, kedge*(kz_f(ir)/kz0)*(1 - 10^(-1.5)));
fprintf('fraction of image k-space energy inside the bow-tie |kx| <= |kz|/(2F#): %.5f\n', sum(E(inside))/sum(E(:)));
fprintf('PSF lateral -6 dB width: %.3f mm (narrowband theory %.3f mm = %.3f lambda F#)\n', lat6, ...
lam0*Fnum*(0.886*strcmp(apod, 'rect') + 1.441*strcmp(apod, 'hann')), 0.886*strcmp(apod, 'rect') + 1.441*strcmp(apod, 'hann'));
fprintf('PSF axial -6 dB width: %.3f mm (c tau/2 = %.3f mm)\n', ax6, c*tau/2);
fprintf('lateral pixel %.3f mm vs Nyquist for the two-way edge at fH: %.3f mm\n', dx, 1/(2*fH/(c*Fnum)));
%% Figure 1: image, k-space; PSF, k-space
toDB = @(A) max(-60, 20*log10(abs(A)/max(abs(A(:))) + 1e-300));
kzmax = kz_s(end);
figure('Name', 'k-space', 'Position', [60 60 900 720]);
subplot(2, 2, 1); imagesc(x_s, z_s, img); colormap(gray); axis image;
xlabel('lateral x (mm)'); ylabel('axial z (mm)'); title('RF image: speckle + 3 points');
subplot(2, 2, 2); imagesc(kx_s, kz_s, toDB(fftshift(K))); set(gca, 'YDir', 'normal'); hold on;
plot([kx_s(1) kx_s(end)], [kz0 kz0], 'r--', [kx_s(1) kx_s(end)], -[kz0 kz0], 'r--');
plot([0 kzmax/(2*Fnum)], [0 kzmax], 'y--', [0 -kzmax/(2*Fnum)], [0 kzmax], 'y--');
plot([0 kzmax/(2*Fnum)], [0 -kzmax], 'y--', [0 -kzmax/(2*Fnum)], [0 -kzmax], 'y--'); hold off;
xlabel('k_x (cycles/mm)'); ylabel('k_z (cycles/mm)'); title('log|FFT2| (60 dB): red 2f_0/c, yellow bow-tie'); colorbar;
subplot(2, 2, 3); imagesc(x_s, z_s, psf); axis image;
xlabel('lateral x (mm)'); ylabel('axial z (mm)'); title('single RF PSF');
subplot(2, 2, 4); imagesc(kx_s, kz_s, toDB(fftshift(H))); set(gca, 'YDir', 'normal'); hold on;
plot([kx_s(1) kx_s(end)], [kz0 kz0], 'r--', [kx_s(1) kx_s(end)], -[kz0 kz0], 'r--');
plot([-kedge kedge], [kz0 kz0], 'go', 'MarkerFaceColor', 'g'); hold off;
xlabel('k_x (cycles/mm)'); ylabel('k_z (cycles/mm)'); title('PSF k-space; green: \pm1/(\lambda_0 F#)'); colorbar;
%% Separable windows and the B-mode (envelope) PSF
Lw = 16; nw = 0:Lw-1;
wins = {ones(1, Lw), 0.5 - 0.5*cos(2*pi*nw/Lw)}; % rect, periodic Hann
wname = {'rect x rect', 'Hann x Hann'};
fprintf('\n--- separable 2D windows (%d x %d, 8x zero padded) ---\n', Lw, Lw);
figure('Name', 'separable windows and B-mode PSF', 'Position', [60 60 900 720]); colormap(gray);
for iw = 1:2
w2 = wins{iw}.' * wins{iw}; % separable: outer product
W2 = abs(fftshift(fft2(w2, Nz, Nx))); W2 = W2/max(W2(:));
ax = 20*log10(W2(Nz/2+1, Nx/2+1:end) + 1e-300); % along kx at kz = 0
k = 2; while ~(ax(k) < ax(k-1) && ax(k) <= ax(k+1)), k = k + 1; end
[pslA, iA] = max(ax(k:end)); iA = iA + k - 1; % first-sidelobe column
diagv = 20*log10(W2(Nz/2+iA, Nx/2+iA)); % product sidelobe on the diagonal
fprintf('%-12s axis sidelobe %.2f dB, diagonal sidelobe %.2f dB (sum of the two 1D levels %.2f dB)\n', ...
wname{iw}, pslA, diagv, 2*pslA);
subplot(2, 2, iw); imagesc((-Nx/2:Nx/2-1)/Nx, (-Nz/2:Nz/2-1)/Nz, max(-80, 20*log10(W2 + 1e-300)));
set(gca, 'YDir', 'normal'); axis image; xlim([-0.25 0.25]); ylim([-0.25 0.25]); colorbar;
xlabel('k_x (cycles/sample)'); ylabel('k_z (cycles/sample)'); title(['|FFT2| ' wname{iw} ' (dB)']);
end
envp = abs(ifft2(fft2(abs(ha)) .* fft2(S1))); % B-mode PSF (envelope), centered
subplot(2, 2, 3); imagesc(x_s, z_s, envp); axis image;
xlabel('lateral x (mm)'); ylabel('axial z (mm)'); title('B-mode PSF (envelope)');
subplot(2, 2, 4); imagesc(kx_s, kz_s, toDB(fftshift(fft2(abs(ha))))); set(gca, 'YDir', 'normal'); colorbar;
xlabel('k_x (cycles/mm)'); ylabel('k_z (cycles/mm)'); title('envelope k-space: band moved to baseband');
%% Filtering in k-space: matched passband mask, then a one-sided kz mask for the envelope
Nimg = randn(Nz, Nx); Nimg = Nimg*norm(img(:))/norm(Nimg(:)); % scaled to exactly 0 dB SNR
Kn = fft2(Nimg);
Mpass = abs(H) > 0.01*max(abs(H(:))); % passband: |H| above -40 dB (fft order)
fill = mean(Mpass(:)); % fraction of k-space kept
sigF = real(ifft2(K .* Mpass)); % filtered signal part
noiF = real(ifft2(Kn .* Mpass)); % filtered noise part
snr0 = round(100*10*log10(sum(img(:).^2)/sum(Nimg(:).^2)))/100 + 0;
snr1 = 10*log10(sum(sigF(:).^2)/sum(noiF(:).^2));
fprintf('\n--- k-space filtering (white noise at %.1f dB SNR) ---\n', snr0);
fprintf('passband mask |H| > -40 dB keeps %.1f %% of k-space; signal energy retained %.2f %%\n', 100*fill, 100*sum(sigF(:).^2)/sum(img(:).^2));
fprintf('SNR after mask %.1f dB: gain %.1f dB (prediction 10 log10(1/fill) = %.1f dB)\n', snr1, snr1 - snr0, 10*log10(1/fill));
% one-sided axial mask: keep kz > 0 (x2), drop kz < 0 -> analytic image along z, |.| = envelope
Mhalf = [ones(1, Nx); 2*ones(Nz/2-1, Nx); ones(1, Nx); zeros(Nz/2-1, Nx)];
anaI = ifft2((K + Kn) .* Mpass .* Mhalf);
bmode = 20*log10(abs(anaI)/max(abs(anaI(:))) + 1e-300);
fprintf('one-sided kz mask: max |real(analytic) - filtered RF| = %.1e (the real part is the RF image)\n', ...
max(max(abs(real(anaI) - (sigF + noiF)))));
figure('Name', 'k-space filtering', 'Position', [60 60 900 720]); colormap(gray);
subplot(2, 2, 1); imagesc(x_s, z_s, img + Nimg); axis image;
xlabel('lateral x (mm)'); ylabel('axial z (mm)'); title(sprintf('RF image + white noise (%.0f dB SNR)', snr0));
subplot(2, 2, 2); imagesc(kx_s, kz_s, toDB(fftshift(K + Kn))); set(gca, 'YDir', 'normal'); hold on;
contour(kx_s, kz_s, double(fftshift(Mpass)), [0.5 0.5], 'g'); hold off; colorbar;
xlabel('k_x (cycles/mm)'); ylabel('k_z (cycles/mm)'); title('noisy k-space; green: passband mask');
subplot(2, 2, 3); imagesc(x_s, z_s, sigF + noiF); axis image;
xlabel('lateral x (mm)'); ylabel('axial z (mm)'); title(sprintf('after the mask: SNR %.1f dB', snr1));
subplot(2, 2, 4); imagesc(x_s, z_s, max(-40, bmode)); axis image; colorbar;
xlabel('lateral x (mm)'); ylabel('axial z (mm)'); title('envelope via one-sided k_z mask (40 dB)');
What to look for. Axial band centered at \(2f_{0}/c = 6.494\) cycles/mm, lateral edge \(1/(\lambda F\#) = 1.623\) cycles/mm at F# 2, essentially all image energy inside the bow-tie. PSF −6 dB widths 0.549 mm lateral (\(0.886 \lambda F\# = 0.546\) mm) and 0.227 mm axial \((c\tau /2)\). Separable rect window: −13.3 dB on the axes, −26.6 dB on the diagonal (the dB add). Filtering: a mask \(|H| > -40\) dB keeps 6.6 % of k-space and 99.99 % of the signal energy, raising SNR from 0 to 11.9 dB (prediction \(10 \log _{10}(1/0.066) = 11.8\) dB); a one-sided \(k_{z}\) mask gives the analytic image, whose magnitude is the B-mode envelope.
m04_aperture_to_beam.mBeam = FT of the aperture: one-way and two-way, rect and Hann, grating lobes vs pitch, element factor, broadband fill · change f0, N, pitches, th0_deg, FBW · runtime ≈ 6 s
%% m04_aperture_to_beam.m -- Module 04: the beam pattern is the Fourier transform of the aperture
% Purpose : compute the far-field (or focal-plane) pattern of a linear array as the DTFT of
% its apodization, compare rect vs Hann, one-way vs two-way (Tx = Rx), show that a
% zero-padded FFT of the weights reproduces the direct far-field sum, and move
% grating lobes with the pitch (d = lambda/2, lambda, 2 lambda).
% Change : f0, N (elements), the pitch list, the steering angle th0_deg.
% Expect : first sidelobe rect -13.3 dB one-way / -26.5 dB two-way,
% Hann -31.5 dB one-way / -63 dB two-way;
% -6 dB width (units of lambda/D in sin(theta)): rect 1.21 / 0.89, Hann 2.00 / 1.44;
% FFT vs direct sum agree to ~1e-14; grating lobes at sin(th_g) = sin(th0) + m lambda/d
% (d = lambda, 20 deg steering: -41.1 deg); element factor (w = 0.9 d) lowers that
% grating lobe by ~4.4 dB one-way; a 60 % band fills the rect two-way first null
% (-24 dB) and lowers the level at the narrowband sidelobe position to -28.8 dB.
% Model : sections 1-3 monochromatic, point-like elements (no element directivity), far field
% or focal plane; section 4 adds a rigid-baffle element factor sinc(w sin(theta)/lambda);
% section 5 a Gaussian two-way spectrum (time-integrated energy pattern).
% Base MATLAB only; runs in MATLAB R2019b+ and GNU Octave 8.
clear; close all; rng(1);
%% Parameters
c = 1.540; % mm/us
f0 = 5; % MHz
lam = c/f0; % wavelength (mm) = 0.308
N = 64; % elements
d = lam/2; % pitch for the apodization study (mm)
n = 0:N-1;
xn = (n - (N-1)/2)*d; % element positions (mm), centered
D = N*d; % aperture length (mm)
wR = ones(1, N);
wH = 0.5 - 0.5*cos(2*pi*(n + 0.5)/N); % symmetric Hann sampled at element centers
AF = @(w, x, u) abs( exp(1j*2*pi/lam * u(:) * x) * w(:) ).' / sum(w); % |sum w e^{jk x u}|, u = sin(th) - sin(th0)
%% 1. First sidelobe and -6 dB width: rect vs Hann, one-way vs two-way
uf = linspace(0, 6*lam/D, 6001); % fine grid from the main-lobe peak outward
fprintf('--- apodization (N = %d, d = lambda/2, D = %.2f mm) ---\n', N, D);
fprintf('%-10s %-8s %12s %16s %14s\n', 'aperture', 'pattern', '1st SL (dB)', '-6 dB width', 'first null');
labels = {'rect', 'Hann'}; Ws = {wR, wH};
theorySL = [-13.26 -26.52; -31.47 -62.93]; theoryW6 = [1.207 0.886; 2.000 1.441];
for ia = 1:2
a1 = AF(Ws{ia}, xn, uf);
for way = 1:2
a = a1.^way; dBv = 20*log10(a + 1e-300);
k = 2; while ~(dBv(k) < dBv(k-1) && dBv(k) <= dBv(k+1)), k = k + 1; end % first null
j = k; while ~(dBv(j) > dBv(j-1) && dBv(j) >= dBv(j+1)), j = j + 1; end % first sidelobe
i6 = find(dBv < -6.0206, 1);
u6 = uf(i6-1) + (-6.0206 - dBv(i6-1))*(uf(i6) - uf(i6-1))/(dBv(i6) - dBv(i6-1));
fprintf('%-10s %-8s %7.2f (%6.2f) %9.3f (%5.3f) lam/D %8.3f lam/D\n', labels{ia}, char('one-way' * (way == 1) + 'two-way' * (way == 2)), ...
dBv(j), theorySL(ia, way), 2*u6*D/lam, theoryW6(ia, way), uf(k)*D/lam);
end
end
fprintf('(lateral -6 dB width in the focal plane = width in lam/D times lambda F#: rect two-way 0.886 lambda F#)\n');
Fn = 2; % example F-number
fprintf('at F# = %d, %.0f MHz (lambda F# = %.3f mm): rect -6 dB width %.3f mm one-way, %.3f mm two-way\n', ...
Fn, f0, lam*Fn, 1.207*lam*Fn, 0.886*lam*Fn);
fprintf('Hann/rect -6 dB width ratio: %.2f one-way, %.2f two-way\n', 2.000/1.207, 1.441/0.886);
%% 2. Beam = FFT of the aperture: zero-padded FFT vs direct far-field sum
L = 4096;
Wf = abs(fft(wH, L)) / sum(wH); % DTFT samples at psi = -2 pi k/L
psi = -2*pi*(0:L-1)/L; psi = mod(psi + pi, 2*pi) - pi; % wrap to [-pi, pi)
uk = psi*lam/(2*pi*d); % psi = k d u -> u = sin(theta)
vis = abs(uk) <= 1;
direct = AF(wH, xn, uk(vis));
fprintf('\n--- FFT of the weights vs direct far-field sum (Hann, L = %d) ---\n', L);
fprintf('max | |FFT| - |direct sum| | over %d visible-region samples = %.2e\n', nnz(vis), max(abs(Wf(vis) - direct)));
fprintf('sin(theta) per FFT bin = lambda/(L d) = %.5f\n', lam/(L*d));
%% 3. Grating lobes vs pitch
th0_deg = 20;
pitches = [0.5 1 2]*lam;
uu = linspace(-1, 1, 20001); thd = asind(uu);
fprintf('\n--- grating lobes, N = %d, steering 0 and %d deg ---\n', N, th0_deg);
figure('Name', 'grating lobes', 'Position', [80 80 760 640]);
for ip = 1:3
dp = pitches(ip); xp = (n - (N-1)/2)*dp;
for st = [0 th0_deg]
s0 = sind(st);
a = AF(wR, xp, uu - s0); adB = 20*log10(a + 1e-300);
pk = find([adB(1) > adB(2), adB(2:end-1) > adB(1:end-2) & adB(2:end-1) >= adB(3:end), adB(end) > adB(end-1)] & adB > -1.5);
meas = thd(pk); meas = meas(abs(meas - st) > 0.5); % drop the main lobe
m = -4:4; m = m(m ~= 0); sg = s0 + m*lam/dp; pred = asind(sg(abs(sg) <= 1 + 1e-12));
sp = sprintf(' %.1f', sort(pred)); if isempty(pred), sp = ' none'; end
sm = sprintf(' %.1f', sort(meas)); if isempty(meas), sm = ' none'; end
fprintf('d = %.2f lambda (%.3f mm), steer %2d deg: predicted [%s ] deg, measured [%s ] deg\n', dp/lam, dp, st, sp, sm);
if st == th0_deg
subplot(3, 1, ip); plot(thd, max(-60, adB), 'b'); hold on;
for g = pred, plot([g g], [-60 3], 'r--'); end
plot([st st], [-60 3], 'k:'); hold off; ylim([-60 3]); xlim([-90 90]); grid on;
xlabel('angle \theta (deg)'); ylabel('|AF| (dB)');
title(sprintf('d = %.1f \\lambda, steered %d deg: red = predicted grating lobes', dp/lam, st));
end
end
end
fprintf('d <= lambda/2: no grating lobe for any steering; d <= lambda/(1+sin(th_max)) for |th0| <= th_max\n');
fprintf('for th_max = %d deg: d <= %.3f mm (%.3f lambda)\n', th0_deg, lam/(1 + sind(th0_deg)), 1/(1 + sind(th0_deg)));
%% 4. Element directivity attenuates grating lobes (d = lambda, steered 20 deg)
dp = lam; xp = (n - (N-1)/2)*dp; s0 = sind(th0_deg);
we = 0.9*dp; % element width (mm): 10 % kerf
sincf = @(v) (sin(pi*v) + (v == 0)) ./ (pi*v + (v == 0));
EF = @(uabs) abs(sincf(we*uabs/lam));
thg = asind(s0 - lam/dp); % predicted grating lobe (deg)
aM = AF(wR, xp, 0) * EF(s0); % main lobe (u = 0 at theta = th0)
aG = AF(wR, xp, sind(thg) - s0) * EF(sind(thg)); % grating lobe
fprintf('\n--- element directivity (d = lambda, w = 0.9 d, steer %d deg) ---\n', th0_deg);
fprintf('grating lobe at %.1f deg; element factor there %.2f dB, at the main lobe %.2f dB\n', thg, 20*log10(EF(sind(thg))), 20*log10(EF(s0)));
fprintf('grating lobe re main lobe: %.2f dB one-way, %.2f dB two-way (0 dB without the element factor)\n', 20*log10(aG/aM), 40*log10(aG/aM));
%% 5. Broadband: a 60 % two-way band smears sidelobes and fills nulls (energy pattern)
FBW = 0.60; sf = FBW/(2*sqrt(2*log(2))); % Gaussian amplitude-spectrum std (units of f0)
fr = linspace(1 - 4*sf, 1 + 4*sf, 41); % frequencies (units of f0)
Pw = exp(-(fr - 1).^2/sf^2); % |P(f)|^2 weights
ue = [0 1 1.43 2 2.46]*lam/D; % sin(theta): peak, rect null, rect SL, Hann null, Hann SL
AFl = @(w, x, u, lm) abs( exp(1j*2*pi/lm * u(:) * x) * w(:) ).' / sum(w);
fprintf('\n--- broadband two-way energy pattern, FBW = %.0f %% (levels in dB re peak) ---\n', 100*FBW);
fprintf('%-6s %-11s %8s %8s %8s %8s\n', 'apod', 'model', 'u=1', 'u=1.43', 'u=2', 'u=2.46');
ub2 = linspace(-8*lam/D, 8*lam/D, 4001); Ebb = zeros(2, numel(ub2));
for ia = 1:2
Eu = zeros(1, numel(ue)); Eb = zeros(1, numel(ub2));
for kf = 1:numel(fr)
Eu = Eu + Pw(kf)*AFl(Ws{ia}, xn, ue, lam/fr(kf)).^4;
Eb = Eb + Pw(kf)*AFl(Ws{ia}, xn, ub2, lam/fr(kf)).^4;
end
Ebb(ia, :) = 10*log10(Eb/max(Eb));
nb = 40*log10(AF(Ws{ia}, xn, ue) + 1e-300);
fprintf('%-6s %-11s %8.1f %8.1f %8.1f %8.1f\n', labels{ia}, 'narrowband', max(nb(2:end), -99));
fprintf('%-6s %-11s %8.1f %8.1f %8.1f %8.1f\n', labels{ia}, 'broadband', 10*log10(Eu(2:end)/Eu(1)));
end
fprintf('(u in units of lambda0/D; -99 marks an exact null)\n');
%% Figures: apodization and FFT-vs-direct
figure('Name', 'aperture to beam', 'Position', [80 80 760 640]);
subplot(2, 2, 1); plot(xn, wR, 'bo', xn, wH, 'r.-', 'MarkerSize', 8); ylim([0 1.1]);
xlabel('element position (mm)'); ylabel('weight'); title('aperture: rect (blue), Hann (red)');
ub = linspace(-8*lam/D, 8*lam/D, 4001);
subplot(2, 2, 2);
plot(ub*D/lam, 20*log10(AF(wR, xn, ub)), 'b', ub*D/lam, 20*log10(AF(wH, xn, ub)), 'r'); ylim([-80 3]); grid on;
xlabel('sin\theta in units of \lambda/D'); ylabel('dB'); title('one-way: -13.3 vs -31.5 dB');
subplot(2, 2, 3);
plot(ub*D/lam, 40*log10(AF(wR, xn, ub)), 'b', ub*D/lam, 40*log10(AF(wH, xn, ub)), 'r'); hold on;
plot(ub2*D/lam, Ebb(1, :), 'b--', ub2*D/lam, Ebb(2, :), 'r--', 'LineWidth', 1.2); hold off; ylim([-100 3]); grid on;
xlabel('sin\theta in units of \lambda/D'); ylabel('dB'); title('two-way: narrowband (solid), 60 % band (dashed)');
subplot(2, 2, 4);
ud = linspace(-1, 1, 4001);
plot(ud, 20*log10(AF(wH, xn, ud)), 'k'); hold on;
iv = find(vis); iv = iv(1:4:end);
plot(uk(iv), 20*log10(Wf(iv) + 1e-300), 'ro', 'MarkerSize', 3); hold off; ylim([-100 3]); xlim([-0.3 0.3]); grid on;
xlabel('sin\theta'); ylabel('dB'); title('Hann: direct sum (black) vs FFT bins (red)');
What to look for. First sidelobes −13.25 / −26.51 dB (rect, one-/two-way) and −31.47 / −62.93 dB (Hann); −6 dB widths 1.207 / 0.886 and \(2.000 / 1.441 \lambda /D\). The zero-padded FFT of the weights equals the direct far-field sum to \(3\times 10^{-15}\). Grating lobes, predicted vs measured: \(d = \lambda\) at 20° → −41.1°; \(d = 2\lambda\) at 0° → \(\pm 30^{\circ}, \pm 90^{\circ}; d = 2\lambda\) at 20° → −41.1°, −9.1°, 57.4°; \(d = \lambda /2\) → none. Element factor \((w = 0.9d)\): grating lobe at −4.36 dB one-way. 60 % band: rect two-way null at −24.0 dB, sidelobe position −28.8 dB.
m04_rf_convolution.mRF line = pulse ∗ reflectivity: spectra multiply, wrap-around, pulse length, two-reflector resolution · change f0, FBW, spacings · runtime ≈ 2 s
%% m04_rf_convolution.m -- Module 04: RF line = pulse * reflectivity, spectra multiply, axial resolution
% Purpose : model an RF line as a Gaussian pulse convolved with a reflectivity profile,
% verify that spectra multiply (with enough zero padding), measure the -6 dB
% pulse length and axial resolution, resolve two reflectors, and compute the
% envelope with an FFT-based analytic signal (no hilbert()).
% Change : f0, fractional bandwidth FBW, the reflector spacings, fs.
% Expect : tau(-6 dB) = 4 ln2/(pi B) = 0.294 us and dz = c tau/2 = 0.227 mm at 5 MHz, 60 %;
% FFT and direct convolution agree to ~1e-13 when Nfft >= L+M-1;
% Gabor product sigma_t' sigma_f' = 1/(4 pi) = 0.0796.
% Base MATLAB only; runs in MATLAB R2019b+ and GNU Octave 8.
clear; close all; rng(1);
%% Parameters
c = 1.540; % speed of sound (mm/us)
fs = 100; % sampling rate (MHz)
f0 = 5; % center frequency (MHz)
FBW = 0.60; % fractional bandwidth at -6 dB (amplitude)
B = FBW*f0; % -6 dB bandwidth (MHz)
sig_t = sqrt(2*log(2))/(pi*B); % envelope std (us): B = 2 sqrt(2 ln2) sigma_f, sigma_f = 1/(2 pi sigma_t)
tau_th = 4*log(2)/(pi*B); % -6 dB pulse duration (us)
dz_th = c*tau_th/2; % axial resolution (mm)
%% Pulse (two-way impulse response)
tp = (-ceil(4.5*sig_t*fs):ceil(4.5*sig_t*fs))/fs; % time axis of the pulse (us)
p = exp(-tp.^2/(2*sig_t^2)) .* cos(2*pi*f0*tp);
M = numel(p);
%% Analytic signal by FFT (replaces hilbert): keep DC, double positive bins, zero negative bins
analytic = @(x, Nf) ifft( fft(x, Nf) .* [1, 2*ones(1, Nf/2-1), 1, zeros(1, Nf/2-1)] );
%% Measured pulse length from its envelope
Nf = 2^nextpow2(8*M);
env_p = abs(analytic(p, Nf)); env_p = env_p(1:M);
above = find(env_p >= max(env_p)/2);
% sub-sample crossing by linear interpolation at both edges
i1 = above(1); i2 = above(end);
t1 = tp(i1-1) + (max(env_p)/2 - env_p(i1-1))/(env_p(i1) - env_p(i1-1))/fs;
t2 = tp(i2) + (env_p(i2) - max(env_p)/2)/(env_p(i2) - env_p(i2+1))/fs;
tau_meas = t2 - t1;
% Gabor product (rms widths of |envelope|^2 and |P(f)|^2, one-sided spectrum)
e2 = env_p.^2; mt = sum(tp.*e2)/sum(e2); st2 = sqrt(sum((tp-mt).^2.*e2)/sum(e2));
Pf = abs(fft(p, Nf)); fax = (0:Nf-1)*fs/Nf; pos = 1:Nf/2;
q2 = Pf(pos).^2; mf = sum(fax(pos).*q2)/sum(q2); sf2 = sqrt(sum((fax(pos)-mf).^2.*q2)/sum(q2));
fprintf('--- pulse: f0 = %.1f MHz, B(-6 dB) = %.2f MHz ---\n', f0, B);
fprintf('tau(-6 dB): theory 4ln2/(pi B) = %.4f us, measured from FFT envelope = %.4f us\n', tau_th, tau_meas);
fprintf('axial resolution c*tau/2: theory %.4f mm, measured %.4f mm\n', dz_th, c*tau_meas/2);
fprintf('Gabor product sigma_t''*sigma_f'' = %.5f (1/(4 pi) = %.5f)\n', st2*sf2, 1/(4*pi));
%% Reflectivity: speckle line (z = 0..6 mm) and the RF line by FFT convolution
zmax = 6; Ns = round(2*zmax/c*fs); % samples covering 0..zmax (round trip)
rho = zeros(1, Ns); hit = rand(1, Ns) < 0.15; % ~20 scatterers per mm (sample = 7.7 um)
rho(hit) = randn(1, nnz(hit));
L = Ns;
Nlin = L + M - 1; % linear convolution length
Nfft = 2^nextpow2(Nlin);
r_fft = real(ifft(fft(rho, Nfft) .* fft(p, Nfft))); r_fft = r_fft(1:Nlin);
r_dir = conv(rho, p);
Nshort = L; % too short (< L+M-1): circular wrap-around
r_circ = real(ifft(fft(rho, Nshort) .* fft(p, Nshort)));
fprintf('\n--- convolution ---\n');
fprintf('L = %d, M = %d, L+M-1 = %d, Nfft = %d: max|FFT conv - conv| = %.2e\n', L, M, Nlin, Nfft, max(abs(r_fft - r_dir)));
fprintf('Nfft = %d (< L+M-1): max error on first %d samples = %.2e (wrap-around)\n', Nshort, M, max(abs(r_circ(1:M) - r_dir(1:M))));
% spectra multiply
R = fft(r_dir, Nfft); S = fft(rho, Nfft); P = fft(p, Nfft);
fprintf('max|R - P.S| / max|R| = %.2e (convolution in time = multiplication in frequency)\n', max(abs(R - P.*S))/max(abs(R)));
%% Two reflectors: axial resolution test
% The envelope of two echoes depends on their relative carrier phase phi = 4 pi f0 s / c:
% in phase (phi = 0) the envelopes add, in quadrature (phi = pi/2) the intensities add
% (= the average over random phase), in antiphase they cancel at the midpoint.
spac = [0.15 0.20 dz_th 0.25 0.30 0.40]; % spacings (mm)
fprintf('\n--- two equal reflectors at 3 mm: envelope dip between them (dB) ---\n');
fprintf('%10s %10s %12s %10s %10s %12s\n', 'spacing mm', 'spacing/dz', 'phi (deg)', 'dip RF', 'dip phi=0', 'dip phi=90');
zc = 3; Nr = 2^nextpow2(Ns + M);
gEnv = @(t) exp(-t.^2/(2*sig_t^2)); % Gaussian envelope
tt = linspace(-1, 1, 4001); % fine time axis (us) for the envelope-only cases
dipOf = @(e, a, b) 20*log10(min(e(a:b))/min(e(a), e(b)));
figure('Name', 'two reflectors', 'Position', [100 100 760 560]);
for is = 1:numel(spac)
s = spac(is);
rr = zeros(1, Ns);
k1 = round(2*(zc - s/2)/c*fs) + 1; k2 = round(2*(zc + s/2)/c*fs) + 1;
rr(k1) = 1; rr(k2) = rr(k2) + 1;
rf = conv(rr, p); % pulse centered: shift by (M-1)/2
rf = rf((M+1)/2 : (M+1)/2 + Ns - 1);
en = abs(analytic(rf, Nr)); en = en(1:Ns);
dip = dipOf(en, k1, k2);
phi = mod(2*pi*f0*(k2 - k1)/fs, 2*pi); % actual relative phase after sample rounding
dt = s/c*2/2; % half the echo separation (us)
e1 = gEnv(tt + dt); e2 = gEnv(tt - dt);
[~, a] = min(abs(tt + dt)); [~, b] = min(abs(tt - dt));
d0 = dipOf(e1 + e2, a, b); % in phase
d90 = dipOf(sqrt(e1.^2 + e2.^2), a, b); % quadrature = intensities add
fprintf('%10.3f %10.2f %12.0f %10.1f %10.1f %12.1f\n', s, s/dz_th, phi*180/pi, dip, d0, d90);
if is == 2 || is == 5
zz = (0:Ns-1)/fs*c/2;
subplot(2, 1, 1 + (is == 5));
plot(zz, rf, 'Color', [0.2 0.4 0.8]); hold on; plot(zz, en, 'r', 'LineWidth', 1.4);
plot([zc-s/2 zc+s/2], [0 0], 'kv', 'MarkerFaceColor', 'k'); hold off;
xlim([zc-1 zc+1]); xlabel('depth z = ct/2 (mm)'); ylabel('RF, envelope');
title(sprintf('s = %.2f mm = %.2f dz, phase %.0f deg: dip %.1f dB', s, s/dz_th, phi*180/pi, dip));
end
end
fprintf('At spacing = c tau/2 (%.3f mm) the quadrature (random-phase average) dip is -3.0 dB.\n', dz_th);
%% Figure: pulse, spectra, speckle RF line with FFT envelope
figure('Name', 'pulse and RF line', 'Position', [100 100 760 560]);
subplot(2, 2, 1);
plot(tp, p, 'b', tp, env_p, 'r', tp, -env_p, 'r'); grid on;
xlim([-0.6 0.6]); xlabel('time (us)'); ylabel('p(t)'); title(sprintf('pulse, tau = %.3f us', tau_meas));
subplot(2, 2, 2);
fa = (0:Nfft/2)*fs/Nfft;
Sn = abs(S(1:Nfft/2+1)); Pn = abs(P(1:Nfft/2+1)); Rn = abs(R(1:Nfft/2+1));
plot(fa, Sn/max(Sn), 'Color', [0.6 0.6 0.6]); hold on;
plot(fa, Pn/max(Pn), 'b', 'LineWidth', 1.5); plot(fa, Rn/max(Rn), 'r'); hold off;
xlim([0 12]); xlabel('frequency (MHz)'); ylabel('|.| (norm.)'); title('|S| gray, |P| blue, |PS| red');
subplot(2, 1, 2);
rfs = r_dir((M+1)/2 : (M+1)/2 + Ns - 1);
ens = abs(analytic(rfs, 2^nextpow2(2*Ns))); ens = ens(1:Ns);
zz = (0:Ns-1)/fs*c/2;
plot(zz, rfs, 'Color', [0.2 0.4 0.8]); hold on; plot(zz, ens, 'r', 'LineWidth', 1.2); hold off;
xlabel('depth z = ct/2 (mm)'); ylabel('amplitude'); title('speckle RF line and FFT-analytic envelope');
What to look for. \(\tau = 0.2942\) µs and \(\Delta z = 0.2265\) mm (theory and FFT-envelope measurement agree); Gabor product \(0.07958 = 1/(4\pi )\). FFT convolution with \(N \ge L + M - 1\) matches conv to \(2\times 10^{-15}\); with \(N = L\) the first samples are wrong by 1.9 (wrap-around). Two reflectors: the envelope dip depends on their relative carrier phase; at spacing \(c\tau /2\) the random-phase (quadrature) dip is −3.0 dB.
04.14Self-check
Q1A 7 MHz tone is sampled at 10 MHz. What frequency do the samples represent, and is anything else changed?
\(k = \operatorname{round} (7/10) = 1\), so \(f_{0} - k f_{s} = -3\) MHz and \(f_{\mathrm{alias}} = 3\) MHz. The negative sign means the content comes from the −7 MHz image: the spectrum is mirrored and the phase is conjugated, so \(\cos (2\pi \cdot 7t + \varphi )\) samples identically to \(\cos (2\pi \cdot 3t - \varphi )\). Demo 04.1 confirms that the FFT peak sits at 3.000 MHz.
Q2Which sampling rates are legal for an RF band spanning 3–7 MHz? Compare with a 5 MHz, 60 % band.
\(B = 4\) MHz and \(\lfloor f_{H}/B\rfloor = \lfloor 7/4\rfloor = 1\), so only \(n = 1\) exists: \(f_{s} \ge 14\) MHz. An 80 % fractional band cannot be undersampled. For [3.5, 6.5] MHz, \(B = 3\) and \(\lfloor 6.5/3\rfloor = 2\), so \(f_{s} \ge 13\) MHz or \(6.5 \le f_{s} \le 7.0\) MHz. The second window is narrow, and the band arrives inverted there (n even).
Q3\(N = 1024\) samples at 40 MHz. What are the bin spacing, the observation time and the frequency resolution? What changes with 4× zero padding?
Bin spacing \(f_{s}/N = 39.06\) kHz, \(T = 25.6\) µs, rectangular-window resolution ≈ \(1/T = 39.06\) kHz (Hann −3 dB width 1.44 bins = 56.3 kHz). Padding to 4096 gives 9.77 kHz bins on the same DTFT. Resolution is unchanged, and only peak interpolation improves.
Q4What is the −6 dB axial resolution of a 5 MHz Gaussian pulse with 60 % fractional bandwidth? What happens at 7.5 MHz with the same 3 MHz absolute bandwidth?
\(B = 0.6 \times 5 = 3\) MHz, \(\tau = 4 \ln 2/(\pi B) = 0.883/3\) MHz = 0.294 µs, \(\Delta z = c\tau /2 = 1.540 \times 0.294/2\) \(= 0.227\) mm. At 7.5 MHz with B still 3 MHz, \(\tau\) and \(\Delta z\) are identical: axial resolution depends on bandwidth, not center frequency. The higher \(f_{0}\) only adds more carrier cycles under the same envelope, which helps phase-based delay estimation (Module 11), not resolution.
Q5A second tone at −40 dB sits 6.5 bins from a strong tone. Is it visible with a rectangular window? With Hann?
The rectangular sidelobe envelope falls as ≈ \(1/(\pi \cdot \Delta k)\), and near 6.5 bins the sidelobes peak at −26 dB (\(1/(64 \sin (6.5\pi /64))\) for \(N = 64\)), so a −40 dB tone is buried. Hann sidelobes there are ≈ −58 dB, so the tone stands about 18–19 dB above the leakage. Demo 04.5 reproduces this case with its default settings.
Q6You filter a 2048-sample RF line with a 63-tap FIR by FFT. What is the minimum FFT size, and what delay must you remove?
\(N \ge L + M - 1\) \(= 2048 + 63 - 1 = 2110\), so the next power of two is 4096 (or use overlap-save with smaller blocks). A symmetric 63-tap filter has group delay (M−1)/2 = 31 samples. At 40 MHz that is 0.775 µs, or 0.60 mm of depth after the c/2 conversion.
Q7A 0.3 mm pitch array runs at 7.5 MHz. Where are the grating lobes unsteered, and what pitch would allow \(\pm 20^{\circ}\) steering?
\(\lambda = 1.540/7.5 = 0.205\) mm, \(\lambda /d = 0.684\), so \(\sin \theta _{g} = \pm 0.684\) and \(\theta _{g} = \pm 43.2^{\circ}\), inside the visible region. Grating-lobe-free steering to 20° needs d ≤ λ/(1 + sin 20°) = \(0.205/1.342 = 0.153\) mm (about \(\lambda /1.34\)).
Q8Zero padding a 16-pulse Doppler ensemble to 256 points makes the spectrum look smooth. Can it now separate two flows whose Doppler shifts differ by 0.5/T?
No. The ensemble's DTFT is the true spectrum convolved with a kernel of width ≈ 1/T (wider with a window), and padding only samples that DTFT more densely. Two components 0.5/T apart form a single lobe in the DTFT itself for most relative phases. Near 90° (relative phase at the first sample) a dip can appear, but it comes from interference, and the two peaks sit far from the true frequencies (Demo 04.4, phase slider). Padding changes neither case. Separating them takes a longer ensemble, or a parametric or high-resolution estimator with its own model assumptions.
04.15Figures from the literature
Published figures to hold this module's transforms against: an open plane-wave benchmark with experimental phantom data, and the reference figures behind every window table. Images are not reproduced here; follow the DOI to the figure.
One plane wave: receive-only focusing on a phantom
H. Liebgott, A. Rodriguez-Molares, F. Cervenansky, J. A. Jensen, O. Bernard, "Plane-wave imaging challenge in medical ultrasound," Proc. 2016 IEEE International Ultrasonics Symposium. doi:10.1109/ULTSYM.2016.7728908 (open copy: DTU Orbit). Fig. 2.
Simulated (a, c) and experimental (b, d) images of the PICMUS resolution and contrast phantoms (CIRS 040GSE, Verasonics Vantage 256, L11 probe) from a single 0° plane wave with delay-and-sum, shown from −60 to 0 dB. Look at the point targets: with no transmit focusing the lateral k-space support comes from the receive aperture alone (interview I10), so the lateral PSF is wider and its sidelobes higher than for a focused two-way beam, where transmit and receive patterns multiply, (04.17)–(04.18).
75 compounded plane waves: a synthetic transmit aperture
Same paper, Fig. 3.
The same four datasets beamformed by coherently compounding all 75 plane waves. Compare each point target and cyst with Fig. 2: each transmit angle shifts the receive k-space region by sin θ/λ, so the angle set builds a transmit aperture and restores two-way focusing. The paper reports resolution as the mean FWHM of the point targets and contrast as the mean CNR of the cysts; the replication period λ/Δ(sin θ) of 04.8 sets how fine the angle step must be.
Rectangle and Hann windows with their transforms
F. J. Harris, "On the use of windows for harmonic analysis with the discrete Fourier transform," Proc. IEEE 66(1):51–83, 1978. doi:10.1109/PROC.1978.10837. Fig. 13 and Fig. 17.
Fig. 13 is the rectangle window and the log-magnitude of its transform; Fig. 17 is the cos²(πn/N) (Hann) window and its transform (Figs. 16–19 cover cosα for α = 1 to 4). These are the curves of Demo 04.5 and, because the beam is the transform of the aperture, of the rect and Hann beam patterns in 04.8: compare the first sidelobe and the far-sidelobe slope, −6 dB/octave for the rectangle against −18 dB/octave for Hann, and the mainlobe that doubles in null-to-null width.
Two-tone detection and the figures of merit (Table I)
Same paper, Figs. 57–59 (rectangle window; Figs. 60–101 repeat the test for the other windows) and Table I.
Fig. 57 is the power spectrum of two tones at bins 10 and 16 through the rectangle window; Figs. 58 and 59 move the large tone to bins 10.5 and 10.25, so its leakage rises across the band. This is Demo 04.5 with the tone-1 offset slider. Table I is the benchmark behind the window table in 04.4: rectangle −13 dB peak sidelobe, 0.89 bin −3 dB width, ENBW 1.00, scalloping loss 3.92 dB; Blackman −58 dB, 1.68 bins, ENBW 1.73, 1.10 dB. The page's own values agree to within the rounding and the DFT-even convention stated in 04.4.
04.16Go deeper
- A. V. Oppenheim, R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., Pearson/Prentice Hall, 2010. Ch. 4 (sampling of continuous-time signals, including bandpass), Ch. 5 (transform analysis of LTI systems, group delay, linear phase), Ch. 7 (filter design, window method), Ch. 8 (the DFT, circular convolution), Ch. 10 (Fourier analysis of signals using the DFT, windowing, resolution).
- F. J. Harris, “On the use of windows for harmonic analysis with the discrete Fourier transform,” Proc. IEEE, 66(1):51–83, 1978. doi:10.1109/PROC.1978.10837. The source of the window figures of merit (PSL, ENBW, scalloping loss, processing gain).
- J. F. Kaiser, R. W. Schafer, “On the use of the I0-sinh window for spectrum analysis,” IEEE Trans. Acoust., Speech, Signal Process., 28(1):105–107, 1980.
- R. G. Vaughan, N. L. Scott, D. R. White, “The theory of bandpass sampling,” IEEE Trans. Signal Process., 39(9):1973–1984, 1991.
- T. L. Szabo, Diagnostic Ultrasound Imaging: Inside Out, 2nd ed., Academic Press, 2014. Chapters on transducer pulses, the pulse-echo system model and array beamforming.
- J. A. Jensen, Estimation of Blood Velocities Using Ultrasound: A Signal Processing Approach, Cambridge University Press, 1996. Pulse-echo modelling, slow-time sampling and wall filters.
- J. W. Goodman, Introduction to Fourier Optics, 3rd ed., Roberts & Company, 2005. Fresnel and Fraunhofer diffraction, the focal plane as a Fourier plane, transfer functions.
- G. S. Kino, Acoustic Waves: Devices, Imaging, and Analog Signal Processing, Prentice-Hall, 1987. Focused-transducer fields, beam width and depth of field.
- W. F. Walker, G. E. Trahey, “The application of k-space in pulse echo ultrasound,” IEEE Trans. Ultrason. Ferroelectr. Freq. Control, 45(3):541–558, 1998. The k-space description of pulse-echo imaging used in 04.8.
- B. D. Steinberg, Principles of Aperture and Array System Design, Wiley, 1976. Array factor, grating lobes, element factor and random phase errors.
- G. Montaldo, M. Tanter, J. Bercoff, N. Benech, M. Fink, “Coherent plane-wave compounding for very high frame rate ultrasonography and transient elastography,” IEEE Trans. Ultrason. Ferroelectr. Freq. Control, 56(3):489–506, 2009. Angle sampling as synthetic transmit focusing.
- C. Demené et al., “Spatiotemporal clutter filtering of ultrafast ultrasound data highly increases Doppler and fUltrasound sensitivity,” IEEE Trans. Med. Imaging, 34(11):2271–2285, 2015. The SVD filter that replaces the wall filter (Module 06).