gistlib
main.m% Generating random data for users numUsers = 5; data = randi([0,1], 100, numUsers); % Creating signature sequences for users signature = [1 1 -1 -1 1; 1 -1 -1 1 1; -1 -1 1 1 1; -1 1 1 -1 -1; 1 -1 1 -1 -1]; % Modulating data with signature sequences modulatedData = data*signature; % Adding noise to modulated data noisyData = awgn(modulatedData, 10); % Demodulating data demodulatedData = noisyData ./ signature; % Decoding data decodedData = round(demodulatedData); % Calculating bit error rate bitErrorRate = sum(sum(abs(decodedData - data))) / (numUsers * size(data,1)); disp(['Bit Error Rate: ', num2str(bitErrorRate)]); 687 chars27 lines
% Generating random data for users numUsers = 5; data = randi([0,1], 100, numUsers); % Creating signature sequences for users signature = [1 1 -1 -1 1; 1 -1 -1 1 1; -1 -1 1 1 1; -1 1 1 -1 -1; 1 -1 1 -1 -1]; % Modulating data with signature sequences modulatedData = data*signature; % Adding noise to modulated data noisyData = awgn(modulatedData, 10); % Demodulating data demodulatedData = noisyData ./ signature; % Decoding data decodedData = round(demodulatedData); % Calculating bit error rate bitErrorRate = sum(sum(abs(decodedData - data))) / (numUsers * size(data,1)); disp(['Bit Error Rate: ', num2str(bitErrorRate)]);
gistlibby LogSnag