## Scalogram Computation in Signal Analyzer

The scalogram is the absolute value of the continuous wavelet transform (CWT) of a signal, plotted as a function of time and frequency. The scalogram can be more useful than the spectrogram for analyzing real-world signals with features occurring at different scales — for example, signals with slowly varying events punctuated by abrupt transients. Use the scalogram when you want better time localization for short-duration, high-frequency events, and better frequency localization for low-frequency, longer-duration events.

**Note**

You need a Wavelet Toolbox™ license to use the scalogram view.

The spectrogram is obtained by windowing the input signal
with a *window* of constant length (duration) that is shifted in time and
frequency. (See Spectrogram Computation in Signal Analyzer for more information.) The window used in the
spectrogram is even, real-valued, and does not oscillate. Because the spectrogram uses a
constant window, the time-frequency resolution of the spectrogram is fixed.

By contrast, the CWT is obtained by windowing the signal with a
*wavelet* that is scaled and shifted in time. The wavelet
oscillates and can be complex-valued. The scaling and shifting operations are applied to a
prototype wavelet. The scaling used in the CWT both shrinks and
stretches the prototype wavelet. Shrinking the prototype wavelet yields short duration,
high-frequency wavelets that are good at detecting transient events. Stretching the
prototype wavelet yields long duration, low-frequency wavelets which are good at isolating
long-duration, low frequency events.

To compute the scalogram, **Signal Analyzer** performs these steps:

If the signal has more than 1 million samples, divide the signal into overlapping segments.

Compute the CWT of each segment to get its scalogram.

Display the scalogram segment by segment.

As implemented, the CWT uses L^{1} normalization.
Therefore, the amplitudes of the oscillatory components in a signal agree with the
amplitudes of the corresponding wavelet coefficients.

**Tip**

Scalogram view does not support complex signals.

Scalogram view does not support nonuniformly sampled signals. To compute the scalogram of a nonuniformly sampled signal, resample your signal to a uniform grid by using the

`resample`

function.Scalogram view is available in displays that contain only one signal. To compare scalograms of different signals, open separate displays and drag each signal to its own display.

### Divide the Signal into Segments

If the input signal has 1 million samples or less, **Signal Analyzer** uses the
`cwt`

(Wavelet Toolbox) function directly. If the signal has
more than 1 million samples, the app performs these steps:

Divide the signal into segments of 1 million samples, with 50% overlap between adjoining segments.

If the last segment extends beyond the signal endpoint, zero-pad the signal until the last segment has 1 million samples.

After computing the scalogram of each segment, remove edge effects:

Discard the first 250,000 and the last 250,000 scalogram samples of all segments except the first and the last.

Discard the last 250,000 scalogram samples of the first segment.

In the last segment, discard the first 250,000 scalogram samples and the samples corresponding to the zero-padded region.

Consider, for example, a signal with 2.6 × 10^{6} samples:

### Compute the Continuous Wavelet Transform

**Signal Analyzer** computes the CWT using the default settings of the
`cwt`

(Wavelet Toolbox) function. The app uses generalized
analytic Morse wavelets with gamma factor *γ* = 3. See Morse Wavelets (Wavelet Toolbox) for more information.

**Signal Analyzer** provides two separate controls for frequency resolution.

The

**Time-Bandwidth**slider controls the time-bandwidth product, which is proportional to the wavelet duration in the time domain. Increasing the time-bandwidth product results in wavelets with more oscillations in their central portions, larger spreads in time, and narrower spreads in frequency. The slider moves in the range from 3 to 120. The default value is 60. The figure shows some Morse wavelets with varying time-bandwidth product*P*. The real part is in blue, the imaginary part is in red, and the absolute value is in black.The

**Voices Per Octave**slider controls the number of scales per octave used to discretize the CWT. As the number of voices per octave increases, the scale resolution becomes finer. The slider moves in steps of multiples of 4 in the range from 4 to 16. The default value is 8.

### Display the Scalogram

**Signal Analyzer** plots the absolute value of the CWT coefficients as a
function of time and frequency. If the signal was divided into segments, the app
concatenates portions of the scalograms of the individual segments and displays them.
The app also plots the cone of influence, which shows where edge effects become
significant. See Boundary Effects and the Cone of Influence (Wavelet Toolbox) for more
information.

## See Also

### Apps

### Functions

`cwt`

(Wavelet Toolbox) |`cwtfilterbank`

(Wavelet Toolbox) |`pspectrum`

## Related Examples

- Spectrogram View of Dial Tone Signal
- Find Interference Using Persistence Spectrum
- Find and Track Ridges Using Reassigned Spectrogram
- Scalogram of Hyperbolic Chirp
- Compute Envelope Spectrum of Vibration Signal