Dear friends,
I modified the following matlab code for QPSK to use it in frequency offset analysis
code
====
%N=100000; % number of bits
N = 2*100000;
F_Offset =[0:100:5000]; % multiple frequency offset values
for x= 1 :length(F_Offset) % Frequency Offset
% Input Data Generation
data=rand(1,N)>0.5;
oddData = data(1:2:end);
evenData = data(2:2:end);
qpskModulated = sqrt(1/2)*(1i*(2*oddData-1)+(2*evenData-1)); %QPSK Mapping
% and normalization of energy to 1
% Frequency offset adding
TX = qpskModulated.* exp(2*j*pi*F_Offset(x)/(N/2)*[0:length(qpskModulated)-1]);
%--------------Demodulation-----------------------------
detected_real = real(TX)>=0;
detected_img = imag(TX)>=0;
estimatedBits=reshape([detected_img;detected_real],1,[]);
%-------------------------------------------------------
nErr(x) = size(find([data - estimatedBits]),2); % couting the number of errors
end
Err_QPSK = nErr/(N);
%=========================================================================
% Plotting output data
%=========================================================================
figure(1);
plot(F_Offset,Err_QPSK,'bs-','LineWidth',2);
axis([0 5000 1/N 1]);
grid on;
legend( 'simulation-QPSK');
xlabel('Freq Offset Hz')
ylabel('Bit Error Rate')
title('Bit error probability curve for QPSK')
But the problem , it gives my constant BER regardless of changing N ?
I think N is the frequency as it is no of bits.
is there any problem in the code
or using frequency offset formula
Thanks
wait your help.