MEASUR-Tools-Suite
v1.0.11
The MEASUR Tools Suite is a collection of industrial efficiency calculations written in C++ and with bindings for compilation to WebAssembly.
Loading...
Searching...
No Matches
include
util
CurveFitVal.h
1
13
#ifndef TOOLS_SUITE_CURVEFITVAL_H
14
#define TOOLS_SUITE_CURVEFITVAL_H
15
16
#include <exception>
17
#include <iostream>
18
#include <stdexcept>
19
#include <vector>
20
class
CurveFitVal
{
21
public
:
29
CurveFitVal
(std::vector<double>
xcoord
, std::vector<double> ycoord,
const
std::size_t
pdegree
,
30
const
double
loadFactor
= 0)
31
:
pdegree
(
pdegree
),
xcoord
(std::move(
xcoord
)), ycoord(std::move(ycoord)),
loadFactor
(
loadFactor
) {
32
if
(this->xcoord.size() != this->ycoord.size()) {
33
throw
std::runtime_error(
"X and Y coordinate vectors must be the same size"
);
34
}
35
36
coeff =
Fit_Coefficients
();
37
}
38
43
double
calculate
()
const
;
44
double
calculate
(
double
)
const
;
45
46
public
:
47
// coeff public so quadratic equation can be used
48
std::vector<double> coeff;
49
50
private
:
54
std::size_t
pdegree
;
58
std::vector<double>
xcoord
, ycoord;
62
double
loadFactor
;
63
67
std::vector<double>
Fit_Coefficients
();
68
};
69
70
#endif
// TOOLS_SUITE_CURVEFITVAL_H
CurveFitVal
Curve Fit class.
Definition
CurveFitVal.h:20
CurveFitVal::loadFactor
double loadFactor
Definition
CurveFitVal.h:62
CurveFitVal::pdegree
std::size_t pdegree
Definition
CurveFitVal.h:54
CurveFitVal::xcoord
std::vector< double > xcoord
Definition
CurveFitVal.h:58
CurveFitVal::Fit_Coefficients
std::vector< double > Fit_Coefficients()
CurveFitVal::CurveFitVal
CurveFitVal(std::vector< double > xcoord, std::vector< double > ycoord, const std::size_t pdegree, const double loadFactor=0)
Definition
CurveFitVal.h:29
CurveFitVal::calculate
double calculate() const
Generated by
1.9.8