본문으로 건너뛰기
cccskills
무료GitHub에 공개

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).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(10)

  • SKILL.md11.2 KB
  • manifest.yaml426 B
  • references/fdaf-filter.md5.9 KB
  • references/fxlms-filter.md3.9 KB
  • references/lms-filter.md3.9 KB
  • references/maxstep-reference.md2.9 KB
  • references/object-selection.md3.9 KB
  • references/other-filters.md3.8 KB
  • references/rls-filter.md3.4 KB
  • references/weight-extraction.md2.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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 by dsp.*Filter System objects (removed in R2020a)
  • Any task involving dsp.LMSFilter, dsp.RLSFilter, dsp.FilteredXLMSFilter, dsp.FrequencyDomainAdaptiveFilter, dsp.AffineProjectionFilter, or maxstep()

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:

ScenarioObjectMethod/Config
General-purpose, white inputdsp.LMSFilter'Normalized LMS'
Colored/correlated inputdsp.AffineProjectionFilterProjectionOrder=4-8
Fast convergence neededdsp.RLSFilterForgettingFactor=0.99
Tracking time-varying systemdsp.RLSFilterForgettingFactor=0.95-0.99
Active noise controldsp.FilteredXLMSFilterRequires secondary path estimate
Long filters (>256 taps)dsp.FrequencyDomainAdaptiveFilter'Constrained FDAF'
Long filter + low latencydsp.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:

ObjectExtraction Method
dsp.LMSFilterThird output: [y, e, w] = lms(x, d)
dsp.RLSFilterProperty: rls.Coefficients
dsp.FilteredXLMSFilterProperty: fxlms.Coefficients (negated for ANC)
dsp.FrequencyDomainAdaptiveFilterSee references/fdaf-filter.md — partitioned vs non-partitioned differ
dsp.AffineProjectionFilterProperty: 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/ObjectPurposeToolbox
dsp.LMSFilterLMS/NLMS/Sign variants (5 methods)DSP System Toolbox
dsp.RLSFilterRecursive Least Squares (5 methods)DSP System Toolbox
dsp.AffineProjectionFilterAffine Projection (colored input)DSP System Toolbox
dsp.FilteredXLMSFilterFiltered-X LMS (ANC)DSP System Toolbox
dsp.FrequencyDomainAdaptiveFilterFDAF (long filters, 4 methods)DSP System Toolbox
dsp.BlockLMSFilterBlock LMS (frame-based)DSP System Toolbox
dsp.AdaptiveLatticeFilterLattice (numerical stability)DSP System Toolbox
dsp.FastTransversalFilterFast transversal (O(N) RLS)DSP System Toolbox
maxstep()Maximum stable step sizeDSP System Toolbox
msesim()Simulated MSE learning curvesDSP 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.*Filter System objects — Never implement weight-update loops manually
  • Always call maxstep() for step size when available (LMS, NLMS, Sign-Error, BlockLMS)
  • Always use AdaptInputPort=true for freeze/adapt control — Never wrap in if/else
  • Always use dsp.FIRFilter for unknown system simulation — It maintains state across frames
  • Never access .Coefficients on dsp.LMSFilter — It doesn't exist; use third output
  • Never access .Coefficients on dsp.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 use dsp.*Filter System 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

