Created
January 19, 2016 09:11
-
-
Save MrWooJ/cb76a48d02ae146d58b9 to your computer and use it in GitHub Desktop.
WJMatlab-Manchester Coding Scehma
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; | |
xSignal = ~xSignal; | |
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)+2*(table < n-0.5)+1*(table == n); | |
else | |
y = -(table < n)+2*(table < n-0.5)-1*(table == n); | |
end | |
plot(table, y, 'LineWidth', 2.5); grid on; | |
xlabel('Frequency') | |
ylabel('Magnitude') | |
title('Line code MANCHESTER'); | |
hold on; | |
axis([0 length(xSignal)-1 -1.5 1.5]); | |
else | |
if xSignal(n+1) == 0 | |
y = (table < n)-2*(table < n-0.5)+1*(table == n); | |
else | |
y = (table < n)-2*(table < n-0.5)-1*(table == n); | |
end | |
plot(table, y, 'LineWidth', 2.5); grid on; | |
xlabel('Frequency') | |
ylabel('Magnitude') | |
title('Line code MANCHESTER'); | |
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