AM, FM, and PM Modulation Implementation in MATLAB

This section provides MATLAB source code demonstrating AM, FM, and PM modulation. It utilizes the modulate MATLAB function.

Using the 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

% Frequency Domain analysis of unmodulated 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));
title('Frequency Spectrum of Unmodulated Signal');
xlabel('Frequency (Hz)');
ylabel('Power Spectral Density (dB/Hz)');

% AM Modulation
y = modulate(s, 3e3, Fs, 'am', 0.1); % Modulated signal

% Frequency Domain analysis of 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));
title('Frequency Spectrum of AM Modulated Signal');
xlabel('Frequency (Hz)');
ylabel('Power Spectral Density (dB/Hz)');

Unmodulated Input Signal:

unmodulated input signal

AM Modulated Signal Output:

AM modulated signal output

FM and PM Modulation

Similar to AM, FM and PM modulation can also be implemented using the modulate function by changing the fourth argument to 'fm' or 'pm' respectively. For example:

% FM Modulation
y_fm = modulate(s, 3e3, Fs, 'fm', 10); % 10 is the modulation index here

% PM Modulation
y_pm = modulate(s, 3e3, Fs, 'pm', 5); % 5 is the modulation index here