0% found this document useful (0 votes)
2 views

2modulating Code

The document outlines a script for simulating amplitude modulation (AM) using two modulating signals combined with a carrier signal. It includes plotting the carrier signal, modulating signals, and the resulting AM signal in both time and frequency domains. Additionally, it demonstrates synchronous detection and demodulation of the AM signal to recover the original modulating signals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

2modulating Code

The document outlines a script for simulating amplitude modulation (AM) using two modulating signals combined with a carrier signal. It includes plotting the carrier signal, modulating signals, and the resulting AM signal in both time and frequency domains. Additionally, it demonstrates synchronous detection and demodulation of the AM signal to recover the original modulating signals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

// 2modulating.

sci

fs=100; //sampling frequency

t=[0:1/fs:10-1/fs]; //time interval from 0 to 10

Vc=15; // peak amplitude of carrier signal

fc=16; // frequency of carrier signal

l=length(t); //length of time vector

figure(1)

x=Vc*sin(2*%pi*fc*t); //carrier signal

subplot(3,1,1)

plot(t,x) // to plot the carrier signal

xgrid(4,7,"r")

xlabel("t", "fontsize", 4, "color", "black") // to label x-axis

ylabel("x", "fontsize", 4, "color", "black") // to label y-axis

title("Carrier Signal")

Vm1=8; // amplitude of first modulating signal

fm1=6; // 1st modulating signal

y1=Vm1*sin(2*%pi*fm1*t);

Vm2=2; // amplitude of second modulating signal

fm2=3; // 2nd modulating signal

y2=Vm2*sin(2*%pi*fm2*t);

y=y1+y2; //to add 1st and 2nd modulating signal

subplot(3,1,2)
plot(t,y) //to plot t-vs-modulating signal

xgrid(4,7,"r")

xlabel("t", "fontsize", 3, "color", "black") // to label x-axis

ylabel("y", "fontsize", 3, "color", "black") // to label y-axis

title("Modulating Signal")

vAM=(Vc+y).*sin(2*%pi*fc*t); //equation of vAM

subplot(3,1,3)

plot(t,vAM) //to plot the modulated signal in time domain

xgrid(4,7,"r")

xlabel("t", "fontsize", 3, "color", "black") // to label x-axis

ylabel("vAM", "fontsize", 3, "color", "black") // to label y-axis

title("AM signal in time domain")

n=[-l/2:l/2-1]*fs/l; //taking fft of z

z1=abs(fftshift(fft(vAM)));

figure(2)

subplot(3,1,1)

plot(n,z1) //plot t-vs-z1

xgrid(4,7,"r")

xlabel("f", "fontsize", 3, "color", "black") // to label x-axis

ylabel("magnitude", "fontsize", 3, "color", "black") // to label y-axis

title("Modulated signal in frequency domain") // title of graph

vm_det=vAM.*sin(2.*%pi.*fc.*t); //Synchronous detection

vm_demod=abs(fft(vm_det));
lpf=[ones(1,15*fm1), zeros(1,l-15*fm1)];

b=fft(vm_det).*lpf

C=real(ifft(b))

subplot(3,1,2)

plot(t,C)

xlabel("t")

ylabel("vm-demod")

title("Demodulated signal")

You might also like