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.?

5 views (last 30 days)
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.?
  2 Comments
KSSV
KSSV on 3 Feb 2017
How these coordinates are related to phi and psi? Do you have any formula?
Stephen23
Stephen23 on 3 Feb 2017
Having lots of variables with names x1, x2, x3, etc, is not a good use of MATLAB: MATLAB works best on arrays, which means keeping your data together as much as possible makes code faster and easier to write.
Using lots of variables also makes accessing them slow and buggy, as is explained here:

Sign in to comment.

Accepted Answer

Roger Stafford
Roger Stafford on 3 Feb 2017
Edited: Roger Stafford on 3 Feb 2017
(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.]
  5 Comments
Roger Stafford
Roger Stafford on 3 Feb 2017
Edited: Roger Stafford on 3 Feb 2017
@Ram. I have modified the answer I gave previously so as both to allow for counterclockwise rotations with negative values and to produce angles in degrees rather than radians. (For your example I got the torsion angle, psi, equal to 85.73846504695527 degrees.)

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!