diff --git a/mission/controller/acs/Igrf13Model.cpp b/mission/controller/acs/Igrf13Model.cpp index ec1b3e08..960ab462 100644 --- a/mission/controller/acs/Igrf13Model.cpp +++ b/mission/controller/acs/Igrf13Model.cpp @@ -144,39 +144,39 @@ void Igrf13Model::updateCoeffGH(timeval timeOfMagMeasurement) { void Igrf13Model::schmidtNormalization() { double kronDelta = 0; schmidtFactors[0][0] = 1; - // for (int n = 1; n <= igrfOrder; n++) { - // if (n == 1) { - // schmidtFactors[0][n - 1] = 1; - // } else { - // schmidtFactors[0][n - 1] = schmidtFactors[0][n - 2] * (2 * n - 1) / n; - // } - // - // for (int m = 1; m <= igrfOrder; m++) { - // if (m == 1) { - // kronDelta = 1; - // } else { - // kronDelta = 0; - // } - // schmidtFactors[m][n - 1] = - // schmidtFactors[m - 1][n - 1] * sqrt((n - m + 1) * (kronDelta + 1) / (n + m)); - // } - // } - for (int n = 1; n <= igrfOrder; n++) { - for (int m = 0; m <= n; m++) { - if (m > 1) { - schmidtFactors[m][n - 1] = schmidtFactors[m - 1][n - 1] * pow((n - m + 1) / (n + m), .5); - } else if (m > 0) { - schmidtFactors[m][n - 1] = - schmidtFactors[m - 1][n - 1] * pow(2 * (n - m + 1) / (n + m), .5); - } else if (n == 1) { - schmidtFactors[m][n - 1] = 1; + if (n == 1) { + schmidtFactors[0][n - 1] = 1; + } else { + schmidtFactors[0][n - 1] = schmidtFactors[0][n - 2] * (2 * n - 1) / n; + } + for (int m = 1; m <= igrfOrder; m++) { + if (m == 1) { + kronDelta = 1; } else { - schmidtFactors[m][n - 1] = schmidtFactors[0][n - 2] * (2 * n - 1) / (n); + kronDelta = 0; } + schmidtFactors[m][n - 1] = + schmidtFactors[m - 1][n - 1] * sqrt((n - m + 1) * (kronDelta + 1) / (n + m)); } } + // for (int n = 1; n <= igrfOrder; n++) { + // for (int m = 0; m <= n; m++) { + // if (m > 1) { + // schmidtFactors[m][n - 1] = schmidtFactors[m - 1][n - 1] * pow((n - m + 1) / (n + m), + // .5); + // } else if (m > 0) { + // schmidtFactors[m][n - 1] = + // schmidtFactors[m - 1][n - 1] * pow(2 * (n - m + 1) / (n + m), .5); + // } else if (n == 1) { + // schmidtFactors[m][n - 1] = 1; + // } else { + // schmidtFactors[m][n - 1] = schmidtFactors[0][n - 2] * (2 * n - 1) / (n); + // } + // } + // } + for (int i = 0; i <= igrfOrder; i++) { for (int j = 0; j <= (igrfOrder - 1); j++) { coeffG[i][j] = schmidtFactors[i][j] * coeffG[i][j];