plot(s,angle,'-r'); % plotting (Figure 1)
title('Figure1: Absolute value of cosine(angle)'); % figure's title,
legend('Absolute value of cosine(angle)'); % legend
axis([-1 1 0 1]);
xlabel('s'); ylabel('cos(angle)'); % and axis label
So, this is my code for plotting. When I plot it ti get a straight line at y =0.8210. The final value of angle is 0.8210. So, the problem is that when I run the loop, I see different values of angle, but when the graph is plotted, it takes angle to be 0.8210 throughout. How do I fix this?
Thanks
to
angle(k+1) = dot(V5,V6)/norm(V5)*norm(V6);
It would be better also to preallocate the s and angle vectors outside the loop.
Hth
Darren