PM modulation involves modulating the carrier signal using message signal such that phase of the carrier is varied according to the message magnitude. Consider a carrier signal of carrier frequency of 1.6 KHz and a message signal of 1 Hz. These frequencies were choose so as to plot and see the frequency changes in the modulated PM signal. Let also the amplitude of carrier and message be 1unit(could be 1mV for example). Let us also kf as the phase sensitivity of the modulator which has a value of 0.7.

To write and plot phase modulated signal the python code is as follows.

from numpy import sin, cos , pi, linspace
import matplotlib.pyplot as plt

t = linspace(0,10,1000)
fm = 1
fc = 1600
Ac = 1
Am = 1
kf = 0.7

spm = Ac*cos([2*pi*fc*ts + kp*Am*sin(2*pi*fm*ts) for ts in t])

plt.figure
plt.plot(t,spm)
plt.title("PM signal")
plt.xlabel("time(t)")
plt.ylabel("Amplitude")
plt.show()

What we get is the following graph:

A phase modulated signal has in its frequencies part the addition of carrier frequency and the message signal. The message signal is multiplied the phase sensitivity. The following equation used in the above code shows this relation.

spm = Ac*cos([2*pi*fc*ts + kf*Am*sin(2*pi*fm*ts) for ts in t])

where fc and fm are the two frequencies of carrier and message signal.

For comparison purpose, see the following graph which shows the PM signal and the message signal waveform. Notice that message signal is smooth where the phase modulated signal has varying kind of changing waveform.

The code for this part is as follows:

from numpy import sin, cos , pi, linspace
import matplotlib.pyplot as plt

t = linspace(0,10,1000)
fm = 1
fc = 1600
Ac = 1
Am = 1
kf = 0.7

spm = Ac*cos([2*pi*fc*ts + kf*Am*sin(2*pi*fm*ts) for ts in t])
m = Am*sin([2*pi*fm*ts for ts in t])

plt.figure
plt.subplot(2,1,1)
plt.plot(t,sfm)
plt.title("FM signal")
plt.xlabel("time(t)")
plt.ylabel("Amplitude")
plt.subplot(2,1,2)
plt.plot(t,m)
plt.title("Message signals")
plt.xlabel("time(t)")
plt.ylabel("Amplitude")
plt.show()

Since this is analog PM communication the PM signal is continous at the places where the phase changes takes place. In contrast if we were to plot digital phase modulated signal then there will be abrupt changes in the places where the phase changes.

So this illustrates how you can plot communication signals such as PM signal with python programming language. In AM modulation in Python programming language it is shown how to do the same for the AM signal.

0 comments:

Post a Comment

 
Top