MATLAB Script
% The code is developed by SalimWireless.Com
clc;
clear;
close all;
% Parameters
numSymbols = 1000; % Number of symbols to simulate
symbolIndices = randi([0 1], numSymbols, 1); % Random binary symbols (0 or 1)
% ASK Modulation (BASK)
askAmplitude = [0, 1]; % Amplitudes for binary ASK
askSymbols = askAmplitude(symbolIndices + 1); % Modulated BASK symbols
% FSK Modulation (Modified BFSK with 90-degree offset)
fs = 100; % Sampling frequency
symbolDuration = 1; % Symbol duration in seconds
t = linspace(0, symbolDuration, fs*symbolDuration);
fBase = 1; % Base frequency
frequencies = [fBase, fBase]; % Same frequency for both
% Generate FSK symbols with 90° phase offset
fskSymbols = arrayfun(@(idx) ...
cos(2*pi*frequencies(1)*t) * (1-idx) + ...
1j * cos(2*pi*frequencies(2)*t) * idx, ...
symbolIndices, 'UniformOutput', false);
% Extract last points (constellation points)
fskConstellation = cellfun(@(x) x(end), fskSymbols);
% PSK Modulation (BPSK)
pskSymbols = exp(1j * pi * symbolIndices); % Binary PSK symbols in complex plane
% Plotting
figure;
% ASK Constellation Diagram
subplot(1, 3, 1);
scatter(real(askSymbols), zeros(size(askSymbols)), 'filled');
grid on;
title('Binary ASK (BASK) Constellation');
xlabel('In-phase');
ylabel('Quadrature');
axis([-1.5 1.5 -1.5 1.5]);
% FSK Constellation Diagram
subplot(1, 3, 2);
scatter(real(fskConstellation), imag(fskConstellation), 'filled');
grid on;
title('Binary FSK (BFSK) Constellation with 90° Offset');
xlabel('In-phase');
ylabel('Quadrature');
axis([-1.5 1.5 -1.5 1.5]);
% PSK Constellation Diagram
subplot(1, 3, 3);
scatter(real(pskSymbols), imag(pskSymbols), 'filled');
grid on;
title('Binary PSK (BPSK) Constellation');
xlabel('In-phase');
ylabel('Quadrature');
axis([-1.5 1.5 -1.5 1.5]);