Main Content

Signal Analyzer

Visualize and compare multiple signals and spectra

Description

The Signal Analyzer app is an interactive tool for visualizing, preprocessing, measuring, analyzing, and comparing signals in the time domain, in the frequency domain, and in the time-frequency domain. Using the app, you can:

  • Easily access all the signals in the MATLAB® workspace

  • Smooth, filter, resample, detrend, denoise, duplicate, extract, rename, and edit signals without leaving the app

  • Add and apply custom preprocessing functions

  • Visualize and compare multiple waveform, spectrum, persistence, spectrogram, and scalogram representations of signals simultaneously

  • Measure data and signal statistics

The Signal Analyzer app provides a way to work with many signals of varying durations at the same time and in the same view.

For more information, see Using Signal Analyzer App.

  • You need a Wavelet Toolbox™ license to use the scalogram view and to apply wavelet denoising to signals.

Signal Analyzer app

Open the Signal Analyzer App

  • MATLAB Toolstrip: On the Apps tab, under Signal Processing and Communications, click the app icon.

  • MATLAB command prompt: Enter signalAnalyzer.

Examples

expand all

You can adjust the spectral leakage of the analysis window to resolve sinusoids in Signal Analyzer.

Generate a two-channel signal sampled at 100 Hz for 2 seconds.

  1. The first channel consists of a 20 Hz tone and a 21 Hz tone. Both tones have unit amplitude.

  2. The second channel also has two tones. One tone has unit amplitude and a frequency of 20 Hz. The other tone has an amplitude of 1/100 and a frequency of 30 Hz.

fs = 100;

t = (0:1/fs:2-1/fs)';

x = sin(2*pi*[20 20].*t)+[1 1/100].*sin(2*pi*[21 30].*t);

Embed the signal in white noise. Specify a signal-to-noise ratio of 40 dB.

x = x + randn(size(x)).*std(x)/db2mag(40);

Open Signal Analyzer and plot the signal. On the Analyzer tab, with the signal selected in the Signal table, click Time Values and select Sample Rate and Start Time. Specify Sample Rate as fs Hz and Start Time as 0 s. On the Display tab, click Spectrum to add a spectral plot to the display.

Click the Spectrum tab. The slider that controls the spectral leakage is in the middle position, corresponding to a resolution bandwidth of about 1.28 Hz. The two tones in the first channel are not resolved. The 30 Hz tone in the second channel is visible, despite being much weaker than the other one.

Increase the leakage so that the resolution bandwidth is approximately 0.83 Hz. The weak tone in the second channel is clearly resolved.

Move the slider to the maximum value. The resolution bandwidth is approximately 0.5 Hz. The two tones in the first channel are resolved. The weak tone in the second channel is masked by the large window sidelobes.

Click the Display tab. Use the horizontal zoom to magnify the frequency axis. Add two cursors to the display and drag the frequency-domain cursors to estimate the frequencies of the tones.

Read an audio recording of an electronic toothbrush into MATLAB®. The signal is sampled at 48 kHz. The toothbrush turns on at about 1.75 seconds and stays on for approximately 2 seconds.

[y,fs] = audioread("toothbrush.m4a");

Open Signal Analyzer and drag the signal from the Workspace Browser to the Signal table. Add time information to the signal by selecting it in the Signal table and clicking Time Values on the Analyzer tab. Select Sample Rate and Start Time and enter fs for the sample rate.

On the Display tab, click Display Grid to create a two-by-two grid of displays. Select each display, click Spectrum to add a spectrum view, and click Time to remove the time view. Drag the signal to all four displays.

Click the Spectrum tab to modify the spectrum view in each display.

  1. Click the top left display to select it. Move the Leakage slider until you get a leakage value of 32.

  2. Click the top right display to select it. On the Resolution Type section, select Window Length. On the Window Length section, select Specify and specify a window length of 1500 samples. On the Window Options section, choose a Rectangular window and specify an overlap percentage of 20.

  3. Click the bottom left display to select it. On the Resolution Type section, select Window Length. On the Window Length section, select Specify and specify a window length of 500 samples. On the Window Options section, choose a Hamming window and specify an overlap percentage of 50. On the NFFT section, specify 550 discrete Fourier transform points.

  4. Click the bottom right display to select it. On the Resolution Type section, select Window Length. On the Window Length section, select Specify and specify a window length of 5000 samples. On the Window Options section, choose a Chebyshev window and specify a sidelobe attenuation of 50 dB and an overlap percentage of 90.

You can see that some views show higher resolution but higher leakage, while other views have lower leakage but at the expense of resolution.

Related Examples

Programmatic Use

expand all

signalAnalyzer opens the Signal Analyzer app.

signalAnalyzer(sig) opens the Signal Analyzer app and imports and plots the signal sig. If the app is already open, then it plots sig in the current display. If sig is already plotted but has changed, then the function call updates the plot.

sig can be a variable in the workspace or a MATLAB expression. sig can be:

  • A vector or a matrix with independent signals in each column.

  • A timetable with time values specified as durations.

  • A timeseries object.

See Data Types Supported by Signal Analyzer for more details.

By default, the app plots the signal as a function of sample index. If you provide time information, or if the signal has inherent time information, then the app plots the signal as a function of time.

signalAnalyzer(sig1,...,sigN) imports N signal vectors or matrices and plots them in the current display. The app does not support importing signals with inherent time information and signals without inherent time information in the same function call.

signalAnalyzer(___,'SampleRate',fs) specifies a sample rate, fs, as a positive scalar expressed in Hz. The app uses the sample rate to plot one or more signals against time, assuming a start time of zero. You can specify a sample rate for signals with no inherent time information.

signalAnalyzer(___,'SampleTime',ts) specifies a sample time, ts, as a positive scalar expressed in seconds. The app uses the sample time to plot one or more signals against time, assuming a start time of zero. You can specify a sample time for signals with no inherent time information.

signalAnalyzer(___,'StartTime',st) specifies a signal start time, st, as a scalar expressed in seconds. If you do not specify a sample rate or sample time, then the app assumes a sample rate of 1 Hz. You can specify a start time for signals with no inherent time information.

signalAnalyzer(___,'TimeValues',tv) specifies a vector, tv, with time values corresponding to the data points. tv can be a real numeric vector with values expressed in seconds. tv can also be a duration array. The values in tv must be unique and cannot be NaN, but they need not be uniformly spaced. All input signals must have the same length as tv. You can specify a vector of time values for signals with no inherent time information.

Filtering and scalogram view do not support nonuniformly sampled signals.

Version History

Introduced in R2016a

expand all