# Transfer Function giving incorrect output?

I am reading a textbook that gives the equation:

$$\frac{1-e^{-sT}}{sT}$$

for the realistic amplitude of a zero order hold circuit.

However, for the Nyquist frequency of fs/2, you should be getting 0.636 as shown in the figure.

(Taken from the Data Converters textbook by Franco Maloberti)

Let's say I take a fs = 1kHz and solve as follows:

$$\frac{1-e^{-j2\pi (500)(0.001)}}{j2\pi (500)(0.001)}$$ = $$\frac{0.9567860817}{\pi }$$ = 0.304

I should get 0.636 instead of 0.304. I'm not understanding what I'm doing wrong, and j seems to be the only thing that could cause 0.304 to change.

You can see in this python code that it creates the same figure as the textbook:

import numpy as np
import matplotlib.pyplot as plt

f = np.linspace(1, 3000, 1000)
w = 2*np.pi*f
s = 1j*w
T = 0.001
H_s = (1-np.exp(-s*T))/(s*T)
mag = np.abs(H_s)
phase = np.angle(H_s, deg=True)

plt.plot(f, mag)
plt.axvline(x=500, color='k')
plt.annotate('frequencies higher than half\nthe sampling rate\nalias to lower frequencies',
xy=(3000,0.68), xytext=(600, 0.6), arrowprops=dict(facecolor='black', shrink=0.05))
plt.xlabel('Input frequency [Hz]')
plt.ylabel('Magnitude H(s)')
plt.title('The zero-order hold transfer function')
plt.show()


Code taken from: http://lcs-vc-marcy.syr.edu:8080/Chapter45.html

As far as I can tell I'm doing the same steps that the code is doing, but somehow it gets 0.636.

• You forgot to take the complex values into account and simply left the $j$ out of your calculation. Jan 28, 2023 at 9:51
• @JeroenBoschma What exactly is the j supposed to do? Jan 28, 2023 at 18:09
• The $j$ denotes the imaginary part of a complex number, mathematicians often use $i$. This means that $v=a+jb$ is a complex number, with $a$ being the real part and $b$ being the imaginary part. If you need to calculate the absolute value, which is the case in your calculation, you write $|v|$ and you calculate it as $|v|=\sqrt{a^2+b^2}$. In your case you can ignore the $j$ in the denominator, but $1-e^{jx}$ becomes $1-\left(\cos(x)+j\sin(x)\right)=(1-\cos(x))+j\sin(x)$ which clearly separates the real and imaginary part. Apply the rules I gave, and you'll find the correct value. Jan 28, 2023 at 18:40
• @JeroenBoschma I can get the 0.636 using 1 - cos(x) with x = 2pi*500*0.001 which is awesome, thank you. However, If I try a test frequency like 200 instead of 500, it gives 0.549 after dividing by the denominator. That can't be correct since a frequency less than 500 should be greater than 0.636 and closer to 1. I tried 1 - cos(x) + sin(x) for the 200 case but that gave 1.30 which is too big, it should be less than 1. The sin(x) has a j on it :( Jan 29, 2023 at 3:41
• Apart from a sign error I made in my last comment in the last equation ($j$ should be $-j$ but it does not influence the absolute value...), things should work out. $x=\frac{2\pi200}{1000}; \sqrt{(1-\cos(-x))^2 + \sin^2(-x)} / x=0.935$. Jan 29, 2023 at 8:04

With the transfer function $$H(s, T)\to\frac{1-\exp (-s T)}{s T}$$ and $$T=\frac{1}{2 f_{Nyq}}$$:
$$\left| H\left(i 2 \pi f_{Nyq},\frac{1}{2 f_{Nyq}}\right)\right|=\frac{2}{\pi} \simeq 0.63662$$