Professional Documents
Culture Documents
TH - TTS - MVT - Bai 2 - 2023
TH - TTS - MVT - Bai 2 - 2023
Mục tiêu
• Hiểu nguyên lý một số loại mã đường truyền trong truyền dẫn dữ liệu số:
NRZ-L, Bipolar-AMI, Manchester.
• Phân tích mật độ phổ các phương pháp mã đường truyền.
1.1. LÝ THUYẾT
Trong các hệ thống truyền dẫn dữ liệu số với khoảng cách ngắn sử dụng dây
dẫn, người ta thường sử dụng kỹ thuật mã hóa đường dây. Khi đó, các dữ liệu số
được biểu diễn thông qua những tín hiệu có biên độ rời rạc. Có khá nhiều loại mã
đường dây đang đựơc sử dụng rộng rãi, mỗi loại đều có ưu và nhược điểm riêng.
Tùy vào yêu cầu của hệ thống mà ta chọn loại mã nào cho phù hợp. Hình dưới mô
tả một số mã đường dây phổ biến.
Trang 1
Mật độ phổ của các loại mã đường truyền khác nhau:
try, catch:
try
statements
catch exception
statements
end
try statements, catch statements end executes the
statements in the try block and catches resulting errors in
the catch block. This approach allows you to override the
default error behavior for a set of program statements. If
any statement in a try block generates an error, program
control goes immediately to the catch block, which contains
your error handling statements.
set:
Set graphics object properties
set(H,Name,Value) specifies a value for the property
Name on the object identified by H. Use single quotes around
the property name, for example, set(H,'Color','red'). If H
Trang 2
is a vector of objects, then set sets the property for all
the objects.
gca:
gca returns the current axes or chart for the current
figure, which is typically the last one created or clicked
with the mouse. Graphics functions, such as title, target
the current axes or chart. Use ax to access and modify
properties of the axes or chart. If axes or charts do not
exist, then gca creates Cartesian axes.
1.1.3. Chương trình mẫu thực hiện mã hóa U NRZ-L
Tạo chuỗi dữ liệu nhị phân và thực hiện điều chế xung:
bitstream = [ 0 1 0 0 1 1 0 0 0 1 0]
pulse_high = 5;
pulse_low = 0;
if bitstream(bit) == 0
% low level pulse
y = (bt<bit)*pulse_low;
else
% high level pulse
y = (bt<bit) * pulse_high;
end
try
if bitstream(bit+1) == 1
y(end) = pulse_high;
end
catch e
% assume next bit is 1
y(end) = pulse_high;
end
Trang 3
% draw grid
grid on;
axis([0 length(bitstream) pulse_low-1…
pulse_high+1]);
set(gca,'YTick', [pulse_low pulse_high])
set(gca,'XTick', 1:length(bitstream))
title('Unipolar Non-Return-to-Zero Level')
1.1.4. Chương trình mẫu phân tích phổ của Polar NRZ-L
pulse_high = 1;
pulse_low = -1;
yy=[];
if bitstream(bit) == 0
% low level pulse
y = (bt<bit)*pulse_low;
else
% high level pulse
y = (bt<bit) * pulse_high;
end
Trang 4
yy=[yy y];
end
k=zeros(100,400);
for j=1:1:100
k(j,:)=yy(400*j-399:400*j);
sep(j,:)=fft(k(j,:),128);
end
n=size(sep,2);
fs=4*fb;
f = (0:n-1)*(fs/n); % frequency range
m_sep=mean((abs(sep).^2),1)/fs;
figure(1);
plot(f,m_sep);
% draw grid
grid on;
ylabel('Mean square voltage');
xlabel('Frequency');
title('Polar Non-Return-to-Zero Level');
Câu 2: Thay đổi chuỗi dữ liệu toàn bit “0” quan sát và vẽ tín hiệu sau điều
biến?
Câu 3: Thay đổi dữ liệu toàn bit “1” quan sát và vẽ tín hiệu sau điều biến?
Câu 4: Từ chương trình mẫu 1.1.3, thay đổi “pulse_low = -5”, quan sát và
vẽ tín hiệu sau mã hóa?
Trang 5
Câu 6: Xây dựng mô phỏng theo mô hình sau, so sánh kết quả phổ với câu
5?
1.2.3. Bipolar-AMI
% pulse height
pulse = 5;
if bitstream(bit) == 0
% binary 0, set to zero
……………………………………
else
% each binary 1 has the opposite pulse level from the
previous
……………………………………
……………………………………
end
Trang 6
end
catch e
% bitstream end; assume next bit is 0
y(end) = -current_level;
end
1.2.4. Manchester.
% pulse height
pulse = 1;
yy=[];
for bit = 1:length(bitstream)
% set bit time
bt = bit-1:0.1:(bit-0.1);
if bitstream(bit) == 1
% low -> high
y = (bt<bit) * pulse …………………… * (bt < bit -
0.5);
% set last pulse point to high level
current_level = pulse;
else
% high -> low
y = -(bt<bit) * pulse + …………………… (bt < bit -
0.5);
% set last pulse point to low level
current_level = -pulse;
end
try
% if the next bit is the same as this one
change the level
if bitstream(bit+1) == bitstream(bit)
y(end) = -current_level;
else
y(end) = current_level;
end
catch e
% assume next bit is the same as the last one
Trang 7
y(end) = current_level;
end
Trang 8