w_bwr
Member level 3
- Joined
- Feb 4, 2010
- Messages
- 66
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Karachi, Pakistan
- Activity points
- 1,810
i am having problem in plotting the demodulated signal, graph shows nothing, can anyone help....
and further , How to calculate BER?
Here is the code......
clear; % Clear all stored variables
Ns=100; %Number of data bits
data=randint(Ns,1);
subplot(3,2,1);
stem(data,'filled')
title('Samples');
ylim([-1 1]);
NRZ=2*data-1;% Converts 0 to -1 and 1 to 1
%---------------------
%BPSK Modulation
%---------------------
Rb=1000;% Bit Rate
Fc=2*Rb;
Fs=16*Rb;% Sampling Frequency
Ts=1/Fs;% Sampling Period
Tb=1/Rb;% Bit Period
time=0:Ts:Tb.*length(data)-Ts;
osc=sin(2*pi*Fc*time);
bpsk=NRZ*osc;
subplot(3,2,3);
plot(time,bpsk)
ylim([-2 2])
title('BPSK Modulated data');
%-----------------------------
%Adding Channel Noise
%-----------------------------
rec=awgn(bpsk,10); % Received Signal with AWGN and SNR = 10
%-----------------------
% Demodulation
%-----------------------
h=modem.pskdemod('M',2);
y=demodulate(h,rec);
subplot(3,2,5);
semilogy(time,y);
and further , How to calculate BER?
Here is the code......
clear; % Clear all stored variables
Ns=100; %Number of data bits
data=randint(Ns,1);
subplot(3,2,1);
stem(data,'filled')
title('Samples');
ylim([-1 1]);
NRZ=2*data-1;% Converts 0 to -1 and 1 to 1
%---------------------
%BPSK Modulation
%---------------------
Rb=1000;% Bit Rate
Fc=2*Rb;
Fs=16*Rb;% Sampling Frequency
Ts=1/Fs;% Sampling Period
Tb=1/Rb;% Bit Period
time=0:Ts:Tb.*length(data)-Ts;
osc=sin(2*pi*Fc*time);
bpsk=NRZ*osc;
subplot(3,2,3);
plot(time,bpsk)
ylim([-2 2])
title('BPSK Modulated data');
%-----------------------------
%Adding Channel Noise
%-----------------------------
rec=awgn(bpsk,10); % Received Signal with AWGN and SNR = 10
%-----------------------
% Demodulation
%-----------------------
h=modem.pskdemod('M',2);
y=demodulate(h,rec);
subplot(3,2,5);
semilogy(time,y);