Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Low pass filter for coherent demodulation?

Hello,

I'm trying to design a low-pass filter to recover a signal that was modulated using DSB-SC. I have produced the message signal and the modulated signal, but I can't seem to recover the original.

To modulate, I use a 2 kHz sinusoid: dsb = m(t) * cos(2pi2000t) To begin demodulation, I multiply that signal by another sinusoid of the same frequency: demod = m(t) * cos^2(2pi2000t)

Finally, I (try to) use an FIR low-pass filter with cutoff frequency 100 Hz. Here is what I'm doing:

import numpy as np
import scipy.signal as sig
import matplotlib.pyplot as plt

# Message signal
def message(t):
    m1 = (100*t + 2) * (unit_step(t+0.02) - unit_step(t+0.01))
    m2 = unit_step(t+0.01) - unit_step(t-0.01)
    m3 = (-100*t + 2) * (unit_step(t-0.01) - unit_step(t-0.02))
    return m1 + m2 + m3

T = 1e-4     # sampling interval
fs = 1 / T    # sampling rate
nyq_freq = fs / 2    # Nyquist frequency
fc = 2000    # carrier frequency
B = 100    # using 100 Hz as the bandwidth of the signal m(t)

t = var('t')
dsb = message(t) * cos(2*pi*fc*t)
dem = dsb(t) * cos(2*pi*fc*t)

t = np.arange(-0.04, 0.04, T)    # redefine 't' as an array
m = map(message, t)
dem = map(dem, t)    # make dem into an array representing its values
h = sig.firwin(40, B/nyq_freq)
a = np.ones(len(h))
rec = sig.lfilter(h, a, dem)

plt.plot(t, m, 'b')
plt.plot(t, rec, 'r')

Based on the examples I've seen to implement filters, this looks to be the way it is done? Am I approaching this incorrectly? Ideally, the plots should look quite similar, but these don't.