# Does chirp have constant magnitude frequency response?

Pg. 223 claims so, yet my results via DFT differ: Is the textbook wrong?

My attempted explanations: (code)

1. DFT vs DTFT: "frequency response" is computed via latter. Still, DFT should resemble a sampled DTFT.

2. DFT time-domain periodicity, whereas DTFT assumes aperiodic, or "repeats at infinity" with infinite zero-padding.

To address each, I try greater N, and zero-padding - below. Zero-padding appears to correct phase (quadratic if unrolled), and more samples tend to flatten the magnitude for an ever-growing portion of frequencies to the right.

I figure, in the limit N -> inf, the amplitude spike has zero width (like in Gibbs) - but this appears contradicted in the "large N long padding" case, where a nontrivial portion of the amplitude decays with oscillations. Further, the left peak appears to scale with N, behaving more like an impulse in the limit, which won't yield zero energy as in Gibbs phenomenon.   Update: turns out magnitude doesn't spike, but rather decays exponentially, which is far from the expected horizontal line - and, the phase is linear: The book is not wrong, but it does present the concepts on LFM in a clunky manner and can be misleading. The book presents the analytical expression for the LFM spectrum, which is an approximation. It also plays with the plot views and most likely unwraps the phase angles, which is usually required to see the phases you expect.

Usually when you're introducing LFM, you'll show the modulated pulse itself as well as the phase progression in the time-domain. The analytical expressions in the time domain is all you need to observe the linear frequency and therefore quadratic phase nature of LFM. Doing this in the frequency-domain just tends to introduce more confusion. An example of the time-domain LFM pulse and its phase is shown below. When deriving the expression for the Fourier transform of an LFM pulse, you do indeed yield a magnitude of 1 over the bandwidth of the pulse. This is intuitively satisfying because you have the same contribution from each frequency over the bandwidth.

Confusion does occur however when one goes to plot this if they expect a constant frequency response. With any practical LFM spectrum plot, even with very long pulse widths, one should expect a ripple effect which you have already identified. The quadratic nature of the phase is still captured in the DFT. The spectrum of the LFM pulse from above is shown below. I haven't tried your code, but it might be that you just need to zoom in the proper areas and unwrap the phases to see what you want. Provided is the MATLAB code to produce the plots to help you in converting it to python.

%% LFM - Time and Frequency Domain

% Sampling
Fs = 50e6;

% Pulse parameters
tau = 50e-6;
bandWidth = 10e6;
alpha = bandWidth/tau;

% Define waveform
t = 0:1/Fs:tau - 1/Fs;
fmcwPulse = exp(1i*pi*alpha.*t.^2); % Complex transmitted LFM waveform

% Plot
figure;
subplot(2, 1, 1);
plot(real(fmcwPulse));
xlabel("Samples");
title("LFM Pulse - Real Part");

subplot(2, 1, 2);
plot(unwrap(angle(fmcwPulse)));
xlabel("Samples");
title("LFM Phase");

figure;
subplot(2, 1, 1);
plot(abs(fftshift(fft(fmcwPulse))));
title("LFM Spectrum Magnitude");

subplot(2, 1, 2);
plot(unwrap(angle(fftshift(fft(fmcwPulse)))));
title("LFM Spectrum Phase");


## Update

