# Demodulating AM signal from carrier signal on Matlab

I'm trying to demodulate a voice signal (bandwidth approximately 5 kHz) from a carrier signal (100kHz).

h=10*sinc(10*(-10:10));

y1=filter(h,1,y);

But when I compare the signal with the "ground truth" signal provided, the size of the signal is 1/20th of the one I made. Did I miss some steps in the process? Thanks.

The reason why the original discrete-time baseband audio message signal $m[n]$ and the discrete-time demodulated audio signal $y[n]$ have different lengths (sample counts) is due to the fact that they have different representation sampling rates.

While the original baseband analog audio signal $m(t)$ which has a bandwidth of $5$ kHz has to be sampled with a sampling frequency of $F_{bb} = \frac{1}{T_{bb}} \geq 10$ kHz in order to represent it in the baseband discrete-time form $m[n] = m(n T_{bb})$ in Matlab.

The amplitude modulated analog signal $x(t) = A_c m(t) \cos(2\pi f_c t + \phi)$ which has a carrier frequency of $f_c = 100$ kHz (and therefore whose bandwidth is $100+5$ kHz) has to be sampled by at least $F_{am} = \frac{1}{T_{am}} = 210$ kHz in order to represent it in Matlab as $x[n] = A_c m_{am}[n] \cos(2 \pi f_c n T_{am} + \phi)$.

Note that in the latter case of th AM, the message signal $m(t)$ is oversampled by about $F_{am}/F_{bb} = 210/10 = 21$ to be able to define the sample by sample product $x[n] = A_c m[n] \cos(2\pi f_c nT_s + \phi)$. Hence the number of samples in the AM modulated (and demodulated) signal which represent the audio information will be about $21$ times more than that of the original baseband audio representation.

Typically you would downsample the demodulated audio in order to reduce its sampling rate (and sample count).

Let's have a look at the concept of the AM modulation.

The simplest linear amplitude modulation formula (for DSB-SC) is:

$$m(t) = A(t) \cos(wt + \phi).$$

In amplitude modulation; you have a carrier signal that has a frequency that is fixed, $\phi$ function can be omitted, and a transmission signal which has it's information in $A(t)$ function. So we are basically modulating our signal to shape of the carrier.

There are different techniques for demodulation of AM modulated signals. The most basic method we can think about how to demodulate this signal is basically detecting the envelope of the signal. In real world, it is a matter of a diode and a well decided capacitor. In MATLAB, you have to simulate those characteristics.

There is an example of envelope detection here.

There is another way which is waaaay more easier to implement in MATLAB. The method is called "phase locked loop" (or something like that). Note that you can use this method IF your signal IS synchronous. The block diagram of this demodulation method is like this:

## The most common mistake when applying analog demodulation techniques in MATLAB is sampling. You have to take your samples on the right frequency, and at the right points.

I hope this is a bit enlightening for you in the terms of amplitude modulation techniques. There is more of the demodulation methods, however who needs all of them anyway? Just take a look at them and find the method that fits for your needs. I used phase locked loop the most so if there is no specific needs, I suggest you to use it.

As always, Have a nice day.

• So after more research, this is the matlab code I came up with: %read in the audio [y,Fs]=audioread('Signal1.wav'); [gt,fs]=audioread('Signal1_gt.wav'); %demodulate the audio x=sin(pi); y=y*x; %low pass filter h=10*sinc(10*(-10:10)); y1=filter(h,1,y); %down sample y1=downsample(y1,Fs/fs); But when I try to plot it out, the y1 signal is much more smaller than gt signal in term of magnitute. What you reckon the problem is? – Anh Tran Oct 17 '17 at 12:34
• It's not a problem at all. You will be still able to hear all the voice clearly. However, this generally happens due to filtering. Since you are basically multiplying your signal while filtering, low filter responses can occur as the lower magnitude signal. – Furkan Küçük Oct 18 '17 at 7:43