DSB SC DEMODULATION in matlab
119 views (last 30 days)
Show older comments
Jetty Rakesh Aditya
on 9 Nov 2020
I have done DSB SC modulation and demodulation. My problem is that my demodulated signal amplitude is far greater than that of message signal. Can someone help me why this is happening? My code is as follows:
clear all;
clc;
t = 0:0.001:5; %time.
fm = 1;%frequency of message signal.
fc = 10;%frequency of carrier signal.
fs=100*fc;%sampling frequency.
Am = 5;%Amplitude of message signal.
Ac = 5;%Amplitude of carrier signal.
msg =Am.*cos(2*pi*fm*t);%message signal.
carrier = Ac.*cos(2*pi*fc*t);%carrier signal.
%% DSB SC MODULATION AND DEMODULATION.
%===========DSB SC IN TIME DOMAIN==================
dsb_sc = msg.*carrier; %dsb sc modulated wave
%=====DSB SC IN FREQUENCY DOMAIN============
ld=length(dsb_sc);
f=linspace(-fs/2,fs/2,ld);
DSB_SC=fftshift(fft(dsb_sc,ld)/ld); %frequency spectrum of dsb_sc modulated signal.
%=====DSB SC DEMODULATION TIME DOMAIN============
pmo = 2*dsb_sc.*carrier; %product modulator output
pmo = pmo/Ac;
nf = fm/fs; %normalised frequency
[num, den] = butter(5,3*nf); %butter worth lpf of 5th order
msg_r = filter(num,den,pmo); %demodulated signal after passing through lpf
%=====DSB SC DEMODULATION FREQUENCY DOMAIN============
lr=length(msg_r);
fr=linspace(-fs/2,fs/2,lr); %frequency bins
MSG_R=fftshift(fft(msg_r,lr)/lr); %frequency spectrum of demodulated signal
%================ PLOTTING =========================
subplot(4,1,1);
plot(t, msg);
title("MESSAGE SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
subplot(4,1,2);
plot(t, carrier);
title("CARRIER SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
subplot(4,1,3);
plot(t, dsb_sc);
title("MODULATED DSB SC SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
subplot(4,1,4);
plot(t, msg_r);
title("DEMODULATED DSB SC SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
figure;
subplot(2,1,1);
plot(f, abs(DSB_SC));
xlim([-15 15]);
title('DSB SC MODULATION IN FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
grid on;
subplot(2,1,2);
plot(fr, abs(MSG_R));
xlim([-6 6]);
title('DSB SC DE MODULATION IN FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
grid on;
0 Comments
Accepted Answer
Sindhu Karri
on 13 Nov 2020
Hi,
Here, message signal amplitude is ‘Am’,carrier signal amplitude is ‘Ac’,
1)Modulated signal is product of message signal and carrier signal ,amplitude of modulated signal is given by Am*Ac.
2)Demodulated signal is product of modulated signal and carrier signal,amplitude of demodulated signal is Am*Ac*Ac.
3)To get this demodulated signal amplitude equal to message signal it needs to be divided by Ac*Ac
Refer to below attached code for better understanding:
t = 0:0.001:5;
fH = 15;
fL = 2;
Ah=5;
Al=10;
xH = Ah*sin(2*pi*fH.*t);
xL = Al*sin(2*pi*fL.*t);
% Modulation
y = xL.*xH;
% De-Modulation By Synchoronous Method
m = (y.*xH)./(Ah*Ah);
% Filtering High Frequencies
[n,w] = buttord(2/1000,4/1000,.5,5);
[a,b] = butter(n,w,'low');
dem = filter(a,b,m);
subplot(2,2,1);
plot(t,xH,'b',t,xL,'r');
title('m(t) & c(t)');
grid;
subplot(2,2,2);
plot(t,y,'k');
title('DSBSC');
grid;
subplot(2,2,3);
plot(t,m);
title('De-Modulated');
grid;
0 Comments
More Answers (5)
Abinaya
on 6 May 2023
t = 0:0.001:5; fH = 15; fL = 2; Ah=5; Al=10; xH = Ah*sin(2*pi*fH.*t); xL = Al*sin(2*pi*fL.*t); % Modulation y = xL.*xH; % De-Modulation By Synchoronous Method m = (y.*xH)./(Ah*Ah); % Filtering High Frequencies [n,w] = buttord(2/1000,4/1000,.5,5); [a,b] = butter(n,w,'low'); dem = filter(a,b,m); subplot(2,2,1); plot(t,xH,'b',t,xL,'r'); title('m(t) & c(t)'); grid; subplot(2,2,2); plot(t,y,'k'); title('DSBSC'); grid; subplot(2,2,3); plot(t,m); title('De-Modulated'); grid;
0 Comments
Abinaya
on 6 May 2023
t = 0:0.001:5; fH = 15; fL = 2; Ah=5; Al=10; xH = Ah*sin(2*pi*fH.*t); xL = Al*sin(2*pi*fL.*t); % Modulation y = xL.*xH; % De-Modulation By Synchoronous Method m = (y.*xH)./(Ah*Ah); % Filtering High Frequencies [n,w] = buttord(2/1000,4/1000,.5,5); [a,b] = butter(n,w,'low'); dem = filter(a,b,m); subplot(2,2,1); plot(t,xH,'b',t,xL,'r'); title('m(t) & c(t)'); grid; subplot(2,2,2); plot(t,y,'k'); title('DSBSC'); grid; subplot(2,2,3); plot(t,m); title('De-Modulated'); grid;
if true
% code
end
0 Comments
Abinaya
on 6 May 2023
Clc; Clear all; Close all; t=0: .001:1; fm=5; fc=50; m=(1/2*sin(2*pi*fm*t)); subplot(6,1,1); Plot(m); title('message signal'); C=cos(2*pi*fc*t); Subplot(6,1,2); Plot(c); title('carrier signal'); y=m.*c; Subplot(6,1,3); Plot(y); title('DSB-SC signal'); \demodulation of dsbsc S1=y.*c; [b,a]=butter(5,0.1); S2=filter(b,a,S1); Subplot(6,1,4); Plot(S2); title('demodulation of DSBSC');
0 Comments
Kishore
on 22 Mar 2024
clear all;
clc;
t = 0:0.001:5; %time.
fm = 1;%frequency of message signal.
fc = 10;%frequency of carrier signal.
fs=100*fc;%sampling frequency.
Am = 5;%Amplitude of message signal.
Ac = 5;%Amplitude of carrier signal.
msg =Am.*cos(2*pi*fm*t);%message signal.
carrier = Ac.*cos(2*pi*fc*t);%carrier signal.
%% DSB SC MODULATION AND DEMODULATION.
%===========DSB SC IN TIME DOMAIN==================
dsb_sc = msg.*carrier; %dsb sc modulated wave
%=====DSB SC IN FREQUENCY DOMAIN============
ld=length(dsb_sc);
f=linspace(-fs/2,fs/2,ld);
DSB_SC=fftshift(fft(dsb_sc,ld)/ld); %frequency spectrum of dsb_sc modulated signal.
%=====DSB SC DEMODULATION TIME DOMAIN============
pmo = 2*dsb_sc.*carrier; %product modulator output
pmo = pmo/Ac;
nf = fm/fs; %normalised frequency
[num, den] = butter(5,3*nf); %butter worth lpf of 5th order
msg_r = filter(num,den,pmo); %demodulated signal after passing through lpf
%=====DSB SC DEMODULATION FREQUENCY DOMAIN============
lr=length(msg_r);
fr=linspace(-fs/2,fs/2,lr); %frequency bins
MSG_R=fftshift(fft(msg_r,lr)/lr); %frequency spectrum of demodulated signal
%================ PLOTTING =========================
subplot(4,1,1);
plot(t, msg);
title("MESSAGE SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
subplot(4,1,2);
plot(t, carrier);
title("CARRIER SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
subplot(4,1,3);
plot(t, dsb_sc);
title("MODULATED DSB SC SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
subplot(4,1,4);
plot(t, msg_r);
title("DEMODULATED DSB SC SIGNAL (TIME DOMAIN)");
xlabel('time (sec)');
ylabel('amplitude');
grid on;
figure;
subplot(2,1,1);
plot(f, abs(DSB_SC));
xlim([-15 15]);
title('DSB SC MODULATION IN FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
grid on;
subplot(2,1,2);
plot(fr, abs(MSG_R));
xlim([-6 6]);
title('DSB SC DE MODULATION IN FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
grid on;
0 Comments
See Also
Categories
Find more on Modulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!