Chapter 7: Phase Frequency and Time

Example7_1,pg 496

In [2]:
# find pulse width

import math
#Variable declaration
delt=1*10**-3                  #pulse width
#w=2wo
#delt at w=2wo

#Calculations
delT=(delt/2.0)                #changed in pulse width

#Result
print("pulse width:")
print("delT = %.1f ms"%(delT*10**3))
pulse width:
delT = 0.5 ms

Example7_2,pg 496

In [3]:
# detector senstivity

import math
#Variable declaration

#senstivity of phase detection
#Sphi=(Vo/sin(B))=(Vo/B)=(+/-)0.5Vmax, B is phase displacement
Vmax=1.0                           #amplitude of cosine waves

#Calculations
Sphi=(1.0/2)*Vmax

#Result
print("senstivity of phase detection:")
print("Sphi = %.1f V/rad"%Sphi)
senstivity of phase detection:
Sphi = 0.5 V/rad

Example7_3,pg 496

In [3]:
# phase measured

import math
#Variable declaration
Vp=1.3                    #pulse height
delt=0.31*10**-3          #pulse width
T=1*10**-3                #pulse repetion rate

#Calculations
Vphi=Vp*(delt/T)          #phase deviation
phi=2*math.pi*(Vphi/Vp)   #phase

#Result
print("phase measured:")
print("phi = %.4f rad"%phi)
#Answer is wrong in the book
phase measured:
phi = 1.9478 rad

Example7_4,pg 497

In [6]:
# measured phase difference

import math
#Variable declaration
delt=0.13*10**-3                   #time delay
T=1.3*10**-3                       #time period

#Calculations
n=(1.0/3.0)*(1+(delt/T))           #order of phase meter
delphi=(n-(1.0/3))*1080            #measured phase difference

#Result
print("measured phase difference:")
print("delphi = %.f°"%delphi)
#Answer slightly different than the book
measured phase difference:
delphi = 36°

Example7_5,pg 497

In [8]:
# find phase difference

import math
#Variable declaration
n=8.0                   #8-bit counter
N2=64.0                 #output digital count

#Calculations
theta=math.pi*(N2/(2**n-1))

#Result
print("measured phase difference:")
print("theta = %.3f radian"%theta)
measured phase difference:
theta = 0.788 radian

Example7_6,pg 497

In [15]:
# states for stages required
import math
#Variable declaration
#since the no. is more than 9, the two-stage counting is required. the states of the stages are
print("D  C   B   A   decimal equivalent")
a1="0  0   0   1    1"
a5="0  1   0   1    5"

#Result
print a1 
print a5
D  C   B   A   decimal equivalent
0  0   0   1    1
0  1   0   1    5

Example7_7,pg 498

In [9]:
# find time base division

import math
#Variable declaration
fd=10.0*10**6                     #frequency meter input
fc=10.0*10**3                     #counter clock
fi=100.0*10**6                    #actual input frequency

#Calculations
k=fc*(fd/fi)                    #division time base

#Result
print("division time base:")
print("k = %.f"%k)
division time base:
k = 1000

Example7_8,pg 498

In [11]:
# frequency of sinusoid

import math
#Variable declaration
V2=0.130                        #output-1
V1=0.103                        #output-2
Vx=0.4                          #peak amplitude
delt=0.1*10**-3                 #time delay

#Calculations
f1=(1.0/(2*math.pi*delt))*(math.asin(V2/Vx)-math.asin(V1/Vx))

#Result
print("frequency of sinusoid:")
print("f1 = %.0f Hz"%(math.ceil(f1)))
frequency of sinusoid:
f1 = 113 Hz

Example7_9,pg 498

In [20]:
# count of counter(refer fig. 7.30(a),(b),(c))

import math
#Variable declaration
#N=(2*fc/fs^2)*fi
fs=10*10**2                        #sampler frequency
fc=10*10**3                        #counter clock

#Calculations
M=(fs**2)/(2*fc)                   #multiplication factor
fi=113.0                           #input frequency
N=(1.0/M)*fi                       #count of counter

print("count of counter:")
print("N = %.2f "%N)
count of counter:
N = 2.26 

Example7_10,pg 498

In [13]:
# find time between events 

import math
#Variable declaration
n=10.0*10**2                      #scale factor=(1/n)
fc=10.0*10**5                     #clock frequency
N=10.0                          #count

#Calculations
Tp=(n/fc)*N                     #time between events

#Result
print("time between events:")
print("Tp = %.f ms"%(Tp*1000))
time between events:
Tp = 10 ms