# OpenStax_CNX

You are here: Home » Content » Linear-Phase FIR Filters: Amplitude Formulas

### Recently Viewed

This feature requires Javascript to be enabled.

# Linear-Phase FIR Filters: Amplitude Formulas

Module by: Ivan Selesnick. E-mail the author

Summary: (Blank Abstract)

Note: You are viewing an old version of this document. The latest version is available here.

## SUMMARY: AMPLITUDE FORMULAS

Table 1
Type θω θ ω Aω A ω
I (Mω) M ω hM+2n=0M1hncos(Mn)ω h M 2 n 0 M 1 h n M n ω
II (Mω) M ω 2n=0N21hncos(Mn)ω 2 n 0 N 2 1 h n M n ω
III (Mω)+π2 M ω 2 2n=0M1hnsin(Mn)ω 2 n 0 M 1 h n M n ω
IV (Mω)+π2 M ω 2 2n=0N21hnsin(Mn)ω 2 n 0 N 2 1 h n M n ω

where M=N12 M N 1 2

## AMPLITUDE RESPONSE CHARACTERISTICS

To analyze or design linear-phase FIR filters, we need to know the characteristics of the amplitude response Aω A ω .

Table 2
Type Properties
I Aω A ω is even about ω=0 ω 0 Aω=Aω A ω A ω
Aω A ω is even about ω=π ω Aπ+ω=Aπω A ω A ω
Aω A ω is periodic with 2π 2 Aω+2π=Aω A ω 2 A ω
II Aω A ω is even about ω=0 ω 0 Aω=Aω A ω A ω
Aω A ω is odd about ω=π ω Aπ+ω=Aπω A ω A ω
Aω A ω is periodic with 4π 4 Aω+4π=Aω A ω 4 A ω
III Aω A ω is odd about ω=0 ω 0 Aω=Aω A ω A ω
Aω A ω is odd about ω=π ω Aπ+ω=Aπω A ω A ω
Aω A ω is periodic with 2π 2 Aω+2π=Aω A ω 2 A ω
IV Aω A ω is odd about ω=0 ω 0 Aω=Aω A ω A ω
Aω A ω is even about ω=π ω Aπ+ω=Aπω A ω A ω
Aω A ω is periodic with 4π 4 Aω+4π=Aω A ω 4 A ω

## EVALUATING THE AMPLITUDE RESPONSE

The frequency response H f ω H f ω of an FIR filter can be evaluated at LL equally spaced frequencies between 0 and π using the DFT. Consider a causal FIR filter with an impulse response hn h n of length-NN, with NL N L . Samples of the frequency response of the filter can be written as H2πLk=n=0N1hne(i)2πLnk H 2 L k n 0 N 1 h n 2 L n k Define the LL-point signal gn 0nL1 g n 0 n L 1 as gn={hn  if  0nN10  if  NnL1 g n h n 0 n N 1 0 N n L 1 Then H2πLk=Gk= DFT L gn H 2 L k G k DFT L g n where Gk G k is the LL-point DFT of gn g n .

### Types I and II

Suppose the FIR filter hn h n is either a Type I or a Type II FIR filter. Then we have from above H f ω=Aωe(i)Mω H f ω A ω M ω or Aω= H f ωeiMω A ω H f ω M ω Samples of the real-valued amplitude Aω A ω can be obtained from samples of the function H f ω H f ω as: A2πLk=H2πLkeiM2πLk=Gk W L M k A 2 L k H 2 L k M 2 L k G k W L M k Therefore, the samples of the real-valued amplitude function can be obtained by zero-padding hn h n , taking the DFT, and multiplying by the complex exponential. This can be written as:

A2πLk= DFT L hn 0 L - N W L M k A 2 L k DFT L h n 0 L - N W L M k
(1)

### Types III and IV

For Type III and Type IV FIR filters, we have H f ω=ie(i)MωAω H f ω M ω A ω or Aω=(i) H f ωeiMω A ω H f ω M ω Therefore, samples of the real-valued amplitude Aω A ω can be obtained from samples of the function H f ω H f ω as: A2πLk=(i)H2πLkeiM2πLk=(i)Gk W L M k A 2 L k H 2 L k M 2 L k G k W L M k Therefore, the samples of the real-valued amplitude function can be obtained by zero-padding hn h n , taking the DFT, and multiplying by the complex exponential.

A2πLk=(i) DFT L hn 0 L - N W L M k A 2 L k DFT L h n 0 L - N W L M k
(2)

### Example 1: EVALUATING THE AMP RESP (TYPE I)

In this example, the filter is a Type I FIR filter of length 7. An accurate plot of Aω A ω can be obtained with zero padding.

The following Matlab code fragment for the plot of Aω A ω for a Type I FIR filter.


h = [3 4 5 6 5 4 3]/30;
N = 7;
M = (N-1)/2;
L = 512;
H = fft([h zeros(1,L-N)]);
k = 0:L-1;
W = exp(j*2*pi/L);
A = H .* W.^(M*k);
A = real(A);

figure(1)
w = [0:L-1]*2*pi/(L-1);
subplot(2,1,1)
plot(w/pi,abs(H))
ylabel('|H(\omega)| = |A(\omega)|')
xlabel('\omega/\pi')
subplot(2,1,2)
plot(w/pi,A)
ylabel('A(\omega)')
xlabel('\omega/\pi')
print -deps type1


The command A = real(A) removes the imaginary part which is equal to zero to within computer precision. Without this command, Matlab takes A to be a complex vector and the following plot command will not be right.

Observe the symmetry of Aω A ω due to hn h n being real-valued. Because of this symmetry, Aω A ω is usually plotted for 0ωπ 0 ω only.

### Example 2: EVALUATING THE AMP RESP (TYPE II)

The following Matlab code fragment produces a plot of Aω A ω for a Type II FIR filter.


h = [3 5 6 7 7 6 5 3]/42;
N = 8;
M = (N-1)/2;
L = 512;
H = fft([h zeros(1,L-N)]);
k = 0:L-1;
W = exp(j*2*pi/L);
A = H .* W.^(M*k);
A = real(A);

figure(1)
w = [0:L-1]*2*pi/(L-1);
subplot(2,1,1)
plot(w/pi,abs(H))
ylabel('|H(\omega)| = |A(\omega)|')
xlabel('\omega/\pi')
subplot(2,1,2)
plot(w/pi,A)
ylabel('A(\omega)')
xlabel('\omega/\pi')
print -deps type2


The imaginary part of the amplitude is zero. Notice that Aπ=0 A 0 . In fact this will always be the case for a Type II FIR filter.

An exercise for the student: Describe how to obtain samples of Aω A ω for Type III and Type IV FIR filters. Modify the Matlab code above for these types. Do you notice that Aω=0 A ω 0 always for special values of ωω?

## Content actions

### Give feedback:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks