Crates.io | gaussian_curve_fit |
lib.rs | gaussian_curve_fit |
version | 0.2.1 |
source | src |
created_at | 2024-11-01 03:32:18.414346 |
updated_at | 2024-11-04 08:49:57.067425 |
description | A no_std and no heap memory library for gaussian curve coefficents calculation. |
homepage | https://github.com/Joker2770/gaussian_curve_fit |
repository | https://github.com/Joker2770/gaussian_curve_fit |
max_upload_size | |
id | 1431260 |
size | 48,098 |
A no_std
and no heap memory library for gaussian curve coefficents calculation.
let mut gaussian_coes = GaussianCoefficents2D::default();
let xdata = [
-8.0f32, -6.0f32, -4.0f32, -2.0f32, 0.0f32, 2.0f32, 4.0f32, 6.0f32,
];
let ydata = [
6.7f32, 10.6f32, 13.5f32, 15.7f32, 16.6f32, 15.4f32, 14.2f32, 10.3f32,
];
let (x_arr, y_arr) = GaussianCoefficents2D::get_matrix_data_from_8_points(&xdata, &ydata);
gaussian_coes.get_coefficents_from_8_matrix_data(&x_arr, &y_arr, 1e-4);
assert!((gaussian_coes.value(-8.0f32) - 6.7f32).abs() < 1.0f32);
assert!((gaussian_coes.value(-4.0f32) - 13.5f32).abs() < 1.0f32);
assert!((gaussian_coes.value(0.0f32) - 16.6f32).abs() < 1.0f32);
assert!((gaussian_coes.value(4.0f32) - 14.2f32).abs() < 1.0f32);