RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
dist_based_position.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 
22 #include "dist_based_position.h"
23 
24 #include <math.h>
25 
26 #include "matrix.h"
27 #include "vector.h"
28 
30  matrix_t approx_value_arr[],
31  matrix_t absolute_error_arr[],
32  uint8_t length)
33 {
34  uint8_t i;
35 
36  if ((value_arr != NULL) && (approx_value_arr != NULL)
37  && (absolute_error_arr != NULL)) {
38  for (i = 0; i < length; i++) {
39  absolute_error_arr[i] = fabs(
40  value_arr[i] - approx_value_arr[i]);
41  }
42  }
43 }
44 
46  matrix_t point[3])
47 {
48  matrix_t dist = 0.0;
49  matrix_t diff_vec[3];
50 
51  vector_sub(3, ref_point, point, diff_vec);
52  dist = vector_get_norm2(3, diff_vec);
53 
54  return dist;
55 }
vector_get_norm2
vector_t vector_get_norm2(uint8_t length, vector_t arr[])
Compute the 2-norm norm of a vector.
Definition: vector.c:42
dist_based_position.h
Functions of distance-based localization systems.
dist_based_get_distance_to_anchor
matrix_t dist_based_get_distance_to_anchor(matrix_t ref_point[3], matrix_t point[3])
Computes the distance between a mobile station and a reference station of a distance-based localizati...
Definition: dist_based_position.c:45
matrix.h
Matrix computations.
dist_based_get_absolute_error
void dist_based_get_absolute_error(matrix_t value_arr[], matrix_t approx_value_arr[], matrix_t absolute_error_arr[], uint8_t length)
Computes the absolute error of a position of a distance-based localization system.
Definition: dist_based_position.c:29
matrix_t
#define matrix_t
Define the data type of the matrix elements.
Definition: matrix.h:38
vector.h
Vector computations.
vector_sub
void vector_sub(uint8_t size, vector_t a_vec[], vector_t b_vec[], vector_t a_minus_b[])
Compute the subtraction of two vectors.
Definition: vector.c:94