I want to calculate the angle of two n-dimensional vectors having a reference point also. What I have found so far is this for 3D:
p1 = [DN(3,1) DN(3,2) DN(3,3)];
p2 = [DN(2,1) DN(2,2) DN(2,3)];
refpoint = [DN(1,1) DN(1,2) DN(1,3)];
v1 = p1 - refpoint;
v2 = p2 - refpoint;
angNew = rad2deg(atan2(norm(cross(v1,v2)),dot(v1,v2)));
disp(angNew)
Thnx very much in advance.