the purpose of this code segment

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 日

2 投票

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!

サインインしてコメントする。

カテゴリ

質問済み:

2020 年 4 月 18 日

コメント済み:

2020 年 4 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by