the purpose of this code segment

조회 수: 4 (최근 30일)
Oai Vu
Oai Vu 2020년 4월 18일
댓글: Oai Vu 2020년 4월 19일
I'm trying to understand the purpose of this code segment
binary_data=kron(ones(1,ratio),binary_data)';
binary_data=binary_data(:);
plot(binary_data);
here ratio = sample_rate/bit_rate and binary_data is a sequence of bits which are converted from a string of text
Is it for NRZ modulation? If it is, what actually happens in detail?

답변 (1개)

Sriram Tadavarty
Sriram Tadavarty 2020년 4월 18일
Hi Oai,
The placed code just repeats the binary data by the ratio provided. It is a sort of upsampling when the binary_vector is column, and repetition of binary_vector if the input is row vector. But not NRZ modulation, since, 0 is not placed as -1.
ratio = 100;
binary_data = [1;1;0;1;0];
binary_data=kron(ones(1,ratio),binary_data)'; % This performs kronecker product and performs transpose
binary_data=binary_data(:); % This makes it to a single column vector
plot(binary_data); % Plots the code
For more details on kroncker product, look at kron page.
For simple exaplanation of what that the 3rd line in above does is below:
% Assume ratio is 2, binary data is [1;1;0]
kron([1 1],[1;0;1])' % kron([a1 a2],B) and then transpose
% This will give a matrix as such
% [a1*B a2*B] => [B B]'
% kron output is
% [1 1;
% 1 1;
% 0 0];
% Transpose the kron output
% [1 1 0;
% 1 1 0];
% Now make it column vector with command(:)
% Output is [1 1 1 1 0 0]'
% For a case of row vector [1 1 0]
% Output is
% [1 1 0 1 1 0]'
Hope this helps.
Regards,
Sriram
  댓글 수: 1
Oai Vu
Oai Vu 2020년 4월 19일
Thank you very much for your help!

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

카테고리

Help CenterFile Exchange에서 Modulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by