% 6.888 Wireless Communications Systems
%
% Dina Katabi / Haitham Hassnaieh 
% CSAIL, MIT 
% September 11, 2013
%
addpath ../SRC_CODE
load ../Mat_Files/Test_2x2_MIMO_R.mat
load ../Mat_Files/Parameters.mat

[T1_bits_data_1 T1_bits_data_2] = decode_2x2_mimo(rx_signal_1_T1,rx_signal_2_T1);
[T2_bits_data_1 T2_bits_data_2] = decode_2x2_mimo(rx_signal_1_T2,rx_signal_2_T2);
[T3_bits_data_1 T3_bits_data_2] = decode_2x2_mimo(rx_signal_1_T3,rx_signal_2_T3);

BER_1_T1 = sum(abs(bits_data_1_T1 - T1_bits_data_1))/length(bits_data_1_T1);
BER_2_T1 = sum(abs(bits_data_2_T1 - T1_bits_data_2))/length(bits_data_2_T1);

BER_1_T2 = sum(abs(bits_data_1_T2 - T2_bits_data_1))/length(bits_data_1_T2);
BER_2_T2 = sum(abs(bits_data_2_T2 - T2_bits_data_2))/length(bits_data_2_T2);

save ../Results/Result_2x2_MIMO.mat T*_bits_data_* BER*

