실험 8. Digital Filter Design 1 전자공학과

실험 8. Digital Filter Design
전자공학과
1
Sampling
: impulse train
Conversion of impulse
train to discrete-time
sequence
0
0
2
3
∴
0
1
0 1
2
2
3
3
전자공학과
•
•
•
•
•
2
Continuous-time signal :
Sampling period(interval):
Sampling frequency(rate):
Angular sampling frequency:
Sampled signal
|
1/
2
FT of
and Discrete-time FT (DTFT)
• DTFT of
→ Fouriertransform
∴
|
At
:discrete‐timefrequency
2
s,
DTFT of
,
|
(
은
1/
와 동일한 주기 함수. 주기는 2 )
0
2
2
DTFT
1/
Inverse DTFT
1
2
2
전자공학과
3
0
2
4
(skip) Discrete Fourier Transform (DFT)Lab10
•
Spectrum of the signal : CTFT
 1) time is infinite and continuous. 2) frequency is continuous
for very short
• FT of sampled signal (time sampling) (approximation
)
2) Finite samples :
∞
∴
1)
∞ → 0
1
1
 DTFT
: continuous  we like to compute the spectrum at finite frequencies
(
∴
equally spaced frequencies)
1
 Discrete Fourier Transform(DFT)
전자공학과
Discrete
time
4
Discrete
frequency
DFT,
Continuous
frequency
DTFT,
Continuous
time
Fourier series,
CTFT,
(skip) Relationship between DTFT and
DFTLab10
•
DTFT
•
DTFT of finite-length sequence
•
DFT is obtained from DTFT by evaluating at a discrete set of equally spaced
frequencies
, for
0,1, ⋯ ,
1.
전자공학과
5
Filter : moving average
• Discrete-time system : 7-point moving average
1
7
1
7
 “filtering”. Ex)
1.02
전자공학과
1
cos
⋯
,5
0, otherwise
6
6
45
Impulse response
• Weighted moving average (filter,
length)
• Impulse response
= filter order,
: output for unit impulse input

0for
0andfor
Impulse Response
 length of
 Convolution sum
∗
전자공학과
1 = filter
7
is finite  Finite
Frequency response
• Frequency response of 7-point moving average system
1
7
Normalized frequency
1
(
/2
전자공학과
8
Digital filter
|
• Filter : frequency response
– Magnitude vs. frequency (LPF, BPF, HPF, …)
– Phase vs. frequency
|
phase
• FIR filter
– Linear phase, Stable, Can be realized efficiently in hardware
– Require much higher filter order than IIR filter to achieve a given level
of performance
• IIR filter
– Meet a given set of specifications with a much lower filter order than
a corresponding IIR filter
–
–
feedback 이 있음. 즉, filter의 이전 출력을 현재 출력 계산에 이용
Nonlinear phase (Usually, the entire data sequence is available prior to filtering. This
allows for a noncausal, zero-phase filtering approach (via the filtfilt function), which
eliminates the nonlinear phase distortion of an IIR filter.)
전자공학과
9
Ideal low pass filter
• Ideal low pass filter
• Inverse DFT
1
2
1
2
1
∴
1
2
0
sin
DTFT
Inverse DTFT
1
2
Zero phase response
Non-casual system
Infinite duration
전자공학과
10
Windowing
• To make it causal, the impulse response is shifted after being
truncated.
 Windowing (rectangular window, hamming window)
 shifting : linear phase/constant group delay
전자공학과
11
Effect of windowing
•
•
•
0.5 ∗ sinc 0.5 , 1000
1000
0.5 ∗ sinc 0.5 , 20
20
:
에 길이 41인 hamming window를 곱한 신호
 fir1 function in Matlab
Frequency response (magnitude)
전자공학과
12
Effect of windowing
전자공학과
13
(skip) FIR filter in Matlab
• fir1
• Ideal LPF에 hamming widowing  ringing을 줄임
• n = 50; Wn = 0.4; b = fir1(n,Wn);
create row vector b containing the coefficients of the order n Hammingwindowed filter. This is a lowpass, linear phase FIR filter with cutoff
frequency Wn. Wn is a number between 0 and 1, where 1 corresponds
to the Nyquist frequency, half the sampling frequency. (Unlike other
methods, here Wn corresponds to the 6 dB point.) For a highpass filter,
simply append the string 'high' to the function's parameter list. For a
bandpass or bandstop filter, specify Wn as a two-element vector
containing the passband edge frequencies; append the string 'stop' for
the bandstop configuration.
b2=fir1(50,[0.2 0.4])
전자공학과
14
Digital Filter Design with Matlab
• fir1
• fdatool
– Refer to the supplement titled as “lab8_supp_filter_design_matlab.ppt”
전자공학과
15
예비 보고서
• 아래의 Matlab function을 조사하시오.
• conv(), freqz(), filter(), fvtool()
• sinc(), hamming(), fir1()
• 강의자료에서 Matlab으로 그린 그래프를 그리시오.
(예비보고서에 각 그래프의 matlab 코드 포함)
전자공학과
16
실험 1
• 다음의 filter를 제작하시오. Filter 제작이 잘 되었는지 frequency
response를 그려서 확인하시오.
– LPF : 0 ~ 1 kHz
– BPF : 1 ~ 2 kHz
• ‘She’곡의 10초 가량을 Load하시오. Load한 곡을 1000 Hz 간격으로
0 Hz~5kHz 주파수 대역을 분리해서 곡을 제작하고 각 주파수 대역
의 주파수 특성 및 음향학적 특성을 분석하시오. 즉, 0 ~ 1 KHz, 1 ~
2 kHz, 2 ~ 3 kHz, 3 ~ 4 kHz, 4~ 5 kHz의 주파수 성분을 분리해내
어 소리를 들어보고 spectrogram을 그려보시오. 어떠한 특성이 있는
지 기술하시오. (디지털 필터 이용)
전자공학과
17
실험 2
• Lab 7의 두 번째 실험에서 제작한 작은별 곡(2, 3, 4차 하모닉 성분
포함)으로부터, 기저대역 (fundamental), 2차 하모닉, 3차 하모닉, 4차
하모닉 성분만으로 된 4개의 곡을 제작하시오 (디지털 필터 설계). 제
작한 각각의 곡의 주파수 특성을 분석하시오
전자공학과
18
실험 3
• 설계2에서 제작된 기저대역, 2차, 3차, 4차 하모닉 성분들을 합성하
여 곡을 제작하시오. 이때 각 주파수 대역의 성분들을 합성하는 비율
을 다르게 하면서 합성된 곡의 주파수 특성 및 음향학적 특성을 분석
하시오.
전자공학과
19