The second argument of the stft function is specifies the window length. The third parameter of the stft function is the window overlap, here set to 50%. The fourth parameter, the sampling frequency, is optional. When specified, the units on the spectrogram plot are time in seconds and frequency in Hz. Without it, the units are time in sample index and normalized frequency in radians/sample.