このページは前リリースの情報です。該当の英語のページはこのリリースで削除されています。
この例では、多段間引きおよび多段内挿の設計法を示します。遷移帯域が狭い FIR フィルターの効率的な設計の例では、ローパス フィルターのシングルレート設計に IFIR と多段のアプローチを適用する方法を示します。この手法は、多段間引きや多段内挿の設計にも応用できます。IFIR アプローチを使用すると、2 ステージの間引き/内挿になります。多段アプローチでは、ステージ数を自動的に最適化するか、手動で制御することができます。
間引きを使用すると、信号のサンプルレートを減少すると同時に、それに比例してバンド幅を減少することができます。たとえば、レートを 48 MHz から 1 MHz (1/48) に減少させるために、バンド幅を同様に減少させるローパス フィルターの一般的な仕様を以下に示します。
Fs = 48e6; TW = 100e3; Astop = 80; % Minimum stopband attenuation M = 48; % Decimation factor
指定されたこれらの仕様の簡単な多段設計を次に示します。
multidecim = designMultistageDecimator(M,Fs,TW,Astop);
結果の設計を解析するには、いくつかの関数が利用できます。
info(multidecim) % Provide some information on the multistage filter cost(multidecim) % Determine the implementation cost fvtool(multidecim) % Visualize overall magnitude response, group delay, etc
ans = 'Discrete-Time Filter Cascade ---------------------------- Number of stages: 5 Stage1: dsp.FIRDecimator ------- Discrete-Time FIR Multirate Filter (real) ----------------------------------------- Filter Structure : Direct-Form FIR Polyphase Decimator Decimation Factor : 2 Polyphase Length : 4 Filter Length : 7 Stable : Yes Linear Phase : Yes (Type 1) Arithmetic : double Stage2: dsp.FIRDecimator ------- Discrete-Time FIR Multirate Filter (real) ----------------------------------------- Filter Structure : Direct-Form FIR Polyphase Decimator Decimation Factor : 2 Polyphase Length : 4 Filter Length : 7 Stable : Yes Linear Phase : Yes (Type 1) Arithmetic : double Stage3: dsp.FIRDecimator ------- Discrete-Time FIR Multirate Filter (real) ----------------------------------------- Filter Structure : Direct-Form FIR Polyphase Decimator Decimation Factor : 2 Polyphase Length : 6 Filter Length : 11 Stable : Yes Linear Phase : Yes (Type 1) Arithmetic : double Stage4: dsp.FIRDecimator ------- Discrete-Time FIR Multirate Filter (real) ----------------------------------------- Filter Structure : Direct-Form FIR Polyphase Decimator Decimation Factor : 3 Polyphase Length : 11 Filter Length : 33 Stable : Yes Linear Phase : Yes (Type 1) Arithmetic : double Stage5: dsp.FIRDecimator ------- Discrete-Time FIR Multirate Filter (real) ----------------------------------------- Filter Structure : Direct-Form FIR Polyphase Decimator Decimation Factor : 2 Polyphase Length : 48 Filter Length : 95 Stable : Yes Linear Phase : Yes (Type 1) Arithmetic : double ' ans = struct with fields: NumCoefficients: 89 NumStates: 146 MultiplicationsPerInputSample: 6.6042 AdditionsPerInputSample: 5.6667
多段設計は、入力サンプルごとの乗算およびフィルター係数の総数において効率的です。単一ステージの設計と比較します。
singledecim = designMultistageDecimator(M,Fs,TW,Astop,'NumStages',1); cost(singledecim) % Determine the implementation cost fvtool(multidecim,singledecim) legend('Multistage','Singlestage')
ans = struct with fields: NumCoefficients: 2361 NumStates: 2400 MultiplicationsPerInputSample: 49.1875 AdditionsPerInputSample: 49.1667
既定では、段階の数は、実装コストを最小化するために自動的に決定されます。段階の数は、1 から間引き係数の素因数の数までの任意の数に手動で設定できます。2 段階に増加させるだけで大きく異なります。
twostagedecim = designMultistageDecimator(M,Fs,TW,Astop,'NumStages',2);
cost(twostagedecim)
ans = struct with fields: NumCoefficients: 218 NumStates: 265 MultiplicationsPerInputSample: 9.2500 AdditionsPerInputSample: 9.1667
既定では、設計によって入力サンプルごとの乗算が最小化されます。また、係数の数を最小化することもできます。
mincoeffdecim = designMultistageDecimator(M,Fs,TW,Astop,... 'MinTotalCoeffs',true); cost(mincoeffdecim)
ans = struct with fields: NumCoefficients: 87 NumStates: 147 MultiplicationsPerInputSample: 6.8125 AdditionsPerInputSample: 6
multidecim
と比較すると、係数の数は少なくなっていますが、入力サンプルごとの乗算は多くなっています。
既定では、最適な多段構成は、各段階で必要な係数の数の推定を使用して決定されます。時間はかかりますが、より正確な方法として、すべてのフィルター候補を設計し、最適解を見つけるための実際の係数の数を決定します。
optimaldecim = designMultistageDecimator(M,Fs,TW,Astop,... 'CostMethod','design'); cost(optimaldecim) fvtool(multidecim,optimaldecim)
ans = struct with fields: NumCoefficients: 87 NumStates: 146 MultiplicationsPerInputSample: 6.5625 AdditionsPerInputSample: 5.6667
多段内挿の設計時には、同様の節約が可能です。すべての内挿と同様に、設計全体には、内挿係数に等しいゲインがあります。
multiinterp = designMultistageInterpolator(8); fvtool(multiinterp)
間引き/内挿の実装時に、多段手法を使用することで、計算上のコストを大幅に削減することができます。