clear
clc
Fc=1000;
Fs=100000;
T=0.02;
Ns=Fs*T;
t=0:1/Fs:(Ns-1)/Fs;
x=[-1:T/10:1-T/10];
x=[x,[1:-T/10:-1+T/10]];
zb=cos(2*pi*Fc*t);
freqdev=1000;
phasedev=pi;
yfm=fmmod(x,Fc,Fs,freqdev);
ypm=pmmod(x,Fc,Fs,phasedev);
figure(1);
subplot(4,1,1)
plot(t,x);
title('调制波形')
subplot(4,1,2)
plot(t,zb);
title('载波波形')
subplot(4,1,3)
plot(t,yfm);
title('FM波形')
subplot(4,1,4)
plot(t,ypm);
title('PM波形')