### Pre-requisites

Sampling theorem – baseband sampling

How to Interpret FFT results – complex DFT, frequency bins and FFTShift

Analytic signal, Hilbert Transform and FFT

Extracting instantaneous amplitude,phase,frequency – application of Analytic signal/Hilbert transform

## Phase modulated signal:

The concept of instantaneous amplitude/phase/frequency are fundamental to information communication and appears in many signal processing application. We know that a monochromatic signal of form \(x(t) = a cos(\omega t + \phi) \) cannot carry any information. To carry information, the signal need to be modulated. Different types of modulations can be performed – Amplitude modulation, Phase modulation / frequency modulation.

In amplitude modulation, the information is encoded as variations in the amplitude of a carrier signal. Demodulation of an amplitude modulated signal, involves extraction of envelope of the modulated signal. This was discussed and demonstrated here.

In phase modulation, the information is encoded as variations in the phase of the carrier signal. In its generic form, a phase modulated signal expressed as an information-bearing sinusoidal signal modulating another sinusoidal carrier signal is expressed as

$$ x(t) = A cos \left[ 2 \pi f_c t + \beta + \alpha sin \left( 2 \pi f_m t + \theta \right) \right] \;\;\;\;\;\;\; (1)$$

where, \( m(t) = \alpha sin \left( 2 \pi f_m t + \theta \right) \) represents the information-bearing modulating signal, with the following parameters

\(\alpha\) – amplitude of the modulating sinusoidal signal

\(f_m\) – frequency of the modulating sinusoidal signal

\(\theta\) – phase offset of the modulating sinusoidal signal

The carrier signal has the following parameters

\(A\) – amplitude of the carrier

\(f_c\) – frequency of the carrier and \(f_c >> f_m\)

\(\beta\) – phase offset of the carrier

## Demodulating a phase modulated signal:

The phase modulated signal shown in equation \((1)\), can be simply expressed as

$$ x(t) = A cos \left[ \phi(t)\right] \;\;\;\;\;\;\; (2) $$

Here, \(\phi(t)\) is the ** instantaneous phase** that varies according to the information signal \(m(t)\).

A phase modulated signal of form \(x(t)\) can be demodulated by forming an analytic signal by applying hilbert transform and then extracting the instantaneous phase. This method is explained here.

We note that the instantaneous phase is \( \phi(t) = 2 \pi f_c t + \beta + \alpha sin \left( 2 \pi f_m t + \theta \right) \) is linear in time, that is proportional to \(2 \pi f_c t\). This linear offset needs to be subtracted from the instantaneous phase to obtained the information bearing modulated signal. If the carrier frequency is known at the receiver, this can be done easily. If not, the carrier frequency term \(2 \pi f_c t\) needs to be estimated using a linear fit of the unwrapped instantaneous phase. The following Matlab and Python codes demonstrates all these methods.

## Matlab

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
%Demonstrate simple Phase Demodulation using Hilbert transform clearvars; clc; fc = 240; %carrier frequency fm = 10; %frequency of modulating signal alpha = 1; %amplitude of modulating signal theta = pi/4; %phase offset of modulating signal beta = pi/5; %constant carrier phase offset receiverKnowsCarrier= 'False'; %If receiver knows the carrier frequency & phase offset fs = 8*fc; %sampling frequency duration = 0.5; %duration of the signal t = 0:1/fs:1-1/fs; %time base %Phase Modulation m_t = alpha*sin(2*pi*fm*t + theta); %modulating signal x = cos(2*pi*fc*t + beta + m_t ); %modulated signal figure(); subplot(2,1,1) plot(t,m_t) %plot modulating signal title('Modulating signal'); xlabel('t'); ylabel('m(t)') subplot(2,1,2) plot(t,x) %plot modulated signal title('Modulated signal'); xlabel('t');ylabel('x(t)') %Add AWGN noise to the transmitted signal nMean = 0; %noise mean nSigma = 0.1; %noise sigma n = nMean + nSigma*randn(size(t)); %awgn noise r = x + n; %noisy received signal %Demodulation of the noisy Phase Modulated signal z= hilbert(r); %form the analytical signal from the received vector inst_phase = unwrap(angle(z)); %instaneous phase %If receiver don't know the carrier, estimate the subtraction term if strcmpi(receiverKnowsCarrier,'True') offsetTerm = 2*pi*fc*t+beta; %if carrier frequency & phase offset is known else p = polyfit(t,inst_phase,1); %linearly fit the instaneous phase estimated = polyval(p,t); %re-evaluate the offset term using the fitted values offsetTerm = estimated; end demodulated = inst_phase - offsetTerm; figure() plot(t,demodulated); %demodulated signal title('Demodulated signal'); xlabel('n'); ylabel('\hat{m(t)}'); |

## Python

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
import numpy as np from scipy.signal import hilbert import matplotlib.pyplot as plt PI = np.pi fc = 240 #carrier frequency fm = 10 #frequency of modulating signal alpha = 1 #amplitude of modulating signal theta = PI/4 #phase offset of modulating signal beta = PI/5 #constant carrier phase offset receiverKnowsCarrier= False; #If receiver knows the carrier frequency & phase offset fs = 8*fc #sampling frequency duration = 0.5 #duration of the signal t = np.arange(int(fs*duration)) / fs #time base #Phase Modulation m_t = alpha*np.sin(2*PI*fm*t + theta) #modulating signal x = np.cos(2*PI*fc*t + beta + m_t ) #modulated signal plt.figure() plt.subplot(2,1,1) plt.plot(t,m_t) #plot modulating signal plt.title('Modulating signal') plt.xlabel('t') plt.ylabel('m(t)') plt.subplot(2,1,2) plt.plot(t,x) #plot modulated signal plt.title('Modulated signal') plt.xlabel('t') plt.ylabel('x(t)') #Add AWGN noise to the transmitted signal nMean = 0 #noise mean nSigma = 0.1 #noise sigma n = np.random.normal(nMean, nSigma, len(t)) r = x + n #noisy received signal #Demodulation of the noisy Phase Modulated signal z= hilbert(r) #form the analytical signal from the received vector inst_phase = np.unwrap(np.angle(z))#instaneous phase #If receiver don't know the carrier, estimate the subtraction term if receiverKnowsCarrier: offsetTerm = 2*PI*fc*t+beta; #if carrier frequency & phase offset is known else: p = np.poly1d(np.polyfit(t,inst_phase,1)) #linearly fit the instaneous phase estimated = p(t) #re-evaluate the offset term using the fitted values offsetTerm = estimated demodulated = inst_phase - offsetTerm plt.figure() plt.plot(t,demodulated) #demodulated signal plt.title('Demodulated signal') plt.xlabel('n') plt.ylabel('\hat{m(t)}') |