# Why do we get ripples in the frequency spectrum of a chirp, and how do I remove it?

The ripples in the amplitude spectrum of a linear spectrum is undesirable. I desire to obtain a flat spectrum response. Hence, how can I remove these ripples? Also, which factors (like time bandwidth product, chirp rate) are affecting the ripples, and how?

I designed a chirp with a frequency from 10 to 90 Hz in MATLAB. However, I obtained Fresnel ripples (which normally occurs) in the passband, along with overshoots at the band edges. I need to study the application of chirps on a material and use it for defect analysis. For this, I need to optimize the whole energy applied to the chirp. Hence, I want to get rid of these ripples. So, what parameters like chirp rate and time of sweep will affect the system?

• Hello, welcome to DSP.se. We will be glad to help you, but it would help us if you could add some examples in your questions, and also tell us what you already know and what you already tied. You can edit your questions to add more detail. – penelope Dec 19 '13 at 12:03
• Could the ripples be an artifact of the way you are computing the spectrum of the chirp? – John Feb 18 '14 at 2:34
• The Fourier transform of a chirp has ripples. Why do you want to remove them? The standard chirp has been used for many years to good effect in the oil industry (search for vibroseis). So long as all relevant frequencies are contained in the chirp, and you know the chirp's initial amplitude, and post-processing you do can take account of the variations in spectral magnitude. – Peter K. Mar 20 '14 at 1:38
• @PeterK, the Fourier transform of just the real (cos) or just the imaginary (sin) part of the chirp has ripples. but the complex chirp is flat in magnitude. – robert bristow-johnson May 18 '14 at 22:37
• @robertbristow-johnson : Does the same hold true for finite-frequency range chirps? The OP is asking about a finite-duration, finite-frequency range chirp with a frequency changing from 10Hz to 90Hz. The result you quote below has frequencies from $-\infty$ to $+\infty$. – Peter K. May 19 '14 at 12:25

Another thing the OP can do is use the "complex" chirp. What you really have to do is (at two different times and both times sweeping all frequencies from -Nyquist through DC to +Nyquist) pass the real part, $$x_r(t)=\cos(\pi \beta t^2)$$ and then pass the imaginary part $$x_i(t)=\sin(\pi \beta t^2)$$ of the complex chirp through the material under test and synchronously measure the two real results ($$y_r(t)$$ and $$y_i(t)$$), then assemble them as the real and imaginary parts of the response.

Let \begin{align} x(t) & = e^{j \pi \beta t^2} \\ & = \cos(\pi \beta t^2) + j \sin(\pi \beta t^2) \\ & = x_r(t) \qquad + j \ x_i(t) \\ \end{align}

Then $$X(f) \ \triangleq \ \mathscr{F}\left\{ x(t) \right\} \ = \ \sqrt{\frac{j}{\beta}} e^{-j\frac{\pi}{\beta} f^2}$$

You will see that $$|X(f)| = \sqrt{\frac{1}{\beta}}$$ for all $$f$$.

The respective outputs that are synchronously measured with the two driving signals are $$y_r(t)$$ and $$y_i(t)$$:

\begin{align} y_r(t) & \triangleq h(t) \circledast x_r(t) \\ & = h(t) \circledast \cos(\pi \beta t^2) \\ \\ y_i(t) & \triangleq h(t) \circledast x_i(t) \\ & = h(t) \circledast \sin(\pi \beta t^2) \\ \end{align}

Then this aggregate complex output, $$y(t)$$, can be assembled (in the mind of the computer) from the responses of the cosine sweep (the real part) and the sine sweep (the imaginary part):

\begin{align} y(t) & = y_r(t) + j \ y_i(t) \\ & = h(t) \circledast x_r(t) + j \ h(t) \circledast x_i(t) \\ & = h(t) \circledast \left(x_r(t) + j \ x_i(t)\right) \\ & = h(t) \circledast x(t) \\ & = \int_{-\infty}^{+\infty} h(u) \, x(t-u) \ du \\ & = \int_{-\infty}^{+\infty} h(u) \, e^{j \pi \beta (t-u)^2} \ du \\ & = \int_{-\infty}^{+\infty} h(u) \, e^{j \pi \beta (t^2-2tu+u^2)} \ du \\ & = e^{j \pi \beta t^2} \int_{-\infty}^{+\infty} \left(h(u) \, e^{j \pi \beta u^2}\right) \, e^{-j 2 \pi \beta t u} \ du \\ & = e^{j \pi \beta t^2} \int_{-\infty}^{+\infty} \tilde{h}(u) \, e^{-j 2 \pi (\beta t) u} \ du \\ & = e^{j \pi \beta t^2} \tilde{H}(\beta t) \\ \end{align}

where $$\tilde{H}(f) \triangleq \int_{-\infty}^{+\infty} \tilde{h}(t) e^{-j 2 \pi f t} \ dt = \mathscr{F}\left\{\tilde{h}(t) \right\}$$

and $$\tilde{h}(t) \triangleq h(t) e^{j \pi \beta t^2}$$

So this is what you get: first consider making this adjustment (dechirping) in the measured output: $$y(t) e^{-j \pi \beta t^2} = \tilde{H}(\beta t)$$

Now if the sweep rate $$\beta$$ is low enough, then $$e^{j \pi \beta t^2} \approx 1$$ for as long as $$h(t)$$ is not close to 0. Then $$\tilde{h}(t) \approx h(t)$$ and $$\tilde{H}(f) \approx H(f)$$ and $$\tilde{H}(\beta t) \approx H(\beta t)$$ and what you have measured in the output is another chirp, but with relative magnitude and phase changed by $$\tilde{H}(\beta t) \approx H(\beta t)$$.

Even if the sweep rate is not so low, you can compute either the true frequency response $$H(f)$$ by first computing

\begin{align} \tilde{h}(t) & = \mathscr{F}^{-1}\left\{ \tilde{H}(f) \right\} \\ & = \int_{-\infty}^{+\infty} \tilde{H}(f) e^{j 2 \pi f t} df \\ & = h(t) e^{j \pi \beta t^2} \\ \end{align}

Or from that result you can get the true impulse response $$h(t)$$ and then $$H(f)$$ if that's what you want. It should be the same $$H(f)$$ you would get if you divided $$Y(f) = \mathscr{F}\left\{ y(t) \right\}$$ by $$X(f) = \mathscr{F}\left\{ x(t) \right\} = \sqrt{\frac{j}{\beta}} e^{-j\frac{\pi}{\beta} f^2}$$. And there is no division by zero, because there are no ripples in $$X(f)$$ because the magnitude is a constant $$\sqrt{\frac{1}{\beta}}$$.

That is how to remove ripples (and any danger of division by zero) in the spectrum of a linearly-swept chirp.

Depends on your application constraints. Easiest way would be the following

1. Create chirp in the time domain
2. Fourier Transform
3. Set the spectrum amplitude to what you want it to be
4. Inverse Fourier Transform

This produces a chirp-like time domain signal that has the exact frequency spectrum that you want

• sometimes it ain't that simple, Hil. – robert bristow-johnson May 18 '14 at 22:39
• Hence my disclaimer "depends on your application" :-) – Hilmar May 19 '14 at 11:32
• one other thing that is a problem with this method is division by zero, which is what you get where either the cosine or sine chirps go to zero. (but the cosine and sine chirps never go to zero at the same frequencies because they always square and add to 1.) – robert bristow-johnson Jul 20 '14 at 5:12

I might be wrong, but my guess is that these ripples appear as a result of your chirp function being finite in time, generating discontinuities at both ends of your signal. The classic way to reduce ripples caused by discontinuities is multiplying your signal by a window, making the transition smoother. In Matlab you could try something like:

smoothChirp = chirp.*hamming(l);

Where l is the length of your signal. Of course the spectrum of your chirp won't have a "flat" characteristic anymore, so in the end we have a trade-off between perfectly linear frequency variation and the appearance of ripples in the signal spectrum.

• i wasn't the person who dinged you, but the window you would want to use with a chirp is the gaussian window $$w(t) = e^{-\pi \alpha t^2}$$ where $\alpha > 0$. – robert bristow-johnson Jul 20 '14 at 6:59