# Low Pass Filter in AM Demodulation

I am trying to recover my baseband signal that was AM modulated. I am using the filter command in MATLAB to perform the low pass filtering ...the code is given below:

Fsig=10;                    Fc=100;              Fsamp=10.*Fc;
t = 0:1/Fsamp:2*pi;

Tx = cos(2.*pi.*Fsig.*t);               % Transmitted Signal
Carrier = cos(600.*t);                  % Carrier Signal
Modulated = Tx.*Carrier;                % Modulated Signal
Demodulated = Modulated.*Carrier;       % Demodulated Signal

Rx= filter([1 1],[1 -0.8],Demodulated);

figure(6);
plot(t,Tx,'r',t,Modulated,'b',t,Demodulated,'g',t,Rx,'k','LineWidth',1.5); grid on;
legend('Trans.','Modulated','Demodulated','Baseband')


How can I select the coefficients of the filter to perfectly recover my baseband signal? Is there any other technique/command that can be used in matlab to recover the baseband signal other than this?

MATLAB has amdemod (see MATLAB documentation) which can be used to recover suppressed carrier AM modulated signal. From the documentation, the demodulator uses a low-pass filter generated using [num,den] = butter(5,Fc*2/Fs). This can be a good start.

In your simulation, the sampling frequency is 1000 Hz, which means the Nyquist frequency is 500 Hz. The carrier frequency is very close to 95.5 Hz (600/(2*pi)). The message has frequency 10 Hz. This means the signal Demodulated has harmonics at frequencies 10, 181, and 201 Hz. So, the cut-off frequency of your low-pass filter can be set at any frequency above 10 and below 181. Let's say you want it at 100 Hz. Matlab has many commands to design filters. A simple one is fir1:

b = fir1(10,100/500);


The 100/500 is your cutoff frequency divided by the Nyquist frequency. The first argument, 10, is the filter order.

To recover the message, you can convolve Demodulated with the filter's impulse response b:

Rx = conv(Demodulated, b);


By the way, I would change the name of the signal Demodulated, since it's not really demodulated yet. A better name might be rx_mixed or something along those lines.