Cosine Filter

Calculus Level 5

An 8-tap "cosine filter" takes in a discrete signal x x as an input, and produces a discrete output signal y y . The filter is designed to pass through 60 Hz 60 \, \text{Hz} with unity gain, while rejecting low frequencies and higher integer multiples of 60 Hz 60 \, \text{Hz} (see diagram).

If the filter is fed a pure sinusoid as an input, the filter gain is the ratio of the peak value of the output sinusoid to the peak value of the input sinusoid.

The filter is implemented as follows:

y k = Σ n = 0 n = 7 α n x k n α n = 1 4 c o s ( 2 π ( n + 1 / 2 ) 8 ) y_k = \Sigma_{n = 0}^{n = 7} \, \alpha_n \, x_{k-n} \\ \alpha_n = \frac{1}{4} \, cos \Big ( \frac{2 \pi (n + 1/2)}{8} \Big )

In the above equations, subscript k k denotes the present processing interval, and subscript k n k - n represents various past processing intervals.

Let the applied frequency in Hz \text{Hz} be f f , and let the filter gain as a function of frequency be H ( f ) H(f) . Determine the following integral, and give your answer as I \lfloor I \rfloor

I = 0 300 H ( f ) d f \large{I = \int_0^{300} \, H(f) \, df}

Details and Assumptions: The filter is processed at a rate of 480 480 samples per second

Hint: Use the time-shift property of the z-transform to derive a transfer function in the z-domain


The answer is 103.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Guilherme Niedu
Jun 4, 2019

We have:

y ( k ) = n = 0 7 1 4 cos [ 2 π ( n + 1 / 2 ) 8 ] x ( k n ) \large \displaystyle y(k) = \sum_{n=0}^7 \frac14 \cos\left [ \frac {2 \pi (n + 1/2)}{8} \right ] x(k-n)

Using the referred time-shift property and considering that x ( k ) = 0 x(k) = 0 for k 0 k \leq 0 , i.e., assuming the time begins to count when the signal begins, and denoting X ( z ) X(z) and Y ( z ) Y(z) as the Z-transforms of x ( k ) x(k) and y ( k ) y(k) respectively:

Y ( z ) = X ( z ) [ n = 0 7 1 4 cos [ 2 π ( n + 1 / 2 ) 8 ] z n ] \large \displaystyle Y(z) = X(z) \cdot \left [ \sum_{n=0}^7 \frac14 \cos\left [ \frac {2 \pi (n + 1/2)}{8} \right ] z^{-n} \right ]

The transfer function T ( z ) T(z) is the ratio between output and input:

T ( z ) = 1 4 [ n = 0 7 cos [ 2 π ( n + 1 / 2 ) 8 ] z n ] \large \displaystyle T(z) = \frac14 \left [ \sum_{n=0}^7 \cos\left [ \frac {2 \pi (n + 1/2)}{8} \right ] z^{-n} \right ]

Since we're sampling at 480 480 Hz, to convert from Z-transform to Laplace Transform we make z = e s T s z = e^{s\cdot T_s} , where T s T_s is the sampling period:

T ( s ) = 1 4 [ n = 0 7 cos [ 2 π ( n + 1 / 2 ) 8 ] e s n 480 ] \large \displaystyle T(s) = \frac14 \left [ \sum_{n=0}^7 \cos\left [ \frac {2 \pi (n + 1/2)}{8} \right ] e^{-\frac{s \cdot n}{480}} \right ]

In the time domain, if we input a signal x ( t ) x(t) through a transfer function p ( t ) p(t) , the output signal y ( t ) y(t) is a convolution, i.e.:

y ( t ) = 0 p ( τ ) x ( t τ ) d τ \large \displaystyle y(t) = \int_0^{\infty} p(\tau) x(t - \tau) d\tau

If x x happens to be a sinusoid, i.e., a signal in the form e j ω t e^{j \omega t} ( j j is the imaginary unit) or a linear combination of such signals (recall that cosine and sine are indeed linear combinations of signals like this), then we have:

