cordic.m

来自「算超越函数的cordic算法的matlab程序」· M 代码 · 共 64 行

M
64
字号
% function [angle]=cordic(xi,yi);%                     % Initialitation%     x = xi%     y = yi%     z = 0%     d = 1;%     zantes = 0;%     a = 0;          % Iterative factor% 	K = 0.6073;     %K Factor%    % x = K*x;% while a < 11        % Really only takes a half of this value get an 0.001 of error%                     % in cosine and sine values.%      if y >=0%         d=-1;%     else%         d=1;%      end%                      %This function is used to get the +1,-1 value, the sing function don?t%                      %perform d=1 if z=0.%     xantes=x;%      x=xantes-(y*d*(1/2^a))%       y=y+(xantes*d*(1/2^a))%    z=z-(d*(1024*atan(1/2^a)))% %     a=a+1;% end% % % cosine = x;% % sine = y;% angle=z;function [z0]=cordic(xi,yi,angle);                    % Initialitation    x = xi;    y = yi;    z = angle;    d = 1;    zantes = 0;    a = 0;          % Iterative factor	K = 0.6073;     %K Factor    %x = K*x;while a < 11      % Really only takes a half of this value get an 0.001 of error                    % in cosine and sine values.     if z >=0        d=1;     else        d=-1;     end                     %This function is used to get the +1,-1 value, the sing function don?t                    % perform d=1 if z=0.    xantes=x;     x=xantes-(y*d*(1/2^a))      y=y+(xantes*d*(1/2^a))   z=z-(d*(atan(1/2^a)))    a=a+1;end% cosine = x;% sine = y; K*x K*yz0=z;

⌨️ 快捷键说明

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