Generated banner for Matlab Design Digital Filter
Generated logo for Matlab Design Digital Filter

Matlab Design Digital Filter

MathWorksOfficialCreated by MathWorks

  • Skill
  • Tool integration
  • Science and research
  • BSD-2-Clause
  • No issues found

From the author

Design and validate digital filters in MATLAB. Use when cleaning up noisy signals, removing interference, filtering signals, designing FIR/IIR filters (lowpass/highpass/bandpass/bandstop/notch), or comparing filters in Filter Analyzer.
— the description by MathWorks

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured workflow for designing and validating digital filters within MATLAB. It guides users through signal analysis, architecture selection, and verification, ensuring that filter designs meet specific frequency and magnitude requirements. The skill emphasizes the use of standard MATLAB functions like designfilt and filterAnalyzer, while enforcing best practices for numerical stability and frequency-aware design.

What it does

  • Designs FIR and IIR filters including lowpass, highpass, bandpass, bandstop, and notch types.
  • Provides a systematic workflow for signal analysis and architecture selection.
  • Facilitates visual comparison of filter designs using Filter Analyzer.
  • Enforces best practices for numerical stability, such as using SOS forms for IIR filters.
  • Includes validation steps to verify filter performance against specifications.
  • Supports both streaming and offline filtering implementation strategies.

When to use it

  • When you need to clean up noisy signals or remove specific interference.
  • When designing digital filters with specific frequency and ripple requirements.
  • When comparing different filter architectures like FIR versus IIR.
  • When working on streaming or batch signal processing pipelines.

Advantages

  • Ensures consistent design methodology through a preflight and verification checklist.
  • Promotes numerical stability by recommending specific filter forms.
  • Integrates directly with MATLAB's signal processing and DSP toolboxes.
  • Provides clear guidance on handling narrow transition bands.

Usage examples

“Design a lowpass filter for a 1000 Hz signal with a 200 Hz cutoff.”
The agent will ask for the sample rate (Fs), filter mode (streaming vs offline), and phase requirements before generating the design code.
“How do I compare two different filter designs in MATLAB?”
The agent will guide you to use the filterAnalyzer function and provide the necessary steps to visualize and compare their magnitude and group delay responses.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/matlab/matlab-design-digital-filter/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip matlab-design-digital-filter.zip -d .agents/skills

Documentation by MathWorks

Design Digital Filters in MATLAB

Design, implement, and validate digital filters using Signal Processing Toolbox and DSP System Toolbox. Choose the right architecture (single-stage vs efficient alternatives), generate correct code, and verify the result with plots and numbers.

When to Use

  • Designing lowpass, highpass, bandpass, bandstop, or notch filters

  • Cleaning up noisy signals or removing interference

  • Choosing between FIR and IIR filter architectures

  • Comparing filter designs in Filter Analyzer

  • Building streaming (real-time) or offline (batch) filtering pipelines

  • Handling narrow transition bands with multirate or IFIR approaches

When NOT to Use

  • Adaptive filtering (LMS, RLS) -- use Signal Processing Toolbox docs directly

  • Audio-specific processing (equalization, room correction) -- use Audio Toolbox

  • Image filtering (2D convolution, morphological ops) -- use Image Processing Toolbox

  • General spectral analysis without filtering intent -- FFT/periodogram docs suffice

Key Rules

  • Read references/INDEX.md before writing any filter design code.

  • Always write to .m files. Never put multi-line MATLAB code directly in evaluate_matlab_code. Write to a .m file, run with run_matlab_file, edit on error.

  • Preflight before ANY MATLAB call. Before calling any function listed in INDEX.md, read the required quick-ref first. State Preflight: [files] at the top of the response.

  • Do not guess key requirements. If Mode (streaming vs offline) or Phase requirement is not stated, ask.

  • No Hz designs without Fs. If Fs is unknown, stop and ask (unless the user explicitly wants normalized frequency).

  • Always pin the sample rate. Use designfilt(..., SampleRate=Fs) and freqz(d, [], Fs).

  • IIR stability: Prefer SOS/CTF forms (avoid high-order [b,a] polynomials).

