RF Wireless World

Home of RF and Wireless Vendors and Resources

One Stop For Your RF and Wireless Need

AM,FM,PM modulation in matlab

This section of MATLAB source code covers AM,FM,PM modulation in matlab. It mentions the same using modulate matlab function.

Modulate matlab function

%Parameters for signal creation
Fs = 8000; %sampling frequency
t = (0:1000-1)/Fs; %Time vector
s = 4*cos(2*pi*500*t); %modulating signal

sdft = fft(s);
N=length(s);
sdft = sdft(1:N/2+1);
psdy1 = (1/(Fs*N)) * abs(sdft).^2;
psdy1(2:end-1) = 2*psdy1(2:end-1);
freq = 0:Fs/length(s):Fs/2;
figure;plot(freq,10*log10(psdy1)); %FD spectrum of unmodulated signal

y = modulate(s,3e3,Fs,'am',0.1); %modulated signal
ydft = fft(y);
N=length(y);
ydft = ydft(1:N/2+1);
psdy = (1/(Fs*N)) * abs(ydft).^2;
psdy(2:end-1) = 2*psdy(2:end-1);
freq = 0:Fs/length(y):Fs/2;
figure;plot(freq,10*log10(psdy)); %FD spectrum of modulated signal

Output  Similar to this FM and PM modulation can also be carried out using modulate function by changing forth argument to 'fm' or 'pm' respectively.