MistakeWhy It's WrongCorrect Approach
Manual LMS loop (w = w + mu*e*x)Error-prone, no state management, no optimized C codeUse dsp.LMSFilter with the appropriate Method
Hardcoded step size without stability checkMay diverge or converge too slowlyCall maxstep() and use 30% of muMaxMSE
filter(h, 1, x) per frame without stateBreaks continuity at frame boundariesUse dsp.FIRFilter (manages state internally)
lms.CoefficientsProperty does not exist for dsp.LMSFilterUse third output: [y, e, w] = lms(x, d)
fdaf.CoefficientsProperty does not exist for FDAFUse real(ifft(fdaf.FFTCoefficients))
'Constrained FDAF' with BlockLength < LengthSilently runs but does NOT partitionMust use 'Partitioned constrained FDAF'
Standard LMS for ANC (ignoring secondary path)Diverges — gradient is misalignedUse dsp.FilteredXLMSFilter
maxstep() on Sign-Data or Sign-Sign LMSThrows error — unsupportedTune StepSize empirically (start small, e.g., 0.005)
Calling maxstep() on dsp.RLSFilterFunction does not exist for RLSRLS uses ForgettingFactor, not step size
Sign-based LMS with default zero weightssign(0)=0 stalls adaptation permanentlySet InitialConditions to small nonzero values
Using adaptfilt.* (lms, nlms, rls, etc.)Entire package removed in R2020a; code will not runReplace with dsp.LMSFilter, dsp.RLSFilter, etc.

References


Copyright 2026 The MathWorks, Inc.


리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Guide for accessing financial and economic data in MATLAB using the Datafeed Toolbox. Covers Bloomberg (market data via bloomberg/blp/bloombergHypermedia), FRED (Federal Reserve economic data via fredrs), Haver Analytics (economic data via haver/haverdirect/haverview), and LSEG Datastream (historical data via datastreamws). Use when connecting to any of these data providers from MATLAB.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/matlab-agentic-toolkit1.2천2026년 10월 14일 업데이트

Read BEFORE writing any code that adds Additive White Gaussian Noise (AWGN) to signals and converts between SNR, Eb/No, Es/No, and per-subcarrier SNR for communications simulations, using awgn(), convertSNR(), berawgn(). The default MATLAB patterns for AWGN (e.g., 'measured' option, manual SNR formulas) produce subtly incorrect results. This skill specifies the correct calling conventions, required function usage, and critical anti-patterns that must be avoided.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/matlab-agentic-toolkit1.2천2026년 10월 14일 업데이트

Analyze AMS waveform data using Mixed-Signal Blockset utilities: phase noise measurement, clock jitter, anti-aliased resampling, timing measurements, lock time, INL/DNL, ADC/DAC calibration, HSpice import. Use when analyzing time-domain voltage from PLL/VCO/clock simulations, measuring phase noise from variable-step solver output, computing jitter, or resampling non-uniform data.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/matlab-agentic-toolkit1.2천2026년 10월 14일 업데이트

Design and analyze electrically large antenna structures using MATLAB Antenna Toolbox. Covers reflector antennas (parabolic, Cassegrain, Gregorian, offset, corner, cylindrical, spherical, custom STL), reflectarrays and reconfigurable intelligent surfaces (RIS), antennas installed on platforms (vehicles, aircraft, ships, satellites), and radar cross section (RCS) analysis. Includes solver selection (MoM-PO, PO, MoM, FMM), mesh control, and GPU acceleration. Use when the user wants to design a dish/reflector antenna, reflectarray, analyze an antenna on a platform, or compute RCS.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/matlab-agentic-toolkit1.2천2026년 10월 14일 업데이트

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/matlab-agentic-toolkit1.2천2026년 10월 14일 업데이트

S-parameters, insertion loss, fields, currents, mesh control, and solver selection for RF PCB performance validation. TRIGGER: user asks to compute S-parameters, analyze insertion/return loss, extract fields or currents, compare MoM vs FEM, or control mesh for any RF PCB component. Invoke BEFORE writing sparameters() or solver code — API is non-obvious. SKIP: designing or creating components (use the specific matlab-design-pcb-* skill), material/stackup setup only (use matlab-manage-pcb-material), optimization sweeps (use matlab-optimize-pcb-design), PDN/IR-drop analysis (use matlab-analyze-pcb-pdn).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matlab/matlab-agentic-toolkit1.2천2026년 10월 14일 업데이트

matlab의 스킬 모두 보기

이 스킬의 문제 신고