Preflight Procedure
  1. List MATLAB functions to call

  2. Check references/INDEX.md for each (function-level + task-level tables)

  3. Read required quick-ref files

  4. State at response top: Preflight: quick-ref/filter-analyzer.md, quick-ref/designfilt.md (or Preflight: none required)

Workflow

Phase 1: Signal Analysis
  • Analyze input data via MCP (spectrum, signal length, interference location)

  • Compute trans_pct and identify interference characteristics

Phase 2: Clarify Intent

After signal analysis, ask Mode + Phase if not stated:

  • Mode: streaming (causal) | offline (batch)

  • Phase: zero-phase | linear-phase | don't-care

Wait for answer before showing any approach comparison or overview.

Phase 3: Architecture Selection
  • Open references/efficient-filtering.md if trans_pct < 2%

  • Show only viable candidates given Mode + Phase constraints

  • Explicitly state excluded families with one-line reason

  • Use Filter Analyzer for visual comparison

Design Intake Checklist

Required signal + frequency spec (cannot proceed without)
  • Fs (Hz)

  • Response type: lowpass / highpass / bandpass / bandstop / notch

  • Edge frequencies in Hz

If any item is missing, ask.

Required intent for architecture choice (ask if unknown)
  • Mode: streaming (causal) | offline (batch)

  • Phase: zero-phase | linear-phase | don't-care

  • Magnitude constraints: Rp_dB passband ripple (default 1 dB), Rs_dB stopband attenuation (default 60 dB)

If Mode or Phase is unknown, ask 1-2 clarifying questions and stop.

Architecture Checkpoint

Compute and state before finalizing an approach:

  • trans_bw = Fstop - Fpass

  • trans_pct = 100 * trans_bw / Fs

  • M_max = floor(Fs/(2*Fstop)) (only meaningful for lowpass-based multirate)

Decision rule:

  • trans_pct > 5% -- single-stage FIR or IIR is usually fine

  • 2% <= trans_pct <= 5% -- single-stage possible; mention efficient alternatives if cost/latency matters

  • trans_pct < 2% -- stop and do a narrow-transition comparison (see references/quick-ref/efficient-filtering.md)

Design + Verify

  1. Feasibility check -- Let designfilt choose minimum order, then query filtord(d). Optionally use kaiserord/firpmord for FIR length estimates.

  2. Design candidates -- Prefer designfilt() with explicit Rp/Rs and SampleRate=Fs. Streaming IIR: use SystemObject=true. Offline zero-phase: filtfilt() is allowed but state that it squares the magnitude response.

  3. Compare visually -- Use filterAnalyzer() for comparing 2+ designs. Read references/quick-ref/filter-analyzer.md first. Minimum displays: magnitude + group delay.

  4. Verify with numbers -- Worst-case passband ripple and stopband attenuation vs spec. For filtfilt(), verify the effective response (magnitude squared).

  5. Deliver the output -- Specs recap, derived metrics, chosen architecture + why, MATLAB code, verification snippet + results, implementation form.

Key Functions

FunctionPurpose
designfilt()Primary filter design (FIR and IIR, all response types)
filterAnalyzer()Visual comparison of 2+ filter designs
freqz(), grpdelay()Frequency response and group delay analysis
filtfilt()Zero-phase offline filtering
dsp.SOSFilterStreaming IIR via SystemObject=true
designMultirateFIR()Multirate decimator/interpolator design
ifir()Interpolated FIR for narrow transitions at constant rate
cost()MPIS (MultiplicationsPerInputSample) on DSP System objects
kaiserord(), firpmord()FIR order estimation

