# Demodulate a AM signal from the carrier using Matlab

So the AM signal has a bandwidth of 5kHz and the carrier signal is 100kHz. I demodulate the AM signal by multiplying it to a sin function (sin(2000000*pi), same frequency with the carrier frequency).

This is my take in Matlab for the ideal:

%read in the audio

%demodulation
for t=1:1:size(y,1)
x=sin(200000*pi*(t/Fs));
y(t,1)=y(t,1)*x;
y(t,2)=y(t,2)*x;
end

%low pass filter
h=10*sinc(10*(-10:10));
y1=filter(h,1,y);

%down sample
y1=downsample(y1,Fs/fs);

%plot
t=1:size(y1,1);
plot(t,y1,t,gt);


But when comparing to the ground truth signal, it's far from correct. Any suggestions?

• What's the sample rate of the modulated carrier (Fs), and the baseband (fs)? Could you please upload the plot your code produces? It's a key piece of information regarding your question. – jms Oct 18 '17 at 1:39