% dotproduct.m

in1 = input('Enter plunge & trend of vector 1 as [p t]: ');

in2 = input('Enter plunge & trend of vector 2 as [p t]: ');

V1 = [ cos(in1(1)*pi/180)*cos(in1(2)*pi/180)...
       cos(in1(1)*pi/180)*sin(in1(2)*pi/180)...
       sin(in1(1)*pi/180) ]

V2 = [ cos(in2(1)*pi/180)*cos(in2(2)*pi/180)...
       cos(in2(1)*pi/180)*sin(in2(2)*pi/180)...
       sin(in2(1)*pi/180) ]

CosTheta = dot(V1,V2)

Theta = acos(CosTheta)*180/pi

