AM, FM, and PM Modulation Implementation in MATLAB

matlab
modulation
am fm pm
signal processing
source code

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
ON OFF Keying (OOK) MATLAB Code

ON OFF Keying (OOK) MATLAB Code

MATLAB code for ON OFF Keying (OOK) modulation, including output plots, relevant equations, and download links. OOK is a digital modulation technique.

matlab
ook
modulation

Convolution in MATLAB: Source Code and Explanation

Explore convolution in MATLAB with example code demonstrating manual calculation and the built-in 'conv' function. Understand the sliding-and-summing process and verify results.

matlab
convolution
signal processing
Decimation/Downsampling MATLAB Source Code

Decimation/Downsampling MATLAB Source Code

MATLAB code demonstrating decimation/downsampling, removing samples to reduce the sample rate of a signal or vector. Includes examples using exponential vectors and the 'decimate' function.

matlab
decimation
downsampling