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

📄 bi2de.m

📁 数字通信第四版原书的例程
💻 M
字号:
function d = bi2de(b, p)
%BI2DE Converts binary to decimal format.
%       D = BI2DE(B) converts a binary representation vector B to a decimal
%       presentation D. When B is a matrix, the output D is a column vector
%       with each element being the transfer of a row of B.
%       The first element in B represents the lowest binary bit. For example
%       bi2de([1 0]) results in 1; bi2de([0 1]) results in 2.
%
%       D = BI2DE(B, P) converts a P-based vector to a decimal.
%
%       See also DE2BI.

%       Wes Wang 9/30/95
%       Copyright (c) 1995-96 by The MathWorks, Inc.
%       $Revision: 1.1 $  $Date: 1996/04/01 17:52:18 $

% check the special cases.
[n,m] = size(b);
if min([m,n]) < 1
    d = [];
    return;
elseif min([n,m]) == 1
    b = b(:)';
    m = max([n,m]);
    n = 1;
end;

if nargin < 2
    p = 2;
end;
d = b * p.^[0 : m-1]';
%---end of BI2DE---

⌨️ 快捷键说明

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