Você está na página 1de 17

Filter Design Assignment 2016-17

EE 338: Digital Signal Processing


OV Shashank 14D070021; Filter Number: 94

BANDPASS FILTER DESIGN


Filter Design Specifications

1-1

- s/2 - s2 - p2 - p1 - s1 0 s1 p1 p2 s2 s/2

We have the filter magnitude response to be designed as shown above periodic with period 2 with
an equiripple passband and a monotonic stopband where the symbols are as follows

Symbol Meaning (Discrete Filter) Value Normalised Values


1 First Stopband Frequency 219.7 / 0.884
1 Passband Start Frequency 220.7 / 0.93
2 Passband End Frequency 225.7 / 1.153
2 Second Stopband Frequency 226.7 / 1.2
Sampling Frequency 2140 / 2
2 Stopband Tolerance 0.1
1 Passband Tolerance 0.1
The angular frequencies have been normalised with respect to the half of the sampling frequency to
obtain the discrete domain filter magnitude specification as shown in the table above and let them be
represented by .

Analog Bandpass Filter Specifications


Now using the following bilinear transform

1 1
=
1 + 1
to go from the discrete domain to the corresponding analog domain that is from the || = 1 circle to
the imaginary axis in the s domain we have the analog domain filter specifications as follows (we
continue to use the notation A to represent the analog domain filter)

Symbol Meaning (Analog Filter) Value


1 First Stopband Frequency 0.473 /
1 Passband Start Frequency 0.5 /
2 Passband End Frequency 0.65 /
2 Second Stopband Frequency 0.68 /
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Lowpass Analog Filter Specifications


Now to get this filter specification into the Low Pass form we do the following transformation

20 + s 2
s =
s
In the above transformation, we choose positive constants 20 and as follows

20 = 1 2 = 0.3259; = 2 1 = 0.1494

Hence for the low pass filter we have the transformation leading to the following frequencies

Symbol Meaning Value


Passband Edge 1
2
2 20 20 1
2
Stopband Edge min { , } = 1.38
2 1

Chebyshev Filter Design


Now because the design specification requires us to get an equiripple passband we must design a
Chebyshev Filter with a transfer function of the form
1
() () =
s
1 + 2 2 ( )

Where is an arbitrary constant which will be fixed based on the specifications and () are the
Chebyshev polynomials such that, () = cos( cos 1 ).
Now we solve to for N and to meet the filter specifications. First, we apply the restriction on the
passband edge as follows to obtain
2 1 1 1
| (Lp )| (1 1 )2 (1 1 )2 2 1= 1
1 + 2 2 (1) (1 1 )2 0.92

= 0.484
Now to get value of N we have

1
21
1 2
2
| (Ls )| 22 22 cosh ( 1 )

1 + 2 2 ( )

1
1
22
cosh1
= 4.7795 = 5

cosh1

Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Now we can calculate the poles of the give magnitude square function after having performed the
analytic continuation as follows


1 + 2 2 ( ) = 0 ( )=

Let be the roots of the above equation and the poles of the magnitude squared function and let

cos 1 = + cos( + ) =


cos cosh sin sinh = cos cosh = 0 = (2 1)
2
This is because hyperbolic cosine can never be 0 and we also have
1
1 1 sinh1
sin sinh = sinh = =

Therefore, we get the Chebyshev poles as follows
= (cos cosh sin sinh ) = sin sinh + cos cosh

We get the poles from the MATLAB code as follows

0.2417 + 0.6134 0.2417 + 0.6134


0.2417 0.6134 0.2417 0.6134
0.2987 0.2987
0.09231 + 0.9926 0.09231 0.9926
0.09231 0.9926 0.09231 + 0.9926
And then can be visualised as
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

From the obtained set of poles, we only take the ones which lie on the left half plane to design a stable
filter. Hence, we have the transfer function as follows
0
() =
( 1 )( )( 5 )
We calculate the 0 as
5

(0) = 1 0 = = 0.129
=1

The transfer function is as follows


0.129
() =
5 + 0.9667 4 + 1.7172 3 + 1.0139 2 + 0.5995 + 0.129
The magnitude response and phase response of the above obtained filter is as follows
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Analog Bandpass Filter


Now we obtain the two reverse transformations, first to get the analog band pass filter and then finally
the digital filter using the bilinear transformation.

Firstly, we replace as follows

20 + 2
=

To obtain a transfer function with 10 poles and 5 zeroes (all at 0). We can find the poles and they are

