% Test script for the CORDIC algorithm
% Author: Michel Barbeau
% Version: December 19, 2014
% number of iterations
n = 10;
% angles
x = 0:0.1:2*pi;
x=[x,x];
% in-phase and quadrature vs angle array
y=zeros(2,length(x));
for i=1:1:length(x)
    % compute the CORDIC vector
    v=cordic(x(i), n);
    % get the in-phase
    y(1,i) = v(1);
    % get the quadrature
    y(2,i) = v(2);
end
% plot the in-phase and quadrature
plot( 0:0.1:4*pi,y(1,:),'--',0:0.1:4*pi,y(2,:),':');
xlabel('Angle (radian)');
ylabel('Amplitude');
legend('in-phase','quadrature');