0
\$\begingroup\$

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
[y,Fs]=audioread('Signal1.wav');
[gt,fs]=audioread('Signal1_gt.wav');

%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?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ Commented Oct 18, 2017 at 1:39

2 Answers 2

1
\$\begingroup\$

I suspect that the problem lies in the FIR filter kernel you generate. (-10:10) generates a vector of 21 successive integers [-10, -9, -8 ... 8, 9, 10]. You then perform an elementwise multiplication of said vector by 10, resulting in the vector [-100, -90, -80 ... 80, 90, 100]. Finally you compute the sinc of each element, resulting in the vector [-0.0051, 0.0100, -0.0124 ... -0.0124, 0.0100, -0.0051]. Note that each sample is 10 rad (573 degrees) apart due to that multiplication by 10, which means that your filter is actually designed for a frequency a few times greater than the nyquist frequency at your sample rate. Probably not what you intended, and such a filter won't work at all.

\$\endgroup\$
0
\$\begingroup\$

Depending on the toolboxes you have, there is a amdemod function

https://uk.mathworks.com/help/comm/ref/amdemod.html

z = amdemod(y,Fc,Fs) demodulates the amplitude modulated signal y from a carrier signal with frequency Fc (Hz). The carrier signal and y have sample frequency Fs (Hz). The modulated signal y has zero initial phase and zero carrier amplitude, so it represents suppressed carrier modulation. The demodulation process uses the lowpass filter specified by [num,den] = butter(5,Fc*2/Fs).

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.