0.007783 0.007783 0.6498 0.6498


0.0195 0.0195 0.6183 0.6183
0.02231 0.02231 0.5705 0.5705
0.01661 0.01661 0.5266 0.5266
0.006007 0.006007 0.5015 0.5015
And we can plot the transfer function as follows
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Digital Bandpass Filter


Now we apply the bilinear transformation as used before to finally get the desired Digital IIR Filter as
follows

(0) + (1) 1 + ()
() =
(0) + (1) 1 + ()
Where = = 10 and the coefficients as follows

[] []
0 2.07106 1
1 0 4.942
2 1.035105 14.51
3 0 28.44
4 2.07105 41.73
5 0 46.31
6 2.07105 39.96
7 0 26.08
8 1.035105 12.74
9 0 4.155
10 2.07106 0.805
On plotting the above digital IIR Filter using MATLAB and the freqz function we have the following
magnitude response which perfectly matches the given filter specifications.
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Direct Form II Realization


The coefficient values of the direct form II
representation are as in the table above
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

FIR Filter Design


The FIR filter design used here is the method of windowing using the Kaiser window.
Given the specifications as in the Filter Design Specifications we have the normalized cut-off
frequencies of the corresponding ideal bandpass filter as follows

1 0.907
2 1.176
And given the tolerance and the normalized transition bands we have the Kaiser Window
specifications as follows.

= 20 = 0
= 0.045
2 + 1 = 121
The ideal bandpass filter has an impulse response of the form
1 2 1
[] = (sin(c2 ) sin(1 )) 0 = 0

And after applying the obtained window and shifting the sequence by 60 samples to obtain a causal
filter we have the FIR coefficients as follows

[] [] [] [] [] []
0 0.00969 20 0.0086 40 0.0054 60 0.0857 80 0.0054 100 0.0086
1 0.00182 21 0.0136 41 0.0110 61 0.0432 81 0.0093 101 0.0029
2 0.00839 22 0.0045 42 0.0231 62 0.0415 82 0.0031 102 0.0086
3 0.01036 23 0.0112 43 0.0116 63 0.0834 83 0.0005 103 0.0049
4 0.00203 24 0.0171 44 0.0193 64 0.0425 84 0.0024 104 0.0013
5 0.00785 25 0.0056 45 0.0381 65 0.0376 85 0.0035 105 0.0030
6 0.00933 26 0.0123 46 0.0184 66 0.0766 86 0.0031 106 0.0009
7 0.00185 27 0.0182 47 0.0273 67 0.0394 87 0.0110 107 0.0001
8 0.00597 28 0.0060 48 0.0529 68 0.0321 88 0.0085 108 0.0023
9 0.00656 29 0.0115 49 0.0255 69 0.0661 89 0.0052 109 0.0029
10 0.00123 30 0.0163 50 0.0342 70 0.0342 90 0.0163 110 0.0012
11 0.00293 31 0.0052 51 0.0661 71 0.0255 91 0.0115 111 0.0066
12 0.00227 32 0.0085 52 0.0321 72 0.0529 92 0.0060 112 0.0060
13 0.00015 33 0.0110 53 0.0394 73 0.0273 93 0.0182 113 0.0019
14 0.00089 34 0.0031 54 0.0766 74 0.0184 94 0.0123 114 0.0093
15 0.00304 35 0.0035 55 0.0376 75 0.0381 95 0.0056 115 0.0079
16 0.00131 36 0.0024 56 0.0425 76 0.0193 96 0.0171 116 0.0020
17 0.00494 37 0.0005 57 0.0834 77 0.0116 97 0.0112 117 0.0104
18 0.00863 38 0.0031 58 0.0415 78 0.0231 98 0.0045 118 0.0084
19 0.00295 39 0.0093 59 0.0432 79 0.0110 99 0.0136 119 0.0018
120 0.0097
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Here is the DTFT of the FIR filter. We can clearly observe that it meets the necessary requirements and
has linear phase in the passband.
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

BANDSTOP FILTER DESIGN


Filter Design Specifications

1-1

- s/2 - p2 - s2 - s1 - p1 0 p1 s1 s2 p2 s/2

We have the filter magnitude response to be designed as shown above periodic with period 2 with
an equiripple passband and a monotonic stopband where the symbols are as follows

Symbol Meaning (Discrete Filter) Value Normalised Values


