Thursday, June 2, 2016

BINARY PHASE SHIFT KEYING (BPSK)

PROGRAM:
clc;
clf;
clear;

bs = input('Enter the input bit sequence :');
f = input('Enter the modulating signal frequency :');
p = input('Enter the modulating signal2 phase difference :');
a = input('Enter the modulating signal amplitude :');

c = 0;
d = 0;
l = length(bs);

% code for generating binary signal
for i = 1:l
    t1 = (c:0.01:c+1);
    x = bs(i) * ones(length(t1),1);
    subplot(2,1,1);
    plot(t1,x);
    axis([0 l -1 2]);
    xlabel('time ->');
    ylabel('amplitude ->');
    title('binary signal');
    hold on
    c=c+1;

end

% code for generating bpsk signal
for i = 1:l
    t=(d:0.01:d+1);
    if (bs(i) == 0)
        b = sin(2 * pi * f * t);
    else
        b = sin(2 * pi * f * t + p);
    end
    subplot(2,1,2);
    plot(t,b);
    xlabel('time ->');
    ylabel('amplitude ->');
    title('bpsk signal');
    hold on
    d=d+1;

end

SAMPLE OUTPUT:
Enter the input bit sequence :[0 1 0 1 1]
Enter the modulating signal frequency :4
Enter the modulating signal2 phase difference :180
Enter the modulating signal amplitude :2


PLOT:

No comments:

Post a Comment