plotting SNR VS BER
Show older comments
i want to plot the SNR and BER of this code, any idea???
clear all;clf;clc;close all;
M = 2;
k = log2(M);
EbNo = 5;
Fs = 16;
nsamp = 17;
freqsep = 8;
n=100000;
msg = randint(n,1,M);
txsig = fskmod(msg,M,freqsep,nsamp,Fs);
ab=abs(txsig);
ps=(sum(ab.^2))/n; %for SNR
%Impulsive noise
A=0.01;
gama=0.01;
sigma=0.4;
% and pn= ps/sigma
sigma0= sigma * (gama/(1+gama));
sigma1=sigma*((1/A)+gama /(1+gama));
sigma2=sigma*((2/A)+gama /(1+gama)) ;
nongas= exp(-0.01).* (sqrt(sigma0)*randn(1,n*nsamp)+sqrt(sigma1)*randn(1,n*nsamp)* A +sqrt(sigma2)*randn(1,n*nsamp)*A^2 );
ngnoise= txsig+ nongas';
msg_rrx = fskdemod(ngnoise,M,freqsep,nsamp,Fs);
[num,BER] = biterr(msg,msg_rrx)
end
Answers (0)
Categories
Find more on BFSK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!