Signals - Systems-05 Filters and Experimental Techniques
Signals - Systems-05 Filters and Experimental Techniques
n y[n]
• A measured signal may represent various phenomena such
0 y[0]
as decay, growth, or oscillation. The general form of an
1 y[1]
exponential function is:
y[n]=Aαn
N y[ N ]
y[n]
• The goal of exponential curve fitting is to find the
parameters A and α that best fit to the data. This is done by
solving a set of equations.
n
• In the simples case, if we have y[0] and y[1] then the
solutions of equations will yield: n
y[1]
y[n] y[n] y[0]
y[0]
Answer
Assumed approximation: y n A n
It should satisfy the follow,ng equations:
n 0 18 A 0
Solution: A=18 and 10 / 18
n 0 10 A 1
y n 18 (10 / 18) n 18 0.5556 n
y[n] 18 0.5556n
LEAST SQUARES REGRESSION
It is used when the number of data points is greater
n y[n] yL [n] ln( y[n]) y[n] A n
than the order of the model.
0 y[0] yL [0]
yL [n] ln A n ln It is used to find a line or a polynomial that best
1 y[1] yL [1]
ln A a0 fits the observed data points by minimizing the
sum of the squared differences between the
ln a1 observed and predicted values.
N y[ N ] yL [ N ]
yL [n] a0 a1n
w[n]
yL [0] a0 1 0
yL [1] a0 a1 1 1
yL [0]
yL [2] a0 2a1 1 2 a0 yL [1]
yL [3] a0 3a1 1 3 a1
n
L
y [ N ]
yL [ N ] a0 Na1 1 N
a
A 0 YL
a1
a0 1 T
a ( A A) A YL
T
1
1 1 1 1 1
A
0 1 2 3 N
Question: An RC circuit is experimented by n y[n]
applying a unit step signal. The output is measured 0 25
at 4 different time instants as given in the table. Find 1 17
an exponential approximation for y[n]. 2 14
Answer:
3 8
1 0
1 1 4 6
A AT A
1 2 6 14
1 3
0.7 0.3 yL [n] 3.235 0.3612n
( AT A) 1
0.3 0.2
10.771
AT y
14.350
a0 1 T 3.235
a ( AT
A) A y 0.3612
1
y[n] 25.39 0.6968n
A e 25.39
a0
y[ n ] 25.39 0.6968 n
N=numel(yn);
A=zeros(N,2);
A(:,1)=1;
A(:,2)=[0:N-1];
x=(transpose(A)*A)^-1*transpose(A)*yL
M=exp(x(1));
alp=exp(x(2)); yL [n] 0.4349 0.4881n
n=[0:0.01:5];
ya=M*alp.^n
plot(n,ya,'r',[0:N-1],yn,'b*');
grid on;
1 2 P a0 a1 z 1 a2 z 2 ... aN z N
H ( z ) h[0] h[1]z h[2]z ... h[ P]z
1 b1 z 1 b2 z 2 ... bM z M
a0 a1 w a2 w2 ... aN w N
h[0] h[1]w h[2]w ... h[ P]w
2 P
1 b1 w b2 w2 ... bM wM
• The order M and N depend on factors such as the desired accuracy and the
behavior of the original function. They should be such that M+N=P
1 a a w 0.5
1 w w2 0 1
2 1 b1 w
Answer:
1 a a w
1 w w2 0 1
2 1 b1 w
1 2
1 w w 1 b1 w a0 a1 w
2
(1) w0 b1 1 w b1 12 w2 a0 a1 w
b1 12 0 b1 12
b1 1 a1 a1 1
2
a0 1 y[n]
x[n]
1 12 w
f pade ( w) δ[n-1]
1 12 w δ[n-1]
1 12 z 1 0.5 0.5
H pade ( z )
1 12 z 1
Graph of H(eiω) versus ω
Useful identities
ei cos i sin
ei e i
cos 1 2sin 2 ( / 2) 2 cos 2 ( / 2) 1
2
ei e i
sin 2sin( / 2) cos( / 2)
2i
20 log10 H (ei ) cos 2 12 12 cos 2
sin 2 12 12 cos 2
cos cos 12 cos( ) 12 cos( )
sin sin 12 cos( ) 12 cos( )
sin cos 12 sin( ) 12 sin( )
p s
A cos B sin A2 B 2 cos tan 1 (B /A)
Example: Plot the graph of H(eiω) x[n] y[n]
versus ω.
δ[n-1]
Answer:
H ( z ) 1 z 1
H (ei ) 1 e i e i / 2 ei / 2 e i / 2 2e i / 2 cos( / 2)
H (ei ) 2 cos( / 2)
H (ei )
2
2/ 2
1
0 π/2
1
Example: Plot the graph of H(eiω) δ[n+1]
versus ω. x[n] y[n]
2
δ[n-1]
Answer: 1
H ( z ) z 2 z 1
H (ei ) ei 2 e i 2 2 cos 4 cos 2 ( / 2)
H (ei )
4/ 2
0 π/2
Example: Plot the graph of H(eiω) x[n] y[n]
versus ω.
δ[n-1]
-1
Answer:
H ( z ) 1 z 1
H (ei ) 1 e i e i / 2 ei / 2 e i / 2 2ie i / 2 sin( / 2)
H (ei ) 2 sin( / 2)
H (ei )
2
2/ 2
0 π/2
-1
Example: Plot the graph of H(eiω) δ[n+1]
versus ω. x[n] y[n]
2
δ[n-1]
Answer: -1
H ( z ) z 2 z 1
H (ei ) ei 2 e i 2 2 cos 4sin 2 ( / 2)
H (ei )
4/ 2
0 π/2
DISRETE-TIME FILTERS
I) Low Pass Filter (LPF)
H (ei )
1
i
H (e ) h[n]e
n
in
2
1 1
i in
h[n] H ( e ) e d H (ei )ein d
2
2 0
c 0 c C is called the cut-off frequency
Answer:
/2
1 2 / 2 1 x h[n]
n 0 h[0]
2
/2
1e0 d
2
2 -3 -0.1061
/2 -2 0
1 sin(n / 2)
n 0 h[n]
2
/2
1ein d
n
-1 0.3183
0 0.5
1 1 0.3183
2 for n=0
h[n] 2 0
sin(n / 2) for n 0 3 -0.1061
n
Answer:
-0.1061x[n 3] 0.3183x[n 1] 0.5 x[n] 0.3183x[n 1]-0.1061x[n 3] y[n]
-0.1061
δ[n+2]
0.3183
δ[n+1]
x[n] y[n]
0.5
δ[n-1]
0.3183
δ[n-2]
-0.1061
H (ei )
18
Example: Find h[0] of the given filter in the graph.
Answer: h[0] 1 The area 1 18 1 2 2 4.5
π/6
2 2 2 6
0 π/3
-π/3 -π/6
3
II) High Pass Filter (HPF)
H (ei )
1
H (e ) i
h[n]e
n
in
2
1 1
H (e
i in i
h[n] H ( e ) e d )ein d
c 0 c 2
2 0
1 2 c
H (e )e d 2 1e d 1
i
Steps to be followed in h[0] 0 0
2
synthesis of systems c
1 2 1 sin(n ) sin(c n) sin( nc )
H (ei )ein d 1e
in
h[n] d 2
Step 1: Evaluate the integrals 2
2 c
2 n n
to find h[n]
H (ei ) h[2]ei 2 h[1]ei h[0]e0 h[1]e i h[2]e i 2
Step 2: Find H(z) c
1 for n=0
h[n]
Step 3: Determine the sin(nc ) for n 0
n
difference equation
Answer:
1 1
1e d 2
n 0 h[0] 2 0 x h[n]
2 /2 -3 0.1061
1 sin(n / 2) -2 0
1e
in
n 0 h[n] 2 d
2 /2
n -1 -0.3183
0 0.5
1
for n=0 1 -0.3183
2
h[n] 2 0
sin(n / 2) for n 0 3 0.1061
n
Answer:
0.1061x[n 3]-0.3183x[n 1] 0.5 x[n]-0.3183x[n 1]+0.1061x[n 3] y[n]
0.1061
δ[n+2]
-0.3183
δ[n+1]
x[n] y[n]
0.5
δ[n-1]
-0.3183
δ[n-2]
0.1061
III) Band Pass Filter (BPF)
H (ei )
1 H (e ) i
h[n]e
n
in
2
1 1
i in
h[n] H ( e ) e d H (ei )ein d
C 2 C1 0 C1 C 2
2 2 0
Steps to be followed in 1 2(C 2 C1 ) C 2 C1
synthesis of systems
h[0]
2
H (ei )d
2
1 sin(nC 2 ) sin(nC1 )
Step 1: Evaluate the integrals h[n]
2
H (ei )d
n
to find h[n]
Step 2: Find H(z) H (ei ) h[2]ei 2 h[1]ei h[0]e 0 h[1]e i h[2]e i 2
C 2 C1
Step 3: Determine the for n=0
h[n]
difference equation
sin(nC 2 ) sin(nC1 ) for n 0
n
Step 4: Implement the system
by drawing a block digram Area
Property: h[0]
2
%% Symbolic integration
% Integrals may be evaluated
% by using int command
clear;clc;
syms w H n;
H=3*exp(-2*i*w)+4*cos(3*w); fft
int(H*exp(i*w*n),w,-pi,pi)
Time DTFT
%% Fast Fourier Transform command
signal signal
% The function H in the graph can be
% transformed into h[n] directly
% by using fft
ifft
clear;clc;
H=[3,5,1].';
h=ifft(H)
H=fft(h)
%%Numerical integration
% Trapezoidal rule may be used for this.
clear;clc;
a=-pi; Trapezoidal rule:
b=+pi; ba
K=20; h
h=(b-a)/K; K
w=a+[0:K]*h; k a kh
n=3; f ( ) H (ei )ei n
f=(3*exp(-2*i*w)+4*cos(3*w)).*exp(i*w*n);
b K 1
hn=h/2*f(1)+h/2*f(K+1)+h*sum(f(2:K-1)); h h
hn f ( )d f (0 ) f (K ) h f (k )
a
2 2 k 1
Usage of FFT in the filter design
n=[-N:N];w=n*pi/N;
He=heaviside(w+wc)-heaviside(w-wc);
h=iDTFT(He);h(abs(n)>7)=0;
Ha=DTFT(h);
subplot(2,1,1);
plot(w,abs(He),'r',w,abs(Ha),'k','linewidth',2);
xlim([-1 1]*pi);ylim([0 1]*1.2);
grid on;title('H(e^{iw})');
subplot(2,1,2);
bar(n,real(h),'b','barwidth',0.2);
xlim([-1 1]*N/2);ylim([-.1 0.4]);
grid on;title('h[n]');
III) Band Stop Filter (BSF)
H (ei )
1
i
H (e ) h[n]e
n
in
2
1 1
i in
h[n] H ( e ) e d H (ei )ein d
C 2 C1 0 C1 C 2
2 2 0
1 C1 C 2
Steps to be followed in h[0]
2
H (ei )d
synthesis of systems
C 1
1 1
in
h[n] 2e d 2ein d
Step 1: Evaluate the integrals 2 0
2 C 2
to find h[n]
1
H ( )
1 j L / R
1 1
H ( ) H ( )
1 j RC 1 j RC
| |
ANALOG HIGH PASS FILTERS (HPF)
1 1
H ( ) H ( )
1 j / ( RC ) 1 jR / ( L)
| |
ANALOG BAND PASS FILTERS (BPF)
1
1 H ( )
H ( ) 1
j 1 1 jR C
1 L L
R C
ANALOG BAND STOP FILTERS (BSF)
1
H ( ) 1
1 H ( )
1 jR / L j 1
C 1 / C
R L