The document presents a MATLAB script for simulating and visualizing various digital signal encoding schemes using a binary input stream. It includes representations for Unipolar NRZ, Unipolar RZ, Polar RZ, and Manchester encoding, each plotted against time. The script generates plots for each encoding scheme, illustrating how the binary information is transformed into different digital signals.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
0 views3 pages
Practical 11
The document presents a MATLAB script for simulating and visualizing various digital signal encoding schemes using a binary input stream. It includes representations for Unipolar NRZ, Unipolar RZ, Polar RZ, and Manchester encoding, each plotted against time. The script generates plots for each encoding scheme, illustrating how the binary information is transformed into different digital signals.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Practical 13
clc, clear all, close all;
% ******************* Digital/Binary input information ******************** x = [1 0 1 0 0 0 1 1 0]; % Binary information as a stream of bits N = length(x); Tb = 0.0001; % Data rate = 1MHz, bit period (seconds) disp('Binary Input Information at Transmitter:'); disp(x); % ************* Represent input information as digital signal ************* nb = 100; % Digital signal per bit digit = []; for n = 1:1:N if x(n) == 1 sig = ones(1, nb); else sig = zeros(1, nb); end digit = [digit sig]; end t1 = Tb/nb:Tb/nb:nb*N*(Tb/nb); % Time period figure('Name','Line Coding Schemes','NumberTitle','off'); % Plot the original digital signal subplot(5,1,1); plot(t1, digit, 'LineWidth', 2.5); grid on; axis([0 Tb*N -0.5 1.5]); xlabel('Time(Sec)'); ylabel('Amplitude(Volts)'); title('Digital Input Signal'); % ***************************** Unipolar NRZ ****************************** for i = 0:N-1 if x(i+1) == 1 Y(i*nb+1:(i+1)*nb) = 1; else Y(i*nb+1:(i+1)*nb) = 0; end end subplot(5,1,2) plot(t1, Y, 'LineWidth', 2.5); grid on; axis([0 Tb*N -0.5 1.5]); xlabel('Time(Sec)'); ylabel('Amplitude(Volts)'); title('Unipolar NRZ'); % ****************************** Unipolar RZ ****************************** for i = 0:N-1 if x(i+1) == 1 Y(i*nb+1:(i+0.5)*nb) = 1; Y((i+0.5)*nb+1:(i+1)*nb) = 0; else Y(i*nb+1:(i+1)*nb) = 0; end end subplot(5,1,3) plot(t1, Y, 'LineWidth', 2.5); grid on; axis([0 Tb*N -0.5 1.5]); xlabel('Time(Sec)'); ylabel('Amplitude(Volts)'); title('Unipolar RZ'); % ******************************* Polar RZ ******************************** for i = 0:N-1 if x(i+1) == 1 Y(i*nb+1:(i+0.5)*nb) = 1; Y((i+0.5)*nb+1:(i+1)*nb) = 0; else Y(i*nb+1:(i+0.5)*nb) = -1; Y((i+0.5)*nb+1:(i+1)*nb) = 0; end end subplot(5,1,4) plot(t1, Y, 'LineWidth', 2.5); grid on; axis([0 Tb*N -0.5 1.5]); xlabel('Time(Sec)'); ylabel('Amplitude(Volts)'); title('Polar RZ'); % ****************************** Manchester ******************************* for i = 0:N-1 if x(i+1) == 1 Y(i*nb+1:(i+0.5)*nb) = 1; Y((i+0.5)*nb+1:(i+1)*nb) = -1; else Y(i*nb+1:(i+0.5)*nb) = -1; Y((i+0.5)*nb+1:(i+1)*nb) = 1; end end subplot(5,1,5) plot(t1, Y, 'LineWidth', 2.5); grid on; axis([0 Tb*N -0.5 1.5]); xlabel('Time(Sec)'); ylabel('Amplitude(Volts)'); title('Manchester'); % ************************** End of the program ***************************