Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Filterentwurf
• IIR-Filter◦ Beispiele fur die verschiedenen Filtertypen
• FIR-Filter◦ Entwurf mit inv. Fouriertransformation und Fensterfunktion◦ Filter mit Tschebyscheff-Verhalten
• Vorgehensweise bei Matlab / Octave
• Allpass-Transformation
1
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Filterentwurf mit Matlab bzw. Octave
Beispiel fur Toleranzschema:
ωd = π/8, ωs = π/6, 20 log(1− δd) = −1, 20 log(δs) = −40
Entwurf eines Butterworth-Filters:wd = 1/8;ws = 1/6;dd = 1;ds = 40;[n,wc] = buttord(wd,ws,dd,ds);n[b,a] = butter(n,wc);
Ergebnis:
• Filtergrad n = 18
• Koeffizienten des Zahlerpolynoms a und des Nennerpolynoms b2
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Butterworth-Tiefpass
Impulsantwort:
L = 200;[x,t] = impz(b,a,L);stem(t,x);
−0.06
−0.04
−0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0 50 100 150 200
3
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Butterworth-Tiefpass
Pol-Nullstellendiagramm:
zplane(b,a);
Genauigkeitsprobleme beiNullstellenberechnungmit mehrfachen Nullstellen!
−1
−0.5
0
0.5
1
−1 −0.5 0 0.5 1
4
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Butterworth-Tiefpass
Pol-Nullstellendiagramm mitkorrigierten Nullstellen
−1
−0.5
0
0.5
1
−1
(18)
−0.5 0 0.5 1
Darstellung von Betrags- und Phasengang: FREQRES = 1024;freqz(b,a,FREQRES);
5
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Butterworth-Tiefpass - Frequenzgange
−3
−2.5
−2
−1.5
−1
−0.5
0Pass band (dB)
−100−90−80−70−60−50−40−30−20−10
0Stop band (dB)
−1800−1600−1400−1200−1000−800−600−400−200
0
Frequency
Phase (degrees)
6
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tschebyscheff-Tiefpass Typ 1
[n, wc] = cheb1ord(wd,ws,dd,ds);n[b, a] = cheby1(n,dd,wc);
Filtergrad n = 8
Impulsantwort:
−0.06
−0.04
−0.02
0
0.02
0.04
0.06
0.08
0.1
0 50 100 150 200
7
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tschebyscheff-Tiefpass Typ 1
Pol-Nullstellendiagramm
−1
−0.5
0
0.5
1
−1 −0.5 0 0.5 1
8
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tschebyscheff-Tiefpass Typ 1 - Frequenzgange
−3
−2.5
−2
−1.5
−1
−0.5
0Pass band (dB)
−100−90−80−70−60−50−40−30−20−10
0Stop band (dB)
−700−600−500−400−300−200−100
0
Frequency
Phase (degrees)
9
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tschebyscheff-Tiefpass Typ 2
[n, wc] = cheb2ord(wd,ws,dd,ds);n[b, a] = cheby2(n,ds,wc);
Filtergrad n = 8
Impulsantwort:
−0.06
−0.04
−0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0 50 100 150 200
10
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tschebyscheff-Tiefpass Typ 2
Pol-Nullstellendiagramm
−1
−0.5
0
0.5
1
−1 −0.5 0 0.5 1
11
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tschebyscheff-Tiefpass Typ 2 - Frequenzgange
−3
−2.5
−2
−1.5
−1
−0.5
0Pass band (dB)
−100
−80
−60
−40
−20
0Stop band (dB)
−400−350−300−250−200−150−100−50
0 50
Frequency
Phase (degrees)
12
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Cauer-Tiefpass
[n,wc] = ellipord(wd,ws,dd,ds);n[b,a] = ellip(n,dd,ds,wc);
Filtergrad n = 5
Impulsantwort:
−0.04
−0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0 50 100 150 200
13
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Cauer-Tiefpass
Pol-Nullstellendiagramm
−1
−0.5
0
0.5
1
−1 −0.5 0 0.5 1
14
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Cauer-Tiefpass - Frequenzgange
−3
−2.5
−2
−1.5
−1
−0.5
0Pass band (dB)
−100−90−80−70−60−50−40−30−20−10
0Stop band (dB)
−400−350−300−250−200−150−100−50
0
Frequency
Phase (degrees)
15
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Entwurf von FIR-Filtern
• Entwurf mit inv. Fouriertransformation und Fensterfunktion
• Filter mit Tschebyscheff-Verhalten
16
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Filterentwurf mit Fensterfunktion
Grundidee:
• Vorgabe eines “Wunschfrequenzgangs”
• Berechnung einer Impulsantwort durch inverseFouriertransformation
• Begrenzung auf endliche Lange durch Multiplikation mitFensterfunktion
Problem bei Unstetigkeiten des Wunschfrequenzgangs:
Gibbs-Effekt: Uberschwingen bleibt bei Rechteckfenster bei ca 10%
Verbesserung: Verwendung besserer Fensterfunktionen
17
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Filterentwurf mit Fensterfunktion
Fur Filterentwurf haufig verwendete Fensterfunktion:
Kaiser-Fenster wK(n) =I0
(α√
1− (2nM )2
)I0(α)
mit−M/2 ≤ n ≤M/2
0
0.2
0.4
0.6
0.8
1
10 20 30 40 50 60 70 80 90 100
α = 10
α = 3
α = 1
α = 0, 1
18
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Filterentwurf mit Fensterfunktion
Vorgehensweise zum Entwurf eines Tiefpassfilters:
• Vorgabe eines Toleranzschemas
• Bestimmung der benotigten Filterlange
• Bestimmung von αwp = 1/8;ws = 1/6;delta = 0.01;[n, w, alpha, ftype] = kaiserord([wp,ws],[1,0],[delta,delta]);a = fir1(n,w,kaiser(n+1,alpha),ftype);
Hier: α = 3.3953, L = n+ 1 = 108
19
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tiefpass mit Kaiser-Fenster
−0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0 20 40 60 80 100
20
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tiefpass mit Kaiser-Fenster
Pol-Nullstellendiagramm:
r = roots(a);zplane(r);
−1
−0.5
0
0.5
1
−1 −0.5 0 0.5 1
21
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Tiefpass mit Kaiser-Fenster
−63
−62.5
−62
−61.5
−61
−60.5 Pass band (dB)
−160−150−140−130−120−110−100−90−80−70 Stop band (dB)
−1600−1400−1200−1000−800−600−400−200
0
Frequency
Phase (degrees)
22
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Filter mit Tschebyscheff-Approximation
Ansatz:
Bestmogliche Ausnutzung des Toleranzschemas
Numerische Optimierung der Positionen der Maxima und Minima:
“Remez-Exchange”, “Parks-McClellan”wp = 1/8;ws = 1/6;d1 = 0.05;d2 = 0.01;D = (.005309*log10(d1)*log10(d1)+.07114*log10(d1)-.4761)
*log10(d2)-.00266*log10(d1)*log10(d1)-.5941*log10(d1)-.4278;
n=ceil(2*D/(ws-wp));a=remez(n,[0 wp ws 1],[1 1 0 0],[1 d1/d2]);
Hier: L = n+ 1 = 7223
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Filter mit Tschebyscheff-Approximation
−0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
10 20 30 40 50 60 70
24
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Filter mit Tschebyscheff-Approximation
Pol-Nullstellendiagramm:
r=roots(a);zplane(r(2:n));
−1
−0.5
0
0.5
1
−1 −0.5 0 0.5 1
25
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Beispiel Filter mit Tschebyscheff-Approximation
−62.5
−62
−61.5
−61
−60.5
−60 Pass band (dB)
−130−120−110−100−90−80−70
−60Stop band (dB)
−1000
−800
−600
−400
−200
0
Frequency
Phase (degrees)
26
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation
Grundidee:
• Entwurf eines IIR-Filters Hp(z) mit bekanntem Verfahren
• Abbildung des Frequenzgangs durch Transformationder Frequenzvariablen
Transformation durch Substitution ζ = f(z) in Hp(ζ)
Bedingung: Einheitskreis muss auf sich selbst abgebildet werden!
|f(ejω)| != 1
f(z) muss der Ubertragungsfunktion einesAllpasses entsprechen
Neue Ubertragungsfunktion: H(z) = Hp (f(z))bzw. H(ejω) = Hp(ejg(ω)) mit g(ω) = arg
(f(ejω)
)27
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation
Realisierungsmoglichkeit:
Ersetzen jedes Verzogerungselements z−1 durch einen
stabilen Allpass A(z) =1
f(z)⇒ g(ω) = − arg
(A(ejω)
)Achtung:
In der Regel bei rekursiven Systemen nicht direkt anwendbarwegen verzogerungsfreier Schleifen!
Neue Ubertragungsfunktion muss berechnet undrealisiert werden
28
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel-Filter
Hp(z) =z
z − b⇒ |Hp(ejω)| =
1√1 + b2 − 2b cosω
mit b = 0, 9:
0
1
2
3
4
5
6
7
8
9
10
0 0.5 1 1.5 2 2.5 3ω
|Hp|
29
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel-Allpasse
1) A1(z) = −z−1 ⇒ g1(ω) = π + ω
0
1
2
3
4
5
6
7
8
9
10
0 0.5 1 1.5 2 2.5 3
|H|
ω
HpH1
30
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel-Allpasse
2) Allpass 1. Ordnung: A2(z) =−az + 1z − a
mit |a| < 1
⇒ g2(ω) = ω + 2 arctana sinω
1− a cosω
z−1
−a
a
X(z)
Y (z)
31
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel-Allpasse
0
0.5
1
1.5
2
2.5
3
3.5
0 0.5 1 1.5 2 2.5 3
g2(ω
)
ω
0.90.5
0−0.5−0.9
Verzerrung der Frequenzachse fur verschiedene Werte von a32
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
0
1
2
3
4
5
6
7
8
9
10
0 0.5 1 1.5 2 2.5 3
|H2|
ω
0.90.5
0−0.5−0.9
Resultierende Frequenzgange33
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
3) Allpass 2. Ordnung: A3(z) =ρ2z2 − 2ρ cosϕz + 1z2 − 2ρ cosϕz + ρ2
mit |ρ| < 1
0
1
2
3
4
5
6
7
0 0.5 1 1.5 2 2.5 3
g3(ω
)
ω
ϕ = π/2
0.90.80.7
34
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
g3(ω) = 2ω + 2 arctan2ρ sinϕ sinω − ρ2 sin 2ω
1− 2ρ cosϕ cosω + ρ2 cos 2ω
0
1
2
3
4
5
6
7
0 0.5 1 1.5 2 2.5 3
g3(ω
)
ω
ϕ = π/4
0.90.80.7
35
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
0
1
2
3
4
5
6
7
8
9
10
0 0.5 1 1.5 2 2.5 3
|H3|
ω
ϕ = π/2
0.90.80.7
36
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
0
1
2
3
4
5
6
7
8
9
10
0 0.5 1 1.5 2 2.5 3
|H3|
ω
ϕ = π/4
0.90.80.7
37
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
4) Allpass 2. Ordnung: A4(z) = −ρ2z2 − 2ρ cosϕz + 1z2 − 2ρ cosϕz + ρ2
mit |ρ| < 1
-4
-3
-2
-1
0
1
2
3
4
0 0.5 1 1.5 2 2.5 3
g4(ω
)
ω
ϕ = π/2
0.90.80.7
38
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
g4(ω) = −π + 2ω + 2 arctan2ρ sinϕ sinω − ρ2 sin 2ω
1− 2ρ cosϕ cosω + ρ2 cos 2ω
-4
-3
-2
-1
0
1
2
3
4
0 0.5 1 1.5 2 2.5 3
g4(ω
)
ω
ϕ = 3π/4
0.90.80.7
39
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
0
1
2
3
4
5
6
7
8
9
10
0 0.5 1 1.5 2 2.5 3
|H4|
ω
ϕ = π/2
0.90.80.7
40
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel
0
1
2
3
4
5
6
7
8
9
10
0 0.5 1 1.5 2 2.5 3
|H4|
ω
ϕ = 3π/4
0.90.80.7
41
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel Butterworth
0
0.2
0.4
0.6
0.8
1
0 0.5 1 1.5 2 2.5 3
|Hp|
ω
Betragsfrequenzgang Butterworthfilter Ordnung 1842
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel Butterworth
0
0.2
0.4
0.6
0.8
1
0 0.5 1 1.5 2 2.5 3
|H4|
ω
ϕ = π/2
0.90.50.1
Betragsfrequenzgang resultierender Bandpass
43
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation - Beispiel Butterworth
0
0.2
0.4
0.6
0.8
1
0 0.5 1 1.5 2 2.5 3
|H4|
ω
ϕ = 3π/4
0.90.50.1
Betragsfrequenzgang resultierender Bandpass
44
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11
Allpass-Transformation
Tiefpass-Bandpass-Transformation mit Allpass 2. Ordnung:
Vorgaben aus Toleranzschema:
• Eckfrequenzen
• Ubergangsbereichsbreiten
• max. Abweichung im Durchlassbereich
• Sperrdampfung(en)
Wahl geeigneter Parameter ρ, ϕ, ωcUbertragung in Toleranzschema fur Tiefpass-Entwurf
45
Bernd Edler ([email protected])Laboratorium fur InformationstechnologieDigSig - Teil 11