Conventions

  • Always specify SampleRate=Fs in designfilt() and plot in Hz with freqz(d, [], Fs)

  • Use filterAnalyzer() for multi-filter comparison, not custom freqz/grpdelay plots

  • Use SOS form for IIR (avoid [b,a] for order > 8)

  • Use tiledlayout/nexttile for multi-panel figures (not subplot)


Copyright 2026 The MathWorks, Inc.


Files

references/filter-analyzer.md

Filter Analyzer App Workflows

Comprehensive guide for using the MATLAB Filter Analyzer app programmatically via filterAnalyzer.

Prefer Filter Analyzer over manual plotting for filter visualization whenever comparing filters, iterating on designs, or needing interactive exploration.

Table of Contents

  • Analysis Types Quick Reference

  • When to Use Filter Analyzer vs Manual Plots

  • Object Methods Quick Reference

  • Session Management

  • Working with Analysis Options

  • Workflow Examples

  • Getting Existing Filter Names

  • Visualizing Multirate Filters

  • Tips and Gotchas

  • Version Info

Analysis Types Quick Reference

AnalysisDomainOverlay?Key Options
"magnitude"FreqYesMagnitudeMode, NormalizeMagnitude
"phase"FreqYesPhaseUnits, ContinuousPhase
"groupdelay"FreqYesGroupDelayUnits
"phasedelay"FreqYesPhaseUnits
"magestimate"FreqYesMagnitudeEstimateNumTrials
"noisepsd"FreqYesNoisePSDNumTrials
"impulse"TimeYesResponseLengthMode, ResponseLength
"step"TimeYesResponseLengthMode, ResponseLength
"polezero"OtherNo—
"info"OtherNo—
"coefficients"OtherNoCoefficientsFormat

Overlay rules: Frequency-domain analyses can overlay with other frequency-domain. Time-domain with time-domain. polezero, info, coefficients do not support overlays.


When to Use Filter Analyzer vs Manual Plots

Use Filter Analyzer when:
  • Comparing multiple filters side-by-side

  • Need interactive exploration (zoom, pan)

  • Want overlay analysis (magnitude + phase, impulse + step)

  • Need specification mask visualization

  • Working iteratively (app stays open, update filters in place)

  • Need multiple analysis displays simultaneously

Use manual freqz/grpdelay when:
  • Simple single-filter quick check

  • Need to customize plot appearance beyond app options

  • Generating figures for export/publication (more control over formatting)

  • Scripting batch analysis without GUI


Object Methods Quick Reference

MethodSyntaxPurpose
addFiltersaddFilters(fa, filt1, filt2, ..., FilterNames=, SampleRates=)Add filters
addDisplaysdispNum = addDisplays(fa, Analysis=, OverlayAnalysis=)Add analysis display
deleteFiltersdeleteFilters(fa, FilterNames=names)Remove filters by name
deleteDisplaysdeleteDisplays(fa, DisplayNums=num)Remove display by number
duplicateDisplaysdupNum = duplicateDisplays(fa, DisplayNums=num)Clone a display
showFiltersshowFilters(fa, true/false, FilterNames=, DisplayNums=)Show/hide filters
showLegendshowLegend(fa, true/false, DisplayNums=)Toggle legend
renameFiltersrenameFilters(fa, oldNames, newNames)Rename filters
replaceFiltersreplaceFilters(fa, filt1, ..., FilterNames=, SampleRates=)Update existing filters
getAnalysisOptionsopts = getAnalysisOptions(fa, DisplayNums=)Get display options
setAnalysisOptionssetAnalysisOptions(fa, opts, DisplayNums=)Set display options
zoomzoom(fa, "passband"/"default", DisplayNums=)Zoom presets
saveSessionsaveSession(fa, 'file.mat')Save session to file
newSessionnewSession(fa)Clear all filters/displays
closeclose(fa)Close the app

Session Management

Problem: Duplicate Filters Accumulating

When repeatedly running code that adds filters to Filter Analyzer, you get:

FIR_Equiripple
FIR_Equiripple_1
FIR_Equiripple_2
...

This happens because filterAnalyzer() or addFilters() appends to existing session.

Use newSession(fa) to clear all filters before adding new ones:

% Get or create Filter Analyzer handle
if exist('fa', 'var') && isvalid(fa)
    newSession(fa);  % Clear all existing filters
else
    fa = filterAnalyzer();
end

% Now add filters - no duplicates
addFilters(fa, d1, d2, d3, ...
    FilterNames=["FIR_Equiripple", "FIR_Kaiser", "FIR_Hamming"], ...
    SampleRates=Fs);
Solution 2: Replace Existing Filters

Use replaceFilters() to update filters by name (keeps app state, displays):

fa = getFilterAnalyzerHandle;

% Replace filters with same names
replaceFilters(fa, d1_new, d2_new, d3_new, ...
    FilterNames=["FIR_Equiripple", "FIR_Kaiser", "FIR_Hamming"], ...
    SampleRates=Fs);

Note: FilterNames specifies WHICH existing filters to replace.

Solution 3: Delete Specific Filters

Remove specific filters by name:

% Template
fa = getFilterAnalyzerHandle;
deleteFilters(fa, FilterNames=["FIR_Equiripple_1", "FIR_Kaiser_2"]);

Working with Analysis Options

Creating and Applying Options
% Template
% Create options for specific analysis (with overlay)
opts = filterAnalysisOptions("magnitude", "phase");
opts.NFFT = 4096;
opts.FrequencyScale = "log";
opts.MagnitudeMode = "db";

% Apply to specific display
setAnalysisOptions(fa, opts, DisplayNums=2);

% Get current options from a display
currentOpts = getAnalysisOptions(fa, DisplayNums=2);
Common filterAnalysisOptions Properties

All Frequency-Domain Analyses:

PropertyValuesDefault
FrequencyNormalizationMode"auto", "normalized", "unnormalized""auto"
FrequencyRange"auto", "onesided", "twosided", "centered""auto"
FrequencyScale"linear", "log""linear"
NFFTpositive integer8192
ReferenceSampleRateMode"max", "specify""max"

Magnitude-Specific:

PropertyValuesDefault
MagnitudeMode"db", "linear", "squared", "zerophase""db"
NormalizeMagnitudetrue, falsefalse

Phase-Specific:

PropertyValuesDefault
PhaseUnits"radians", "degrees""radians"
ContinuousPhasetrue, falsefalse

Group Delay:

PropertyValuesDefault
GroupDelayUnits"samples", "time""samples"

Time-Domain (impulse/step):

PropertyValuesDefault
ResponseLengthMode"auto", "specify""auto"
ResponseLengthpositive integer(auto-computed)

Coefficients Display:

PropertyValuesDefault
CoefficientsFormat"decimal", "hex", "binary""decimal"

CTF View (cascaded transfer functions):

PropertyValuesDefault
CTFAnalysisMode"complete", "individual", "cumulative", "specify""complete"

Workflow Examples

Example 1: Multi-Display Filter Comparison
%% Compare Butterworth, Elliptic, and FIR filters
Fs = 44100;

% Design filters
d_butter = designfilt("lowpassiir", ...
    PassbandFrequency=2000, StopbandFrequency=2500, ...
    PassbandRipple=1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="butter");

d_ellip = designfilt("lowpassiir", ...
    PassbandFrequency=2000, StopbandFrequency=2500, ...
    PassbandRipple=1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="ellip");

d_fir = designfilt("lowpassfir", ...
    PassbandFrequency=2000, StopbandFrequency=2500, ...
    PassbandRipple=1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="equiripple");

filterNames = ["Butterworth", "Elliptic", "FIR_Equiripple"];

% Open with magnitude + phase overlay
[fa, disp1] = filterAnalyzer(d_butter, d_ellip, d_fir, ...
    FilterNames=filterNames, ...
    SampleRates=Fs, ...
    Analysis="magnitude", OverlayAnalysis="phase");

