Need help for Cordic Function implementation
4 views (last 30 days)
Show older comments
I need to fill in the blanks \????" in the provided code to implement the CORDIC function for division. I have to Choose appropriate values for i. Then Test the algorithm by computing the division of 7 by 15. Can any body guide me for this
% Initialize
x = ???;
y = ???;
z = ???;
disp(['True value: x/y = ' num2str(x/y)])
for ii = ???:???,
d = ???;
x = ???;
z = ???;
disp([ii d x z])
end
0 Comments
Answers (1)
bym
on 27 Oct 2011
doesn't follow your template, but might give you some ideas
x = 7;
y = 15;
z = 0;
format long
a = zeros(20,3);
for i = 1:20
if x > 0
x = x - y*2^(-i);
z = z + 2^(-i);
else
x = x + y*2^(-i);
z = z - 2^(-i);
end
a(i,:) = [i 7/15 z];
end
a
0 Comments
See Also
Categories
Find more on Fixed-Point Math Operations in MATLAB and Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!