Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

ICI self cancellation code for ofdm. please anyone solve my error or give me a code.

Status
Not open for further replies.

Dhaval_21

Newbie level 1
Joined
Mar 12, 2016
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
22

Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
nbitpersym = 256; % number of bits per OFDM symbol
nsym = 1000; % number of symbols
len_fft = 256; % fft size
sub_car = 256; % number of data subcarriers
EbNo = 0:2:30;
 
 
EsNo= EbNo + 10*log10(524/512); 
snr=EsNo;
 
M = modem.pskmod(4); % modulation object
 
% Generating data
t_data=randint(nbitpersym*nsym,1);
 
% modulating data
mod_data = modulate(M,t_data);
 
% serial to parallel conversion
par_data = reshape(mod_data,nbitpersym,nsym).';
 
% making X[k], -X[k] subcarriers
par_data_self=zeros(nsym,sub_car*2);
for i=1:sub_car,
    par_data_self(:,2*i-1)=par_data(:,i);
    par_data_self(:,2*i)=(-1)*((par_data(:,i)));
end
 
% IFFT transform for OFDM transmission
IFFT_data = ifft(par_data_self.').';
 
% addition cyclic prefix
cylic_add_data = [IFFT_data(:,[501:512]) IFFT_data].';
 
% parallel to serial coversion
ser_data = reshape(cylic_add_data,524*nsym,1);
 
%% Phase Noise addition %%
noised_data = phase_noise_teian.'.*ser_data;
 
no_of_error=[];
ratio=[];
for ii=1:length(snr)
     
chan_awgn = sqrt(524/512)*awgn(noised_data,snr(ii),'measured'); % awgn addition
 
ser_to_para = reshape(chan_awgn,524,nsym).'; % serial to parallel coversion
 
cyclic_pre_rem = ser_to_para(:,[13:524]); %cyclic prefix removal
 
FFT_recdata = fft(cyclic_pre_rem.').';% freq domain transform
 
% making self canceled data by 0.5*(X[k]-(-X[k])
rx=zeros(nsym,sub_car);
for i=1:sub_car,
    rx(:,i)=0.5*(FFT_recdata(:,2*i-1)-(FFT_recdata(:,2*i)));
end
 
ser_data_rx = reshape(rx.',nbitpersym*nsym,1); % serial coversion
 
z=modem.pskdemod(4); %demodulation object
 
demod_Data = demodulate(z,ser_data_rx); %demodulating the data
 
[no_of_error(ii),ratio(ii)]=biterr(t_data,demod_Data) ; % error rate calculation
 
end
 
 
semilogy(EbNo,ratio,'--or','linewidth',2);
hold on;
theoryBer = (1/2)*erfc(sqrt(10.^(EbNo/10)));
semilogy (EbNo,theoryBer,'--*b','linewidth',2);
grid on
axis([0 12 10^-5 1])
xlabel('EbNo');
ylabel('BER')
title('Bit error probability curve for BPSK using OFDM');

 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top