Using MATLAB's Spectrogram Function for Analysis
See the MATLAB documentation: s = spectrogram(x) returns the short-time Fourier transform of the input signal, x. Each column of s contains an estimate of the short-term, time-localized frequency content of x.. Namely each column of the matrix s is the result of an fft() on some samples of the input. So the plot you see is the magnitude of the columns of s.

Spectrogram is about analysis of Non Stationary signals. So something is changing over time which means it makes no sense to look on the DFT of all samples. The window length is the time you think the signal has the same properties over time. The overlap time should be similar to the time the signal is changing. Something like the time of Fade Out / Fade In, the transient length.


Example
The following code will recreate the figure form the function (Up to the Colorbar and the units of the Axis):
t = 0:0.001:2;
x = chirp(t,100,1,200,'quadratic');

figure();
spectrogram(x,128,120,128,1e3);

s = spectrogram(x,128,120,128,1e3);

figure();
hA = axes();
imagesc(20 * log10(abs(s).'));
set(hA, 'YDir', 'normal');
```