MATLAB Script
% The code is developed by SalimWireless.Comclc;
clear;
close all;
% Parameters
frequency = 10; % Message signal frequency (Hz)
carrier_frequency = 100; % Carrier signal frequency (Hz)
fs = 1000; % Sampling frequency
% Time values
t = linspace(0, 1, 10000);
% Message signal
message_signal = sin(2 * pi * frequency * t);
% Carrier signal
carrier_signal = cos(2 * pi * carrier_frequency * t);
% DSB-SC Modulation
dsbsc_modulated_signal = message_signal .* carrier_signal;
% DSB-SC Demodulation
dsbsc_demodulated_signal = dsbsc_modulated_signal .* carrier_signal;
% Low-pass filter
lpf_cutoff = frequency; % Low-pass filter cutoff frequency
[b, a] = butter(6, lpf_cutoff / (0.5 * fs)); % 6th-order Butterworth filter
dsbsc_demodulated_signal_filtered = filter(b, a, dsbsc_demodulated_signal);
% Plot results
figure;
% Subplot 1: Message signal
subplot(3, 1, 1);
plot(t, message_signal, 'b');
title('Message Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Subplot 2: DSB-SC Modulated Signal
subplot(3, 1, 2);
plot(t, dsbsc_modulated_signal, 'r');
title('DSB-SC Modulated Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Subplot 3: DSB-SC Demodulated Signal
subplot(3, 1, 3);
plot(t, dsbsc_demodulated_signal_filtered, 'g');
title('DSB-SC Demodulated Signal (Filtered)');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Optional: Adjust spacing for better visualization
sgtitle('DSB-SC Modulation and Demodulation');