Transfer Function giving incorrect output?

55 Views Asked by At

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.

enter image description here (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.