the purpose of this code segment
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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 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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standard File Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!