Why I am getting 0.5 BER although code is compatible with Matlab Help?

1 visualizzazione (ultimi 30 giorni)
I want to use "rayleighchan" function for frequency selective channel model. "Rayleighchan" function lags the input data by "ChannelFilterDelay" value. So, truncating operation should be used to get correct comparison between input and output data. I'm using sufficient truncating as specified in Matlab Help but the BER is always about 0.5 even if SNR is increased to 20-30 dB. Where is the error in the code? Please help me. I have not solved the problem for a long time..
clc;
clear all;
M = 2; % DPSK modulation order
ts = 1/256;
fd = 0;
tau = [0 1/256 1/356];
pdb = [0 -8 -10];
% Create Rayleigh fading channel object.
ch = rayleighchan(ts,fd,tau,pdb);
delay = ch.ChannelFilterDelay
tx = randint(256,1,M); % Random bit stream
dpskSig = dpskmod(tx,M); % DPSK signal
ifft_sig = (256/sqrt(256))*ifft(dpskSig);% IFFT Operation for OFDM at Transmit Side
fadedSig = filter(ch,ifft_sig); % Effect of channel
awgn_sig = awgn(fadedSig,15); % AWGN Effect
fft_sig = (sqrt(256)/256)*fft(awgn_sig);% FFT Operation for OFDM at Receive Side
rx = dpskdemod(fft_sig,M); % Demodulated signal
% Compute bit error rate, taking delay into account.
% Remove first sample because of DPSK initial condition.
tx_rev = tx(2:end);
rx_rev = rx(2:end);
% Truncate to account for channel delay.
tx_trunc = tx_rev(1:end-delay);
rx_trunc = rx_rev(delay+1:end);
[num,ber] = biterr(tx_trunc,rx_trunc) % Bit error rate

Risposte (0)

Categorie

Scopri di più su Test and Measurement in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by