the following code doesnt give me the ber vs ebno i need which is a logarthmic curve..all i get is a noise signal..can someone tell me whats wrong with it
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc; clear all; close all; 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; snr=EbNo+(10*log(524/512));
M = modem.pskmod(4); % modulation object
% Generating data t_data=randint(nbitpersym*nsym,1);
% serial to parallel conversion par_data = reshape(t_data,nsym,sub_car); % modulating data mod_data = modulate(M,par_data);
% 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)=mod_data(:,i); par_data_self(:,2*i)=(exp(-j*pi/2))*((mod_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); K=length(ser_data); ep=0:9.5420e-007:0.5; k=1:(length(ep));
%phase noise addition d=(ep(k))./(K*(0:K-1)); d1=reshape(d,524000,1); noised_data = ser_data.*exp(j*pi*d1); no_of_error=[]; ratio=[]; for ii=1:length(snr)
% chan_awgn = awgn(ser_data,snr(ii));% awgn addition
ser_to_para = reshape(noised_data,524,1000).'; % 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)-(exp(-j*pi/2)*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) end % figure(1); % stem(t_data); % hold on; % stem(demod_Data,'*'); % title('plural weighted data conversion scheme t_data and received data compare'); figure(2); semilogy(EbNo,ratio); xlabel('EbNo'); ylabel('BER') title('Bit error rate of plural weighted data conversion scheme');
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Modulation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!