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

📄 dbc.m

📁 dpcm matlab code in zip format
💻 M
字号:
function [b0,b,bb]=dbc(x,B);% [b0,b,bb]=dbc(x,B)%% Decimal-to-Binary conversion using B+1 bit precision%% x  : a constant in decimal% B  : number of the precision bit% b0 : sign bit ( 0 represent + sign, and 1 represents - sign)% b  : binary bits after the binary point% bb : (B+1)st bit% ---------------------------------------------------------------------------% Example: x=-0.778; b=4;%          [b0,b,bb]=dbc(x,B);    % returns binary result.%          [b]=qround(b,bb);      % rounds off the binary input, returns binary.%          [Y]=bdc(b0,b);         % returns decimal result.%%      see also QROUND and BDC%% Sabri Gurbuz, 7-27-98% Drexel University% E-mail:sabrig@cbis.ece.drexel.edu% *************************************************************************** B = B-1;
if x>1, error(' x is not normilized.'); end  if x>=0	b0=0;		% + sign is assigned.	z=x;else 	b0=1;		% - sign is assigned. 	z=-x;endif z >= 0    for i=1:B,	a=2*z;     if a>=1	b(i)=1;	z=a-1;     else         b(i)=0;         z=a;     end    end	a=2*z;        % finds B+1 th bit in the binary point part     if a>=1	bb=1;      else         bb=0;      end    end 	 

⌨️ 快捷键说明

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