All All: %% BPSK Demodulation

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

clc; %% BPSK Demodulation

clear all; mn = [];


close all; for n = ss:ss:length(m)
t = bp/99:bp/99:bp;
x = [1 0 0 1 1 0 1]; y = cos(2*pi*f*t);
bp = 0.000001; mm = y.*m((n-(ss-1)): n);
disp(x); t4 = bp/99:bp/99:bp;
bit = []; z = trapz(t4, mm);
for n = 1:1:length(x) zz = round((2*z/bp));
if (x(n) == 1) if (zz > 0)
se = ones(1, 100); a = 1;
elseif (x(n) == 0) else
se = zeros(1, 100); a = 0;
end end
bit = [bit, se]; mn = [mn a];
end end
t1 = disp(mn);
bp/100:bp/100:100*length(x)*(bp/10 bit = [];
0); for n = 1:1:length(mn)
subplot(311); if (mn(n) == 1)
plot(t1, bit, 'black'); se = ones(1, 100);
xlabel('Time'); elseif (mn(n) == 0)
ylabel('Amplitude'); se = zeros(1, 100);
title('Information as Digital end
Signal'); bit = [bit se];
end
%% BPSK Modulation t5 =
A = 5; bp/100:bp/100:100*length(x)*(bp/10
br = 1/bp; 0);
f = br*2; subplot(313);
t2 = bp/99 : bp/99 : bp; plot(t5, bit, 'black');
ss = length(t2); ylabel('Amplitude');
m = []; xlabel('Time');
for i = 1:1:length(x) title('BPSK Demodulated Signal');
if (x(i) == 1)
y = A*cos(2*pi*f*t2);
else
y = A*cos(2*pi*f*t2+pi);
end
m = [m y];
end
t3 = bp/99: bp/99: bp*length(x);
subplot(312);
plot(t3, m, 'black');
xlabel('Time');
ylabel('Amplitude');
title('BPSK Modulated Signal')

You might also like