Frequency Modulation Using Message Signal as A Square in Matlab with Waveforms

By
Advertisement
clc;
clear all;
close all;
fc=30;
fm=2;
dev=20;
fs=100*fc;
t=0:1/fs:2/fm;
mt=square(2*pi*fm*t);
ct=sin(2*pi*fc*t);
st1=fmmod(mt,fc,fs,dev);
st2=pmmod(mt,fc,fs,dev);
figure(1);
subplot(4,1,1);
plot(t,mt,'r');
title('msg signal');
xlabel('time');
ylabel('amplitude');
subplot(4,1,2);
plot(t,ct);
title('carrier signal');
xlabel('time');
ylabel('amplitude');
subplot(4,1,3);
plot(t,st1);
title('fm modulated signal');
xlabel('time');
ylabel('amplitude');
subplot(4,1,4);
plot(t,st2);
title('pm modulated signal');
xlabel('time');
ylabel('amplitude');


2 comments: