Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

clc;

clear all;
close all;
fs=10000;
ac=1;
am=1;
fm=35;
fc=500;
b=10;
t=(0:0.1*fs)/fs;
wc=2*pi*fc;
wm=2*pi*fm;
mt=am*cos(wm*t);
figure(1) subplot(4,1,1);
plot(t,mt);
title('modulating signal');
ct=ac*cos(wc*t);
subplot(4,1,2);
plot(t,ct);
title('carrier signal');
st=ac*cos((wc*t)+b*sin(wm*t));
subplot(4,1,3);
plot(t,st);
title('modulated signal');
zct = fft(ct);
zct = abs(zct(1:length(zct)/2+1));
frqct = [0:length(zct)-1]*fs/length(zct)/2;
zmt = fft(mt);
zmt = abs(zmt(1:length(zmt)/2+1));
frqmt = [0:length(zmt)-1]*fs/length(zmt)/2;
zst = fft(st);
zst = abs(zst(1:length(zst)/2+1));
frqst = [0:length(zst)-1]*fs/length(zst)/2;
figure(2)
subplot(3,1,1)
plot(frqct,zct)
title('carrier signal');
xlabel('Frequency (Hz)')
subplot(3,1,2) plot(frqmt,zmt)
title('modulating signal');
xlabel('Frequency (Hz)')
subplot(3,1,3)
plot(frqst,zst)
title('modulated signal');
xlabel('Frequency (Hz)')

You might also like