Professional Documents
Culture Documents
Question 4
Question 4
D. Modulation:
modulated_signal = 1 - 2 * encoded_bits; maps the encoded bits to modulated signals.
E. Add Noise:
noise = sqrt(sigma) * randn(1, length(modulated_signal)); generates Gaussian noise.
received_signal = modulated_signal + noise; adds the noise to the modulated signal.
F. Demodulation:
detected_bits = received_signal < 0; demodulates the received signal.
G. Decoding:
decoded_bits = decodeHam(detected_bits); decodes the received bits using Hamming
decoding.
I. SNR Sweep:
The code then simulates the system over a range of signal-to-noise ratios (SNR).
For each SNR value, it repeats steps 5-7 and calculates the BER.
The BER values for different SNR levels are stored in the array ber.
J. Plotting:
semilogy(snr, ber); plots the BER against SNR in logarithmic scale.
Labels and titles are added to the plot.