matlab - Debugging 24 symmetric operators -
i have written following code calculate disorientation between 2 points in large dataset using 24 crystal symmetry operators. code seems work fine though end result not right. have huge dataset containing euler angles each points. find misorientation between 1st point , 2nd point , between 2 , 3rd , on.
i want end result contain corresponding misorientaion angles each 2 data points. following full code better understanding of requirement.
la=[phi1 phi phi2]; function gi=get_gi(pvec) %pvec 1x3 vector of [phi1 phi phi2] g_11=((cosd(pvec(1)).*cosd(pvec(3)))-(sind(pvec(1)).*sind(pvec(3)).*cosd(pvec(2)))); g_12=((sind(pvec(1)).*cosd(pvec(3)))+(cosd(pvec(1)).*sind(pvec(3)).*cosd(pvec(2)))); g_13= (sind(pvec(3)).*sind(pvec(2))); g_21 =((-cosd(pvec(1)).*sind(pvec(3)))-(sind(pvec(1)).*cos(pvec(3)).*cos(pvec(2)))); g_22 = ((-sin(pvec(1)).*sind(pvec(3)))+(cosd(pvec(1)).*cosd(pvec(3)).*cosd(pvec(2)))); g_23 = (cosd(pvec(3)).*sind(pvec(2))); g_31 = (sind(pvec(1)).* sind(pvec(2))); g_32 = -cosd(pvec(1)).* sind(pvec(2)); g_33 = cosd(pvec(2)); gi =[g_11 g_12 g_13;g_21 g_22 g_23;g_31 g_32 g_33]; f = [1 1 1 -1 1 -1 -1 -1 1 1 -1 -1]; l= [1 1 1]; i=1:3:10 l1= [f(i) 0 0;0 f(i+1) 0;0 0 f(i+2)]; l2= [0 f(i) 0;0 0 f(i+1);f(i+2) 0 0]; l3= [0 0 f(i);f(i+1) 0 0;0 f(i+2) 0]; l4= -[0 0 f(i);0 f(i+1) 0;f(i+2) 0 0]; l5= -[0 f(i) 0;f(i+1) 0 0;0 0 f(i+2)]; l6= -[f(i) 0 0;0 0 f(i+1);0 f(i+2) 0]; l=[l;l1;l2;l3;l4;l5;l6]; end k=1; t=1; m=1:(length(a)-1) i=2:3:71 j=2:3:71 g_r= (get_gi(la(m,:)*l(i:i+2,1:3))*(inv(get_gi(la(m+1,:)))*inv(l(j:j+2,1:3)))); tr(k)= g_r(1,1) + g_r(2,2) +g_r(3,3); angle(k) = real(acosd((tr(k)-1)/2)); k=k+1; end angle(angle==0)=360; del_theta=min(angle) del(t)=del_theta; t=t+1; end
Comments
Post a Comment