terminator.m

来自「Cordic算法的Matlab实现」· M 代码 · 共 24 行

M
24
字号
%% description
%   Terminator play an important role in iterative
%   algorithms.In this project, there are mainly two 
%   conditions which terminate the process,zi=0 or 
%   yi=0.However, the word width for every digital 
%   system is finite, which relaxes the conditions. 
%   Therefore, we get
%                          zi < 2^(-wordwidth)
%       or                 yi < 2^(-wordwidth)
% input
%   z or y can play such a role
%   wordwidth is a system parameter
% output
%   signals the end of the process
%% code
function disable=terminator(z,acc)
if(nargin<2)
    acc=2^(-64-5-1);
end
if(abs(z)<acc)
    disable=1;
else disable=0;
end
end

⌨️ 快捷键说明

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