1 First Stopband Frequency 216.1 / 1.124
1 Passband Start Frequency 215.1 / 1.05
2 Passband End Frequency 220.1 / 1.403
2 Second Stopband Frequency 219.1/ 1.33
Sampling Frequency 260 / 2
2 Stopband Tolerance 0.1
1 Passband Tolerance 0.1
The angular frequencies have been normalised with respect to the half of the sampling frequency to
obtain the discrete domain filter magnitude specification as shown in the table above and let them be
represented by .

Analog Bandstop Filter Specifications


Now using the following bilinear transform

1 1
=
1 + 1
to go from the discrete domain to the corresponding analog domain that is from the || = 1 circle to
the imaginary axis in the s domain we have the analog domain filter specifications as follows (we
continue to use the notation A to represent the analog domain filter)

Symbol Meaning (Analog Filter) Value


1 First Stopband Frequency 0.630 /
1 Passband Start Frequency 0.58 /
2 Passband End Frequency 0.845 /
2 Second Stopband Frequency 0.79 /
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Lowpass Analog Filter Specifications


Now to get this filter specification into the Low Pass form we do the following transformation
s
s =
20
+ s2

In the above transformation, we choose positive constants 20 and as follows

20 = 1 2 = 0.4918; = 2 1 = 0.2361

Hence for the low pass filter we have the transformation leading to the following frequencies

Symbol Meaning Value


Passband Edge 1
2 1
Stopband Edge min { 2 2, 2 2 } = 1.62
2 0 0 1

Butterworth Filter Design


Now because the design specification requires us to get an equiripple passband we must design a
Butterworth Filter with a transfer function of the form
1
() () =
2
1 + ( 2)

Where is an arbitrary constant which will be fixed based on the specifications.
Now we solve to for N and to meet the filter specifications. First, we apply the restriction on the
passband edge as follows to obtain N

2 1 Lp 2 1
| (Lp )| (1 1 )2 (1 1 )2 ( ) 1 = 1
2 c (1 1 )2
1+( )

And

2 1 Ls 2 1
| (Ls )| 22 22 ( ) 2 1 = 2
2 c 2
1 + ( )

1
1 ln (2 )
( ) = 10
2
ln ( )

Now to get value of we have


2
c 1 c 2 1
1

1
( ) ( ) 1 2 2 2
Lp 1 Ls 2
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

We pick the value of to the arithmetic mean of the limits to prevent overdesign of any of the
passband or the stopband. Hence, we have

= 1.275
We get the poles from the MATLAB code for the denominator polynomial as follows (showing only the
negative real axis poles there exists symmetry about the y axis)

0.5787 + 1.136 1.136 + 0.5787


0.9014 + 0.9014 0.9014 + 0.9014
1.136 + 0.5787 0.5787 + 1.136
1.259 + 0.1994 0.1994 + 1.259
1.259 + 0.1994 0.1994 + 1.259
And they can be visualised as

From the obtained set of poles, we only take the ones which lie on the left half plane to design a stable
filter. Hence, we have the transfer function as follows
0
() =
( 1 )( )( 5 )
We calculate the 0 as
5

(0) = 1 0 = = 11.33
=1

The transfer function can be obtained hence as


Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94
0
, () =
0 + 1 1 + + + 0
Where the coefficients are as follows

