3-Coefficient Differentiator

Calculus Level 5

Suppose we sample a time sinusoid at discrete time intervals. The angular frequency of the sinusoid is ω \omega and the sampling time interval is T T . The sampled signal looks like:

y k = A sin ( ω k T ) \large{y_k = A \, \sin(\omega \, k T)}

In the above equation, k k is an integer denoting the sample number. Suppose we define two discrete differentiators: one with two coefficients (the classic difference quotient), and another with three coefficients.

f 2 = 1 T y k 1 T y k 1 f 3 = 1.5 T y k 2 T y k 1 + 0.5 T y k 2 \large{f_2 = \frac{1}{T} \, y_k - \frac{1}{T} \, y_{k-1} \\ f_3 = \frac{1.5}{T} \, y_k - \frac{2}{T} \, y_{k-1} + \frac{0.5}{T} \, y_{k-2}}

If we take the z-transform of both of the above equations, we obtain the following transfer functions (the " z z " in parentheses denotes functions of z z ):

F 2 ( z ) Y ( z ) = H 2 ( z ) F 3 ( z ) Y ( z ) = H 3 ( z ) z = e j ω T j = 1 \large{\frac{F_2 (z)}{Y(z)} = H_2 (z) \\ \frac{F_3 (z)}{Y(z)} = H_3 (z) \\ z = e^{j \, \omega T} \\ j = \sqrt{-1}}

For a sinusoid, the ideal transfer function is H i d e a l = j ω H_{ideal} = j \omega . We can therefore say that the error of the differentiator is H a c t u a l j ω H_{actual} - j \omega . As it turns out, the three-coefficient differentiator has a better response for some frequencies (given some sampling rate).

Calculate the following error ratio:

H 2 j ω H 3 j ω \Huge | \large{ \frac{H_2 - j \omega}{H_3 - j \omega} } \Huge |

Details and Assumptions:
- ω = 120 π \omega = 120 \pi
- T = 1 8000 T = \frac{1}{8000}
- |\cdot| denotes the modulus of a complex number
- Hint: Use the time-shift property of the z-transform to get the transfer functions


The answer is 31.834.

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

Steven Chase
Apr 24, 2019

See the solution by @Karan Chatrath . I will just add some plots here. The ideal normalized magnitude response is 1 1 (after normalizing by ω \omega ), and the ideal phase response is 90 degrees. We can see from the plots that the 2-coefficient differentiator has a slightly better magnitude response, and that the 3-coefficient differentiator has a substantially better phase response.

Interesting observations! Thank you for the problem and for the insights. My takeaway from this problem is that while differentiating high frequency and sampled signals, it is always better to use the 3 coefficient differentiator as opposed to a simple (first order) Taylor series approximation (2 coefficient).

Karan Chatrath - 2 years, 1 month ago

If your application is sensitive to both magnitude and phase, then you are probably better off with the 3-coefficient version. The downside though is that it has a 50% greater buffer depth, and takes correspondingly longer to "charge". It also requires more computation to implement. So it depends on the desired balance between accuracy, speed, and computational burden.

Steven Chase - 2 years, 1 month ago
Karan Chatrath
Apr 24, 2019

Consider the first difference equation:

f 2 ( k ) = y ( k ) y ( k 1 ) T f_2 (k) = \frac{y(k) - y(k-1)}{T}

Taking the Z-Transform on both sides assuming no initial conditions gives us:

F 2 ( z ) = 1 z 1 T Y ( Z ) F_2 (z) = \frac{1 - z^{-1}}{T} Y(Z)

This Implies:

H 2 ( z ) = 1 z 1 T H_2 (z) = \frac{1 - z^{-1}}{T}

Doing the same for the second difference equation:

f 3 ( k ) = 1.5 y ( k ) 2 y ( k 1 ) + 0.5 y ( k 2 ) T f_3 (k) = \frac{1.5y(k) -2y(k-1) + 0.5y(k-2)}{T}

Taking the Z-Transform on both sides, assuming no initial conditions and dividing by Y(z) gives us:

H 3 ( z ) = 1.5 2 z 1 + 0.5 z 2 T H_3 (z) = \frac{1.5 - 2z^{-1} + 0.5z^{-2}}{T}

Now, it is already given that

z = e j ω T = cos ( ω T ) + j sin ( ω T ) z = e^{j \omega T} =\cos(\omega T) + j \sin(\omega T)

This means:

z 1 = e j ω T = cos ( ω T ) j sin ( ω T ) z^{-1} = e^{-j \omega T} =\cos(\omega T) - j \sin(\omega T)

And:

z 2 = e 2 j ω T = cos ( 2 ω T ) j sin ( 2 ω T ) z^{-2} = e^{-2j \omega T} =\cos(2\omega T) - j \sin(2\omega T)

The values of T and ω \omega are known.

Plugging this into each of the transfer functions H 2 ( z ) , H 3 ( z ) H_2 (z) , H_3 (z) gives us two complex numbers in terms of T and ω \omega .

These complex numbers are, in turn, plugged into the required expression and the modulus of the resulting complex number is computed. The substitutions and simplifications are straightforward, but are a bit tedious. The answer comes out to be 31.8339

Nice solution, thanks. The 2-coefficient differentiator has a slightly better magnitude response, but the 3-coefficient differentiator has a much better phase response. Maybe I'll upload some plots showing that.

Steven Chase - 2 years, 1 month ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...