In MatLab
Forked from tasfik007/1. Digital to Digital Signal Conversion.md
Created
February 27, 2022 09:48
-
-
Save IamMuhammadHasib/3c7bfc02411b23119202a10d5089dfeb to your computer and use it in GitHub Desktop.
Line Coding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load input.txt; | |
m = input; | |
n = length(m); | |
x = []; | |
y = []; | |
for i=1:n | |
x=[x i-1 i]; | |
if(m(i)==0) | |
y=[y 0 0]; | |
else | |
y=[y 1 1]; | |
end | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Unipolar NRZ'); | |
# tasfik |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load input.txt; | |
m = input; | |
n = length(m); | |
x = []; | |
y = []; | |
for i=1:n | |
x=[x i-1 i]; | |
if(m(i)==0) | |
y=[y 1 1]; | |
else | |
y=[y -1 -1]; | |
end | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Polar NRZ L'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [0 1 0 0 1 1 1 0]; | |
n = length(m); | |
x = []; | |
y = []; | |
a=1; | |
for i=1:n | |
x=[x i-1 i]; | |
if(m(i)==1) | |
y=[y -a -a]; | |
else | |
y=[y a a]; | |
end | |
a=y(length(y)); | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Polar NRZ I'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [0 1 0 0 1]; | |
n = length(m); | |
x = []; | |
y = []; | |
for i=1:n | |
x=[x i-1 i-1+0.5 i-1+0.5 i]; | |
if(m(i)==0) | |
y=[y -1 -1 0 0]; | |
else | |
y=[y 1 1 0 0]; | |
end | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Polar RZ'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [0 1 0 0 1 1]; | |
n = length(m); | |
x = []; | |
y = []; | |
for i=1:n | |
x=[x i-1 i-1+0.5 i-1+0.5 i]; | |
if(m(i)==0) | |
y=[y 1 1 -1 -1]; | |
else | |
y=[y -1 -1 1 1]; | |
end | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Manchester'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [0 1 0 0 1 1]; | |
n = length(m); | |
x = []; | |
y = []; | |
a = 1; | |
for i=1:n | |
x=[x i-1 i-1+0.5 i-1+0.5 i]; | |
if(m(i)==0) | |
y=[y -a -a a a]; | |
else | |
y=[y a a -a -a]; | |
end | |
a=y(length(y)); | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Differential Manchester'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [0 1 0 0 1 0]; | |
n = length(m); | |
x = []; | |
y = []; | |
a=1; | |
for i=1:n | |
x=[x i-1 i]; | |
if(m(i)== 1) | |
y=[y a a]; | |
a=a*(-1); | |
else | |
y=[y 0 0]; | |
end | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Bipolar AMI'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [0 1 0 0 1 0]; | |
n = length(m); | |
x = []; | |
y = []; | |
a=1; | |
for i=1:n | |
x=[x i-1 i]; | |
if(m(i)== 0) | |
y=[y a a]; | |
a=a*(-1); | |
else | |
y=[y 0 0]; | |
end | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('Bipolar Pseudoternary / opposite of AMI'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [0 1 0 1 1 0 1 1]; | |
n = length(m); | |
x = []; | |
y = []; | |
cur_lvl=0; | |
last_non_zero_lvl=-1; | |
for i=1:n | |
x=[x i-1 i]; | |
if(m(i)==0) | |
y=[y cur_lvl cur_lvl]; | |
else | |
if(cur_lvl~=0) | |
y=[y 0 0]; | |
cur_lvl=0; | |
else | |
y=[y -last_non_zero_lvl -last_non_zero_lvl]; | |
last_non_zero_lvl = last_non_zero_lvl*(-1); | |
cur_lvl = last_non_zero_lvl; | |
end | |
end | |
end | |
plot(x,y),axis([0,n,-2,2]); | |
title('MLT-3'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 0 1 1 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment