Created
January 19, 2016 09:04
-
-
Save MrWooJ/49cf4796bbe7e0666603 to your computer and use it in GitHub Desktop.
WJMatlab-BiPolarRZ Coding Scehma
This file contains hidden or 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-0.5)-(table == n); | |
| else | |
| y = -(table < n-0.5)+(table == n); | |
| end | |
| plot(table, y, 'LineWidth', 2.5); grid on; | |
| xlabel('Frequency') | |
| ylabel('Magnitude') | |
| title('Line code BIPOLAR RZ'); | |
| hold on; | |
| axis([0 length(xSignal)-1 -1.5 1.5]); | |
| else | |
| if xSignal(n+1) == 0 | |
| y = (table < n-0.5)-1*(table == n); | |
| else | |
| y = (table < n-0.5)+1*(table == n); | |
| end | |
| plot(table, y, 'LineWidth', 2.5); grid on; | |
| xlabel('Frequency') | |
| ylabel('Magnitude') | |
| title('Line code BIPOLAR RZ'); | |
| 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