Hey everyone. I am developing a model for an OFDM transceiver and am investigating BER degradation due to frequency offsets. However, my BER vs Normalized offset results do not appear to be correct at all. I cannot really put my finger on where the error may have originated. Here is my code:
%% OFDM Model (CP and GT) with AWGN at different SNR's
% NOTE!!! OFDM Parameters used in WiMAX are found in the ebook page 42!!!!!
%% OFDM parameters
Tu = 0.001; %symbol period for each subcarrier
N = 128; %number of carriers
R = 1/8; %guard time ratio (WiMAX standard)
G = Tu*R; %guard time
Ti = Tu + G; %OFDM symbol period
T = Ti/N; %original symbol period
fi = 1/Ti; %symbol rate of each datastream
f = fi*N;
Q = 8; %sampling frequency factor (should be chosen such that Q*R = whole number)
Fs = Q*f; %sampling frequency
z = 4*N;
t = 0:1/Fs:(z*Ti-1/Fs); %simulation period (upper limit should
%be an integer K ==> K*N*Ti -1/Fs
%% TRANSMITTER
%generate message
L = length(t)/Q;
M1 = randint(1,L);
tn = 0:Q/Fs:(z*Ti-1/Fs);
%using BPSK (mapping 0's to -1's)
M=2*M1-1;
stem (tn,M); %plot the original message (BPSK)
xlabel('Time (seconds)');
ylabel('Digital Message Signal (in discrete bits)');
title ('Message vs Time');
%S/P conversion
A = reshape(M,N,L/N);
%modulate each subcarrier using IFFT
B = ifft(A);
%P/S conversion
C = reshape(B,1,L);
%oversample by a factor of Q (DAC ~)
D=ones(Q,1)*C;
D=conj(D(:)');
%guard time insertion
i=1;
k=1;
for t0=1:L;
for t1=1:R*Q;
D(1,k*Q-R*Q+i)=0;
i=i+1;
end
k=k+1;
i=1;
end
%cyclic prefix insertion
j=1;
i=Q-R*Q+1;
k=1;
a=1;
for f = 1:length(C);
for g = 1:R*Q;
D(:,Q*k-R*Q+j) = D(:,a);
j=j+1;
a=a+1;
end
j=1;
a=1+k*Q;
k=k+1;
end
plot (t,D); %plot the OFDM signal
xlabel ('Time (seconds)');
ylabel ('OFDM Signal');
title ('OFDM Signal (with guard time & cyclic prefix) vs Time');
DD = awgn(D,10,'measured');
xlabel ('Time (seconds)'); ylabel('OFDM Signal with CP, GT and AWGN');
plot(t,DD);
%% Add frequency offset
SNR = 10;
index = 1;
f0 = 1/Tu;
S = zeros(2,10);
BER = 0;
BER1 = 0;
per = 0;
N_max = 100;
h = modem.pskdemod(2,pi);
for tr = 0:0.05:0.5
D1 = D.*exp(2*pi*sqrt(-1)*per*f0);
for tk = 1:N_max
%% RECEIVER
%undersampling (ADC ~) removing Tg and CP
Dn = awgn(D1, SNR,'measured');
E = zeros(1,L);
i = 1;
j = 1;
for t0=1:L;
E(1,i) = Dn(1,j);
i=i+1;
j=j+Q;
if j>Q*L
j=j-1;
end
end
%S/P
F = reshape(E, N, L/N);
%demodulation
G = fft(F);
%P/S
Mr = reshape(G, 1, L);
Mr = real(Mr);
%BPSK Demodulation
M2 = demodulate(h,Mr);
%comparing the recieved and the sent message (0's & 1's)
bit_error = length(find(M1~=M2));
BER = bit_error/length(M2);
BER1 = BER1+BER;
end
S(1,index) = BER1/N_max;
S(2,index) = per;
per = per + 0.05;
index = index + 1;
BER1 = 0;
BER = 0;
end
loglog(S(2,:),S(1,:))
xlabel ('Normalized frequency offset')
ylabel ('Bit Error Rate')
title ('BER vs Frequency Offset')
grid on
Awaiting your replies,
Thanks!
|
|
0
|
|
|
|
Reply
|
Omar
|
11/5/2010 10:06:03 PM |
|
Dear Omar,
> Hey everyone. I am developing a model for an OFDM transceiver and am investigating BER degradation due to frequency offsets. However, my BER vs Normalized offset results do not appear to be correct at all.
You are awaiting our replies. But do you have a specific question?
It would be very kind, if you take the time to explain with any details, what "do not appear to be correct" means.
Jan
|
|
0
|
|
|
|
Reply
|
Jan
|
11/5/2010 11:42:03 PM
|
|
"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <ib24ob$qlv$1@fred.mathworks.com>...
> Dear Omar,
>
> > Hey everyone. I am developing a model for an OFDM transceiver and am investigating BER degradation due to frequency offsets. However, my BER vs Normalized offset results do not appear to be correct at all.
>
> You are awaiting our replies. But do you have a specific question?
> It would be very kind, if you take the time to explain with any details, what "do not appear to be correct" means.
>
> Jan
If you run the code, a figure of BER vs frequency offset will show up, but the curve is incorrect because it doesnt match theoretical equations. Run the code and see the curve for urself.
My question is, how should the BER vs offset curve look like and do u think my way iof implementing it is correct or not?
thank u
|
|
0
|
|
|
|
Reply
|
Omar
|
11/6/2010 8:33:08 AM
|
|
Dear Omar,
> If you run the code, a figure of BER vs frequency offset will show up, but the curve is incorrect because it doesnt match theoretical equations. Run the code and see the curve for urself.
I do not have the Communication Toolbox, therefore I cannot run your code.
On the other hand, I have the feeling that debugging your program is not my job for today.
Do *you* have the impression, that your implementation is correct?
Good luck, Jan
|
|
0
|
|
|
|
Reply
|
Jan
|
11/6/2010 10:59:05 AM
|
|
"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <ib3cdo$kho$1@fred.mathworks.com>...
> Dear Omar,
>
> > If you run the code, a figure of BER vs frequency offset will show up, but the curve is incorrect because it doesnt match theoretical equations. Run the code and see the curve for urself.
>
> I do not have the Communication Toolbox, therefore I cannot run your code.
> On the other hand, I have the feeling that debugging your program is not my job for today.
> Do *you* have the impression, that your implementation is correct?
>
> Good luck, Jan
good job...
i think ur code is coreect
|
|
0
|
|
|
|
Reply
|
MANISH
|
12/3/2010 7:06:06 AM
|
|
|
4 Replies
152 Views
(page loaded in 0.107 seconds)
|