% Add group delay display
disp2 = addDisplays(fa, Analysis="groupdelay");
showFilters(fa, true, FilterNames=filterNames, DisplayNums=disp2);

% Add impulse + step response display
disp3 = addDisplays(fa, Analysis="impulse", OverlayAnalysis="step");
showFilters(fa, true, FilterNames=filterNames, DisplayNums=disp3);

% Add pole-zero plot
disp4 = addDisplays(fa, Analysis="polezero");
showFilters(fa, true, FilterNames=filterNames, DisplayNums=disp4);

% Customize magnitude display for log frequency scale
opts = getAnalysisOptions(fa, DisplayNums=disp1);
opts.FrequencyScale = "log";
setAnalysisOptions(fa, opts, DisplayNums=disp1);
Example 2: Iterative Design with Live Updates
%% Iterative filter design - update without duplicates
Fs = 48000;

% Initial design
d = designfilt("lowpassfir", ...
    PassbandFrequency=1000, StopbandFrequency=1200, ...
    PassbandRipple=0.1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="equiripple");

fa = filterAnalyzer(d, FilterNames="LP_Design", SampleRates=Fs, ...
    Analysis="magnitude", OverlayAnalysis="phase");

% ... user reviews, wants tighter transition band ...

% Update design - replaceFilters keeps same name, no duplicates
d_v2 = designfilt("lowpassfir", ...
    PassbandFrequency=1000, StopbandFrequency=1100, ...
    PassbandRipple=0.1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="equiripple");

replaceFilters(fa, d_v2, FilterNames="LP_Design", SampleRates=Fs);
% Display updates in-place, no "LP_Design_1" created
Example 3: Complete Session Management Pattern
%% Robust pattern for repeated runs
Fs = 44100;
filterNames = ["FIR_Equiripple", "FIR_Kaiser", "FIR_Hamming"];

% Design filters
d_eq = designfilt("lowpassfir", ...
    PassbandFrequency=2800, StopbandFrequency=3100, ...
    PassbandRipple=0.1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="equiripple");

d_kaiser = designfilt("lowpassfir", ...
    PassbandFrequency=2800, StopbandFrequency=3100, ...
    PassbandRipple=0.1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="kaiserwin");

d_hamming = designfilt("lowpassfir", ...
    FilterOrder=200, CutoffFrequency=2950, ...
    SampleRate=Fs, DesignMethod="window", Window=hamming(201));

%% Visualize in Filter Analyzer (no duplicates on re-run)
if exist('fa', 'var') && isvalid(fa)
    % App already open - fresh start
    newSession(fa);
    addFilters(fa, d_eq, d_kaiser, d_hamming, ...
        FilterNames=filterNames, SampleRates=Fs);
else
    % First run - create new session
    fa = filterAnalyzer(d_eq, d_kaiser, d_hamming, ...
        FilterNames=filterNames, SampleRates=Fs, ...
        Analysis="magnitude", OverlayAnalysis="phase");
end

% Add more displays
addDisplays(fa, Analysis="groupdelay");
showFilters(fa, true, FilterNames=filterNames);

addDisplays(fa, Analysis="impulse", OverlayAnalysis="step");
showFilters(fa, true, FilterNames=filterNames);

Getting Existing Filter Names (Undocumented)

No official API exists, but this helper function works:

function names = getFilterAnalyzerFilterNames(fa)
    % Get filter names from an open Filter Analyzer session
    % Usage: names = getFilterAnalyzerFilterNames(fa)
    %        names = getFilterAnalyzerFilterNames()  % auto-gets handle

    if nargin < 1
        fa = getFilterAnalyzerHandle;
    end

    warning('off', 'MATLAB:structOnObject');
    try
        s = struct(fa);
        impl = s.FilterAnalyzerImpl;
        implStruct = struct(impl);
        faModel = struct(struct(implStruct.MainModel).FilterAnalyzerModel);
        filterInfoMap = faModel.FilterInfoMap;

        k = keys(filterInfoMap);
        names = strings(1, length(k));

        for i = 1:length(k)
            fwa = struct(struct(filterInfoMap(k(i))).FilterWithAnalysis);
            names(i) = string(fwa.Name);
        end
    catch ME
        names = strings(0);
        warning('Could not get filter names: %s', ME.message);
    end
    warning('on', 'MATLAB:structOnObject');
end

Example usage:

% Template
fa = getFilterAnalyzerHandle;
existingNames = getFilterAnalyzerFilterNames(fa);
disp(existingNames);  % ["FIR_Equiripple", "FIR_Kaiser", "FIR_Hamming"]

Visualizing Multirate Filters

Filter Analyzer fully supports multirate System objects including dsp.FIRDecimator, dsp.FIRInterpolator, and dsp.FilterCascade (from multistage designs).

Example 1: Compare Decimator Designs
%% Compare single-stage vs multistage decimators
Fs = 44100;

% Single-stage decimators
dec4 = designMultirateFIR(DecimationFactor=4, SystemObject=true);
dec8 = designMultirateFIR(DecimationFactor=8, SystemObject=true);

% Multistage decimator (automatic cascade optimization)
decMultistage = designMultistageDecimator(8);

% Compare all three in Filter Analyzer
filterAnalyzer(dec4, dec8, decMultistage, ...
    SampleRates=Fs, ...
    FilterNames=["Decim4_Single", "Decim8_Single", "Decim8_Multistage"], ...
    Analysis="magnitude");
Example 2: Compare Interpolator Designs
%% Compare interpolators with different attenuation specs
Fs = 48000;

interp_60dB = designMultirateFIR(InterpolationFactor=4, ...
    StopbandAttenuation=60, SystemObject=true);
interp_80dB = designMultirateFIR(InterpolationFactor=4, ...
    StopbandAttenuation=80, SystemObject=true);

filterAnalyzer(interp_60dB, interp_80dB, ...
    SampleRates=Fs, ...
    FilterNames=["Interp_60dB", "Interp_80dB"], ...
    Analysis="magnitude", OverlayAnalysis="phase");
Example 3: Analyze Multistage Cascade Structure
%% Visualize a multistage decimator cascade
Fs = 44100;
decCascade = designMultistageDecimator(16);

% View overall response
filterAnalyzer(decCascade, SampleRates=Fs, FilterNames="Multistage16x");

% Check cascade structure
info(decCascade)
Supported Multirate Types
System ObjectCreated ByFilter Analyzer Support
dsp.FIRDecimatordesignMultirateFIR(..., SystemObject=true)✓ Full support
dsp.FIRInterpolatordesignMultirateFIR(..., SystemObject=true)✓ Full support
dsp.FIRRateConverterdesignMultirateFIR(..., SystemObject=true)✓ Full support
dsp.FilterCascadedesignMultistageDecimator()✓ Full support
dsp.FilterCascadedesignMultistageInterpolator()✓ Full support
dsp.FilterCascadeManual cascade (see below)✓ Full support
Example 4: Visualizing Multirate Pipelines (dec→filter→interp)

When comparing multirate pipelines against single-stage filters, wrap the complete pipeline in dsp.FilterCascade:

%% Compare FIR, IFIR, and Multirate Pipeline side-by-side
Fs = 44100;
M = 4;

% Approach 1: Single-stage FIR
d_fir = designfilt("lowpassfir", ...
    PassbandFrequency=2800, StopbandFrequency=3000, ...
    PassbandRipple=0.1, StopbandAttenuation=60, ...
    SampleRate=Fs, DesignMethod="equiripple");
fir_sys = dsp.FIRFilter('Numerator', d_fir.Numerator);