y ( t ) = 0 p ( τ ) e j ω ( t τ ) d τ \large \displaystyle y(t) = \int_0^{\infty} p(\tau)e^{j \omega (t -\tau)} d\tau

y ( t ) = e j ω t 0 p ( τ ) e j ω τ d τ \large \displaystyle y(t) = e^{j \omega t} \int_0^{\infty} p(\tau)e^{- j \omega \tau} d\tau

This integral is the exact definition of Laplace transform of p ( t ) p(t) (denoted P ( s ) P(s) ) evaluated at s = j ω s = j \omega (also known as Fourier Transform ):

y ( t ) = e j ω t P ( j ω ) \large \displaystyle y(t) = e^{j \omega t} P(j \omega)

This means that if we input a sinusoid with frequency ω \omega through a transfer function p ( t ) p(t) , it will receive a gain equal to the absolute value of P ( j ω ) P( j \omega) and a phase change equal to the angle of P ( j ω ) P( j \omega) .

So, the gain at linear frequency f f (angular frequency 2 π f 2\pi f ) is equal to the absolute value of T ( j 2 π f ) T(j2\pi f) . Thus:

H ( f ) = T ( j 2 π f ) = 1 4 [ n = 0 7 cos [ 2 π ( n + 1 / 2 ) 8 ] e n j 2 π f 480 ] \large \displaystyle H(f) = |T(j2\pi f)| = \left | \frac14 \left [ \sum_{n=0}^7 \cos\left [ \frac {2 \pi (n + 1/2)}{8} \right ] e^{-\frac{n \cdot j2\pi f}{480}} \right ] \right |

Integrating it numerically from f = 0 f=0 to 300 300 gives:

I = 0 300 H ( f ) d f 103.064 I = 103 \color{#3D99F6} \large \displaystyle I = \int_0^{300} H(f) df \approx 103.064 \rightarrow \boxed{ \large \displaystyle \lfloor I \rfloor = 103 }

Very nice solution, thanks

Steven Chase - 2 years ago

Log in to reply

Thank you, Mr Chase. It's an honor. I always enjoy your problems.

Guilherme Niedu - 2 years ago
Hosam Hajjir
Jun 4, 2019

The convolution integral is

y ( k ) = n = 0 7 h ( n ) x ( k n ) ( 1 ) y(k) = \displaystyle \sum_{n = 0}^7 h(n) x(k - n) \hspace{12pt} (1)

where h ( n ) h(n) is the impulse response of the filter, and is referred to in the problem as α n \alpha_n .

If we plug in a complex sinusoidal input of frequency f f , as our input, then

x ( k ) = e j 2 π f k ( 2 ) x(k) = e^{j 2 \pi f k} \hspace{12pt} (2)

Plugging in (2) into (1) results in

y ( k ) = n = 0 7 h ( n ) e j 2 p i f ( k n ) y(k) = \displaystyle \sum_{n = 0}^7 h(n) e^{ j 2 pi f (k - n) } = e j 2 π f k ( n = 0 7 h ( n ) e j 2 π f n ) ( 3 ) \hspace{12pt} = e^{ j 2 \pi f k} \left( \displaystyle \sum_{n = 0}^7 h(n) e^{- j 2 \pi f n } \right) \hspace{12pt} (3)

The term between parantheses in (3) is exactly the complex transfer function (The fourier transform of h ( n ) h(n) ). That is,

H ( f ) = n = 0 7 h ( n ) e j 2 p i f n ( 4 ) H(f) = \displaystyle \sum_{n=0}^7 h(n) e^{ - j 2 pi f n } \hspace{12pt} (4)

Hence, we can evaluate H ( f ) | H(f) | , the magnitude of H ( f ) H(f) at each frequency f f .

What remains is to numerically integrate that over the range of f f from 0 0 to 300 H z 300 \hspace{2pt} Hz .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...