Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

任意の振幅フィルター設計

この例では、任意の振幅応答をもつフィルターの設計法を示します。フィルター設計 (FDESIGN) オブジェクトのファミリは、さまざまなタイプの応答をもつフィルターの設計に対応しています。これらのタイプの中で、任意の振幅はあまり特化されておらず、最も柔軟なものです。以下の例は、その他の応答タイプに限界がある場合に任意の振幅設計を使用して問題を解決する方法を示します。

周波数サンプリング法による FIR モデル化

ここでは、フィルターの振幅が (緩和領域や "don't care" 領域のない) 完全なナイキスト範囲上で定義される場合について説明します。以下の例では、単一の (完全) 帯域仕様タイプおよびロバストな周波数サンプリング アルゴリズムを使用して、振幅が次の 3 つのセクションで定義されるフィルターを設計します。正弦波セクション、区分的線形セクションおよび 2 次セクション。このフィルターの形状は非常に複雑なので、大きいフィルター次数を選択しなければなりません。

N = 300;
B1 = 0:0.01:0.18;
B2 = [.2 .38 .4 .55 .562 .585 .6 .78];
B3 = 0.79:0.01:1;
A1 = .5+sin(2*pi*7.5*B1)/4;    % Sinusoidal section
A2 = [.5 2.3 1 1 -.2 -.2 1 1]; % Piecewise linear section
A3 = .2+18*(1-B3).^2;          % Quadratic section
F = [B1 B2 B3];
A = [A1 A2 A3];
d = fdesign.arbmag('N,F,A',N,F,A);
Hd = design(d,'freqsamp','SystemObject',true);
fvtool(Hd,'MagnitudeDisplay','Zero-phase');

Figure Figure 1: Zero-phase Response contains an axes object. The axes object with title Zero-phase Response, xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Amplitude contains 2 objects of type line.

close(gcf)

前の例では、正規化周波数点は 0 と pi ラジアン/サンプル (極値を含む) の間に分布していました。負の周波数を指定して複素フィルターを得ることもできます。以下の例では、複素 RF バンドパス フィルターをモデル化し、カイザー ウィンドウを使用して、-pi と pi ラジアン/サンプル周波数の間の 70 dB のギャップが原因で発生するギブズ現象の影響を緩和します。

load cfir.mat; % load a predefined set of frequency and amplitude vectors
N = 200;
d = fdesign.arbmag('N,F,A',N,F,A);
Hd = design(d,'freqsamp', 'window' ,{@kaiser,20},'SystemObject',true);
fvtool(Hd,'FrequencyRange','[-pi, pi)');

Figure Figure 2: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line.

等リップル FIR フィルターによる平滑化関数のモデル化

最小次数の FIR フィルターで指数をモデル化する以下の例のように、等リップル アルゴリズムは平滑化関数のモデル化に適しています。この例では、全周波数で小さいリップル値を指定し、目的の振幅まで比例的に増加する重みを定義して、高い周波数でのパフォーマンスを改善します。

F = linspace(0,1,100);
A = exp(-2*pi*F); 
R = 0.045; % ripple
W = .1-20*log10(abs(A)); % weights
d = fdesign.arbmag('F,A,R',F,A,R);
Hd = design(d,'equiripple','weights',W,'SystemObject',true);
fvtool(Hd,'MagnitudeDisplay','Zero-phase', 'FrequencyRange','[0, pi)');

Figure Figure 3: Zero-phase Response contains an axes object. The axes object with title Zero-phase Response, xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Amplitude contains 2 objects of type line.

単一帯域の等リップル FIR 設計とマルチ帯域の等リップル FIR 設計

特定のアプリケーションでは、フィルターの阻止帯域を調整して、統合されたサイド ローブを最小化したり量子化されたロバスト性を向上させたりすることができます。以下の例では、階段状の阻止帯域でローパス フィルターを設計します。そのために、各ステップの減衰を阻止帯域で 5dB ずつ増加させる重みの分布を使用します。

