i have a program like below :
a=dec2bin(n,8) . n is random input from 0 to 255. then i want to plot the result of 'a' into NRZ signal format. anyone can help me?

 채택된 답변

Walter Roberson
Walter Roberson 2017년 6월 2일

0 개 추천

bits = reshape( (dec2bin(n,8) - '0').', 1, [] );
encoded_bits = unrz(bits)
Now you can plot the encoded bits

댓글 수: 4

it's said error
Install the above contribution. Then
FS = 8000; %sample frequency
n = randi([0 256], 1, 5); %sample data
bits = reshape( (dec2bin(n,8) - '0').', 1, [] );
[t, encoded_bits] = unrz(bits, FS);
stairs(t, encoded_bits)
ok thank you for the answer. it's very helpful
I am running this code and it is showing undefined function or variable unrz. Kindly help me in this regard.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by