Pulse shaping on BER
13 views (last 30 days)
Show older comments
I build a pam-2 modulation, then I make a pulse shaping with half sine (matched filter). Then I send it through the AWGN channel. At the end I do down sampling and demodulation. But i have problem with plotting BER. I don't understand what I'm doing wrong:
clc;
clear;
N=1e4;
N2 = 1e2;
M = 2;
range = 0:10;
error = zeros(1,length(range)); %BER
%
% half sine
Rc = 1e3; % Chip rate
T = 1/Rc; % inverse of chip rate
Tc = 0.5* T;
Fs = 2e3; % sampling frequency
dt = 1/Fs;
over = Fs/Rc; % sampling factor
sps = 10;
time = 0:dt/sps:2*T;
half_Sine = sin(pi*time/(2*T)).^3;
%% BER
for i = 1:length(range)
for n = 1:N2
% Modulation
x=randi([0 M-1],N,1);
h_mod = pammod(x,M);
over_data=upsample(h_mod,over);
txSig = conv(over_data,half_Sine, 'same');
% AWGN
Ps = mean(((txSig)).^2);
Sigma = sqrt(Ps * 10^(-range(i)/10) / 2);
Noise = randn(length(txSig), 1) * Sigma;
rx_SIG = Noise + txSig;
% Downsample
down = rx_SIG(1:over:end);
% Demodulation
hDemod = pamdemod(down,M);
% Errors
error(i) = error(i)+...
sum(hDemod~=x) / length(hDemod);
end
BER = error/n;
end
figure(1);
grid on
semilogy(range,BER);
title('BER');
0 Comments
Answers (1)
vidyesh
on 15 Sep 2024
Hi Rory,
The issue lies in the below line of code:
txSig = conv(over_data,half_Sine, 'same');
Are you trying to simulate the channel or trying to modulate to a higher frequency by using convolution?
In either scenario, you will have to perform deconvolution at the receiever side. But the 'deconv' function is very sensitive to noise, so it may not give the desired results either.
For simulating the channel/modulation, refer the below examples and functions:
1) Rayleigh Channel fading: https://www.mathworks.com/matlabcentral/fileexchange/62779-bpsk-over-rayleigh-fading-channel?s_tid=srchtitle_support_results_3_Rayleigh%2520channel
2) 'comm.Rayleigh' function: https://www.mathworks.com/help/comm/ref/comm.rayleighchannel-system-object.html?searchHighlight=rayleigh&s_tid=srchtitle_support_results_3_rayleigh
3) 'modulate' function: https://www.mathworks.com/help/signal/ref/modulate.html?searchHighlight=modulate&s_tid=srchtitle_support_results_1_modulate
Utilizing the above functions or following the process used in the example will be a better option over using 'conv'
0 Comments
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!