MatlabCode
MatlabCode
fs=100//sampling frequency
fc=10
fm1=3
fm2=5
vm1=Vm1.*cos(2.*fm1.*%pi.*t)//modulating signal 1
vm2=Vm2.*cos(2.*fm2.*%pi.*t)//modulating signal 2
figure(1)
subplot(3,1,1)
plot(t,vm)
xlabel("t")
ylabel("vm")
title("Modulating Signal")
vc=Vc.*cos(2*fc.*%pi.*t)//carrier signal
subplot(3,1,2)
plot(t,vc)
xlabel("t")
ylabel("vc")
title("Carrier Signal")
xlabel("t") ;
ylabel("vam");
figure(2)
subplot(2,1,1)
xlabel("f")
ylabel("Magnitude")
title("AM Spectrum")
demod=vam.*vc//local oscillator
//x=abs(fft(demod))
//subplot(3,1,2)
//plot(f,x)
lpf=[ones(1,4.*fm2),zeros(1,l-4.*fm2)]
recov=abs(fft(demod)).*lpf
subplot(2,1,2)
plot (t,ifft(recov))
xlabel("t")
ylabel("v_demod")
title("Demodulated Signal")