Created
January 19, 2016 09:13
-
-
Save MrWooJ/b51e749c863b26e1604b to your computer and use it in GitHub Desktop.
WJMatlab-UniPolarNRZ Coding Scehma Raw
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
clc; | |
clear all; | |
close all; | |
FigHandle = figure('Menu','none','Position', [350, 200, 700, 500]); | |
xSignal = [ 1 0 0 1 1 0 1 0 1 1 ]; | |
n = 1; | |
signalLength = length(xSignal); | |
xSignal(signalLength+1) = 1; | |
while n <= length(xSignal)-1; | |
table = n-1 : 0.001 : n; | |
if xSignal(n) == 0 | |
if xSignal(n+1) == 0 | |
y = (table > n); | |
else | |
y = (table == n); | |
end | |
plot(table, y, 'LineWidth', 2.5); grid on; | |
xlabel('Frequency') | |
ylabel('Magnitude') | |
title('Line code UNIPOLAR NRZ'); | |
hold on; | |
axis([0 length(xSignal)-1 -1.5 1.5]); | |
else | |
if xSignal(n+1) == 0 | |
y = (table < n)-0*(table == n); | |
else | |
y = (table < n)+1*(table == n); | |
end | |
plot(table, y, 'LineWidth', 2.5); grid on; | |
xlabel('Frequency') | |
ylabel('Magnitude') | |
title('Line code UNIPOLAR NRZ'); | |
hold on; | |
axis([0 length(xSignal)-1 -1.5 1.5]); | |
end | |
n = n+1; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment