random_binary.m
来自「对于QPSK通信系统的蒙特卡洛仿真」· M 代码 · 共 15 行
M
15 行
% File: random_binary.m
%
%
function [x, bits] = random_binary(nbits,nsamples)
% This function genrates a random binary waveform of length nbits
% sampled at a rate of nsamples/bit.
x = zeros(1,nbits*nsamples);
bits = round(rand(1,nbits));
for m=1:nbits
for n=1:nsamples
index = (m-1)*nsamples + n;
x(1,index) = (-1)^bits(m);
end
end
% End of function file.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?