Stuck in demodulation of AM

3 views (last 30 days)
Abdul Basit Jaweed
Abdul Basit Jaweed on 23 Apr 2016
Edited: Walter Roberson on 29 Jan 2021
I am working on a Amplitude modulation and Demodulation But i have facing trouble in only demodulation using RC low pass Filter I have upload my code and also required results picture
clear all;
close all;
t1 = [0:0.001:10];
Ac=1; fc =10; fm=1; C = 1.5;
carrier = Ac*sin(2*pi*fc*t1); % Carrier signal, Ac and fc are amplitude and frequency
message = sin(2*pi*fm*t1); % Modulating signal, fm is message frequency
am = Ac*(C + message).*carrier; % am is Modulated signal first method
%am = ammod(message,fc,2*fc); % am is Modulated signal second method
r = abs(am); % Rectified Signal
% [num,den] = butter(1,fc*2/fm); % Lowpass filter
% s1 = amdemod(am,fc,fm,0,0,num,den); % Demodulate
figure(1);
subplot(3,1,1) plot(t1, message); title('Original Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
subplot(3,1,2) plot(t1, carrier); title('Carrier Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
subplot(3,1,3) plot(t1, am); title('AM Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
figure(2);
subplot(3,1,1) plot(t1, r); title('Rectified Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
subplot(3,1,2) plot(t1, s1); title('Demodulated Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
picture of required waveform
  2 Comments
Star Strider
Star Strider on 23 Apr 2016
I don’t have the Communications System Toolbox so I won’t list this as an Answer, since I can’t run your code.
It seems that your demodulated signal simply has high-frequency noise. I would re-design your low-pass filter, either to have a lower cutoff frequency or a sharper cutoff (higher order). I would also use the filtfilt function if you have the Signal Processing Toolbox (or if the Communications System Toolbox has it or a version of it, since it is phase-neutral).
Palempalle Pavan Kumar Reddy
yes, It's doesn't working fine showing error like ..
Error using butter (line 58)
The cutoff frequencies must be within the interval of (0,1).
Error in goona (line 13)
[num,den] = butter(2,fc*2/fm)

Sign in to comment.

Answers (1)

Mathieu NOE
Mathieu NOE on 29 Jan 2021
hello
you should use a bandpass filter to remove the DC value of the rectified signal
clear all;
close all;
Fs = 1000;
dt = 1/Fs;
t1 = [0:dt:10];
Ac=1;
fc =10;
fm=1;
C = 1.5;
carrier = Ac*sin(2*pi*fc*t1); % Carrier signal, Ac and fc are amplitude and frequency
message = sin(2*pi*fm*t1); % Modulating signal, fm is message frequency
am = Ac*(C + message).*carrier; % am is Modulated signal first method
%am = ammod(message,fc,2*fc); % am is Modulated signal second method
r = abs(am); % Rectified Signal
% filter
f_high = 2*fm;
f_low = 0.5*fm;
[num,den] = butter(2,[f_low f_high]*2/Fs); % Lowpass filter
% s1 = amdemod(am,fc,fm,0,0,num,den); % Demodulate
s1 = filter(num,den,r);
figure(1);
subplot(3,1,1),plot(t1, message); title('Original Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
subplot(3,1,2),plot(t1, carrier); title('Carrier Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
subplot(3,1,3),plot(t1, am); title('AM Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
figure(2);
subplot(2,1,1),plot(t1, r); title('Rectified Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;
subplot(2,1,2),plot(t1, s1); title('Demodulated Signal'); xlabel('Time'); ylabel('Amplitude'); grid on;

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!