ARVIND KUMAR
clc;
clear all;
close all;
fc = 1000; % Carrier frequency in Hz
fs = 10000; % Sampling frequency in Hz
t = 0:1/fs:0.05; % Time vector from 0 to 0.05 seconds
data = [1 0 1 1 0 1]; % Binary data to be transmitted
% Calculate how many samples each bit represents
samples_per_bit = length(t) / length(data);
mt = []; % Initialize mt
for i = 1:length(data)
% Repeat each bit according to samples per bit
mt = [mt repmat(data(i), 1, round(samples_per_bit))];
end
% Adjust mt size to match time vector length if necessary
mt = mt(1:length(t));
carrier = sin(2 * pi * fc * t); % Generate carrier signal (sinusoidal wave)
ask = mt .* carrier; % ASK Modulation (multiplying message signal with carrier)
figure;
subplot(3,1,1);
plot(t, mt);
title('Message Signal (Data)');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,2);
plot(t, carrier);
title('Carrier Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,3);
plot(t, ask);
title('ASK Modulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');