calcH_MAG.m 939 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. function H_MAG = calcH_MAG(magX,magY,magZ,q0,q1,q2,q3)
  2. %CALCH_MAG
  3. % H_MAG = CALCH_MAG(MAGX,MAGY,MAGZ,Q0,Q1,Q2,Q3)
  4. % This function was generated by the Symbolic Math Toolbox version 5.8.
  5. % 27-Dec-2014 13:59:09
  6. t2 = q0.^2;
  7. t3 = q1.^2;
  8. t4 = q2.^2;
  9. t5 = q3.^2;
  10. t6 = q0.*q2.*2.0;
  11. t7 = q1.*q3.*2.0;
  12. t8 = t6+t7;
  13. t9 = q0.*q3.*2.0;
  14. t13 = q1.*q2.*2.0;
  15. t10 = t9-t13;
  16. t11 = t2+t3-t4-t5;
  17. t12 = magX.*t11;
  18. t14 = magZ.*t8;
  19. t19 = magY.*t10;
  20. t15 = t12+t14-t19;
  21. t16 = t2-t3+t4-t5;
  22. t17 = q0.*q1.*2.0;
  23. t24 = q2.*q3.*2.0;
  24. t18 = t17-t24;
  25. t20 = 1.0./t15;
  26. t21 = magY.*t16;
  27. t22 = t9+t13;
  28. t23 = magX.*t22;
  29. t28 = magZ.*t18;
  30. t25 = t21+t23-t28;
  31. t29 = t20.*t25;
  32. t26 = tan(t29);
  33. t27 = 1.0./t15.^2;
  34. t30 = t26.^2;
  35. t31 = t30+1.0;
  36. H_MAG = [-t31.*(t20.*(magZ.*t16+magY.*t18)+t25.*t27.*(magY.*t8+magZ.*t10)),t31.*(t20.*(magX.*t18+magZ.*t22)+t25.*t27.*(magX.*t8-magZ.*t11)),t31.*(t20.*(magX.*t16-magY.*t22)+t25.*t27.*(magX.*t10+magY.*t11)),0.0,0.0,0.0,0.0,0.0,0.0];