I want to find the angle between two vectors, but some times, it looks not very correct.
Is there any better methods to do this?
Tx = [-1 10];current = [2 4]; % common point
last = [0 4];figure;aa = [Tx;current]plot(aa(:,1),aa(:,2),'bo-'); hold on;aa1 = [last;current]plot(aa1(:,1),aa1(:,2),'mo-'); hold on;plot(current(1),current(2),'go')angle = (atan((Tx(2)-current(2))/(Tx(1)-current(1))) - atan((last(2)-current(2))/(last(1)-current(1)))) * 180/piaxis([-4 10 -4 10])
Best Answer