
matlab-design-adaptive-filter
Design and implement adaptive filters using DSP System Toolbox System objects. Use when working with adaptive filtering, system identification, noise cancellation, echo cancellation, active noise control (ANC), channel equalization, inverse system identification, or adaptive prediction. Covers dsp.LMSFilter, dsp.RLSFilter, dsp.FilteredXLMSFilter, dsp.FrequencyDomainAdaptiveFilter, dsp.AffineProjectionFilter, dsp.BlockLMSFilter, dsp.AdaptiveLatticeFilter, dsp.FastTransversalFilter, maxstep(), and algorithm selection for adaptive filtering problems. Replaces deprecated adaptfilt. objects (removed R2020a).
- Installs
- 74
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-design-adaptive-filter- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads matlab-design-adaptive-filter automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Adaptive Filtering
Implementation guideline — Use DSP System Toolbox System objects to implement adaptive filters. Do not implement manual weight-update loops.
When to Use
- System identification — Model unknown FIR or IIR systems online
- Noise or interference cancellation — Recover signals from noise-corrupted measurement
- Echo cancellation — Suppress acoustic or line echo
- Active noise control — Feedforward ANC with secondary path
- Inverse system identification — Equalization and deconvolution
- Adaptive prediction — Linear prediction and speech coding
- Algorithm evaluation — Compare adaptive filter algorithm performance
- Migrating from deprecated
adaptfilt.*objects — Replaced bydsp.*FilterSystem objects (removed in R2020a) - Any task involving
dsp.LMSFilter,dsp.RLSFilter,dsp.FilteredXLMSFilter,dsp.FrequencyDomainAdaptiveFilter,dsp.AffineProjectionFilter, ormaxstep()
When NOT to Use
- Static (non-adaptive) FIR/IIR filter design — Use
matlab-design-digital-filter - Kalman filtering or state estimation — Use Control System Toolbox
- Deep learning-based denoising — Use Deep Learning Toolbox
- Simulink adaptive filter blocks — Use when working in Simulink (different modeling workflow)
Workflow
Every adaptive filtering task follows this five-step workflow:
1. Analyze the Problem
Before writing code, determine:
- Topology — System identification, inverse system identification, noise cancellation, ANC, or prediction?
- Signal characteristics — White or colored input? Stationary or time-varying?
- Constraints — Filter length, latency budget, computational cost, real-time?
- Filter length — Match or slightly exceed the unknown system order
2. Select Object and Method
Use the routing table to pick the right System object:
| Scenario | Object | Method/Config |
|---|---|---|
| General-purpose, white input | dsp.LMSFilter | 'Normalized LMS' |
| Colored/correlated input | dsp.AffineProjectionFilter | ProjectionOrder=4-8 |
| Fast convergence needed | dsp.RLSFilter | ForgettingFactor=0.99 |
| Tracking time-varying system | dsp.RLSFilter | ForgettingFactor=0.95-0.99 |
| Active noise control | dsp.FilteredXLMSFilter | Requires secondary path estimate |
| Long filters (>256 taps) | dsp.FrequencyDomainAdaptiveFilter | 'Constrained FDAF' |
| Long filter + low latency | dsp.FrequencyDomainAdaptiveFilter | 'Partitioned constrained FDAF' |
| Low-complexity (no multiplies) | dsp.LMSFilter | 'Sign-Data LMS' or 'Sign-Sign LMS' |
For detailed selection guidance, see references/object-selection.md.
3. Configure
Step size (critical for stability):
lms = dsp.LMSFilter(Length=L, Method="Normalized LMS");
[muMax, muMaxMSE] = maxstep(lms, x);
lms.StepSize = 0.3 * muMaxMSE;
maxstep() is available only for:
dsp.LMSFilter(Methods:'LMS','Normalized LMS','Sign-Error LMS')dsp.BlockLMSFilter
For all other objects, see references/maxstep-reference.md.
Filter length: Set to unknown system order + 1 (or slightly longer if order is uncertain).
4. Run in Streaming Loop
All adaptive filter System objects process data frame-by-frame:
for k = 1:numFrames
xFrame = x((k-1)*frameSize+1 : k*frameSize);
dFrame = d((k-1)*frameSize+1 : k*frameSize);
[y, err, wts] = lms(xFrame, dFrame);
end
In simulation, use dsp.FIRFilter or dsp.IIRFilter for the unknown system. These objects automatically maintain internal filter state across frames.
5. Verify Convergence and Extract Weights
Weight extraction differs by object and is a common source of errors:
| Object | Extraction Method |
|---|---|
dsp.LMSFilter | Third output: [y, e, w] = lms(x, d) |
dsp.RLSFilter | Property: rls.Coefficients |
dsp.FilteredXLMSFilter | Property: fxlms.Coefficients (negated for ANC) |
dsp.FrequencyDomainAdaptiveFilter | See references/fdaf-filter.md — partitioned vs non-partitioned differ |
dsp.AffineProjectionFilter | Property: ap.Coefficients |
Important: dsp.LMSFilter does NOT have a .Coefficients property. The third output argument is the only way to access weights.
For full details, see references/weight-extraction.md.
Key Functions
| Function/Object | Purpose | Toolbox |
|---|---|---|
dsp.LMSFilter | LMS/NLMS/Sign variants (5 methods) | DSP System Toolbox |
dsp.RLSFilter | Recursive Least Squares (5 methods) | DSP System Toolbox |
dsp.AffineProjectionFilter | Affine Projection (colored input) | DSP System Toolbox |
dsp.FilteredXLMSFilter | Filtered-X LMS (ANC) | DSP System Toolbox |
dsp.FrequencyDomainAdaptiveFilter | FDAF (long filters, 4 methods) | DSP System Toolbox |
dsp.BlockLMSFilter | Block LMS (frame-based) | DSP System Toolbox |
dsp.AdaptiveLatticeFilter | Lattice (numerical stability) | DSP System Toolbox |
dsp.FastTransversalFilter | Fast transversal (O(N) RLS) | DSP System Toolbox |
maxstep() | Maximum stable step size | DSP System Toolbox |
msesim() | Simulated MSE learning curves | DSP System Toolbox |
Patterns
System Identification
unknownSys = dsp.FIRFilter(Numerator=fir1(31, 0.4));
lms = dsp.LMSFilter(Length=32, Method="Normalized LMS");
[muMax, muMaxMSE] = maxstep(lms, randn(1000, 1));
lms.StepSize = 0.3 * muMaxMSE;
for k = 1:numFrames
xFrame = randn(frameSize, 1);
dFrame = unknownSys(xFrame);
[~, ~, wts] = lms(xFrame, dFrame);
end
Active Noise Control (Two-Stage)
% Stage 1: Estimate the secondary path
estFilter = dsp.LMSFilter(Length=secPathLen, Method="Normalized LMS");
[~, ~, secPathEst] = estFilter(probeSignal, secPathOutput);
% Stage 2: Configure the FxLMS controller
fxlms = dsp.FilteredXLMSFilter(Length=ctrlLen, ...
SecondaryPathCoefficients=secPathTrue, ...
SecondaryPathEstimate=secPathEst.');
[y, e] = fxlms(reference, errorMic);
See references/fxlms-filter.md for the full ANC workflow.
Low-Latency Long Filter (Partitioned FDAF)
Use partitioned FDAF when you need a long adaptive filter with low processing latency.
fdaf = dsp.FrequencyDomainAdaptiveFilter( ...
Length=2048, ...
BlockLength=128, ...
Method="Partitioned constrained FDAF", ...
StepSize=0.5);
for k = 1:numBlocks
xBlock = x((k-1)*128+1 : k*128);
dBlock = d((k-1)*128+1 : k*128);
[y, e] = fdaf(xBlock, dBlock);
end
% Latency = BlockLength/fs = 128/16000 = 8 ms
See references/fdaf-filter.md for method strings and FFTCoefficients extraction.
Freeze Adaptation (Stop Learning, Keep Filtering)
% dsp.LMSFilter — use AdaptInputPort
lms = dsp.LMSFilter(Length=32, AdaptInputPort=true);
adaptFlag = true;
for k = 1:numFrames
if k > freezeFrame, adaptFlag = false; end
[y, e, w] = lms(xFrame, dFrame, adaptFlag);
end
For dsp.FrequencyDomainAdaptiveFilter, use LockCoefficients instead. This object does not support AdaptInputPort. See references/fdaf-filter.md.
Conventions
- Always use
dsp.*FilterSystem objects — Never implement weight-update loops manually - Always call
maxstep()for step size when available (LMS, NLMS, Sign-Error, BlockLMS) - Always use
AdaptInputPort=truefor freeze/adapt control — Never wrap in if/else - Always use
dsp.FIRFilterfor unknown system simulation — It maintains state across frames - Never access
.Coefficientsondsp.LMSFilter— It doesn't exist; use third output - Never access
.Coefficientsondsp.FrequencyDomainAdaptiveFilter— Use.FFTCoefficients+ IFFT - Never use
adaptfilt.*functions (adaptfilt.lms,adaptfilt.nlms,adaptfilt.rls, etc.) — The entire package was removed in R2020a and will error. Always usedsp.*FilterSystem objects. - Prefer
'Normalized LMS'over'LMS'as the default method — Robust to input power variations - Prefer
'Constrained FDAF'over'Unconstrained FDAF'— Prevents spectral leakage
Common Mistakes
| Mistake | Why It's Wrong | Correct Approach |
|---|---|---|
Manual LMS loop (w = w + mu*e*x) | Error-prone, no state management, no optimized C code | Use dsp.LMSFilter with the appropriate Method |
| Hardcoded step size without stability check | May diverge or converge too slowly | Call maxstep() and use 30% of muMaxMSE |
filter(h, 1, x) per frame without state | Breaks continuity at frame boundaries | Use dsp.FIRFilter (manages state internally) |
lms.Coefficients | Property does not exist for dsp.LMSFilter | Use third output: [y, e, w] = lms(x, d) |
fdaf.Coefficients | Property does not exist for FDAF | Use real(ifft(fdaf.FFTCoefficients)) |
'Constrained FDAF' with BlockLength < Length | Silently runs but does NOT partition | Must use 'Partitioned constrained FDAF' |
| Standard LMS for ANC (ignoring secondary path) | Diverges — gradient is misaligned | Use dsp.FilteredXLMSFilter |
maxstep() on Sign-Data or Sign-Sign LMS | Throws error — unsupported | Tune StepSize empirically (start small, e.g., 0.005) |
Calling maxstep() on dsp.RLSFilter | Function does not exist for RLS | RLS uses ForgettingFactor, not step size |
| Sign-based LMS with default zero weights | sign(0)=0 stalls adaptation permanently | Set InitialConditions to small nonzero values |
Using adaptfilt.* (lms, nlms, rls, etc.) | Entire package removed in R2020a; code will not run | Replace with dsp.LMSFilter, dsp.RLSFilter, etc. |
References
- Object Selection Guide — Full decision matrix
- dsp.LMSFilter — methods, maxstep, AdaptInputPort, weights
- dsp.RLSFilter — ForgettingFactor, methods, coefficients
- dsp.FilteredXLMSFilter — ANC workflow, secondary path properties
- dsp.FrequencyDomainAdaptiveFilter — Partitioned mode, FFTCoefficients
- Other Filters — AP, BlockLMS, Lattice, FTF
- Weight Extraction — per-object coefficient access
- maxstep Reference — Compatibility and fallbacks
Copyright 2026 The MathWorks, Inc.
FAQ
What does the matlab-design-adaptive-filter skill do?
Design and implement adaptive filters using DSP System Toolbox System objects. Use when working with adaptive filtering, system identification, noise cancellation, echo cancellation, active noise control (ANC), channel equalization, inverse system identification, or adaptive prediction. Covers dsp.LMSFilter, dsp.RLSFilter, dsp.FilteredXLMSFilter, dsp.FrequencyDomainAdaptiveFilter, dsp.AffineProjectionFilter, dsp.BlockLMSFilter, dsp.AdaptiveLatticeFilter, dsp.FastTransversalFilter, maxstep(), and algorithm selection for adaptive filtering problems. Replaces deprecated adaptfilt. objects (removed R2020a).
How do I install matlab-design-adaptive-filter?
Run npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-design-adaptive-filter in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/matlab-design-adaptive-filter/ (personal) or .claude/skills/matlab-design-adaptive-filter/ (project).
Which AI agents can use matlab-design-adaptive-filter?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is matlab-design-adaptive-filter safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains matlab-design-adaptive-filter?
It is published by matlab in matlab/matlab-agentic-toolkit. It has 74 recorded installs.
More from matlab/matlab-agentic-toolkit
matlab-review-code
matlab/matlab-agentic-toolkit
Review MATLAB code for quality, performance, maintainability, and adherence to MathWorks coding standards. Uses checkmatlabcode and matlabcodingguidelines. Use when reviewing code, checking style, finding code smells, assessing quality, or preparing code for handoff or publication.
matlab-analyze-data
matlab/matlab-agentic-toolkit
Analyze data using MATLAB. Use when the task involves tables, timetables, time-series data, numeric arrays, sensor matrices, or gridded data — including but not limited to exploring, row filtering, sorting, cleaning, transforming, aggregating, smoothing, padding, trimming, and answering questions about data. MATLAB provides extensive, easy-to-use built-in functions for these workflows with no additional products required.
matlab-design-digital-filter
matlab/matlab-agentic-toolkit
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.
matlab-modernize-code
matlab/matlab-agentic-toolkit
Modernize removed or discouraged MATLAB functions and patterns. Use when the checkmatlabcode MCP tool reports that a function "is not recommended", "will be removed in a future release", or "has been removed" — at any severity (info, warning, or error) — when migrating legacy code, or when replacing removed or discouraged APIs with current equivalents. Also applies to discouraged patterns Code Analyzer does not flag (containers.Map, bsxfun, str2num, eval, clear all) and to removed or discouraged functions such as trainNetwork, csvread, xlsread, datenum, guide, svmtrain, ltln2val, webmap.
matlab-create-live-script
matlab/matlab-agentic-toolkit
Create, edit, and run plain-text MATLAB live scripts (.m files) with rich text formatting, LaTeX equations, section breaks, and inline figures. Use when generating tutorials, analysis notebooks, reports, documentation, or educational content, when modifying existing live scripts, or when converting existing binary .mlx files to .m for version control. Requires R2025a+.
matlab-agentic-toolkit-setup
matlab/matlab-agentic-toolkit
Install and configure the MATLAB Agentic Toolkit — detect MATLAB, install the MCP server, register with your AI coding agent, and verify the environment. Supports Claude Code, Codex, GitHub Copilot, Amp, and Gemini CLI.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available