% Approach 2: IFIR
Hf = fdesign.lowpass(2800/(Fs/2), 3000/(Fs/2), 0.1, 60);
ifir_sys = ifir(Hf, 'SystemObject', true);

% Approach 3: Multirate pipeline (dec → filter → interp)
dec_sys = designMultirateFIR(DecimationFactor=M, StopbandAttenuation=60, SystemObject=true);
d_core = designfilt("lowpassfir", ...
    PassbandFrequency=2800, StopbandFrequency=3000, ...
    PassbandRipple=0.1, StopbandAttenuation=60, ...
    SampleRate=Fs/M, DesignMethod="equiripple");
core_sys = dsp.FIRFilter('Numerator', d_core.Numerator);  % Wrap for cascade
interp_sys = designMultirateFIR(InterpolationFactor=M, StopbandAttenuation=60, SystemObject=true);

% Create cascade from pipeline
multirate_cascade = dsp.FilterCascade(dec_sys, core_sys, interp_sys);

% Compare ALL THREE in Filter Analyzer
fa = filterAnalyzer(fir_sys, ifir_sys, multirate_cascade, ...
    FilterNames=["FIR_SingleStage", "IFIR_Cascade", "Multirate_Pipeline"], ...
    SampleRates=Fs, Analysis="magnitude");

% Add group delay for latency comparison
addDisplays(fa, Analysis="groupdelay");
showFilters(fa, true, FilterNames=["FIR_SingleStage", "IFIR_Cascade", "Multirate_Pipeline"]);

% Compare MPIS
fprintf('MPIS: FIR=%.0f, IFIR=%.0f, Multirate=%.0f\n', ...
    cost(fir_sys).MultiplicationsPerInputSample, ...
    cost(ifir_sys).MultiplicationsPerInputSample, ...
    cost(multirate_cascade).MultiplicationsPerInputSample);

Key points:

  • Wrap digitalFilter in dsp.FIRFilter before adding to cascade

  • Use dsp.FilterCascade(dec, filter, interp) to create a single object

  • Filter Analyzer shows the overall frequency response of the cascade

  • Use same SampleRates=Fs for all (multirate rates are handled internally)


Tips and Gotchas

  1. Match FilterNames to variable names: Use the same name as your workspace variable so you can easily identify filters. Example: filterAnalyzer(d_butter, d_ellip, FilterNames=["d_butter", "d_ellip"]) — not ["Butterworth", "Elliptic"]

  2. Always store the handle: Keep fa in your workspace to manage the session

  3. Check validity: Use isvalid(fa) before calling methods

  4. Lost your handle?: Use fa = getFilterAnalyzerHandle to recover it

  5. Persist across sessions: Use saveSession(fa, 'myfilters.mat') and load later

  6. FilterNames must be valid MATLAB identifiers: No spaces, hyphens, or special characters. Use underscores: "d_butter" not "d-butter" or "d butter"

  7. Overlay rules are strict: Frequency-domain only overlays with frequency-domain; time-domain with time-domain. polezero, info, coefficients don't support overlays.

  8. Name-value syntax required: Most methods use DisplayNums=, FilterNames= syntax, not positional arguments

  9. Zoom presets: "passband", "default", "x", "y", "xy" — custom axis limits require using the app UI

  10. filterAnalyzer returns display number: [fa, dispNum] = filterAnalyzer(...) — only the initial call returns both


Version Info

  • filterAnalyzer function: R2024a+

  • replaceFilters method: R2024a+

  • getAnalysisOptions / setAnalysisOptions: R2024a+

  • LegendStrings argument: R2025a+

  • Tested on: R2024b


Copyright 2026 The MathWorks, Inc.


Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
MathWorks
Publisher
MathWorks (Official)
Source
matlab/matlab-agentic-toolkit · skills-catalog/signal-processing/matlab-design-digital-filter · commit 2a7f215
Licence
BSD 2-Clause License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by MathWorks.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-design-digital-filter.zip