#find Nquist Rate
#Variable declaration
#given
pi=3.14
w1=50*pi
w2=300*pi
w3=100*pi
#w=2*%pi*f
#Calculation
f1=w1/(2*pi)
f2=w2/(2*pi)
f3=w3/(2*pi)
fm=f2 #fm = maximum frquency is present at the signal
#Result
print('maximum frquency of the signal is = %.2f Hz' %f2)
fs=2*fm #Nyquist rate
print('Nquist Rate of Signal is = %.2f Hz' %fs)
import math
#Find Nquist Rate and Nquist time interval
#Variable declaration
#given
w1=5000*math.pi
w2=3000*math.pi;
f1=w1/(2*math.pi);
f2=w2/(2*math.pi);
#Calculation
fm=f1 #fm = maximum frquency is present at the signal
fs=2*fm #Nyquist rate
Ts=1.0/(2.0*fm) #frequncy =1/time
Ts=Ts*(10**3)
#Result
print('maximum frquency of the signal is = %.f Hz' %f1)
print('Nquist Rate of the given Signal is = %.f Hz' %fs)
print('Nquist Interval of the given signal is = %.1f m Sec' %Ts)
#Find Nquist Rate
#Variable declaration
#given
f=100.0 # Frequency component of continuous-time signal
#Calculation
fs=2*f #Nyquist rate
#Result
print('i) To avoid aliasing Nquist Rate is = %.f Hz' %fs)
print('ii) It is theoretical example ')
print('iii) It is theoretical example ')
print('iv) It is theoretical example ')
import math
#Find Nquist Rate of Continous signal
#Variable declaration
#given
w1=50*math.pi
w2=300*math.pi
w3=100*math.pi
#Calculation
f1=w1/(2*math.pi)
f2=w2/(2*math.pi)
f3=w3/(2*math.pi)
fmax=f2 #fmax = Highest frquency component of the message signal
fs=2*fmax #Nyquist rate
#Result
print('Highest frquency component of the message signal will be fmax = %.f Hz' %fmax)
print('Nquist Rate of the given Signal is = %.f Hz' %fs)
#find amplitude distortion at highest frquency
#Variable declaration
#given
fs=9.5 #samplig frequncy
fmax=1 #maximum frequncy
t=0.2 #pulse width
#Calculation
c=3*10**8
f=fmax
H1=t*(0.9933) #aperture effect at highest frequency, sinc(f*t)=0.9933 (given)
H1=H1*100
#Result
print('|H(1)|=%.2f' %H1)
print('Approximation error')
#Calculate Transmission Bandwidth
#Variable declaration
#given
fm=3.0*(10^3)
fs=8.0*(10^3) # sampling frequncy
#Calculation
Ts=1.0/fs
t=0.1*Ts
BW=1.0/(2*t) #Bandwidth
BW=BW/(10^3)
#Result
print('Transmission Bandwidth of PAM signal is kHz = %.f Khz ' %BW)