# Magnitude Spectrum of a Linear Chirp Signal

I am trying to understand intuitively the fft of a signal that changes in frequency in time.

Suppose I have the fft of a linear chirp signal sampled at 1 kHz for 2 seconds. The instantaneous frequency is 100 Hz at t = 0 and crosses 200 Hz at t = 1 second.

Using matlab, I have the following magnitude spectrum plot:

t1 = 0;
t2 = 1;
Fs = 1; %1khZ
f0 = 100;
f1 = 200;
T = 2;

figure;
subplot(2,2,[1,2]);
t = 0:0.001:T;
y = chirp(t,f0,t2,f1); %generate chirp signal
Y=fft(y); %apply DFT on the signal
F=linspace(0,1e3,length(y)); %create x-axis for plotting the spectrum
plot(F,abs(Y)./length(y)*2); %plot the magnitude spectrum


I then truncate the signal by getting only the first 100 samples. Now I have:

I have some questions.

1. Are the plots correct?
2. Is it correct to say that by truncating, the ripples produced during transform are minimized hence the peak at 100Hz can be easily distinguished?
• Please see this post that I think will interest you as a lot of the considerations with regards to the ripple and range of sweep are covered in detail: dsp.stackexchange.com/questions/66541/… May 29 at 12:49

Are the plots correct?

Mostly. Two things to consider: since your input signal is real (as it not complex), the spectrum is conjugate symmetric. So typically you would only plot the first half from 0Hz to 500Hz. If you want to plot the whole thing, it's better to circulate it and plot it from -500Hz to +500Hz. In most cases you would also use a logarithmic scale (in dB) for the amplitude and not a linear scale.

Is it correct to say that by truncating, the ripples produced during transform are minimized hence the peak at 100Hz can be easily distinguished?

Not really. It looks like you truncated both the signal and the FFT length. At this point your frequency resolution is only 10 Hz, which means it's large compared to your sweep width. There are still plenty of ripples: you just can't see them because of your poor frequency resolution. There are only two discrete points in your "passband" and you can't make a lot of ripple with just two points.

If you don't like the frequency domain ripple, you can simply flatten it out in the frequency domain. That creates a little bit of amplitude ripple in the time domain, but it's ruler flat in the frequency domain. Which one you want to choose depends on what you want to do with the signal.

understand intuitively the fft of a signal that changes in frequency in time.

Intuition can easily fail you so it's a good idea to stay close to the math. The whole concept of instantaneous frequency only makes sense for signals that have very small bandwidth over a decent amount of time. For most signals that's not the case: while you can technically calculate it, the result is often meaningless. What's the instantaneous frequency of the sum of two steady state sine waves with different frequencies ?

• I like that last question Hilmar! I was going to comment on an answer here but I think this will make an actual great DSP Puzzle question so will post that now, and will answer there if no one else does. (I assume you will be able to if you think it through further--- it certainly isn't meaningless) May 29 at 12:47
• Ok I see it is already asked so I will simply answer there- I will try to clarify in my answer that the instantaneous frequency for the sum of two steady state sine waves is very clearly defined, exists and is useful. May 29 at 12:58
• Cool. I'm looking forward to it. Would you mind posting a link ? May 29 at 13:44
• Yes and I know you'll get it quickly now that it's been written out: dsp.stackexchange.com/questions/61937/… (and I see someone else downvoted your answer- that wasn't me and wish people would provide an explanation when they do that! I'm giving a counter-balance upvote) May 29 at 13:47