;*************************************************************** ; Prof. Christopher Russel ; If another rotation is needed to align with a different orientation ; ; Csr = B * Cso ; (CXsr) (b11 b12 b13) (CXso) ; (CYsr) = (b21 b22 b23) (CYso) ; (CZsr) (b31 b32 b33) (CZso) ; where B, (bii) 3x1 is a roatation matrix (inverse = transpose) ; with rows, columns have unit magnitude and are orthogonal. ; Therefore, bii's defaulted values will be set to 0 when i ne j and 1 when i=j, ; shown as above ;*************************************************************** function mag_rotation_cal, Cso, rot_cal ; This calibration function is used to make a correction for the rotation of the sensor ; ; Return values initialization CXsr = 0 CYsr = 0 CZsr = 0 CXsr = rot_cal(0,0)*Cso(0) + rot_cal(0,1)*Cso(1) + rot_cal(0,2)*Cso(2) CYsr = rot_cal(1,0)*Cso(0) + rot_cal(1,1)*Cso(1) + rot_cal(1,2)*Cso(2) CZsr = rot_cal(2,0)*Cso(0) + rot_cal(2,1)*Cso(1) + rot_cal(2,2)*Cso(2) Csr = [CXsr, CYsr, CZsr] return, Csr end; end of function