Effacer les filtres
Effacer les filtres

I have calculated BER please check whether it is right or not

1 vue (au cours des 30 derniers jours)
imran khan
imran khan le 15 Nov 2019
Modifié(e) : Adam Danz le 16 Nov 2019
I have calculated BER(bit error rate) please check whether it is right or not.I want to confirm that my output is right or not becuase i have no idea about BER(bit error rate).
clc,close all,clear all
codn=100;
EbN0=1:12;
q=1.6e-19; %
% signal-to-noise ratio in dB.
SNR=10.^(EbN0./10); % signal-to-noise ratio
Ib=202e-6; % Background Noise Current+interfernce
N0=2*q*Ib; % Noise Spectral Density, 2*q*Ib
%sgma=1;
% fc=6e+3;
fs=360;
bode=10;
code=round(rand(1,codn));
code_len=round(1/bode/(1/fs)) % no of samples/symbol
sgma=zeros(1,length(SNR));
ber=zeros(1,length(SNR));
for iii=1:length(SNR)
for ii=1:codn
x((ii-1)*code_len+1:code_len*ii)=code(ii);
end
size(x)
sgma(iii)=sqrt(N0/2/0.1);
x=x+sgma(iii)*randn(1,length(x)); % if want to add noise
x2 = x-(1/2); % get rid of most of the dc peak
pt=ones(1,code_len);
rt=pt;
% set up time and frequency arrays
length(x)
u = length(x2);
N = 2^nextpow2(u);
delt = 1/fs;
delf1=fs/u;
figure(1)
tvec2=(1:length(x2))*delt;
plot(tvec2,x2(1,:)+0.5)
title('orignal baseband')
xlabel('time');
ylabel('amplitude')
ylim([-1 1.5]);
y = fftshift(fft(x2)/N);
z=abs(y);
figure(2)
fvec2=(-length(x2)/2:length(x2)/2-1)*delf1;
plot(fvec2,z)
title('FFT')
xlabel('frequency')
ylabel('amplitude')
figure(3)
z=y;
z(abs(fvec2)>50 & abs(fvec2)<=150)=0;
plot(fvec2,abs(z))
xlabel('frequency removed from 50 to 150 HZ');
ylabel('amplitude')
figure(4)
zf=fftshift(z)*N;
zifft=ifft(zf)+0.5;
MF_out=conv(zifft,rt)*0.1; % sampling time = 0.1
MF_out_downsamp=MF_out(code_len:code_len:end);
MF_out_downsamp=MF_out_downsamp(1:100);
Rx_th=zeros(1,100);
Rx_th(find(MF_out_downsamp>1/2))=1;
[nerr ber(iii)]=biterr(code,Rx_th);
end
plot(tvec2,abs(zifft))
ylim([-1 1.5])
title('recovered signal')
xlabel('time');
ylabel('amplitude')
figure; semilogy(EbN0,ber,'b');
xlabel('Eb/N0,db');
ylabel('Bit Error Rate');
grid on
title('Bit error probability curve for OOK ');
legend('simulation','theory');
% PARAMETERS FOR DATA RATE ARE;
% T=10ms
%
% F(signal frequency)=1/T=0.1KHZ
%
% Fs(sampling frequency)=360HZ
%
% bode=10
%
% N=4096
%
% No.of bits in 1ms=10 bits
%
% No.of bits in 1s=10k bits/sec
%
% data rate will be=10kb/sec
  5 commentaires
imran khan
imran khan le 15 Nov 2019
Sorry dear fellows.Code which i have pasted was mistakenly wrong.Now,i have pasted my new code for which i have to know myBER(bit error rate).In my output it shows it nothing.When i put some error it shows straight line for which i have doubt it is right or not.
Adam Danz
Adam Danz le 16 Nov 2019
Modifié(e) : Adam Danz le 16 Nov 2019
Thanks @Daniel.
Imran, I'd like to help out but I don't know where to start. If you have a matlab related question, please let us know where we can help. If there's a section of your code that you're doubting, please point to that section so we don't have to guess.

Connectez-vous pour commenter.

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by