"I ran an FFT on the bearing and saw a mountain at 4 kHz. It told me the machine was ringing. It did not tell me the machine was dying."
A Resonating AI Agent
Prerequisites
This section builds directly on the DFT and spectral leakage of Section 7.1 and the analytic signal and instantaneous amplitude introduced with the Hilbert transform in Section 7.4. It uses band-pass filtering from Chapter 6 and the accelerometer measurement chain (mounting resonance, bandwidth, anti-alias sampling) from Chapter 2 and Chapter 3. No new transforms are needed beyond the FFT; the two methods here are recipes built on top of it.
Why a plain spectrum misses a broken bearing
A rotating machine that is about to fail rarely announces it with a loud tone at an obvious frequency. A spall on a bearing race produces a tiny, repeated impact every time a rolling element rolls over it. Each impact is a sharp click that rings the nearest structural resonance of the housing, often a few kilohertz, then dies away before the next click. So the fault energy does not live at the fault repetition rate (tens to hundreds of hertz); it lives up at the resonance, amplitude-modulated by the slow impact train. A raw FFT shows you the loud resonance carrier and buries the diagnostic repetition rate in its skirts. This section teaches the two classical demodulators that recover the hidden periodicity: envelope analysis, which strips the carrier and reads the impact rate directly, and the cepstrum, which detects evenly spaced harmonic families that betray gear and shaft faults. Together they are the backbone of vibration-based condition monitoring in Chapter 37 and predictive maintenance in Chapter 36.
The fault hides inside a carrier
What a defective bearing generates is a periodic sequence of impulsive impacts. Why their rate is diagnostic is pure kinematics: the geometry of the bearing fixes exactly how often a rolling element strikes a defect on each surface, and the four characteristic rates have names. For a shaft turning at \(f_r\) hertz with \(n\) rolling elements of diameter \(d\), pitch diameter \(D\), and contact angle \(\phi\), the two most useful are the ball-pass frequency of the outer and inner race:
$$\text{BPFO} = \frac{n}{2}\,f_r\!\left(1 - \frac{d}{D}\cos\phi\right), \qquad \text{BPFI} = \frac{n}{2}\,f_r\!\left(1 + \frac{d}{D}\cos\phi\right).$$The ball-spin frequency and the cage frequency (FTF) complete the set. How you exploit them: if you see energy repeating at BPFO, the outer race is spalled; at BPFI, the inner race; and the fact that these are non-integer multiples of shaft speed is what makes them unmistakable once you can see them. The problem is that you usually cannot see them in the raw spectrum, because, as the big picture warned, the impacts are not tones. They are a low-frequency modulation riding on a high-frequency resonant carrier. Formally the signal looks like \(x(t) = a(t)\cos(2\pi f_c t)\), where the carrier \(f_c\) is the housing resonance and the envelope \(a(t)\) is the impact train that repeats at BPFO or BPFI. Demodulation is the act of throwing away \(f_c\) and keeping \(a(t)\).
Envelope analysis: demodulate the impacts
The squared envelope spectrum (SES), also called the high-frequency resonance technique or envelope detection, is the single most effective classical bearing diagnostic. The recipe is four steps. First, band-pass the vibration signal around the resonance that the impacts excite, keeping the modulated band and discarding low-frequency mechanical clutter (imbalance, misalignment) that would otherwise dominate. Second, form the analytic signal \(x_a(t) = x(t) + j\,\mathcal{H}\{x(t)\}\) with the Hilbert transform from Section 7.4. Third, take its magnitude to get the envelope \(a(t) = |x_a(t)|\), which follows the impact train with the carrier removed. Fourth, run an FFT on the envelope. Peaks now appear precisely at BPFO, BPFI, and their harmonics, at frequencies tens of times lower than the carrier you filtered around.
Demodulation moves the diagnostic from where the energy is to where the meaning is
The counterintuitive move in envelope analysis is that you deliberately discard the loudest, highest-energy part of the signal (the resonance) and keep only how its amplitude wobbles. The resonance frequency is an accident of how the housing is bolted together; it carries no fault information by itself. The rate at which its amplitude pulses is the entire diagnosis. This is why an envelope spectrum can flag a failing bearing weeks before the overall vibration level (the RMS your alarm threshold watches) has risen at all: the impacts are energetically tiny but temporally regular, and regularity is exactly what a spectrum of the envelope rewards.
The one judgment call is which band to demodulate. Choose it wrong and you filter around a quiet region and see nothing. The classical automatic answer is the kurtogram: it scans many candidate band-pass windows and picks the one whose filtered signal has the highest spectral kurtosis, because impulsive fault energy is spiky (high kurtosis) while broadband noise and steady tones are not. In practice you compute the kurtogram, read off the center frequency and bandwidth of the most impulsive band, and hand those to the envelope step.
import numpy as np
from scipy.signal import hilbert, butter, filtfilt
fs = 20_000 # accelerometer sample rate, Hz
t = np.arange(0, 1.0, 1/fs)
# simulate a spalled bearing: impacts at BPFO ringing a 4 kHz resonance
bpfo = 118.0 # outer-race fault rate, Hz
impacts = np.zeros_like(t)
impacts[(np.arange(len(t)) % int(fs / bpfo)) == 0] = 1.0
resonance = np.exp(-1500 * (t % (1/bpfo))) * np.cos(2*np.pi*4000*t)
x = np.convolve(impacts, resonance, mode="same")
x += 0.3 * np.random.randn(len(t)) # broadband measurement noise
# envelope analysis: band-pass around the resonance, then demodulate
b, a = butter(4, [3000/(fs/2), 5000/(fs/2)], btype="band")
xb = filtfilt(b, a, x) # keep the modulated band
env = np.abs(hilbert(xb)) # analytic-signal envelope
env -= env.mean() # drop the DC pedestal
spec = np.abs(np.fft.rfft(env * np.hanning(len(env))))
freq = np.fft.rfftfreq(len(env), 1/fs)
peak = freq[1 + np.argmax(spec[1:len(freq)//40])] # search below ~250 Hz
print(f"dominant envelope line: {peak:.1f} Hz (BPFO = {bpfo} Hz)")
x is dominated by the 4 kHz resonance, where an FFT would show a single mountain and nothing at 118 Hz. After band-passing to the resonance and taking the Hilbert envelope, rfft of the envelope places its dominant line at the BPFO, recovering the fault rate the plain spectrum hid. The filtfilt zero-phase filter avoids smearing the impact timing.The printed line lands on the BPFO because the envelope, unlike the raw signal, oscillates at the impact rate rather than the carrier rate. Everything upstream of the FFT exists only to expose that rate. This four-line demodulator is the classical feature extractor that later feeds the fault classifiers of Chapter 8.
Right tool: the analytic signal in one call
The envelope step above hides real work: forming the analytic signal by hand means an FFT, zeroing the negative-frequency half, doubling the positive half, and an inverse FFT, with a subtle factor-of-two and a Nyquist-bin edge case that are easy to botch. scipy.signal.hilbert does all of it, correctly, in one line:
from scipy.signal import hilbert
envelope = np.abs(hilbert(band_passed_signal)) # analytic magnitude
ssqueezepy or a maintained kurtogram implementation returns the optimal center frequency and bandwidth, saving another 30-plus lines of the fast-kurtogram tree.Write the manual analytic-signal path once, to understand it; use the library everywhere after that.
The cepstrum: finding periodicity in the spectrum
Envelope analysis targets a single modulated band. Gearboxes pose a different problem: a worn or cracked gear tooth produces a spectrum full of families of harmonics and sidebands, evenly spaced tones stacked across a wide frequency range. Reading them by eye is tedious and error-prone. The cepstrum is built for exactly this: it detects periodicity in the spectrum itself. What it is: take the log magnitude of the spectrum, then inverse-transform it back to a time-like axis:
$$c[\tau] = \left|\;\mathcal{F}^{-1}\!\big\{\log |X(f)|\big\}\;\right|.$$The independent variable \(\tau\) has units of seconds and is called quefrency (an anagram of frequency, part of the field's affectionate wordplay: peaks are rahmonics, filtering is liftering). Why it works: a family of \(K\) harmonics uniformly spaced by \(\Delta f\) in the spectrum is itself a periodic pattern with period \(\Delta f\); the inverse transform collapses that whole comb into a single sharp rahmonic at quefrency \(\tau = 1/\Delta f\). Thirty gear-mesh sidebands become one clean peak whose position is the reciprocal of their spacing. When you reach for it: whenever the diagnosis is "are there evenly spaced sidebands, and how far apart," which covers gear faults, blade-pass modulation, and any harmonic family.
The log is not cosmetic. Because \(\log|A\cdot B| = \log|A| + \log|B|\), the cepstrum turns a multiplicative mix of a source and a transfer path into an additive one. A machine's measured vibration is (source excitation) times (structural transfer function); in the cepstrum these separate into different quefrency regions. This gives the cepstrum a second job: liftering, or editing in the quefrency domain, can remove the structural resonances (the transfer path) and leave a cleaner picture of the source, which is the same transfer-path-removal idea that made the cepstrum famous in speech, where it separates vocal-tract shaping from pitch.
The wind-turbine gearbox that hid its crack in the sidebands
An offshore wind operator instrumented a 2 MW turbine's gearbox with a housing accelerometer feeding the condition-monitoring stack of Chapter 37. The overall vibration trend was flat and every alarm was green. But the spectrum around the gear-mesh frequency was thick with small sidebands spaced at the intermediate-shaft rotation rate, the signature of a once-per-revolution modulation from a single cracked tooth. Buried among dozens of other tones, no threshold caught them. The cepstrum did: those sidebands collapsed into one rahmonic at a quefrency equal to the shaft period, and the height of that single rahmonic, trended week over week, climbed steadily for two months while the raw RMS never budged. The turbine was scheduled for a planned gearbox swap during a low-wind window instead of failing catastrophically in a storm. One scalar, the rahmonic amplitude, did what a full spectrum could not: it turned a diffuse family of faint tones into a trendable number.
Choosing, and combining, the two
The two methods answer different questions and are strongest together. Envelope analysis is the tool when the fault is impulsive and localized (rolling-element bearing spalls) and you can identify a resonance band to demodulate; it reads out an absolute repetition rate you can match to BPFO or BPFI. The cepstrum is the tool when the fault produces evenly spaced harmonic or sideband families (gears, shafts, modulation) and you want one number for their spacing, or when you need to strip a transfer path multiplicatively. A common industrial pipeline runs both: cepstrum pre-whitening (liftering out the deterministic gear-mesh and shaft components) cleans the signal so that the residual, once envelope-analyzed, reveals a bearing fault that the strong gear tones would otherwise have masked. Both are cheap, interpretable, and physics-grounded, which is why they remain the first pass in predictive maintenance even as the deep models of Chapter 36 take over the final classification; the demodulated spectrum is often a far better input to those models than the raw waveform.
Exercise 7.5
A bearing on a shaft turning at \(f_r = 30\) Hz has \(n = 9\) balls, \(d/D = 0.32\), and \(\phi = 0\). (a) Compute BPFO and BPFI in hertz. (b) You sample the accelerometer at \(f_s = 20\) kHz and know the housing resonance sits near 6 kHz; state the band-pass corners you would pass to the envelope stage and justify the bandwidth. (c) After envelope analysis you see a strong line at 108.5 Hz and weaker ones at 217 and 325.5 Hz; which race is faulted, and what are the two extra lines? (d) A colleague proposes skipping the band-pass and taking the Hilbert envelope of the raw signal; explain in one sentence what low-frequency component would then swamp the fault line, and why.
Self-check
1. In envelope analysis you deliberately throw away the highest-energy part of the signal. Which part, and why does discarding it improve the diagnosis rather than destroy it?
2. Why does the cepstrum take the logarithm of the spectrum before the inverse transform? Name one thing that step makes possible that a plain inverse FFT of the spectrum would not.
3. A quefrency peak (rahmonic) sits at \(\tau = 20\) ms. What spectral-domain feature produced it, and what is that feature's spacing in hertz?
What's Next
In Section 7.6, we shift from finding periodicity within one channel to relating two channels: the power spectral density gives a leakage-robust, statistically averaged view of where a signal's energy lives, and coherence measures how much of one sensor's spectrum is linearly explained by another, the foundation for transfer-path analysis and multi-sensor fault localization.