Digital Signal Processing Reference
In-Depth Information
Now to cater for the recoding part, the problem is reformulating to compute the following set of
iterations for i ¼
1,
...
, N
1:
x i ¼ x i 1 r i tan 2 i y i 1
ð 12 : 17a Þ
y i ¼ r i tan 2 i x i 1 þ y i 1
ð
12
:
17b
Þ
where, unlike
s i , the values of r i are predetermined, and these iterations do not include any
computations of the D i as are done in the basic CORDIC algorithm.
clear all
close all
N=16;
% Computing the constant value K, the recording part
K=1;
for i = 0:N 1
K=K*cos(2^(-(i þ 1)));
end
% The constant initial rotation
theta_init = (2)^0 - (2)^(-N);
x0 = K*cos(theta_init);
y0 = K*sin(theta_init);
cosine = [];
sine = [];
for theta = 0:.1:pi/2
angle =[0:.1:pi/2];
theta = round(theta * 2^(N-1)); % convert theta in Q1.15 format
% Separating bits of theta as b=b[1],b[2],....,b[N]
for k=1:N
b(N+1-k) = rem(theta, 2);
theta = fix(theta/2);
end
% Recoding shifted bits of b as r with +1,-1
for k=1:N
r(k) = 2*b(k) - 1;
end
% First modified CORDIC rotation
x(1) = x0 - r(1)*(tan(2^(-1)) * y0);
y(1) = y0 + r(1)*(tan(2^(-1)) * x0);
% Remainder of the modified CORDIC rotations
for k=2:N,
x(k) = x(k-1) - r(k)* tan(2^(-k)) * y(k-1);
y(k) = y(k-1) + r(k) * tan(2^(-k)) * x(k-1);
end
cosine = [cosine x(k)];
sine = [sine y(k)];
end
Search WWH ::




Custom Search