0% found this document useful (0 votes)
9 views28 pages

Signals - Systems-05 Filters and Experimental Techniques

Uploaded by

glllsnn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views28 pages

Signals - Systems-05 Filters and Experimental Techniques

Uploaded by

glllsnn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

EXPONENTIAL CURVE FITTING TO AN OUTPUT SIGNAL

• Exponential curve fitting is a powerful tool in signals and


systems analysis for extracting meaningful information
from measurements or any available data.

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] 

• Once the exponential curve is fitted to the data, it can be


n
used for finding H(z) and the drawing a block diagram.
Question: An RC circuit is experimented by applying
a unit step signal. The measured values are as follows:
y[0]=18
y[1]=10
Find an exponential approximation for y[n].

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

  e a1  0.6968 n y[n] Appr.


0 25 25.39
1 17 17.69
2 14 12.33
3 8 8.592
Question: The impulse response of a system is recorded as given in n y[n]
the table. Find an exponential approximation for y[n]. 0 0.7
1 0.9
Answer: 2 1.8
3 3.0
1 0
1 1 
4 4.4
  5 10 
A  1 2   AT A   
  10 30 
1 3
1 4 
yL [n]  0.4349  0.4881n
 0.6 0.2 
( AT A) 1   
 0.2 0.1 
 2.706 
AT y   
10.293
 a0  1 T  0.4349 
a   ( AT
A) A y   0.4881 
 1  
y[n]  0.6473  1.6291n
A  e a0  0.6473 n y[n] Appr.
 y[ n ]  0.6473  1.6291n

  e a1  1.6291  0 0.7 0.6473


1 0.9 1.0546
2 1.8 1.7181
3 3.0 2.7990
4 4.4 4.5599
Computer code:
clear;clc;
yn=[0.7,0.9,1.8,3.0,4.4].';
yL=log(yn);

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;

y[n]  0.6473  1.6291n


n y[n] Appr.
0 0.7 0.6473
1 0.9 1.0546
2 1.8 1.7181
3 3.0 2.7990
4 4.4 4.5599
PADE APPROXIMATION TO A TRANSFER FUNCTION
(an advanced method)

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

• Pade uses rational functions to approximate a polynomial of H(z) via a ratio


of two polynomials.

• 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

• Calculation of an and bn is done by solving a system of equations derived


from matching the Taylor series expansions of the original function and the
rational function.

• Pade approximation has numerous applications in various fields such as


control theory, signal processing, computational physics and
electromagnetics.
x[n] y[n]
Example: The transfer function of a system 
is given by 1 1 2 1
H ( z)  1  z  z  1  w  w2 δ[n-1]
2 2
Determine the unknown coefficents in the
following form of Pade approximation: δ[n-1]

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 ω

asd h[n]  H (ei )  H (ei )  H (ei )  20 log10 H (ei )

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

Steps to be followed in synthesis of  c


1 1 c Area
 H (e )e d  2  1e d  
i
systems h[0]  0 0

2  c
2
 c c
Step 1: Evaluate the integrals to find 1 1 ein sin(n )
 H (e )e d  2  1e d  2 in   n c
i in in
h[n] 
h[n] 2 c  c

Step 2: Find H(z)


H (ei )   h[2]ei 2  h[1]ei  h[0]e0  h[1]e i  h[2]e i 2 
Step 3: Determine the difference  c
  for n=0
equation h[n]  
 sin(nc ) for n  0
  n
Step 4: Implement the system by
Area
drawing a block digram Property: h[0] 
2
Example: Determine h[n] of a LPF by calculating for -4<n<4

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

H ( z )  -0.1061z 3  0.3183z  0.5  0.3183z 1 -0.1061z 3


Example: Draw the block diagram of the given system.
H ( z )  -0.1061z 3  0.3183z  0.5  0.3183z 1 -0.1061z 3

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( nc )
 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(nc ) for n  0
  n
difference equation

Step 4: Implement the system


by drawing a block digram
Property: H HPF  1  H LPF
H (ei )
18 Example: Find h[0] of the given filter in the graph.

 -π/3 -π/6 0 π/6 π/3  


Answer:
1
h[0]  The area
2
1 1    1 1
 2  18  18   18     4.5
2  2 6 6 12 6 
Example: Determine h[n] of a HPF by calculating for -4<n<4

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

H ( z )  0.1061z 3  0.3183z  0.5  0.3183z 1 +0.1061z 3


Example: Draw the block diagram of the given system.
H ( z )  0.1061z 3 -0.3183z  0.5-0.3183z 1 +0.1061z 3

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(nC 2 )  sin(nC1 )
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(nC 2 )  sin(nC1 ) 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; ba
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

Example: Using π/3 as the cut-off frequency, design an LPF.


clear;clc;format short;
DTFT=@(h)ifftshift(fft(ifftshift(h)));
iDTFT=@(H)fftshift(ifft(fftshift(H)));
N=20;
wc=pi/3;

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]

Step 2: Find H(z)

Step 3: Determine the


difference equation

Step 4: Implement the system


by drawing a block digram
ANALOG LOW PASS FILTERS (LPF)

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 

You might also like