Modulation and Demodulation FSK/BPSK

4 views (last 30 days)
Michael Angeles
Michael Angeles on 2 May 2022
Edited: Sudarsanan A K on 6 Oct 2023
Hi,
Need help to create a modulate/demodulate file.
  1. I have "DATA_X" that I need to modulate then demodulate after to simulate data transmitted.
  2. I then have to add random noise to this modulate to see how much data transmitted is correct or incorrect after demodulated.
I just need some examples that I can utilize with the matlab communications toolbox since I have not used this add-on before.
Thank you!

Answers (1)

Sudarsanan A K
Sudarsanan A K on 4 Oct 2023
Edited: Sudarsanan A K on 6 Oct 2023
Hello Michael,
I understand that you are looking for a working example code that illustrate modulation of a given data, transmission of the modulated data over a noisy channel and demodulation of the received noisy signal to estimate the actual data. Also, you would like to evaluate the performance of the modulation scheme, probably using error metrics such as Bit Error Rate (BER). I also understand that you are particularly interested in exploring the features and functionalities that the Communications Toolbox provide for digital baseband modulation schemes such as FSK, BPSK, QPSK, QAM, etc.
In this case, here is a small working example that demonstrates the mentioned tasks by using functions available from the Communications Toolbox.
% Parameters
data = [0 1 1 0 1 0 1 1]; % Example data to be transmitted - the data stream
snr_dB = 0.1; % Signal-to-Noise Ratio (in dB)
% Modulation
modulated_data = pskmod(data, 2); % BPSK modulation
% Adding noise
noisy_data = awgn(modulated_data, snr_dB); % Add Gaussian noise
% Demodulation
demodulated_data = pskdemod(noisy_data, 2); % BPSK demodulation
% Calculate bit error rate (BER)
bit_errors = sum(data ~= demodulated_data);
bit_error_rate = bit_errors / length(data);
% Display results
disp("Original Data: " + num2str(data))
Original Data: 0 1 1 0 1 0 1 1
disp("Demodulated Data: " + num2str(demodulated_data))
Demodulated Data: 0 0 1 0 1 0 0 1
disp("Bit Error Rate: " + num2str(bit_error_rate))
Bit Error Rate: 0.25
Feel free to adjust the 'snr_dB' variable to see how the modulation scheme performs in terms of BER at different SNR regimes.
Digital baseband modulation schemes can be implemented using MATLAB's Communications Toolbox functions such as pskmod, pskdemod, qammod, qamdemod, etc. You can specify the modulation order, symbol mapping, and other parameters depending on the specific scheme you want to use.
You can explore more on features available in Communications Toolbox for digital baseband modulation in the link: https://in.mathworks.com/help/comm/ug/digital-baseband-modulation.html
Remember that these modulation schemes operate at baseband, meaning the transmitted signal occupies the frequency range around zero Hertz. If you need to transmit the signal over a higher frequency band, additional steps such as up-conversion and filtering are required.
I hope this helps in resolving your query.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!