Download - ΕΠΕΞΕΡΓΑΣΙΑ ΣΗΜΑΤΩΝ ΝΙΚ. Α. ΤΣΟΛΙΓΚΑΣ ΕΙΣΑΓΩΓΗ ΣΤΑ ΦΙΛΤΡΑ

Transcript

Slide 1

. .

MATLAB

: ? . R, C- Matlab. (Butterworth, Chebyshev , Bessel) . FIR .0 FIR .MATLAB Butterworth IIR ?

: (-): (R) (L) (C) : . ( PC DSP chip ?

: . . . . :

. . . .

f2 : .

. : : : : .

:

: .

Notch :

RCVIVO+_+_

.

0 dB101/RC1/RCBodeLinear Plot.-3 dBx0.707 . . . cutoff frequency. 0.707 .

( ohm) (R) (C) .

For x = 1 (f = fo) we have:

.

VO+_CRVi_+

0 dB..-3 dB01/RC1/RC1/RC10.707BodeLinear x

:

x = 1 (f = fo) we have:

, x >> 1, :

, f x 1, x1, x>1

: L.P, H.P, B.P, B.R R,L,C .: Butterworth, Chebyshev, Bessel. ( ( )

1. Butterworth : . -20db/decade.2. Chebyshev: -20db/decade 3. Bessel: L.P, H.P, B.P, B.R R,L,C .: Butterworth, Chebyshev, Bessel. ( ( ).

DF : Butterworth, Chebyshev R1, R2

f:

C1= C2= R3= R4(1/(2*pi*C1*f)R1=R2=20*R3Cin=Cout=100 to 1000 *C1..

.

(LTI): : . , . : , , ,

x(t) x(n) .K y(t) y(n) . =[-] y(t) = H[x(t)]

(LTI): :: .

: to

(n) x[n] = [n]. : h[n] : h[n] = H[(n)]H h[n] . :

h[n] x[n] y[n] :

y[n]=x[n]*h[n]*

matlab code x1=input('Enter the first sequence e.g x1(n) = [1 2 6 2 3 1 4] x1(n) = ');t1=input('Enter the starting time of first sequence e.g t1 = -3 t1 = ');x2=input('Enter the second sequence e.g x2(n) = [3 1 4 5 2] x2(n) = ');t2=input('Enter the starting time of second sequence e.g t2 = -1 t2 = ');l1=length(x1);l2=length(x2);ln=l1+l2-1; yn=conv(x1,x2); a=t1+l1-1;t=t1:a;subplot(311);stem(t,x1);grid on;xlabel('time--->');ylabel('amplitude--->');title('First sequence'); a=t2+l2-1;t=t2:a;subplot(312);stem(t,x2);grid on;xlabel('time--->');ylabel('amplitude--->');title'Second sequence'); tn=t1+t2;a=tn+ln-1;t=tn:a;subplot(313);stem(t,yn);grid on;xlabel('time--->');ylabel('amplitude--->');title('Convolved output');

LTI :

h(t) :

H(j) . :

:

. PC chip .

: . , , / workstations. ( ). .

-1. : y(n) = x(n)2. y(n) = Kx(n)3. y(n) = x(n-1)4. - y(n) = x(n)-x(n-1)5. - y(n) = 0.5(x(n)+x(n-1))6. -(3-point moving average filter) y(n) = 1/3[x(n)+x(n-1)+x(n-2)]7. . ilter y(n) = 1/2[ x(n) x(n-2)]: . . . x(n), x(n-1),.. Etc :

: : . : . FIR and IIR . : lowpass, highpass, bandpass and bandstop filters.

- . :: . . : T , (z) h(n). chip H/Y.

- . : . FIR . IRR () . :

- O |H(ejw)|. FIR . FIR R decibels (dB), :

- :

-

- : [0,wp] , and delta p . [ws,pi] delta s [wp, ws] .

- (DB) :

FIR

FIR (Finite Impulse Response). .. FIR :

: y(n) n. bk x(nk) k . M (taps) FIR .: FIR . .1. (delay line) x(n) 2. y(n) 3. b(k) FIR :

. .

x1(n)+x2(n)+x1(n)x2(n)x(n)a x(n)a z-1x(n)x(n-1)

FIR FIR (delay line) x(n), b(k).

(n) : Delay = ( x Taps)/Sampling rate. . , 300 48KHz 3.125 ms [(0.5 x 300)/48 = 3.125 milli-seconds].

. . FIR - ( Equiripple). :

: BartlettHanningHammingBlackmanKaiser

MATLABMATLAB fdatoolMATLAB sptool

M files o web-siteHelp fir1Help filter

:

RC Low Pass Filter with Cutoff 200HzR=1000; C=0.00001/2;w=0:0.01:5000;a=sqrt(1+(w*R*C).^2);b=1./a;

plot(w,abs(b))title('Low Pass Filter')xlabel('Frequency')ylabel('Magnitude')

RC High Pass Filter with Cutoff 200HzR=1000; C=0.00001/2;w=0:0.01:5000;a=sqrt(1+(w*R*C).^2);b=(w*R*C)./a;

plot(w,abs(b))title('High Pass Filter')xlabel('Frequency')ylabel('Magnitude')

Comparison of Low Pass & High PassR=1000; C=0.00001/2;1/(R*C)w=0:0.01:5000;a=sqrt(1+(w*R*C).^2);b=1./a;subplot(211)plot(w,abs(b))title('Low Pass Filter')xlabel('Frequency')ylabel('Magnitude')

b=(w*R*C)./a;subplot(212)plot(w,abs(b))title('High Pass Filter')xlabel('Frequency')ylabel('Magnitude')ylim([0 1.1])

Digital Filters and its typesIIR FiltersFIR Filtersdifficult to control, no particular

techniques available can be unstable, less

derived from analog filters

linear phase always possible

always stable, more

no analog history

Phase

Stability

Order

History

FIR Low Pass Filter with Cutoff 1200Hzfs=8000; % sampling frequencyn=50; % order of the filterw=1200/ (fs/2);b=fir1(n,w,'low'); % Zeros of the filterfreqz(b,1,128,8000figure(2)

[h,w]=freqz(b,1,128,8000);plot(w,abs(h));

FIR High Pass Filter with Cutoff 1200Hzfs=8000;n=50;w=1200/ (fs/2);b=fir1(n,w,'high');freqz(b,1,128,8000);figure(2)[h,w]=freqz(b,1,128,8000)plot(w,abs(h));

FIR Band Pass Filter with Pass Band 1200--1800Hzfs=8000;n=40;

b=fir1(n,[1200/4000 1800/4000],'bandpass');

freqz(b,1,128,8000)

figure(2)[h,w]=freqz(b,1,128,8000);plot(w,abs(h));

Butterworth IIR Low Pass Filterfs=8000;[n,w]=buttord(1200/4000,1500/4000,1,50); % finding the order of the filter

[b,a]=butter(n,w); % finding zeros and poles for filter

figure(1)freqz(b,a,512,8000);figure(2)[h,q] = freqz(b,a,512,8000);plot(q,abs(h));

SummaryFilters and their basic TypesAnalog FiltersMATLAB implementation of RC Low Pass and High Pass Filters Digital Filters and their typesMATLAB implementation of FIR Low Pass, High Pass and Band Pass FilterMATLAB implementation of Butterworth IIR Low Pass Filter

R1

4

1

3

R2

2

Uin

C2

Uot

C1