Need help for Cordic Function implementation

1 次查看(过去 30 天)
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

回答(1 个)

bym
bym 2011-10-27
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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by