Hie all, I am now doing the OFDM Simulation for Power Line Communication. I have written a very simple code for OFDM and have the impulse response of the power line channel. I am facing the problem that the BER of my result are high and constant along the SNR. So I would like to know whether my simulation is correct or not, and hope that someone can give me an advice on the simulations. I am using BPSK modulation. When I remove the impulse response and only inserting the awgn noise, the graph is nice. but if with the impulse response, the BER will get distorted. Here are the codes...hope anyone can help me in this. Thanks in advance. % OFDM Simulation % Power Line Chanel Parameters % impulse response imp = [0.1556 0.0416 0.0586 0.0889 0.0199 -0.0055 -0.0201 0.0020 0.0096 0.0141 0.0070 0.0055 0.0049]; % Setup Value SNR = 1:1:20; num_data = 1000; fft_size = 128; repeat = 10; M = 2; % BPSK for i_snr = 1:1:length(SNR) snr = SNR(i_snr); total_ber = 0; for rep = 1:1:repeat data_in = floor(rand(1,1000)*M); %randint(1,num_data); num_chunk = ceil(num_data/fft_size); num_zero = fft_size - rem(num_data,fft_size); if num_zero ~= fft_size % pad the data with zero for i = 1:1:num_zero data_in = [data_in 0]; end end % modulation data_mod = pskmod(data_in,M); % serial to parallel data_chunk = zeros(num_chunk,fft_size); for i = 1:1:num_chunk data_chunk(i,:) = data_mod(1,((i-1)*fft_size + 1):(i*fft_size)); end % IFFT data_ifft = ifft(data_chunk); % parallel to serial data_tx = zeros(1,(num_chunk*fft_size)); for i = 1:1:num_chunk data_tx(1,(((i-1)*fft_size) + 1):(i*fft_size)) = data_ifft(i,:); end % channel data_rx = filter(imp,1,data_tx)*1/imp(1); data_rx = awgn(data_rx,snr,'measured'); % serial to parallel data_fft = zeros(num_chunk,fft_size); for i = 1:1:num_chunk data_fft(i,:) = data_rx(1,((i-1)*fft_size + 1):(i*fft_size)); end % FFT data_dechunk = fft(data_fft); % parallel to serial data_out = zeros(1,(num_chunk*fft_size)); for i = 1:1:num_chunk data_out(1,(((i-1)*fft_size) + 1):(i*fft_size)) = data_dechunk(i,:); end % demodulation data_out = pskdemod(data_out,M); % analysis total_ber = total_ber + symerr(data_in,data_out)/length(data_in); end % average ber ber(i_snr,1) = snr; ber(i_snr,2) = total_ber/repeat; end % plotting the analysis semilogy(ber(:,1),ber(:,2),'-r'); grid on;
ofdm in power line communication simulation
Started by ●February 16, 2006