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
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>
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
Curve Fit class.
Definition CurveFitVal.h:20
double loadFactor
Definition CurveFitVal.h:62
std::size_t pdegree
Definition CurveFitVal.h:54
std::vector< double > xcoord
Definition CurveFitVal.h:58
std::vector< double > Fit_Coefficients()
CurveFitVal(std::vector< double > xcoord, std::vector< double > ycoord, const std::size_t pdegree, const double loadFactor=0)
Definition CurveFitVal.h:29
double calculate() const