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

📄 direction.m

📁 Cordic算法的Matlab实现
💻 M
字号:
%% description
% In order to find the right direction to rotate, this
% program was provided.According to the algorithm, it's
% much too easy to choose di. However, this file was 
% provided separately to make the structure of the 
% program clear.
% inputs/outputs refer to cordic.m,while dv_name denotes
% the name of the decision variable

%% code
function di=direction(dv,dv_name)
% check the No. of inputs
if(nargin<2)
    dv_name='z'; % default decision variable:z
end
% main code section
di=1;
if(dv_name=='x' || dv_name=='y' || dv_name=='z')
    % main code section
    if(dv_name=='z') % z is decision variable
        if(dv<0) di=-1; end
    else % x/y is decision variable
        if(dv>=0) di=-1; end
    end
else printf('Wrong decision name!\n');
end
%end of function
end

⌨️ 快捷键说明

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