Apply Machine Learning in wireless communication?

7 visualizaciones (últimos 30 días)
Kasun Wickramarathna
Kasun Wickramarathna el 6 de Dic. de 2023
Comentada: Kasun Wickramarathna el 27 de Dic. de 2023
I am trying to apply machine learning to wireless communication. So I need to generate a BPSK sample data set in Matlab. Is there any special way to generate sample data?I need your help to start it just for a source-destination direct link. predicting the received data at the destination.

Respuesta aceptada

Yash
Yash el 6 de Dic. de 2023
Hi Kasun,
You can generate a BPSK sample data set in MATLAB using the randi function. Here's an example code snippet to generate a BPSK signal with 1000 bits:
bits = randi([0 1], 1000, 1); % generate random bits
bpsk = 2*bits - 1; % BPSK modulation
This will generate a vector bpsk with values of either -1 or 1, representing the BPSK signal.
To simulate a source-destination direct link, you can add some noise to the signal using the awgn function. Here's an example code snippet:
snr = 10; % signal-to-noise ratio in dB
noisy_bpsk = awgn(bpsk, snr); % add noise to the signal
This will add Gaussian white noise to the bpsk signal with a signal-to-noise ratio of 10 dB, and store the result in noisy_bpsk.
To predict the received data at the destination, you can use machine learning algorithms such as neural networks or support vector machines. You will need to train your model on a set of known input-output pairs, and then use the trained model to predict the output for new input data.
You can read more about the 'randi' and 'awgn' functions here:
Hope this helps!
  2 comentarios
Kasun Wickramarathna
Kasun Wickramarathna el 13 de Dic. de 2023
Hi Yash,
Thnk you very much for your answer.I will try it.
Kasun Wickramarathna
Kasun Wickramarathna el 27 de Dic. de 2023
Hi Yash ,
I need help to clarify my steps are correct or not.
  1. I generated data set as below as you mentioned.
clear all;close all;clc;
bits = randi([0 1], 1000, 1); % generate random bits
bpsk = 2*bits - 1; % BPSK modulation
snr = 10; % signal-to-noise ratio in dB
noisy_bpsk = awgn(bpsk, snr); % add noise to the signal
newdata = [bpsk ,noisy_bpsk];
writematrix(newdata, 'tx_rx_data.csv'); %Writing data to .csv file
Part of the data set.
2. Training the model with generated dataset.I used support vector machines.
%Prepare the dataset
tx_rx_data = readmatrix('tx_rx_data.csv');
%Assigning data to X and Y variables
X = tx_rx_data(:,1);
Y = tx_rx_data(:,2);
rand = randperm(10^2);%Generate random nums is equal to rows
%divide the data for traing and testing
Xtr = X(rand(1:length(rand)*0.8) ,:);% 80% for training
Ytr = Y(rand(1:length(rand)*0.8) ,:);% 80% for training
Xtest = X(rand(1:length(rand)*0.2) ,:);% 20% for testing
Ytest = Y(rand(1:length(rand)*0.2) ,:);% 20% for testing
model_tx_rx_data = fitcecoc(Xtr , Ytr); %used support vector machines
save model_tx_rx_data;%save the model
%Testing the model
result = predict(model_tx_rx_data , Xtest);
accuracy = (sum(result == Ytest)/length(Ytest))*100;
sp = sprintf("Test Accuracy = %0.2f" , accuracy);
disp(sp);
This shows very low accuracy.If I increse the number of bits , it says ,the system needs more memery.
3.Testing to new data.
bits = randi([0 1], 1000, 1); % generate random bits
bpsk = 2*bits - 1; % BPSK modulation
snr = 10; % signal-to-noise ratio in dB
noisy_bpsk = awgn(bpsk, snr); % add noise to the signal
rx_symbols = noisy_bpsk;
Where do I include the trained model to predict the received data.I think it is added after the decoder.Then I use the trained model as below ? I need to clarify this step correct or not.
decodedData = real(rx_symbols) >; %Decoder output
%Prepare the dataset for real data
TrainedmodelRx_data = readmatrix('tx_rx_data.csv');
%Assigning data to variable
TrainedmodelRx_data = Trainedmodel_data(:,2);
%use the trained model to predict the data at Rx
ML_predicted_receivedData = predict(TrainedmodelRx_data , decodedData);
%TrainedmodelRx_data - Output of the trained model
%decodedData - output from the decoder at Rx
Need help with this.
Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Link-Level Simulation en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by