MATLAB: Hey guys.,x1=[6.630]; y1=[12.294]; z1=[-1.457]; x2=[7.613]; y2=[12.686]; z2=[-0.404]; x3=[8.324]; y3=[11.427]; z3=[0.102]; x4=[9.372]; y4=[11.018]; z4=[-0.564]; these are coordinates to calculate phi and psi angles, please tell me how i should do.

angle between points

hey guys.,
x1=[6.630]; y1=[12.294]; z1=[-1.457]; x2=[7.613]; y2=[12.686]; z2=[-0.404]; x3=[8.324]; y3=[11.427]; z3=[0.102]; x4=[9.372]; y4=[11.018]; z4=[-0.564];
these are coordinates to calculate phi and psi angles, please tell me how i should do.?

Best Answer

(Corrected) I am assuming that the four sets of coordinates you describe correspond to four points P1 = [x1;y1;z1], P2 = [x2;y2;z2], P3 = [x3;y3;z3], P4 = [x4;y4;z4], and that these four points are positions of four atoms in a polypeptide chain for which you wish to determine their torsion angle, as defined in the website:
http://www.proteinstructures.com/Structure/Structure/Ramachandran-plot.html
for the four corresponding points A, B, C, and D in the “standard IUPAC definition” given there. This torsion angle can vary from -180 to +180 degrees as the rotation varies from extreme counterclockwise to extreme clockwise, respectively, while moving forward from point B (P2) to point C (P3). This is a signed dihedral angle between the plane defined by points A, B, and C, and the plane defined by points B, C, and D.
That computation can be performed in Matlab as follows:
Q12 = cross(P3-P2,P1-P2);
Q43 = cross(P3-P2,P4-P3);
Q1243 = cross(Q12,Q43);
ang = atan2d(sign(dot(P3-P2,Q1243))*norm(Q1243),dot(Q12,Q43));
[Note that the function ‘atan2d’ is used here to obtain angles in degrees, and the quantity “sign(dot(P3-P2,Q1243))” is used to distinguish between clockwise and counterclockwise rotations.]