Written and maintained by CASRAI Editorial Board
Last updated
Signal analysis in MATLAB usually means three jobs in sequence: clean a signal with a digital filter, estimate how its power is spread across frequency, and inspect the result interactively. This guide gives one end-to-end workflow using designfilt, filtfilt, pwelch and the Signal Analyzer app, with the defaults MathWorks documents for each. It is written for researchers and analysts who already have MATLAB and want a working analysis they can read correctly.
What signal analysis in MATLAB is used for in research
Signal processing in MATLAB (also written signal processing with MATLAB, or MATLAB signal processing) covers filtering, spectral estimation and time-frequency inspection of sampled data such as sensor recordings, physiological traces or vibration measurements. The functions in this guide are documented in MathWorks’ Signal Processing Toolbox documentation. The Signal Analyzer page itself names the Wavelet Toolbox as the only separately required product (for the scalogram view and wavelet denoising).
Install or access (official source only)
Obtain MATLAB and its toolboxes only from MathWorks (mathworks.com) or through your institution’s campus licence. For installer steps and checking what is installed, see the CASRAI guide on installing MATLAB. If you later want physical-system modelling rather than analysis of recorded data, see MATLAB and Simulink.
Step-by-step: filter a signal, estimate its spectrum, inspect it
The example below generates a noisy 100 Hz tone, low-pass filters it, estimates its power spectral density (PSD), and opens the result in Signal Analyzer. The parameter values come from the MathWorks documentation pages for each function; the sample rate and tone frequency are chosen for illustration.
- Create or import the signal. Generate a test signal (see linspace in MATLAB for building time axes), or load your own data into a vector, matrix,
timetableortimeseries.Fs = 1500; % sample rate in Hz t = 0:1/Fs:5-1/Fs; % 5 seconds of samples x = cos(2*pi*100*t) + randn(size(t)); % 100 Hz tone plus white noise - Design the filter with
designfilt. The general syntax isd = designfilt(response,Name=Value). For a low-pass IIR filter the documented default design method is"butter"; for a low-pass FIR filter the default minimum-order method is"equiripple".d = designfilt("lowpassiir",FilterOrder=8, ... HalfPowerFrequency=400,SampleRate=Fs);An FIR alternative uses
designfilt("lowpassfir",FilterOrder=20,PassbandFrequency=400,StopbandFrequency=450,SampleRate=Fs). - Apply the filter. The
designfiltpage states: usey = filter(d,x)ory = filtfilt(d,x)to filter a signalx.y = filtfilt(d,x); - Estimate the PSD with
pwelch. Syntax:[pxx,f] = pwelch(x,win,nOverlap,freqSpec,Fs).win = hamming(500); noverlap = 300; nfft = 500; [pxx,f] = pwelch(y,win,noverlap,nfft,Fs); plot(f,pow2db(pxx)) xlabel("Frequency (Hz)") ylabel("PSD (dB/Hz)")The
win,noverlapandnfftvalues mirror the Welch example in the MathWorkspwelchreference. For plotting conventions see MATLAB graphing. - Open the data in Signal Analyzer. Enter
signalAnalyzerat the command prompt (or use the Apps tab, under Signal Processing and Audio), or pass data directly:signalAnalyzer(y). Optional name-value arguments includeSampleRate,SampleTime,StartTimeandTimeValues, so setSampleRateif the app should show hertz rather than sample indices. - Add a spectrum view. On the Display tab, in the Views section, click Spectrum. On the Spectrum tab you can set the Leakage slider, Resolution Type (including Window Length), Window Options (window type and overlap percentage), NFFT, Frequency Limits, and the Spectrum in dB check box under Scale.
Output and how to read it
pwelch output and defaults
pxx is the PSD estimate, in squared-magnitude units of the input signal per unit frequency; f is the matching frequency vector. When you pass empty arguments, pwelch uses documented defaults:
| Argument | If you pass [] (or omit) |
|---|---|
win |
A Hamming window of a length that divides x into eight segments |
nOverlap |
A number that produces 50% overlap between segments |
freqSpec |
Number of DFT points equal to the greater of 256 or the next power of two at or above the window length |
Fs |
If omitted, the input is assumed to have a sample rate of 2π rad/sample, so f is in rad/sample |
In the example above, the filtered 100 Hz tone should appear as a peak at 100 Hz on a noise floor, with content above the 400 Hz cutoff attenuated; check this on your own plot rather than assuming it.
Reading the Signal Analyzer spectrum
Spectrum in dB is on by default, and Frequency Scale can be Linear or Log (Log is not available for complex signals). MathWorks documents that the app uses pspectrum when you control leakage and pwelch when you control resolution bandwidth or window length (pwelch behaviour since R2023b). The Spectrogram view is under Display, Views; the scalogram view needs a Wavelet Toolbox licence. For a deeper look at time-frequency analysis see the short-time Fourier transform and building FFT frequency axes in MATLAB.
Troubleshooting
- Frequency axis reads 0 to π. You omitted
Fs;pwelchthen reports rad/sample. Pass the sample rate as the fifth argument. - Spectral peak looks wide or the floor looks noisy. Window length and overlap set the trade-off between resolution and variance. Change
winandnoverlapdeliberately instead of relying on the eight-segment default. - Signal Analyzer shows samples, not seconds or hertz. Supply
SampleRate,SampleTimeorTimeValueswhen callingsignalAnalyzer. - Scalogram or wavelet denoising unavailable. These need the Wavelet Toolbox.
- Smoothing rather than frequency-selective filtering. A moving average is a different tool; see moving averages in MATLAB.
Free alternatives
If you do not have MATLAB, comparable functions exist in open-source tools. Names below are from each project’s own documentation.
| Tool | Relevant documented functions | Source |
|---|---|---|
SciPy (scipy.signal, Python) |
welch (Welch PSD), filtfilt (digital filter forward and backward), butter (Butterworth design), spectrogram (legacy; ShortTimeFFT listed as newer) |
SciPy reference, signal module (read 2026-11-08) |
GNU Octave signal package |
Described as signal processing tools including filtering, windowing and display functions; GPL-3.0-or-later and public domain | Octave Packages, signal (v1.4.8, read 2026-11-08) |
A CASRAI guide to the Python route is at SciPy signals.
FAQ
How do I do signal processing in MATLAB?
Load or generate the signal, design a filter with designfilt, apply it with filter or filtfilt, estimate the spectrum with pwelch, and inspect interactively with signalAnalyzer, as in the steps above.
Which MATLAB function gives a power spectral density?
pwelch returns a Welch PSD estimate; with no window, overlap or length specified it uses a Hamming window giving eight segments, 50% overlap, and at least 256 DFT points.
How do I open the Signal Analyzer?
Enter signalAnalyzer at the MATLAB command prompt, or choose it on the Apps tab under Signal Processing and Audio.
Do I need extra toolboxes?
The functions here are documented in the Signal Processing Toolbox documentation. The Wavelet Toolbox is additionally required for the scalogram view and wavelet denoising in Signal Analyzer, and the designfilt page notes some extra design specifications (since R2023b) require a DSP System Toolbox licence.







