# Confusion about frequency illustration of FMCW in matlab

I am currently working through the FMCW radar example in the Matlab Docs and have a question concerning the following plot

1. Why is the frequency of the signal apparently decreasing if I have a linear chirp ramp? I would have expected a signal with an ever so increasing frequency

2. How can I interpret the picture in the lower half showing the spectogram? What do the colours stand for?

New contributor
Carsten D is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• re: 1. who says "linear" means "increasing"? $f(x) = -2x$ is definitely a linear function, but it's definitely not increasing. – Marcus Müller Nov 8 at 20:02
• The lower question might be a bit broad. Have you tried to read up on "spectrogram"? What's your specific question, then? – Marcus Müller Nov 8 at 20:02
• regarding the second question: I dont get why there are frequency components plotted in colour above and below the actual frequency ramp in yellow. The two images are supposed to show the same signal. However, I dont understand why the frequency in the upper image is then obviously decreasing after half of the sweep time – Carsten D Nov 9 at 6:56
• If you have generated the chirp yourself, you may need to revise the way phase increases in the trigonometric function. This looks like plain simple phase advance which will cause that folding in the middle when in reality you also have to take into account an extra term. – A_A Nov 9 at 9:11
• thanks, but this is from the official matlab docs Oo – Carsten D Nov 9 at 10:52

Why is the frequency of the signal apparently decreasing if I have a linear chirp ramp?

Why do you think it's decreasing? The bottom plot clearly shows it increases linearly from start to finish of the signal. I suspect the signal you're looking at is a complex-valued signal (effectively).

The code below aims to simulate (without the tool boxes) what that matlab example does.

f_low = 0;
f_high = 150;
fs = 300;

N = 512;
t = 0:(N-1);

f = 2*pi*linspace(f_low, f_high, N)/fs;

subplot(311);
plot(f)
subplot(312);
plot(cos(f.*t))
subplot(313);
plot(sin(f.*t))


So the sampling rate is 300MHz and the range of frequencies of the signal is from 0 Hz to 150 MHz.

The resulting plot is below. As you can see, it has a similar shape to the example.

How can I interpret the picture in the lower half showing the spectogram? What do the colours stand for?

The picture shows the frequency peak as a function of time. The colours, as indicated by the key on the right, show the magnitude at that time/frequency location.

• thank you for your detailed explanations. I was just wondering why both signals seem to reduce in frequency (if looking at the plots) although the frequency is obviously increasing. Is that due to aliasing? And why are there blue and green colored structures then above and below the linear ramp in the spectrogram? – Carsten D 51 mins ago