forked from MuhammadSaariya/DC-Line-Encoding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask2c.m
More file actions
34 lines (34 loc) · 802 Bytes
/
Task2c.m
File metadata and controls
34 lines (34 loc) · 802 Bytes
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
X=[0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 0 0 1 1 1 1 0 0 0];
if X(1) == 0
encode(1:100) = 5;
else if X(1) == 1
encode(1:100) = -5;
end
end
i=100;
for x = 2:length(X)
if X(x) == 0
if encode(i) == 5
encode(i+1:i+50) = 5;
encode(i+51:i+100) = 0;
else if encode(i) == -5
encode(i+1:i+50) = -5;
encode(i+51:i+100) = 0;
end
end
else if X(x) == 1
if encode(i) == 5
encode(i+1:i+50) = -5;
encode(i+51:i+100) = 0;
else if encode(i) == -5
encode(i+1:i+50) = 5;
encode(i+51:i+100) = 0;
end
end
end
end
i = i+100;
end
length(encode())
stem(encode())
grid on