(0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
1 8.1488 33.202 88.663 171.33 249.88 278.41 234.12 142.47 56.82

The magnitude response and phase response of the above obtained filter is as follows

Analog Bandstop Filter


Now we obtain the two reverse transformations, first to get the analog band pass filter and then finally
the digital filter using the bilinear transformation.

Firstly, we replace as follows



=
20
+ 2
To obtain a transfer function with 20 poles and 20 zeroes. We can find the poles and they are
0.01846 + 0.01846 0.8104 + 0.8104
0.05294 + 0.05294 0.7977 + 0.7977
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

0.08055 + 0.08055 0.7743 + 0.7743


0.09811 + 0.09811 0.7437 + 0.7437
0.1043 + 0.1043 0.7102 + 0.7102
0.09954 + 0.09954 0.6779 + 0.6779
0.08575 + 0.08575 0.65 + 0.65
0.01382 + 0.01382 0.6066 + 0.6066
0.06537 + 0.06537 0.6284 + 0.6284
0.04074 + 0.04074 0.6139 + 0.6139
And we have the zeros as

0.006353 + 0.006353 0.7208 + 0.7208


0.006353 + 0.006353 0.7208 + 0.7208
0.01661 + 0.01661 0.7133 + 0.7133
0.01661 + 0.01661 0.7133 + 0.7133
0.02048 + 0.02048 0.7013 + 0.7013
0.02048 + 0.02048 0.7013 + 0.7013
0.01652 + 0.01652 0.6893 + 0.6893
0.01652 + 0.01652 0.6893 + 0.6893
0.006297 + 0.006297 0.6819 + 0.6819
0.006297 + 0.006297 0.6819 + 0.6819

And we can plot the transfer function as follows


Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

Digital Bandstop Filter


Now we apply the bilinear transformation as used before to finally get the desired Digital IIR Filter as
follows

(0) + (1) 1 + ()
() =
(0) + (1) 1 + ()
Where = = 20 and the coefficients as follows

[] []
0 0.4138 1
1 2.819 6.214
2 12.78 25.63
3 41.07 75.06
4 106.5 177.3
5 226.7 344.3
6 412.7 572
7 646.4 818.4
8 887.3 1027
9 1068 1130
10 1138 1102
11 1068 947.8
12 887.3 721.7
13 646.4 482.3
14 412.7 282.6
15 226.7 142.6
16 106.5 61.55
17 41.07 21.84
18 12.78 6.25
19 2.819 1.269
20 0.4138 0.1713
On plotting the above digital IIR
Filter using MATLAB and the freqz
function we have the following
magnitude response which
perfectly matches the given filter
specifications.

Direct Form II Realization


The Direct Form II Realization is
same as that for the Digital
Bandstop Filter, with the change
in the size of the depth of the
Direct Form II to 20 and the
coefficients as in the table above.
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

FIR Filter Design


The FIR filter design used here is the method of windowing using the Kaiser window.
Given the specifications as in the Filter Design Specifications we have the normalized cut-off
frequencies of the corresponding ideal bandpass filter as follows

1 1.089
2 1.368
And given the tolerance and the normalized transition bands we have the Kaiser Window
specifications as follows.

= 20 = 0
= 0.07
2 + 1 = 79
The ideal bandstop filter has an impulse response of the form
1 + 1 2
[] = (sin(c1 ) sin(2 ) + sin()) 0 =0

And after applying the obtained window and shifting the sequence by 39 samples to obtain a causal
filter we have the FIR coefficients as follows

[] [] [] []
0 0.008487 20 0.003378 40 0.02972 60 0.00494
1 0.01261 21 0.02062 41 0.06799 61 0.0006505
2 0.001402 22 0.01173 42 0.07383 62 0.001931
3 0.01629 23 0.02162 43 0.01696 63 0.001922
4 0.01002 24 0.03358 44 0.08105 64 0.006672
5 0.0111 25 0.003235 45 0.03653 65 0.009915
6 0.01837 26 0.04585 46 0.05123 66 0.002597
7 0.000943 27 0.03011 47 0.06574 67 0.01561
8 0.0176 28 0.03367 48 0.004224 68 0.008228
9 0.0123 29 0.06027 49 0.06027 69 0.0123
10 0.008228 30 0.004224 50 0.03367 70 0.0176
11 0.01561 31 0.06574 51 0.03011 71 0.000943
12 0.002597 32 0.05123 52 0.04585 72 0.01837
13 0.009915 33 0.03653 53 0.003235 73 0.0111
14 0.006672 34 0.08105 54 0.03358 74 0.01002
15 0.001922 35 0.01696 55 0.02162 75 0.01629
16 0.001931 36 0.07383 56 0.01173 76 0.001402
17 0.0006505 37 0.06799 57 0.02062 77 0.01261
18 0.00494 38 0.02972 58 0.003378 78 0.008487
19 0.009233 39 0.9111 59 0.009233

Here is the DTFT of the FIR filter. We can clearly observe that it meets the necessary requirements
and has linear phase in the passband.
Filter Design Assignment 2016-17
EE 338: Digital Signal Processing
OV Shashank 14D070021; Filter Number: 94

SUBMISSION CONTENTS
Codes Folder
This folder contains the MATLAB codes that have been used to obtain the above results. It also
contains the coefficients of the filters in their respective .mat files. The applyFilter.m and
discreteFilter.m are realizations of the direct form II in a MATLAB code form.

Transcripts
This folder contains the text files that are printed by the MATLAB codes

Images
This folder contains the images as saved from the plots formed by the MATLAB codes

Html
This folder contains the documentation of the MATLAB codes along with the plots as plotted by the
codes.

design_specs.txt
Contains the Assignment specifications as calculated using the Filter Number

Você também pode gostar