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#pragma once
2
15#include <exception>
16#include <iostream>
17#include <stdexcept>
18#include <vector>
20 public:
28 CurveFitVal(std::vector<double> xcoord, std::vector<double> ycoord, const std::size_t pdegree,
29 const double loadFactor = 0)
30 : pdegree(pdegree), xcoord(std::move(xcoord)), ycoord(std::move(ycoord)), loadFactor(loadFactor) {
31 if (this->xcoord.size() != this->ycoord.size()) {
32 throw std::runtime_error("X and Y coordinate vectors must be the same size");
33 }
34
35 coeff = Fit_Coefficients();
36 }
37
42 double calculate() const;
43 double calculate(double) const;
44
45 public:
46 // coeff public so quadratic equation can be used
47 std::vector<double> coeff;
48
49 private:
53 std::size_t pdegree;
57 std::vector<double> xcoord, ycoord;
61 double loadFactor;
62
66 std::vector<double> Fit_Coefficients();
67};
68
Curve Fit class.
Definition CurveFitVal.h:19
double loadFactor
Definition CurveFitVal.h:61
std::size_t pdegree
Definition CurveFitVal.h:53
std::vector< double > xcoord
Definition CurveFitVal.h:57
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:28
double calculate() const