Page 198 -
P. 198

b = (cos(Ω  ) − cos(Ω  )) 2           (6.125)
                                                             1       2
                                2. Ω  is given by:
                                    0
                                                               
                                                                   /
                                                              − 1 ra 12  
                                                      Ω = cos      2                    (6.126)
                                                        0
                                                                1+ r  
                             Example 6.12
                             Write a program to determine the parameters r and Ω  of a prototype band-
                                                                            0
                             pass filter if the cutoff frequencies and the sampling time are given.

                             Solution: The following script M-file implements the above target:

                                f1= ;                %enter the lower cutoff
                                f2= ;                %enter the upper cutoff
                                tau= ;                %enter the sampling time
                                w1=2*pi*f1*tau;
                                w2=2*pi*f2*tau;
                                a=(cos(w1)+cos(w2))^2;
                                b=(cos(w1)-cos(w2))^2;
                                p=[1 0 a-b -8*a 14*a-2*b-2 -8*a a-b 0 1];
                                rr=roots(p);
                                r=rr(find(rr>0 & rr<1 & imag(rr)==0))
                                w0=acos((r*a^(1/2))/(1+r^2));
                                f0=(1/(2*pi*tau))*w0

                              In Figure 6.6, we show the gain and phase response for this filter, for the
                             case that the cutoff frequencies are chosen to be 1000 Hz and 1200 Hz, and the
                             sampling rate is 10 µs.
                              To test the action of this filter, we input into it a signal that consists of a mix-
                             ture of a sinusoid having a frequency at the frequency of the maximum gain
                             of this filter and a number of its harmonics; for example,

                                           u t( ) =  sin(2π ft) + 0 . sin(5  4π ft) + 0 . sin(6  6π ft)  (6.127)
                                                      0            0            0
                              We show in Figure 6.7 the input and the filtered signals. As expected from
                             an analysis of the gain curve, only the fundamental frequency signal has sur-
                             vived. The amplitude of the filtered signal settles to that of the fundamental
                             frequency signal following a short transient period.
                             NOTE Before leaving this topic, it is worth noting that the above prototype
                             bandpass filter can have sharper cutoff features (i.e., decreasing the value of


                             © 2001 by CRC Press LLC
   193   194   195   196   197   198   199   200   201   202   203