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
hi i am posting self cancellation code but i have some doubts
clc;
clear all;
close all;

ep= [0 0.15 0.3];

EbNo= 1:15;

NS= 100; % No of OFDM symbols to transmit

modulation= 'qam';
M=2;

N= 52; % No of carriers in OFDM symbol

BPS= N*log2(M); % No of bits per OFDM symbol

carriers= (1:52)+ 2;

ifftsize= 64; % IFFT size

% Input Bit Stream is normally Distributed
input_bit_stream = sign(randn(1,BPS*NS));
input_bit_stream(input_bit_stream == -1) = 0;
% PERFORM SERIAL TO PARALLEL CONVERSION
% work on whole data stream at once
disp('Serial to Parallerl Conversion')
parallel_data = StoP(input_bit_stream, log2(M));
% PERFORM MODULATION
% using indicated modulation type and M-ary alphabet
disp(['Modulating with ' modulation ' and ' num2str(M) '-ary Alphabet'])
modulated_data = dmodce(parallel_data, 1, 1, modulation, M);
%modulated_data = (modulated_data/max(abs(modulated_data)));
% CREATE OFDM SYMBOLS
disp('Transmitting OFDM symbols')
odd_carriers = carriers(1:2:52);
even_carriers = carriers(2:2:52);
for ll= 1:length(ep)
for l=1:length(EsNo)
k = 1;
for n = 1:NS
ofdm_symbol1 = zeros(1,ifftsize);
ofdm_symbol2 = zeros(1,ifftsize);
% MAP to carriers
ofdm_symbol1(odd_carriers) = modulated_data(k:k+25);
ofdm_symbol1(even_carriers) = -modulated_data(k:k+25);
ofdm_symbol2(odd_carriers) = modulated_data(k+26:k+51);
ofdm_symbol2(even_carriers) = -modulated_data(k+26:k+51);
% Time Signal to transmit
tx_signal1 = (ifft(ofdm_symbol1,ifftsize));
tx_signal2 = (ifft(ofdm_symbol2,ifftsize));
% DOPPLER SHIFT
rx_signal1 = tx_signal1.*exp(j*pi*ep(ll)/ifftsize*(0:ifftsize-1));
rx_signal2 = tx_signal2.*exp(j*pi*ep(ll)/ifftsize*(0:ifftsize-1));
% ADD NOISE
rx_signal1 = awgn(rx_signal1, EsNo(l),0);
rx_signal2 = awgn(rx_signal2, EsNo(l),0);
% FFT
received_ofdm1 = fft(rx_signal1, ifftsize);
received_ofdm2 = fft(rx_signal2, ifftsize);
demod_sym1 = .5*(received_ofdm1(odd_carriers)-received_ofdm1(even_carriers));
demod_sym2 = .5*(received_ofdm2(odd_carriers)-received_ofdm2(even_carriers));
received_ofdm3 = [demod_sym1 demod_sym2];
% Extract data from carriers in OFDM symbol
received_symbols(k:k+51) = received_ofdm3;
k = k + 52;
end
% PERFROM DEMODULATION
disp('Performing Demodulation')
received_data = ddemodce(received_symbols, 1, 1, modulation, M);
%PERFORM PARALLEL TO SERIAL CONVERSION
disp('Performing Parallel to Serial Converion')
output_bit_stream = PtoS(received_data, log2(M));
% CALCULATE BER
disp('Calculating BER ')
BER(ll,l)= sum(xor(input_bit_stream, output_bit_stream))/length(input_bit_stream);
end
end


the above code have small problems. it has two functions StoP,PtoS,dmodce,ddmodce. i don't know these functions can u plz change it as normal using reshape and qam mod functions and repost it here
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…