Matlab Design Digital Filter
MathWorksOfficialCreated by MathWorks
- Skill
- Tool integration
- Science and research
- BSD-2-Clause
- No issues found
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
Download the skill as a ZIP:
https://autogineer.com/agent-skills/matlab/matlab-design-digital-filter/downloadUnzip 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.mfile, run withrun_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
Fsis unknown, stop and ask (unless the user explicitly wants normalized frequency).Always pin the sample rate. Use
designfilt(..., SampleRate=Fs)andfreqz(d, [], Fs).IIR stability: Prefer SOS/CTF forms (avoid high-order
[b,a]polynomials).
Preflight Procedure
List MATLAB functions to call
Check
references/INDEX.mdfor each (function-level + task-level tables)Read required quick-ref files
State at response top:
Preflight: quick-ref/filter-analyzer.md, quick-ref/designfilt.md(orPreflight: none required)
Workflow
Phase 1: Signal Analysis
Analyze input data via MCP (spectrum, signal length, interference location)
Compute
trans_pctand 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.mdiftrans_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_dBpassband ripple (default 1 dB),Rs_dBstopband 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 - Fpasstrans_pct = 100 * trans_bw / FsM_max = floor(Fs/(2*Fstop))(only meaningful for lowpass-based multirate)
Decision rule:
trans_pct > 5%-- single-stage FIR or IIR is usually fine2% <= trans_pct <= 5%-- single-stage possible; mention efficient alternatives if cost/latency matterstrans_pct < 2%-- stop and do a narrow-transition comparison (seereferences/quick-ref/efficient-filtering.md)
Design + Verify
Feasibility check -- Let
designfiltchoose minimum order, then queryfiltord(d). Optionally usekaiserord/firpmordfor FIR length estimates.Design candidates -- Prefer
designfilt()with explicitRp/RsandSampleRate=Fs. Streaming IIR: useSystemObject=true. Offline zero-phase:filtfilt()is allowed but state that it squares the magnitude response.Compare visually -- Use
filterAnalyzer()for comparing 2+ designs. Readreferences/quick-ref/filter-analyzer.mdfirst. Minimum displays: magnitude + group delay.Verify with numbers -- Worst-case passband ripple and stopband attenuation vs spec. For
filtfilt(), verify the effective response (magnitude squared).Deliver the output -- Specs recap, derived metrics, chosen architecture + why, MATLAB code, verification snippet + results, implementation form.
Key Functions
| Function | Purpose |
|---|---|
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.SOSFilter | Streaming 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=Fsindesignfilt()and plot in Hz withfreqz(d, [], Fs)Use
filterAnalyzer()for multi-filter comparison, not customfreqz/grpdelayplotsUse SOS form for IIR (avoid
[b,a]for order > 8)Use
tiledlayout/nexttilefor multi-panel figures (notsubplot)
Copyright 2026 The MathWorks, Inc.
Files
- ATTRIBUTION.mdAdded by AutoGineer1.0 KiB
- LICENSELicence file added by AutoGineer1.4 KiB
- SKILL.md6.1 KiB
- manifest.yaml473 B
- references/INDEX.md2.9 KiB
- references/best-practices.md7.8 KiB
- references/efficient-filtering.md14.4 KiB
- references/filter-analyzer.md18.1 KiB
- references/multirate.md13.2 KiB
- references/multistage-ifir.md8.5 KiB
- references/patterns.md16.2 KiB
- references/quick-ref/designfilt.md6.0 KiB
- references/quick-ref/efficient-filtering.md6.1 KiB
- references/quick-ref/filter-analyzer.md3.0 KiB
- references/quick-ref/general-iir-fir.md3.0 KiB
- references/quick-ref/multirate-offline.md2.3 KiB
- references/quick-ref/multirate-streaming.md3.6 KiB
- references/quick-ref/multistage-ifir.md2.8 KiB
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
| Analysis | Domain | Overlay? | Key Options |
|---|---|---|---|
"magnitude" | Freq | Yes | MagnitudeMode, NormalizeMagnitude |
"phase" | Freq | Yes | PhaseUnits, ContinuousPhase |
"groupdelay" | Freq | Yes | GroupDelayUnits |
"phasedelay" | Freq | Yes | PhaseUnits |
"magestimate" | Freq | Yes | MagnitudeEstimateNumTrials |
"noisepsd" | Freq | Yes | NoisePSDNumTrials |
"impulse" | Time | Yes | ResponseLengthMode, ResponseLength |
"step" | Time | Yes | ResponseLengthMode, ResponseLength |
"polezero" | Other | No | — |
"info" | Other | No | — |
"coefficients" | Other | No | CoefficientsFormat |
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
| Method | Syntax | Purpose |
|---|---|---|
addFilters | addFilters(fa, filt1, filt2, ..., FilterNames=, SampleRates=) | Add filters |
addDisplays | dispNum = addDisplays(fa, Analysis=, OverlayAnalysis=) | Add analysis display |
deleteFilters | deleteFilters(fa, FilterNames=names) | Remove filters by name |
deleteDisplays | deleteDisplays(fa, DisplayNums=num) | Remove display by number |
duplicateDisplays | dupNum = duplicateDisplays(fa, DisplayNums=num) | Clone a display |
showFilters | showFilters(fa, true/false, FilterNames=, DisplayNums=) | Show/hide filters |
showLegend | showLegend(fa, true/false, DisplayNums=) | Toggle legend |
renameFilters | renameFilters(fa, oldNames, newNames) | Rename filters |
replaceFilters | replaceFilters(fa, filt1, ..., FilterNames=, SampleRates=) | Update existing filters |
getAnalysisOptions | opts = getAnalysisOptions(fa, DisplayNums=) | Get display options |
setAnalysisOptions | setAnalysisOptions(fa, opts, DisplayNums=) | Set display options |
zoom | zoom(fa, "passband"/"default", DisplayNums=) | Zoom presets |
saveSession | saveSession(fa, 'file.mat') | Save session to file |
newSession | newSession(fa) | Clear all filters/displays |
close | close(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.
Solution 1: Fresh Session (Recommended)
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:
| Property | Values | Default |
|---|---|---|
FrequencyNormalizationMode | "auto", "normalized", "unnormalized" | "auto" |
FrequencyRange | "auto", "onesided", "twosided", "centered" | "auto" |
FrequencyScale | "linear", "log" | "linear" |
NFFT | positive integer | 8192 |
ReferenceSampleRateMode | "max", "specify" | "max" |
Magnitude-Specific:
| Property | Values | Default |
|---|---|---|
MagnitudeMode | "db", "linear", "squared", "zerophase" | "db" |
NormalizeMagnitude | true, false | false |
Phase-Specific:
| Property | Values | Default |
|---|---|---|
PhaseUnits | "radians", "degrees" | "radians" |
ContinuousPhase | true, false | false |
Group Delay:
| Property | Values | Default |
|---|---|---|
GroupDelayUnits | "samples", "time" | "samples" |
Time-Domain (impulse/step):
| Property | Values | Default |
|---|---|---|
ResponseLengthMode | "auto", "specify" | "auto" |
ResponseLength | positive integer | (auto-computed) |
Coefficients Display:
| Property | Values | Default |
|---|---|---|
CoefficientsFormat | "decimal", "hex", "binary" | "decimal" |
CTF View (cascaded transfer functions):
| Property | Values | Default |
|---|---|---|
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" createdExample 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');
endExample 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 Object | Created By | Filter Analyzer Support |
|---|---|---|
dsp.FIRDecimator | designMultirateFIR(..., SystemObject=true) | ✓ Full support |
dsp.FIRInterpolator | designMultirateFIR(..., SystemObject=true) | ✓ Full support |
dsp.FIRRateConverter | designMultirateFIR(..., SystemObject=true) | ✓ Full support |
dsp.FilterCascade | designMultistageDecimator() | ✓ Full support |
dsp.FilterCascade | designMultistageInterpolator() | ✓ Full support |
dsp.FilterCascade | Manual 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
digitalFilterindsp.FIRFilterbefore adding to cascadeUse
dsp.FilterCascade(dec, filter, interp)to create a single objectFilter Analyzer shows the overall frequency response of the cascade
Use same
SampleRates=Fsfor all (multirate rates are handled internally)
Tips and Gotchas
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"]Always store the handle: Keep
fain your workspace to manage the sessionCheck validity: Use
isvalid(fa)before calling methodsLost your handle?: Use
fa = getFilterAnalyzerHandleto recover itPersist across sessions: Use
saveSession(fa, 'myfilters.mat')and load laterFilterNames must be valid MATLAB identifiers: No spaces, hyphens, or special characters. Use underscores:
"d_butter"not"d-butter"or"d butter"Overlay rules are strict: Frequency-domain only overlays with frequency-domain; time-domain with time-domain.
polezero,info,coefficientsdon't support overlays.Name-value syntax required: Most methods use
DisplayNums=,FilterNames=syntax, not positional argumentsZoom presets:
"passband","default","x","y","xy"— custom axis limits require using the app UIfilterAnalyzerreturns display number:[fa, dispNum] = filterAnalyzer(...)— only the initial call returns both
Version Info
filterAnalyzerfunction: R2024a+replaceFiltersmethod: R2024a+getAnalysisOptions/setAnalysisOptions: R2024a+LegendStringsargument: 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 or MathWorks.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-design-digital-filter.zip