calcH_MAG.m 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. function H_MAG = calcH_MAG(gPhi,gPsi,gTheta,magX,magY,magZ,q0,q1,q2,q3)
  2. %CALCH_MAG
  3. % H_MAG = CALCH_MAG(GPHI,GPSI,GTHETA,MAGX,MAGY,MAGZ,Q0,Q1,Q2,Q3)
  4. % This function was generated by the Symbolic Math Toolbox version 6.1.
  5. % 15-Feb-2015 16:00:09
  6. t2 = cos(gPhi);
  7. t3 = cos(gTheta);
  8. t4 = sin(gPhi);
  9. t5 = sin(gTheta);
  10. t6 = q0.^2;
  11. t7 = q1.^2;
  12. t8 = q2.^2;
  13. t9 = q3.^2;
  14. t10 = t6+t7-t8-t9;
  15. t11 = sin(gPsi);
  16. t12 = cos(gPsi);
  17. t13 = q0.*q2.*2.0;
  18. t14 = q1.*q3.*2.0;
  19. t15 = t13+t14;
  20. t16 = q0.*q3.*2.0;
  21. t18 = q1.*q2.*2.0;
  22. t17 = t16-t18;
  23. t19 = t3.*t11;
  24. t20 = t4.*t5.*t12;
  25. t21 = t19+t20;
  26. t22 = t16+t18;
  27. t23 = t5.*t11;
  28. t41 = t3.*t4.*t12;
  29. t24 = t23-t41;
  30. t25 = q0.*q1.*2.0;
  31. t31 = q2.*q3.*2.0;
  32. t26 = t25-t31;
  33. t27 = t6-t7+t8-t9;
  34. t28 = t5.*t12;
  35. t29 = t3.*t4.*t11;
  36. t30 = t28+t29;
  37. t32 = t3.*t12;
  38. t46 = t4.*t5.*t11;
  39. t33 = t32-t46;
  40. t35 = t4.*t17;
  41. t36 = t2.*t5.*t10;
  42. t37 = t2.*t3.*t15;
  43. t38 = t35+t36-t37;
  44. t39 = magZ.*t38;
  45. t40 = t10.*t21;
  46. t42 = t15.*t24;
  47. t43 = t2.*t12.*t17;
  48. t44 = t40+t42-t43;
  49. t45 = magY.*t44;
  50. t47 = t10.*t33;
  51. t48 = t15.*t30;
  52. t49 = t2.*t11.*t17;
  53. t50 = t47+t48+t49;
  54. t51 = magX.*t50;
  55. t52 = -t39+t45+t51;
  56. t53 = 1.0./t52;
  57. t54 = t4.*t27;
  58. t55 = t2.*t3.*t26;
  59. t56 = t2.*t5.*t22;
  60. t57 = -t54+t55+t56;
  61. t58 = magZ.*t57;
  62. t59 = t21.*t22;
  63. t60 = t24.*t26;
  64. t61 = t2.*t12.*t27;
  65. t62 = t59-t60+t61;
  66. t63 = magY.*t62;
  67. t64 = t26.*t30;
  68. t65 = t22.*t33;
  69. t66 = t2.*t11.*t27;
  70. t67 = t64-t65+t66;
  71. t68 = magX.*t67;
  72. t69 = t58-t63+t68;
  73. t70 = t53.*t69;
  74. t34 = tan(t70);
  75. t71 = t34.^2;
  76. t72 = t71+1.0;
  77. t73 = 1.0./t52.^2;
  78. H_MAG = [-t72.*(t53.*(magZ.*(t4.*t26+t2.*t3.*t27)+magY.*(t24.*t27+t2.*t12.*t26)+magX.*(t27.*t30-t2.*t11.*t26))-t69.*t73.*(magZ.*(t4.*t15+t2.*t3.*t17)+magY.*(t17.*t24+t2.*t12.*t15)+magX.*(t17.*t30-t2.*t11.*t15))),t72.*(t53.*(magZ.*(t2.*t3.*t22-t2.*t5.*t26)+magY.*(t22.*t24+t21.*t26)+magX.*(t22.*t30+t26.*t33))+t69.*t73.*(magZ.*(t2.*t3.*t10+t2.*t5.*t15)+magY.*(t10.*t24-t15.*t21)+magX.*(t10.*t30-t15.*t33))),t72.*(t53.*(-magZ.*(t4.*t22+t2.*t5.*t27)+magY.*(t21.*t27-t2.*t12.*t22)+magX.*(t27.*t33+t2.*t11.*t22))-t69.*t73.*(magZ.*(t4.*t10-t2.*t5.*t17)+magY.*(t17.*t21+t2.*t10.*t12)+magX.*(t17.*t33-t2.*t10.*t11))),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];