views:

8

answers:

0

hi i was trying to implement the amdemod given in matlab without using this function, i am not getting the answer close to the amswer given by the function. can u please let me know , wwhere is the problem. The code i tried are as follows:

Fs = 8000; % Sampling rate is 8000 samples per second. Fc = 300; % Carrier frequency in Hz t = [0:.1*Fs]'/Fs; % Sampling times for .1 second x = sin(20*pi*t); % Representation of the signal m = cos(2*pi*t*Fc); % carrier signal y = ammod(x,Fc,Fs); % Modulate x to produce y. z = amdemod(y,Fc,Fs);% amplitude demodulation of y figure; subplot(2,1,1); plot(t,x); % Plot x on top. subplot(2,1,2); plot(t,z); for i=0:.1*Fs % my code first multiplied by carrier k(i+1)=y(i+1)*m(i+1); end [num,den] = butter(5,2*Fc/Fs,'low'); %using lowpass butterworth filter as given by matlab to use l= filter(num,den,k); % filter the k signal to get the demolulated signal

figure; subplot(2,1,1) ; plot(t,l); % plot demodulated signal not matching with the demodulated by the matlab function