Sei sulla pagina 1di 8

Dalluay, Jovan Avery S.

/ ECE151
Name/Section Rating

Date performed February 18, 2019


Date submitted February 20, 2019

LINE CODE INSPECTRA


Activity 3

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 1 of 8


Question 1:Unipolar Non-Return to Zero (UNRZ).
Answer:
UNRZ

The commands used to generate the output:


>> bits = [1,0,1,1,0,1,1,0,0,1];
>> bitrate = 10;
>> [t,x] = unrz (bits,bitrate);
>> plot(t,x)
>> title ('UNRZ');
>> n =length(x);
>> fs = 2001;
>> f = (0:n-1)*(fs/n);
>> y = fft(x);
>> power = abs(y).^2/n;
>> figure(2);plot (f,power);
>> title('UNRZ');
>> xlabel('Frequency');ylabel('Power');

The script code:


function [t,x] = unrz(bits, bitrate)
T = length(bits)/bitrate;
n = 200;
N = n*length(bits);
dt = T/N;
t = 0:dt:T;
x = zeros(1,length(t));
for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+1)*n) = 5;
else
x(i*n+1:(i+1)*n) = 0;
end
end

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 2 of 8


Question 2:Polar Non-Return to Zero (PNRZ).
Answer:
PNRZ

The commands used to generate the output:


>> bits = [1,0,1,1,0,1,1,0,0,1];
>> bitrate = 10;
>> [t,x] = pnrz (bits,bitrate);
>> plot(t,x)
>> title ('PNRZ');
>> n =length(x);
>> fs = 2001;
>> f = (0:n-1)*(fs/n);
>> y = fft(x);
>> power = abs(y).^2/n;
>> figure(2);plot (f,power);
>> title('PNRZ');
>> xlabel('Frequency');ylabel('Power');

The script code:


function [t,x] = unrz(bits, bitrate)
T = length(bits)/bitrate;
n = 200;
N = n*length(bits);
dt = T/N;
t = 0:dt:T;
x = zeros(1,length(t));
for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+1)*n) = 5;
else
x(i*n+1:(i+1)*n) = -5;
end
end

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 3 of 8


Question 3:Unipolar Return to Zero (URZ).
Answer:
URZ

The commands used to generate the output:


>> bits = [1,0,1,1,0,1,1,0,0,1];
>> bitrate = 10;
>> [t,x] = urz (bits,bitrate);
>> plot(t,x)
>> title ('URZ');
>> n =length(x);
>> fs = 2001;
>> f = (0:n-1)*(fs/n);
>> y = fft(x);
>> power = abs(y).^2/n;
>> figure(2);plot (f,power);
>> title('URZ');
>> xlabel('Frequency');ylabel('Power');

The script code:


for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+0.5)*n) = 5;
x((i+0.5)*n+1:(i+1)*n) = 0;
else
x(i*n+1:(i+1)*n) = 0;
end
end

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 4 of 8


Question 4:Polar Return to Zero (PRZ).
Answer:
PRZ

The commands used to generate the output:


>> bits = [1,0,1,1,0,1,1,0,0,1];
>> bitrate = 10;
>> [t,x] = prz(bits,bitrate);
>> plot(t,x)
>> title ('PRZ');
>> grid on;
>> n =length(x);
>> fs = 2001;
>> f = (0:n-1)*(fs/n);
>> y = fft(x);
>> power = abs(y).^2/n;
>> figure(2);plot (f,power);
>> title('PRZ');
>> xlabel('Frequency');ylabel('Power');
>> grid on;

The script code:


for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+0.5)*n) = 5;
x((i+0.5)*n+1:(i+1)*n) = 0;
else
x(i*n+1:(i+0.5)*n) = -5;
x((i+0.5)*n+1:(i+1)*n) = 0;
end
end

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 5 of 8


Question 5: Manchester Coding
Answer:
Manchester

The commands used to generate the output:


>> bits = [1,0,1,1,0,1,1,0,0,1];
>> bitrate = 10;
>> [t,x] = manchester(bits,bitrate);
>> plot(t,x)
>> title ('Manchester');
>> grid on;
>> n =length(x);
>> fs = 2001;
>> f = (0:n-1)*(fs/n);
>> y = fft(x);
>> power = abs(y).^2/n;
>> figure(2);plot (f,power);
>> title('Manchester');
>> xlabel('Frequency');ylabel('Power');
>> grid on;

The script code:


for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+0.5)*n) = 5;
x((i+0.5)*n+1:(i+1)*n) = -5;
else
x(i*n+1:(i+0.5)*n) = -5;
x((i+0.5)*n+1:(i+1)*n) = 5;
end
end

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 6 of 8


Question 6: Bipolar 8 zero substitution (B8SZ)
Answer:

The commands used to generate the output:


>> bits = [1,0,1,0,0,1,1,0,0,1];
>> bitrate = 10;
>> [t,x] = manchester(bits,bitrate);
>> plot(t,x)
>> title ('Manchester');
>> grid on;
>> n =length(x);
>> fs = 2001;
>> f = (0:n-1)*(fs/n);
>> y = fft(x);
>> power = abs(y).^2/n;
>> figure(2);plot (f,power);
>> title('Frequency-domain Representation UNRZ');
>> xlabel('Frequency');ylabel('Power');
>> grid on;

The script code:


for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+0.5)*n) = 5;
x((i+0.5)*n+1:(i+1)*n) = -5;
else
x(i*n+1:(i+0.5)*n) = -5;
x((i+0.5)*n+1:(i+1)*n) = 5;
end
end

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 7 of 8


References

DALLUAY, JOVAN AVERY S. / FDIGICOMM / ECE151 Page 8 of 8

Potrebbero piacerti anche