%Matlab code to generate line code wave form for given bit stream
clc;
close all;
clear all;
x=[1 0 1 1 0 1];
nx=size(x,2);
sign=1;
i=1;
while i<nx+1
t = i:0.001:i+1-0.001;
if x(i)==1
unipolar_code=square(t*2*pi,100);
polar_code=square(t*2*pi,100);
bipolar_code=sign*square(t*2*pi,100);
sign=sign*-1;
manchester_code=-square(t*2*pi,50);
else
unipolar_code=0;
polar_code=-square(t*2*pi,100);
bipolar_code=0;
manchester_code=square(t*2*pi,50);
end
subplot(4,1,1);
plot(t,unipolar_code);
ylabel('unipolar code');
hold on;
grid on;
axis([1 10 -2 2]);
subplot(4,1,2);
plot(t,polar_code);
ylabel('polar code');
hold on;
grid on;
axis([1 10 -2 2]);
subplot(4,1,3);
plot(t,bipolar_code);
ylabel('bipolar code');
hold on;
grid on;
axis([1 10 -2 2]);
subplot(4,1,4);
plot(t,manchester_code);
ylabel('manchester code');
hold on;
grid on;
axis([1 10 -2 2]);
i=i+1;
end
clc;
close all;
clear all;
x=[1 0 1 1 0 1];
nx=size(x,2);
sign=1;
i=1;
while i<nx+1
t = i:0.001:i+1-0.001;
if x(i)==1
unipolar_code=square(t*2*pi,100);
polar_code=square(t*2*pi,100);
bipolar_code=sign*square(t*2*pi,100);
sign=sign*-1;
manchester_code=-square(t*2*pi,50);
else
unipolar_code=0;
polar_code=-square(t*2*pi,100);
bipolar_code=0;
manchester_code=square(t*2*pi,50);
end
subplot(4,1,1);
plot(t,unipolar_code);
ylabel('unipolar code');
hold on;
grid on;
axis([1 10 -2 2]);
subplot(4,1,2);
plot(t,polar_code);
ylabel('polar code');
hold on;
grid on;
axis([1 10 -2 2]);
subplot(4,1,3);
plot(t,bipolar_code);
ylabel('bipolar code');
hold on;
grid on;
axis([1 10 -2 2]);
subplot(4,1,4);
plot(t,manchester_code);
ylabel('manchester code');
hold on;
grid on;
axis([1 10 -2 2]);
i=i+1;
end
Can you write to me a full code of HDB3?
ReplyDeletethanks.
https://www.blogger.com/blogger.g?blogID=1098589623302643586#editor/target=post;postID=3255457773256582234;onPublishedMenu=posts;onClosedMenu=posts;postNum=0;src=postname
Deletehi! the code you have written above, is applicable the way it is on matlab?
ReplyDeletethanks dude
ReplyDeletebut why some of the line is missing or breaking?
ReplyDeleteanyway to solve it?
https://longdistance15.blogspot.com/2020/07/he-met-his-one-of-good-friends-who-was.html
DeleteCreate a MATLAB program for the B8ZS code. Create signaling formats corresponding to 1,000,000 bits making the following assumptions on your bitstream (the following are separate cases to consider)
ReplyDeleteo P(1)=P(0)=0.5, i.e. ‘1’ and ‘0’ are equally likely
o P(1)=0.3; P(0)=0.7
do u have code for rz polar and bipolar
ReplyDeleteif x(i)==1
Deleteunipolar_code=square(t*2*pi,100);
polar_code=square(t*2*pi,100);
bipolar_code=sign*square(t*2*pi,100);
sign=sign*-1;
manchester_code=-square(t*2*pi,50);
else
unipolar_code=0;
polar_code=-square(t*2*pi,100);
bipolar_code=0;
manchester_code=square(t*2*pi,50);
hi could you provide me a code for manchester and differential Manchester only
ReplyDelete.
I am working over a new digitizing scheme, but don't know how to program over matlab, can you help me please ....
ReplyDeleteShannon fano code
ReplyDeleteplease write the differential manchester code
ReplyDelete1xbet korean | legalbet.co.kr
ReplyDelete1xbet korean is a betting company with more than 5 years of experience in the industry. 바카라 Our business 1xbet is based in Namibia and deccasino it consists of three main