Modifying the code above so that $$\tau = 1 \space s$$, which is relatively long, yields a spectrum closer to the ideal flat spectrum that one would expect analytically. The spectrum is shown below. • "even with very long pulse widths, one should expect a ripple effect" - why? What prevents the magnitude from converging to a straight line as N -> inf? As I further noted, the energy of the magnitude spike doesn't near zero with increasing N, which it must if we are to conclude "it's because N is finite". It isn't even a spike, but worse, and unwrapped phase turned out linear - question updated. – OverLordGoldDragon Sep 3 at 0:00
• @OverLordGoldDragon Technically yes, if you increase the pulse width you will approach a flat spectrum but is not practical. Take a look at the code I posted. There might be something wrong with how you have implemented it in Python. – Envidia Sep 3 at 0:04
• You presented a misleading (if not false) example with the topmost chirp; the phase shown is that of the imaginary component relative to real component of a 'complex chirp' (which isn't even the phase of the chirp itself); "the phase" refers to that of the sinusoidal frequency components, doesn't it? So it must first be transformed, and be real to begin with. Further, my code is fine; it uses numpy's fft to find real DFT, then finds magnitude as sqrt(imag^2 + real^2). Are you able to flatten the magnitude in MATLAB? – OverLordGoldDragon Sep 3 at 0:32
• @ I don't understand what you mean that "which isn't even the phase of the chirp itself". This is by definition the phase of the LFM pulse. Recall that the instantaneous frequency of a sinusoid is the derivative of the phase. This is why LFM chirps are called to be quadratic phase, which is where their linear frequency comes from. I'm going to update the post to include a long chirp that yields a flatter spectrum. – Envidia Sep 3 at 0:41
• We aren't on the same page then, as the definition I follow is within the context of the textbook, which hasn't presented what you speak of. It's a chapter on DFT, so I can only understand "phase" as that of a signal's frequency components. I can't attribute much meaning to your usage of phase, however; looks like the phase of a signal whose DFT's real & imaginary components are chirp. Have a reading reference? – OverLordGoldDragon Sep 3 at 0:51

The textbook is wrong, or very misleading depending on interpretation. The frequency response is square - or, constant over the swept frequency. Assuming an ideal chirp system which can scale up $$f$$ to any arbitrary duration $$t$$ (infinite bandwidth);, then the magnitude is a square of infinite width - which happens to be the same as plain "constant".

What follows are a number of related descriptions; thanks to Envidia for helpful discussion - refer to his answer for complex chirp plots.

• Phase (of chirp): quadratic. Must be careful with what's meant by "phase"; the instantaneous, i.e. the complete input, $$\phi(t)$$: $$\cos(\phi(t))$$. The instantaneous frequency of $$\cos(t^2)$$ isn't $$t$$, but $$t/2$$; see here.

• Phase (of freq response): parabolic, with half-parabolas symmetric about and adjacent to the spike at $$f_{\text{max}}/2$$. So is the textbook wrong? For any physical, finite chirp system, yes - but book again assumes an ideal system with an infinite frequency swept, so the "peak" sits at infinity, rendering the phase a true parabola.

• Magnitude (of chirp): for a complex chirp, it's unity / peak amplitude, as for any complex signal with shared inst. phase ($$\sin^2 + \cos^2$$). For a real chirp, it's the abs. value of amplitude.

• Magnitude (of freq response): why the ripples? Because $$f$$ sweeps fractional frequencies, which are represented as combinations of nearby and higher frequencies when a given frequency doesn't last long enough (for a chirp, each lasts for a mere one sample).

• Symmetry: real -> even about DC; complex -> asymmetric, no negative frequencies. I've used mainly this code for visualizing various scenarios. As a puzzle (to readers; I already understand) for understanding the topmost bullet point, I pose the following: how does a frequency swept from 1 to 2 complete more cycles than a signal with $$f=10$$ over the same period? What if instead $$t$$ is from 11.9 to 12.0? Don't look at the Wiki, or especially this code, as both answer the question (for most part).

• Take this result and then try plotting it over the interval [0, 1] but then zoom in to the interval [0.9, 1]. What do you notice? – Envidia Sep 8 at 16:46
• @Envidia Edited to clarify I already understand it - unless you're suggesting it for other readers. – OverLordGoldDragon Sep 8 at 17:04
• So you have a good handle on why setting the time vector from [0, 0.1] shows that the swept signal completes less cycles over the same period? – Envidia Sep 8 at 17:45
• @Envidia Total handle; derived ("reinvented") this via a thought experiment of a physical handle powered electrically, where source jumps from $f=1$ to $=2$. The results are more absurd the larger $t$ is, and that it's dependent on $t$ at all is itself absurd. I used to not be a fan of discrete stuff - but finally relearning it properly, I'm liking it even more than continuous, as it's more "inspectable" and truer to reality in some regards. – OverLordGoldDragon Sep 8 at 17:56
• @Envidia Also, I was wrong about "not phase of complex chirp itself" - it seemed meaningless to call the angle between imag & real components the phase of the signal; figured it otherwise when thinking in terms of phase as a complex vector, and of phase itself as the complete input to a sinusoid. – OverLordGoldDragon Sep 8 at 18:13