Bài tập môn học kỹ thuật truyền dẫn

  • Người chia sẻ :
  • Số trang : 15 trang
  • Lượt xem : 11
  • Lượt tải : 500
  • Tất cả luận văn được sưu tầm từ nhiều nguồn, chúng tôi không chịu trách nhiệm bản quyền nếu bạn sử dụng vào mục đích thương mại

NHẬP MÃ XÁC NHẬN ĐỂ TẢI LUẬN VĂN NÀY

Nếu bạn thấy thông báo hết nhiệm vụ vui lòng tải lại trang

Bạn đang xem trước 20 trang tài liệu Bài tập môn học kỹ thuật truyền dẫn, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD LUẬN VĂN ở trên

Mã nguồn chương trình Matlab: 1.Mã NRZ: file nrz_l.m function y=nrz_l(x) for i=1:length(x) if x(i)==0 temp(i) = -1; else temp(i) = +1; end; end y=temp; 2.Mã CMI: file cmi_1.m function y = cmi(x); polar = +1; %chon cuc tinh cua bit 1 dau tien la duong for i=1:length(x) if x(i)==1 temp(2*i-1) = polar; temp(2*i) = polar; polar = -polar; %xac dinh cuc tinh cho bit 1 tiep theo else temp(2*i-1) = -1; temp(2*i) = +1; end end y = temp; 3.Mã HDB3: File hdb3.m function y = hdb3(x) next_polar = +1; b=0; %so bit B giua 2 bit V i=1; while i<= length(x) if x(i)==1 temp(i)=next_polar; next_polar = -next_polar; b=b+1; i=i+1; else if (i<=length(x)-3)&(x(i+1)==0) & (x(i+2)==0) & (x(i+3)==0) %truong hop 4 bit 0 lien tiep if mod(b,2)==1 temp(i) = 0; %bit 0 temp(i+1) = 0; %bit 0 temp(i+2) = 0; %bit 0 temp(i+3) = -next_polar;%bit V next_polar = -next_polar; b=0; i=i+4; else temp(i) = next_polar; %bit B temp(i+1) = 0; %bit 0 temp(i+2) = 0; %bit 0 temp(i+3) = next_polar; %bit V next_polar = -next_polar; b=0; i=i+4; end else temp(i)=0; %truong hop 3 bit ke tiep khac 000 i=i+1; end end