Using MATLAB's Spectrogram Function for Analysis In the documentation - sepctrogram().
Question 1)s = spectrogram(signal) and spectrogram(signal) are two commands to plot the spectrogram. However, the variable s is complex valued. I am unable to understand which output of the spectrogram is used to generate the image plot?
Question 2) How to determine the best values of the parameters window and noverlap ? Should noverlap be 50% of the signal length (number of elements in the time series) or 90% etc? What if it is zero then what does it mean? My dataset has sampling time = 1sec. I remember reading somewhere that the window should be at least roughly twice as long as the period of the lowest frequency. So, for my case is w=2 since frequency = 1?
I was thinking of using pspectrum(signal,'spectrogram') which outputs the spectrogram and use the output values as inputs to the spectrogram() function. But again, I don't know which output values from pspectrum can be used, if at all that is possible.
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');
```