算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
matlab-design-digital-filter【设计与创意】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.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
evaluate_matlab_code. Write to a .m file, run with run_matlab_file, edit on error.Preflight: [files] at the top of the response.Fs is unknown, stop and ask (unless the user explicitly wants normalized frequency).designfilt(..., SampleRate=Fs) and freqz(d, [], Fs).[b,a] polynomials).references/INDEX.md for each (function-level + task-level tables)Preflight: quick-ref/filter-analyzer.md, quick-ref/designfilt.md (or Preflight: none required)trans_pct and identify interference characteristicsAfter signal analysis, ask Mode + Phase if not stated:
Wait for answer before showing any approach comparison or overview.
references/efficient-filtering.md if trans_pct < 2%Fs (Hz)If any item is missing, ask.
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.
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 (see references/quick-ref/efficient-filtering.md)designfilt choose minimum order, then query filtord(d). Optionally use kaiserord/firpmord for FIR length estimates.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.filterAnalyzer() for comparing 2+ designs. Read references/quick-ref/filter-analyzer.md first. Minimum displays: magnitude + group delay.filtfilt(), verify the effective response (magnitude squared).| 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 |
SampleRate=Fs in designfilt() and plot in Hz with freqz(d, [], Fs)filterAnalyzer() for multi-filter comparison, not custom freqz/grpdelay plots[b,a] for order > 8)tiledlayout/nexttile for multi-panel figures (not subplot)Copyright 2026 The MathWorks, Inc.