A nonstationary signal is a signal whose frequency content changes with time. The spectrogram of a nonstationary signal is an estimate of the time evolution of its frequency content. To construct the spectrogram of a nonstationary signal, Signal Analyzer follows these steps:
Divide the signal into equal-length segments. The segments must be short enough that the frequency content of the signal does not change appreciably within a segment. The segments may or may not overlap.
Window each segment and compute its spectrum to get the short-time Fourier transform.
Display segment-by-segment the power of each spectrum in decibels. Depict the magnitudes side-by-side as an image with magnitude-dependent colormap.
The spectrogram view is available in displays that contain only one signal.
To construct a spectrogram, first divide the signal into possibly overlapping segments. In Signal Analyzer, you can control the length of the segments and the amount of overlap between adjoining segments using Time Resolution and Overlap. If you do not specify the length and overlap, Signal Analyzer chooses a length based on the entire length of the signal, and 50% overlap. The app aligns the time axis of the spectrogram with the axis of the time-domain plot.
On the Spectrogram tab, in the Time Resolution section, click Specify.
If the signal does not have time information, specify the time resolution (segment length) in samples. The time resolution must be an integer greater than or equal to 1 and smaller than or equal to the signal length.
If the signal has time information, specify the time resolution in seconds. The app converts the result into a number of samples and rounds it to the nearest integer that is less than or equal to the number but not smaller than 1. The time resolution must be smaller than or equal to the signal duration.
Specify the overlap as a percentage of the segment length. The app converts the result into a number of samples and rounds it to the nearest integer that is less than or equal to the number.
If you select Auto for the time resolution computation, then Signal Analyzer uses the length of the entire signal to choose the length of the segments. The app sets the time resolution as ⌈N/d⌉ samples, where the brackets denote the ceiling function, N is the length of the signal, and d is a divisor that depends on N:
|Signal Length (N)||Divisor (d)||Segment Length|
You can still specify the overlap between adjoining segments. Specifying the overlap changes the number of segments. Segments that extend beyond the signal endpoint are zero-padded.
Consider the seven-sample signal
[s0 s1 s2 s3 s4 s5 s6]. Because ⌈7/2⌉ = ⌈3.5⌉ = 4, the app divides the signal into two segments of length four when
there is no overlap. The number of segments changes as the overlap
|Number of Overlapping Samples||Resulting Segments|
s0 s1 s2 s3 s4 s5 s6 0
s0 s1 s2 s3 s3 s4 s5 s6
s0 s1 s2 s3 s2 s3 s4 s5 s4 s5 s6 0
s0 s1 s2 s3 s1 s2 s3 s4 s2 s3 s4 s5 s3 s4 s5 s6
Once the segment length and overlap are set, the number of segments and their edge locations stay fixed and are independent of any zooming or panning. When you zoom and pan, the app computes and displays the spectrogram using the segments that fall within the visible zoomed-in region of interest.
Aligns the time axis of the spectrogram with the axis of the corresponding time-domain plot. That way, the spectral content at a given time aligns with its occurrence.
For nonzero overlap, extends the first and last segments to the signal endpoints.
Zero-pads the signal if the last segment extends beyond the signal endpoint.
When the segments have 0% overlap, each segment is centered at the actual time of occurrence. When the overlap is nonzero, the alignment of the spectrogram time axis with the time-domain axis has the effect that the first and last time intervals are elongated. All other time intervals are of the same length. In other words, the center of each segment, except for the first and last, corresponds to the actual time of occurrence. Consider this example:
After Signal Analyzer divides the signal into overlapping segments, the app windows each segment with a Kaiser window. The shape factor β of the window, and therefore the leakage, is adjustable.
The leakage used to compute the signal spectrum and the leakage used to window the spectrogram segments are independent of each other. You can adjust them separately.
The app then computes the spectrum of each segment, following the procedure outlined in Spectrum Computation in Signal Analyzer, except that the lower limit of the resolution bandwidth is
In summary, Signal Analyzer finds a compromise between the spectral resolution achievable with the entire length of the segment and the performance limitations that result from computing large FFTs.
If the resolution resulting from analyzing the full segment is achievable, the app computes a single modified periodogram of the whole segment using a Kaiser window with the specified shape factor.
If the resolution resulting from analyzing the full segment is not achievable, the app computes a Welch periodogram: It divides the segment into overlapping subsegments, windows each subsegment, and averages the periodograms of the subsegments. The app chooses the subsegment size, the window, and the overlap so that the composite periodogram is equivalent to a modified periodogram of the whole segment with the specified Kaiser window.
The app displays the power of the short-time Fourier transform in decibels, using a color bar with the default MATLAB® colormap. The color bar comprises the full power range of the spectrogram and does not change if you zoom or pan.
You can change the magnitude levels represented by a given color range. On the Spectrogram tab, change the minimum and maximum power values to display. You can also set the colormap so that it comprises the full power range of the zoomed-in section of the spectrogram. On the Display tab, click the Fit colormap button.