This post is a part of the book : Digital Modulations using Matlab : Build Simulation Models from Scratch –

by Mathuranathan Viswanathan

### Pre-requisites

Sampling theorem – baseband sampling

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

Analytic signal, Hilbert Transform and FFT

## Related topic:

Phase demodulation using Hilbert transform – application of analytic signal

## Introduction

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. Take for example the case of amplitude modulation, in which a positive real-valued signal (m(t)) modulates a carrier (cos(\omega_c t)). That is, the amplitude modulation is effected by multiplying the information bearing signal (m(t)) with the carrier signal (cos(\omega_c t)).

$$ x(t) = m(t) cos\left(\omega_c t\right)$$

Here, (\omega_c) is the angular frequency of the signal measured in *radians/sec *and is related to the temporal frequency (f_c) as (\omega_c = 2 \pi f_c ). The term (m(t)) is also called * instantaneous amplitude*.

Similarly, in the case of phase or frequency modulations, the concept of instantaneous phase or instantaneous frequency is required for describing the modulated signal.

$$ x(t) = a cos \left(\phi(t) \right)$$

Here, (a) is the constant amplitude factor (no change in the envelope of the signal) and (\phi(t)) is the ** instantaneous phase **which varies according to the information. The

*is expressed as the*

**instantaneous angular frequency***.*

**derivative of instantaneous phase**$$ \omega(t) = \frac{d}{dt} \phi(t) $$

$$ f(t) = \frac{1}{2 \pi} \frac{d}{dt} \phi(t) $$

## Definition

Generalizing these concepts, if a signal is expressed as

$$ x(t) = a(t) cos\left(\phi(t) \right) $$

- The instantaneous amplitude or the envelope of the signal is given by \(a(t)\)
- The instantaneous phase is given by \(\phi(t)\)
- The instantaneous angular frequency is derived as \(\omega(t) = \frac{d}{dt} \phi(t) \)
- The instantaneous temporal frequency is derived as \(f(t) = \frac{1}{2 \pi} \frac{d}{dt} \phi(t) \)

### Problem statement

An amplitude modulated signal is formed by multiplying a sinusoidal information and a linear frequency chirp. The information content is expressed as (a(t) = 1 + 0.7 \; sin \left( 2 \pi 3 t\right) ) and the linear frequency chirp is made to vary from (20 \; Hz) to (80 \; Hz). Given the modulated signal, extract the instantaneous amplitude (envelope), instantaneous phase and the instantaneous frequency.

### Solution

We note that the modulated signal is a real-valued signal. We also take note of the fact that amplitude/phase and frequency can be easily computed if the signal is expressed in complex form. Which transform should we use such that the we can convert a real signal to the complex plane without altering the required properties ?? Answer: Apply Hilbert transform and form the analytic signal on the complex plane. Figure 1 illustrates this concept.

If we express the real-valued modulated signal (x(t)) as an analytic signal, it is expressed in complex plane as

$$ z(t) = z_r(t) + j z_i(t) = x(t) + j HT \left[ x(t) \right] $$

where, (HT[]) represents the Hilbert Transform operation. Now, the required parameters are very easy to obtain.

The instantaneous amplitude (** envelope extraction**) is computed in the complex plane as

$$ a(t) = |z(t)| = \sqrt{z_r^2(t) + z_i^2(t)} $$

The instantaneous phase is computed in the complex plane as

$$\phi(t) = \angle z(t) = arctan \left[ \frac{z_i(t)}{z_r(t)} \right]$$

The instantaneous temporal frequency is computed in the complex plane as

$$ f(t) = \frac{1}{2 \pi} \frac{d}{dt} \phi(t) $$

Once we know the instantaneous phase, the carrier can be regenerated as (cos[\phi(t)]). The regenerated carrier is often referred as Temporal Fine Structure (TFS) in * Acoustic signal processing [1]*.

## Matlab

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
fs = 600; %sampling frequency in Hz t = 0:1/fs:1-1/fs; %time base a_t = 1.0 + 0.7 * sin(2.0*pi*3.0*t) ; %information signal c_t = chirp(t,20,t(end),80); %chirp carrier x = a_t .* c_t; %modulated signal subplot(2,1,1); plot(x);hold on; %plot the modulated signal z = hilbert(x); %form the analytical signal inst_amplitude = abs(z); %envelope extraction inst_phase = unwrap(angle(z));%inst phase inst_freq = diff(inst_phase)/(2*pi)*fs;%inst frequency %Regenerate the carrier from the instantaneous phase regenerated_carrier = cos(inst_phase); plot(inst_amplitude,'r'); %overlay the extracted envelope title('Modulated signal and extracted envelope'); xlabel('n'); ylabel('x(t) and |z(t)|'); subplot(2,1,2); plot(cos(inst_phase)); title('Extracted carrier or TFS'); xlabel('n'); ylabel('cos[\omega(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 |
import numpy as np from scipy.signal import hilbert, chirp import matplotlib.pyplot as plt fs = 600.0 #sampling frequency duration = 1.0 #duration of the signal t = np.arange(int(fs*duration)) / fs #time base a_t = 1.0 + 0.7 * np.sin(2.0*np.pi*3.0*t)#information signal c_t = chirp(t, 20.0, t[-1], 80) #chirp carrier x = a_t * c_t #modulated signal plt.subplot(2,1,1) plt.plot(x) #plot the modulated signal z= hilbert(x) #form the analytical signal inst_amplitude = np.abs(z) #envelope extraction inst_phase = np.unwrap(np.angle(z))#inst phase inst_freq = np.diff(inst_phase)/(2*np.pi)*fs #inst frequency #Regenerate the carrier from the instantaneous phase regenerated_carrier = np.cos(inst_phase) plt.plot(inst_amplitude,'r'); #overlay the extracted envelope plt.title('Modulated signal and extracted envelope') plt.xlabel('n') plt.ylabel('x(t) and |z(t)|') plt.subplot(2,1,2) plt.plot(regenerated_carrier) plt.title('Extracted carrier or TFS') plt.xlabel('n') plt.ylabel('cos[\omega(t)]') |

Pingback: Phase demodulation using Hilbert transform – application of analytic signal – GaussianWaves()

Pingback: Analytic signal, Hilbert Transform and FFT – GaussianWaves()