to plot BER curve for IDWT
2 views (last 30 days)
Show older comments
i am not able to plot the proper ber curve .this is my piece of code which is attached for your reference
clc;
clear all;
close all;
PSK = 4; SNR = -5;
M_rx = 1; % No. of Rx antennas
SNRs = -50:20; % signal-to-noise ratios: -10dB … 20dB
bit_errors = zeros(length(SNRs), 1); % BER with respect to SNR
%implementation of the The transmitter
data = randi([0 PSK-1],64,1000);
symbol = pskmod(data, PSK, 0, 'Gray');
% symbol = qammod(data, PSK, 0, 'Gray');
%to Perform parallel to serial conversion
pstx=reshape(symbol,1,[]);
%to perform IDWT operation
AC =pstx; %% approximation coefficients
DC = zeros(size(pstx));%% detailed (wavelet) coefficients
IDWT=idwt(AC,DC,'haar').';% IDWT process
%implementation of the receiver
for SNR_idx = 1:length(SNRs)
received_symbol = awgn(IDWT, SNRs(SNR_idx)).';
[ca cd]=dwt(received_symbol,'haar' );
%to perform parallel to serial conversion
psrx=reshape(ca,64,1000);
estimated_data = pskdemod(psrx, PSK, 0, 'Gray');
% estimated_data = qamdemod(received_symbol, PSK, 0, 'Gray');
[no_of_error(SNR_idx), bit_errors(SNR_idx)]=biterr(data,estimated_data);
end
semilogy(SNRs , bit_errors); % plot with logarithmic y-axis
grid on; % show a grid
xlabel('SNR [dB]');
ylabel('BER'); % label x- and y-axis
2 Comments
Raymond Norris
on 16 Oct 2020
Hi,
I would suggest posting a bit more detail about what you mean by "not able to plot the proper BER curve." Are you getting errors or the curve doesn't look right? For starters, AC appears to be complex and not real, which is causing problems with your call to idwt.
Raymond
Answers (0)
See Also
Categories
Find more on Propagation and Channel Models 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!