⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 binary.m

📁 英文书《Digital Signal Processing with Examples in MATLAB》附带的MATLAB实例
💻 M
字号:
function bits=binary(x,N)
% bits=binary(x,N)
% Input:
% x     =vector of integers >=0 with N bits/integer.
% Output:
% bits  = row vector with N*length(x) binary elements.
% Example:
% >> bits=binary([0,15,3], 4)
% bits =
%  0  0  0  0  1  1  1  1  0  0  1  1
x=row_vec(round(x));
if min(x)<0,
	error('x cannot have negative elements.');
elseif N<2 | N>32,
	error('N must be in the range [2,32].');
end
bits=rem(fix(row_vec(x'*2.^-[N-1:-1:0])),2);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -