View
213
Download
0
Embed Size (px)
Citation preview
Programming Assignment presentation
ByAbdulRahman AlKhayyat
Muhammad Felimban
Encoding Techniques
• NRZL
• NRZL
• AMI
• PSEUDO
• MANCH
• DIFMANCH
NRZL - NRZI
• NRZL :0 ‘+’ pulse1 ‘-’ pulse
• NRZI :0 same pulse1 change pulse
AMI - PSEUDO
• AMI :0 0 pulse1 alternate ‘+’ & ‘-’
• PSEUDO :0 alternate ‘+’ & ‘-’
• 1 0 pulse
MANCH - DIFMANCH
• MANCH :0 ‘+’ to ‘-’1 ‘-’ to ‘+’
• DIFMANCH :0 ‘+’ to ‘-’ with last pulse ‘-’1 ‘-’ to ‘+’ with last pulse ‘-’
• 0 ‘-’ to ‘+’ with last pulse ‘+’ 1 ‘+’ to ‘-’ with last pulse ‘+’
Programming Tool
MATLAB for 1st time :
- Matrix Laboratory
- Powerful with matrixoperations
- Ability of graphical representation
MATLAB Interface
MATLAB tools
Code Editor
MATLAB tools
• Algorithm and development• Math and computation• Data acquisition• Modeling and simulating• Data analysis• Scientific and engineering graphics• Application development
Library contains :
program codes
program codes
• Get the binary bits from a file
• Encode by proper encoding scheme
• NRZL,NRZI, AMI and PSEUDO :straight forward representing of 0 or pulse, with a consideration of last pulse
program codes
• For MANCH and DIFMANCH, more techniques are used
• Saving every bit as a 2-bits (01 or 10) in a new file, depending on the last pulse
• Then read from the new file, and simply represent the data as before in previous schemes
program codes
• Before drawing the bits, we need to divide the Tb by 2 to make every 2-bits represent one bit in our graph
Need more explain ?
More explain
Graphing concepts
• We are making 2 arrays, one for the time and one for the value representing the bit
• Then by making a loop to take the values of every bit and storing it in the values array, and so on with the time array
Generating the graphs
For NRZL :
clear allload here.txtx = here;InputSize = length(x);
Generating the graphs
% Generating the NRZL : t=[];u=[];periode= 1; for i = 1 : InputSize tt = (i-1)*periode:1: (i)*periode; if x(i) == 1 uu= zeros(size(tt)); else uu = ones(size(tt)); end t=[t tt]; u=[u uu]; end
plot(t,u), axis([0 length(x) -2 2])gridxlabel('t(s)')ylabel('u(t)')title('NRZL')
MANCH GRAPH
For MANCH:
clear allload here.txtx = here;InputSize = length(x) ;
MANCH GRAPH %Generating the MANCH:
counter = 1;
for i = 1 : InputSize if x(i) == 1
y(counter) = '1;' fid = fopen('MANCH.txt','w');
fprintf(fid,'%c \n',y); fclose(fid)
y(counter+1) = '0;' fid = fopen('MANCH.txt','w');
fprintf(fid,'%c \n',y); counter = counter + 2;
else y(counter) = '0;'
fid = fopen('MANCH.txt','w'); fprintf(fid,'%c \n',y);
fclose(fid) y(counter+1) = '1;'
fid = fopen('MANCH.txt','w'); fprintf(fid,'%c \n',y);
counter = counter + 2; end
fclose(fid)end
clear allload MANCH.txtx = MANCH;InputSize = length(x);
t=[];u;[]=
periode= 1; for i = 1 : InputSize
tt = (i-1)*periode:1: (i)*periode; if x(i) == 1
uu = zeros(size(tt)); else
uu = ones(size(tt)); end
t=[t tt]; u=[u uu];
end plot(t/2,u), axis([0 length(x)/2 -2 2])gridxlabel('t(s)')ylabel('u(t)')title('MANCH')
Hope you enjoy our
programmingAlKhyyat & Filemban