N = 150;
F = [0 .25 .3 .4 .401 .5 .501 .6 .601 .7 .701 .8 .801 .9 .901 1]; 
A = [1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
W = 10.^([0 0 5 5 10 10 15 15 20 20 25 25 30 30 35 35]/20);
d = fdesign.arbmag('N,F,A',N,F,A);
Hd1 = design(d,'equiripple','weights',W,'SystemObject',true);

以下の例は、"don't care" 領域 (つまり遷移帯域) で分割された 2 つの帯域 (通過帯域と阻止帯域) を定義するマルチ帯域アプローチを使用する代替の設計例です。

B = 2;            % Number of bands
F1 = F(1:2);      % Passband
F2 = F(3:end);    % Stopband
% F(2:3)=[.25 .3] % Transition band
A1 = A(1:2);
A2 = A(3:end);
W1 = W(1:2);
W2 = W(3:end);
d = fdesign.arbmag('N,B,F,A',N,B,F1,A1,F2,A2);
Hd2 = design(d,'equiripple','B1Weights',W1,'B2Weights',W2,...
    'SystemObject',true);
hfvt = fvtool(Hd1,Hd2,'MagnitudeDisplay','Magnitude (dB)','Legend','On');
legend(hfvt, 'Single-Band Design', 'Multi-Band Design');

Figure Figure 4: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line. These objects represent Single-Band Design, Multi-Band Design.

マルチ帯域アプローチには明確な利点があります。遷移領域での制約を緩和することによって、等リップル アルゴリズムが低い通過帯域リップルと大きい阻止帯域の減衰をもつ解に収束します。言い換えれば、最初のフィルターの周波数特性を低い次数に一致させることができるのです。以下の例では、最小次数設計を使用する等価フィルターを取得して、この最後のコメントを実証します。

最小次数設計では、帯域ごとに 1 つのリップル値を指定する必要があります。この例の場合、すべての帯域でリップルを 0.0195 に設定します。

R = 0.0195;

% Single-band minimum order design
d = fdesign.arbmag('F,A,R',F,A,R);
Hd1 = design(d,'equiripple','Weights',W,'SystemObject',true);

% Multi-band minimum order design
d = fdesign.arbmag('B,F,A,R',B,F1,A1,R,F2,A2,R);
Hd2 = design(d,'equiripple','B1Weights',W1,'B2Weights',W2,...
    'SystemObject',true);

hfvt = fvtool(Hd1,Hd2);
legend(hfvt, 'Single-Band Minimum Order Design', ...
  'Multi-Band Minimum Order Design');

Figure Figure 5: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line. These objects represent Single-Band Minimum Order Design, Multi-Band Minimum Order Design.

両方の設計の通過帯域リップルと阻止帯域の減衰は一致します。しかし、単一帯域設計の次数が 152 であるのに対して、マルチ帯域設計の次数は 72 です。

order(Hd)
ans = 32

制約付きマルチ帯域等リップル設計

マルチ帯域等リップル設計では、さまざまな帯域のリップル制約の指定、単一周波数帯域の指定、および指定値に対する指定周波数点の強制を行うことができます。

制約付き帯域設計

以下の例では、最初の阻止帯域での減衰が 60 dB、2 番目の阻止帯域での減衰が 40 dB である 80 次通過帯域フィルターを設計します。2 番目の阻止帯域の減衰を緩和することによって、通過帯域でのリップルは減少しますが、同じフィルター次数が維持されます。

N = 80; % filter order
B = 3;  % number of bands

d = fdesign.arbmag('N,B,F,A,C',N,B,[0 0.25],[0 0],true,...
  [0.3 0.6],[1 1],false,[0.65 1],[0 0],true)
d = 
  arbmag with properties:

               Response: 'Arbitrary Magnitude'
          Specification: 'N,B,F,A,C'
            Description: {4x1 cell}
    NormalizedFrequency: 1
            FilterOrder: 80
                 NBands: 3
          B1Frequencies: [0 0.2500]
           B1Amplitudes: [0 0]
          B1Constrained: 1
               B1Ripple: 0.2000
          B2Frequencies: [0.3000 0.6000]
           B2Amplitudes: [1 1]
          B2Constrained: 0
          B3Frequencies: [0.6500 1]
           B3Amplitudes: [0 0]
          B3Constrained: 1
               B3Ripple: 0.2000

最初と 3 番目の帯域を制約付き帯域として指定するため、B1ConstrainedB3Constrained の各プロパティが真に設定されています。BiRipple プロパティを使用して、i 番目の制約付き帯域のリップル値を指定します。

d.B1Ripple = 10^(-60/20); % Attenuation for the first stopband
d.B3Ripple = 10^(-40/20); % Attenuation for the second stopband

Hd = design(d,'equiripple','SystemObject',true)
Hd = 
  dsp.FIRFilter with properties:

            Structure: 'Direct form'
      NumeratorSource: 'Property'
            Numerator: [-0.0036 0.0049 0.0052 -0.0022 -0.0097 -0.0044 0.0093 0.0100 -0.0031 -0.0062 -8.4302e-04 -0.0055 -0.0040 0.0120 0.0100 -0.0056 -0.0026 -0.0032 -0.0157 8.1567e-04 0.0218 0.0050 -0.0029 0.0057 -0.0200 -0.0274 ... ] (1x81 double)
    InitialConditions: 0

  Use get to show all properties

fvtool(Hd,'Legend','Off');

Figure Figure 6: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line.

単一周波数帯域

以下の例では、正確に 0.25*pi と 0.55*pi ラジアン/サンプルに 2 つのノッチがあり、通過帯域に 0.15 のリップルがある最小次数等リップル フィルターを設計します。

B = 5; % number of bands
d = fdesign.arbmag('B,F,A,R',B);

d.B1Frequencies = [0 0.2];  
d.B1Amplitudes = [1 1];
d.B1Ripple = 0.15;
d.B2Frequencies = 0.25; % single-frequency band
d.B2Amplitudes = 0; 
d.B3Frequencies = [0.3 0.5]; 
d.B3Amplitudes = [1 1]; 
d.B3Ripple = 0.15;
d.B4Frequencies = 0.55; % single-frequency band
d.B4Amplitudes = 0; 
d.B5Frequencies = [0.6 1];  
d.B5Amplitudes = [1 1];
d.B5Ripple = 0.15;
Hd = design(d,'equiripple','SystemObject',true);
fvtool(Hd);

Figure Figure 7: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line.

強制周波数点

以下の例では、阻止帯域エッジが 100 Hz、通過帯域エッジが 150 Hz にあるハイパス フィルターを設計します。追加フィルターを追加したり、フィルター次数を大幅に増やしたりすることなく、強力な 60 Hz 干渉を排除するものとします。そのためには、60 Hz でのハイパス フィルターの振幅応答を強制的に 0 にします。

B = 2;    % number of bands
N = 92;   % filter order
Fs = 2e3; % sampling frequency
d = fdesign.arbmag('N,B,F,A',N,B,[0 60 100],[0 0 0],[150 1000],[1 1],Fs);

B1ForcedFrequencyPoints 設計オプションを使用して、指定した振幅値を強制的に 60 Hz 点にします。

Hd = design(d,'equiripple','B1ForcedFrequencyPoints',60,...
    'SystemObject',true);
hfvt = fvtool(Hd,'Fs', Fs);

Figure Figure 8: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Frequency (Hz), ylabel Magnitude (dB) contains 2 objects of type line.

ハイパス フィルターの阻止帯域を拡大して、指定した 60 Hz 周波数点で振幅がゼロであることを確認します。

hfvt.MagnitudeDisplay = 'Magnitude';

Figure Figure 8: Magnitude Response contains an axes object. The axes object with title Magnitude Response, xlabel Frequency (Hz), ylabel Magnitude contains 2 objects of type line.

単一帯域の IIR 設計とマルチ帯域の IIR 設計

FIR の場合と同様に、遷移帯域を簡単に識別できない IIR 設計の問題は、単一 (完全) 帯域仕様のアプローチで解決できます。例として、ガスの光吸収をモデル化します (atomic Rubidium87 蒸発)。

Nb = 12; 
Na = 10;
F = linspace(0,1,100);
As = ones(1,100)-F*0.2;
Absorb = [ones(1,30),(1-0.6*bohmanwin(10))',...
    ones(1,5), (1-0.5*bohmanwin(8))',ones(1,47)];
A = As.*Absorb;
d = fdesign.arbmag('Nb,Na,F,A',Nb,Na,F,A);
W = [ones(1,30) ones(1,10)*.2 ones(1,60)];
Hd = design(d, 'iirlpnorm', 'Weights', W, 'Norm', 2, 'DensityFactor',30,...
    'SystemObject',true);
fvtool(Hd, 'MagnitudeDisplay','Magnitude (dB)', ...
    'NormalizedFrequency','On');

Figure Figure 9: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line.

1 つ以上の遷移帯域で制約を緩和できる場合、マルチ帯域アプローチには FIR の場合と同じメリット (通過帯域と阻止帯域の特性の向上) があります。以下の例では、レイリー フェージング無線通信チャネルをモデル化して、これらの違いを示します。

Nb = 4;
Na = 6;
F = [0:0.01:0.4 .45 1];
A = [1.0./(1-(F(1:end-2)./0.42).^2).^0.25 0 0];
d = fdesign.arbmag('Nb,Na,F,A',Nb,Na,F,A); % single-band design
Hd1 = design(d,'iirlpnorm','SystemObject',true);

B = 2;
F1 = F(1:end-2);          % Passband
F2 = F(end-1:end);        % Stopband
% F(end-2:end-1)=[.4 .45] % Transition band
A1 = A(1:end-2);  
A2 = A(end-1:end);
d = fdesign.arbmag('Nb,Na,B,F,A',Nb,Na,B,F1,A1,F2,A2); % multi-band design
Hd2 = design(d,'iirlpnorm','SystemObject',true);
hfvt = fvtool(Hd1,Hd2);
legend(hfvt, 'Single-Band Design', 'Multi-Band Design');

Figure Figure 10: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line. These objects represent Single-Band Design, Multi-Band Design.