Awgn
Awgn
% Parameters
N = 10; % Number of bits
SNR_dB = 10; % Signal-to-Noise Ratio in dB
Tb = 1; % Bit duration (seconds)
fs = 100; % Sampling frequency (Hz)
Samples_per_bit = Tb * fs;
% Generate AWGN
noise = sqrt(noise_power) * randn(1, length(tx_signal_unsampled));
% Calculate errors
num_errors = sum(rx_data ~= data);
BER = num_errors / N;
% Display results
disp(['Number of errors: ', num2str(num_errors)]);
disp(['Bit Error Rate (BER): ', num2str(BER)]);
% Transmitted Signal
subplot(2, 1, 1);
plot(time, tx_signal_unsampled, 'b');
title('Transmitted Binary Baseband Signal');
xlabel('Time (seconds)');
ylabel('Amplitude');
% Received Signal
subplot(2, 1, 2);
plot(time, rx_signal, 'b');
title('Received Signal with AWGN');
xlabel('Time (seconds)');
ylabel('Amplitude');