AWGN = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR', 7);
Multipath = rayleighchan(1/100000, 0.0001, [0 1.4e-4 1e-4 1.8e-4 2.3e-4 3.5e-4], [0 0 0 0 0 0]); %Ts=2/Bandwidth (200KHz for GSM) Ds=0.0001 the object is not moving
dH = comm.GMSKDemodulator('BitOutput', true);
H = comm.GMSKModulator('BitInput', true);
hError = comm.ErrorRate('ReceiveDelay', dH.TracebackDepth);
Multipath.StoreHistory = 1;
Multipath.ResetBeforeFiltering = true;
training=randi([0 1],26,1); %Generating Training sequence
%---------------Assembling Matrix for LS Estimator--------------------%
A=zeros(21,6);
for n=1:21
A(n,:)=training(n:n+5);
end
%----------------------GSM NETWORK SIMULATION-------------------------%
for counter=1:1
%-----------------------Assembling GSM Burst--------------------------%
data1 = randi([0 1],61, 1); %Generating pre-training data
data2 = randi([0 1],61, 1); %Generating post-training data
Burstcol = [data1; training; data2 ]; %Assembling Burst as a single row matrix
%-----------------------Transmitting Signal---------------------------%
modSignal = step(H, Burstcol); %Signal through GMSK
multichannel = filter(Multipath,modSignal); %Modulated Signal through multipath
noisySignal = step(AWGN, multichannel); %Distorted through noise
received = step(dH,noisySignal); %received Signal
errorStats = step(hError, Burstcol, received); %Calculates BER
end
vector = received(61:81); %Supposedly the received training sequence %Should I choose the 77:97 Bits as there as a delay of the received data with 16 Bits caused by the modulator
hLS = inv(transpose(A)*A)*transpose(A)*vector
minError = transpose(vector-A*hLS)*(vector-A*hLS)
%-------------------------Plotting Results---------------------------%
h = scatterplot(modSignal,3,58,'kx'); hold on;
scatterplot(multichannel,2,58,'r.',h);
scatterplot(noisySignal,2,58,'g.',h);
legend('Idealy modulated Signal','Signal after Multipath');
hold off;
plot(Multipath)
fprintf('Error rate = %f\nNumber of errors = %d\n', ...
errorStats(1), errorStats(2))