RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
magnetic_based_fi.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
3  * 2020 Freie Universität Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
23 #include <math.h>
24 #include <inttypes.h>
26 
27 #include "matrix.h"
28 
29 void magnetic_based_f_i(uint8_t ref_points_num,
30  matrix_t ref_points_matrix[][3], matrix_t point[],
31  matrix_t Bi_vec[], matrix_t f_vec[])
32 {
33 
34  for (int i = 0; i < ref_points_num; i++) {
35 
36  matrix_t X_Xi_sq = pow(point[0] - ref_points_matrix[i][0], 2);
37  matrix_t Y_Yi_sq = pow(point[1] - ref_points_matrix[i][1], 2);
38  matrix_t Z_Zi_sq = pow(point[2] - ref_points_matrix[i][2], 2);
39 
40  f_vec[i] = (K_T * (sqrt(X_Xi_sq + Y_Yi_sq + 4.0 * Z_Zi_sq)) /
41  pow((X_Xi_sq + Y_Yi_sq + Z_Zi_sq), 2))
42  - Bi_vec[i];
43  }
44 }
magnetic_based_position.h
Functions of of DC-pulsed, magnetic localization system.
matrix.h
Matrix computations.
magnetic_based_f_i
void magnetic_based_f_i(uint8_t ref_points_num, matrix_t ref_points_matrix[][3], matrix_t point[], matrix_t Bi_vec[], matrix_t f_vec[])
Defines the error function of a magnetic-based localization system.
Definition: magnetic_based_fi.c:29
K_T
#define K_T
The number of turns of the wire.
Definition: magnetic_based_position.h:75
matrix_t
#define matrix_t
Define the data type of the matrix elements.
Definition: matrix.h:38