📄 cordic.m
字号:
% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -