Frequency modulation(FM) refers to the technique of embedding message signal into a carrier signal. This means that the message signal information is embedded in the carrier signal as changing frequencies.

Consider the problem of implementing frequency modulation in python programming language. You should know the equation of FM signal. The difference between phase modulated signal and frequency modulated signal equation is that frequency modulated signal waveform has an integration of message signal term.

To the purpose of writing python code for frequency modulation, we consider a message signal of 1Hz, amplitude of 1 and a carrier signal of 500Hz and amplitude of also 1. The modulater frequency sensitivity is kf which has value of 0.7.

Now consider the following python code:

from numpy import sin, cos , pi, linspace

import matplotlib.pyplot as plt

import scipy.integrate as integrate

fm = 1

fc = 500

Ac = 1

Am = 1

kf = 0.7

t = linspace(0,10,1000)

sfm = [Ac*cos(2*pi*fc*ts + kf*integrate.quad(lambda t:Am*sin(2*pi*fm*ts),0,pi)[0]) for ts in t]

plt.figure

plt.plot(t,sfm)

plt.show

The graph generated is shown below:

The actual FM signal equation which contains the two frequencies in the FM signal is evident from the equation for the FM modulate signal in the code:

sfm = [Ac*cos(2*pi*fc*ts + kf*integrate.quad(lambda t:Am*sin(2*pi*fm*ts),0,ts)[0]) for ts in t]

See also PM modulation in Python programming language.

Consider the problem of implementing frequency modulation in python programming language. You should know the equation of FM signal. The difference between phase modulated signal and frequency modulated signal equation is that frequency modulated signal waveform has an integration of message signal term.

To the purpose of writing python code for frequency modulation, we consider a message signal of 1Hz, amplitude of 1 and a carrier signal of 500Hz and amplitude of also 1. The modulater frequency sensitivity is kf which has value of 0.7.

Now consider the following python code:

from numpy import sin, cos , pi, linspace

import matplotlib.pyplot as plt

import scipy.integrate as integrate

fm = 1

fc = 500

Ac = 1

Am = 1

kf = 0.7

t = linspace(0,10,1000)

sfm = [Ac*cos(2*pi*fc*ts + kf*integrate.quad(lambda t:Am*sin(2*pi*fm*ts),0,pi)[0]) for ts in t]

plt.figure

plt.plot(t,sfm)

plt.show

The graph generated is shown below:

The actual FM signal equation which contains the two frequencies in the FM signal is evident from the equation for the FM modulate signal in the code:

sfm = [Ac*cos(2*pi*fc*ts + kf*integrate.quad(lambda t:Am*sin(2*pi*fm*ts),0,ts)[0]) for ts in t]

See also PM modulation in Python programming language.

## 0 comments:

## Post a Comment