Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] ICI cancellation in OFDM matlab code

Status
Not open for further replies.

khakiss_janu

Newbie level 2
Joined
Apr 17, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,339
hello i am using this OFDM code for ICI cancellation i am getting wrong simulation result can anyone examine the result.........and correct me
otherwise if any one have working code for ICI reduction in ofdm system plz send to my email khakiss_janu@yahoo.com

clc;
close all;
clear all
nFFT = 64; % fft size
SC = 52; % number of data subcarriers
L = 52; % number of bits per OFDM symbol (same as the number of subcarriers for BPSK)
M = 1; % number of symbols
N=26;
EbN0dB = [0:10]; % bit to noise ratio
EsN0dB = EbN0dB + 10*log10(26/nFFT) + 10*log10(38/47); % converting to symbol to noise ratio
ep=0.01;


% Transmitter
ipBit = rand(1,L*M) > 0.5; % random 1's and 0's
ipD = mod(filter(1,[1 -1],ipBit),2);%dpsk mod
ipBit1 = 2*ipD-1; % BPSK modulation 0 --> -1, 1 --> +1
% taking half of the bits
re=[ipBit(1) ipBit(2) ipBit(3) ipBit(4) ipBit(5) ];
rw=[ ipBit(6) ipBit(7) ipBit(8) ipBit(9) ipBit(10) ipBit(11)];
rt=[ipBit(12) ipBit(13) ipBit(14) ipBit(15) ipBit(16) ipBit(17) ipBit(18) ipBit(19)];
ro=[ipBit(20) ipBit(21) ipBit(22) ipBit(23) ipBit(24) ipBit(25) ipBit(26)];
rq=[re rw rt ro];
ipMod = reshape(ipBit1,L,M).'; % serial to parallel
ipModx=[ipMod];
v=length(ipModx);
h=[ipModx(2) ipModx(4) ipModx(6) ipModx(8) ipModx(10) ipModx(12)];
hu=[ipModx(14) ipModx(16) ipModx(18) ipModx(20) ipModx(22) ipModx(24)];
hy=[ipModx(26) ipModx(28) ipModx(30) ipModx(32) ipModx(34) ipModx(36)];
hr=[ipModx(38) ipModx(40) ipModx(42) ipModx(44) ipModx(46) ipModx(48) ipModx(50) ipModx(52)];
ty=[h hu hy hr];
%ici self cancellation modulation
n = 2:2:52;
S = sin(pi*(-n+ep))./(N*sin(pi/N*(ep-n))).*exp(j*pi*(1-1/N)*(ep-n));
Sp1 = sin(pi*(-n+ep+1))./(N*sin(pi/N*(ep-n+1))).*exp(j*pi*(1-1/N)*(ep-n+1));
Sp2 = sin(pi*(-n+ep-1))./(N*sin(pi/N*(ep-n-1))).*exp(j*pi*(1-1/N)*(ep-n-1));
Sp = S - Sp1;
Spp = -Sp2-Sp1+2*S;

for g =1:length(ty)

ipMod1 =Sp*ty(g);
end

% % Assigning modulated symbols to subcarriers from -13 t0 -1, +1 t0 +26
xF = [zeros(M,6) ipMod1:),[1:26/2]) zeros(M,1) ipMod1:),[26/2+1:26]) zeros(M,5)] ;

% Taking IFFT,
xt = (nFFT/sqrt(52))*ifft(fftshift(xF.')).';

% Add cylic prefix
xk = [xt:),[30:38]) xt];


xp = reshape(xk.',1,M*47);% parallel to serial
% Gaussian noise of unit variance, 0 mean

for ii = 1:length(EbN0dB)

nt = 1/sqrt(2)*[randn(1,M*47) + j*randn(1,M*47)];% noise


yt = sqrt(47/37*xp + 10^(-EsN0dB(ii)/20)*nt);


% % Receiver
ys = reshape(yt.',47,M).';
yd = ys:),[10:47]); % removing cyclic prefix

% % converting to frequency domain
yF = (sqrt(26)/nFFT)*fftshift(fft(yd.')).';
yMod = yF:),[6+[1:26/2] 7+[26/2+1:26] ]);
% ICI self cancellation demodulation
for gg =1:length(yMod)

yMod1 = Spp*yMod(gg);
end


% BPSK demodulation
% +ve value --> 1, -ve value --> -1
yg = 2*floor(real(yMod1/2)) + 1;
yg(yg>1) = +1;
yg(yg<-1) = -1;
yg1 = mod(filter([1 -1],1,yg),2);% dpsk demod
% converting modulated values into bits
yp = (yg1 +1)/2;
yp = reshape(yp.',26*M,1).';

% % counting the errors


nErr(ii) = size(find(yp - rq),2);

end

simBer = nErr/(26);
theoryBer = (1/2)*erfc(sqrt(10.^(EbN0dB/10)));

close all; figure
semilogy(EbN0dB,theoryBer,'bs-','LineWidth',2);
hold on
semilogy(EbN0dB,simBer,'mx-','LineWidth',2);

axis([0 10 10^-5 1])
grid on
legend('theory', 'simulation');
xlabel('Eb/No, dB')
ylabel('Bit Error Rate')
title('Bit error probability curve for BPSK using OFDM self cancellation scheme')
 

omowunmi

Newbie level 2
Joined
Nov 20, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
pls i also need a correct matlab code for ici cancellation and anyone with this can plsssssssssss send to my email wunmigrace@yahoo.com. thanks.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top