matlab-design-digital-filter
Skill8 starsChanged 5 months agoMITView on GitHub
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.
In this repository58 other files it gives its agents.
- skills/writing-polish/humanizer/AGENTS.mdAGENTS.md
- frontend-designSkill
- ask-mattSkill
- codebase-designSkill
- code-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- github-codex-keySkill
- github-ssh-key-pushSkill
- implementSkill
- improve-codebase-architectureSkill
- prototypeSkill
- setup-matt-pocock-skillsSkill
- tddSkill
- to-issuesSkill
- to-prdSkill
- triageSkill
- huggingface-accelerateSkill
- quantizing-models-bitsandbytesSkill
- gpuboxSkill
- evaluating-llms-harnessSkill
- ml-training-recipesSkill
- peft-fine-tuningSkill
- experiment-tracking-swanlabSkill
- unslothSkill
- matlab-add-awgnSkill
- matlab-agentic-toolkit-setupSkill
- matlab-build-appSkill
- matlab-create-live-scriptSkill
- matlab-debuggingSkill
- matlab-display-imageSkill
- matlab-install-productsSkill
- matlab-list-productsSkill
- matlab-map-database-objectsSkill
- matlab-model-serdes-systemsSkill
- matlab-modernize-codeSkill
- matlab-read-databaseSkill
- matlab-review-codeSkill
- matlab-testingSkill
- matlab-use-duckdbSkill
- matlab-write-databaseSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- teachSkill
- writing-great-skillsSkill
- ara-compilerSkill
- ara-research-managerSkill
- research-paper-notesSkill
- ara-rigor-reviewerSkill
- brainstorming-research-ideasSkill
- creative-thinking-for-researchSkill
- academic-plottingSkill
- ml-paper-writingSkill
- paper-spineSkill
- humanizerSkill
- prompt-optimizerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 7 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Read references/INDEX.md: before writing any filter design code.
- Very specific: line 36
Always write to .m files: Never put multi-line MATLAB code directly in evaluate_matlab_code.
- Very specific: line 37
Preflight before ANY MATLAB call: Before calling any function listed in INDEX.md, read the required quick-ref first.
- Distinctive: line 38
Do not guess key requirements: If Mode (streaming vs offline) or Phase requirement is not stated, ask.
- Very specific: line 39
No Hz designs without Fs: If Fs is unknown, stop and ask (unless the user explicitly wants normalized frequency).
- Very specific: line 40
Always pin the sample rate: Use designfilt(..., SampleRate=Fs) and freqz(d, [], Fs).
- Very specific: line 41
IIR stability: Prefer SOS/CTF forms (avoid high-order [b,a] polynomials).
- Very specific: line 46
Check references/INDEX.md for each (function-level + task-level tables)
- Distinctive: line 47
Read required quick-ref files
- Distinctive: line 59
After signal analysis, ask Mode + Phase if not stated:
- Distinctive: line 63
Wait for answer before showing any approach comparison or overview.
- Distinctive: line 70
Use Filter Analyzer for visual comparison
- Distinctive: line 80
If any item is missing, ask.
- Distinctive: line 88
If Mode or Phase is unknown, ask 1-2 clarifying questions and stop.
- Very specific: line 127
Always specify SampleRate=Fs in designfilt() and plot in Hz with freqz(d, [], Fs)
- Very specific: line 128
Use filterAnalyzer() for multi-filter comparison, not custom freqz/grpdelay plots
- Very specific: line 129
Use SOS form for IIR (avoid [b,a] for order > 8)
- Very specific: line 130
Use tiledlayout/nexttile for multi-panel figures (not subplot)
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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/grpdelayplots - Use SOS form for IIR (avoid
[b,a]for order > 8) - Use
tiledlayout/nexttilefor multi-panel figures (notsubplot)
Copyright 2026 The MathWorks, Inc.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

