blob: 2665151aa73b1a24a13d98a984cd9d6efe54deb9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//clear//
//Caption:Nonreturn-to-zero bipolar format
//Figure 6.1(c):Discrete PAM Signals Generation
// [3].BiPolar NRZ
//page 235
clear;
close;
clc;
x = [0 1 1 0 0 1 0 0 1 1];
binary_negative = [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1];
binary_zero = [0 0 0 0 0 0 0 0 0 0];
binary_positive = [1 1 1 1 1 1 1 1 1 1];
L = length(x);
L1 = length(binary_negative);
total_duration = L*L1;
//plotting
a =gca();
a.data_bounds =[0 -2;L*L1 2];
for i =1:L
if(x(i)==0)
plot([i*L-L+1:i*L],binary_zero);
poly1= a.children(1).children(1);
poly1.thickness =3;
elseif((x(i)==1)&(x(i-1)~=1))
plot([i*L-L+1:i*L],binary_positive);
poly1= a.children(1).children(1);
poly1.thickness =3;
else
plot([i*L-L+1:i*L],binary_negative);
poly1= a.children(1).children(1);
poly1.thickness =3;
end
end
xgrid(1)
title('BiPolar NRZ')
|