Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

Signal Analysis in MATLAB: Filter, Spectrum, Signal Analyzer

A worked MATLAB workflow for signal processing: designfilt and filtfilt, pwelch defaults, and the Signal Analyzer app, plus free alternatives.

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.

  1. 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, timetable or timeseries.
    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
  2. Design the filter with designfilt. The general syntax is d = 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).

  3. Apply the filter. The designfilt page states: use y = filter(d,x) or y = filtfilt(d,x) to filter a signal x.
    y = filtfilt(d,x);
  4. 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, noverlap and nfft values mirror the Welch example in the MathWorks pwelch reference. For plotting conventions see MATLAB graphing.

  5. Open the data in Signal Analyzer. Enter signalAnalyzer at the command prompt (or use the Apps tab, under Signal Processing and Audio), or pass data directly: signalAnalyzer(y). Optional name-value arguments include SampleRate, SampleTime, StartTime and TimeValues, so set SampleRate if the app should show hertz rather than sample indices.
  6. 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; pwelch then 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 win and noverlap deliberately instead of relying on the eight-segment default.
  • Signal Analyzer shows samples, not seconds or hertz. Supply SampleRate, SampleTime or TimeValues when calling signalAnalyzer.
  • 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.

Sources (official documentation, read 2026-11-08)

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Signal Analysis in MATLAB: Filter, Spectrum, Signal Analyzer

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →