Loading [MathJax]/extensions/tex2jax.js
Cantera
3.1.0
Install
User Guide
Examples
Reference
Develop
Community
Toggle main menu visibility
Developer API
Modules
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
v
w
x
Typedefs
Enumerations
Related Symbols
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
v
w
Variables
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
Typedefs
Enumerations
Enumerator
Files
File List
File Members
All
a
b
c
e
f
k
l
m
n
p
s
t
v
x
Functions
Variables
Typedefs
Macros
a
c
e
f
m
n
p
s
t
v
x
Related Pages
cantera.org
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
polyfit.h
Go to the documentation of this file.
1
//! @file polyfit.h
2
3
// This file is part of Cantera. See License.txt in the top-level directory or
4
// at https://cantera.org/license.txt for license and copyright information.
5
6
#ifndef CT_POLYFIT_H
7
#define CT_POLYFIT_H
8
9
#include "
cantera/base/ct_defs.h
"
10
11
namespace
Cantera
12
{
13
14
//! Fits a polynomial function to a set of data points
15
/*!
16
* Given a collection of *n* points *x* and a set of values *y* of some function
17
* evaluated at those points, this function computes the weighted least-squares
18
* polynomial fit of degree *deg*:
19
*
20
* @f[ f(x) = p[0] + p[1] x + p[2] x^2 + \cdots + p[deg] x^deg @f]
21
*
22
* @param n The number of points at which the function is evaluated
23
* @param deg The degree of the polynomial fit to be computed. deg <= n - 1.
24
* @param x Array of points at which the function is evaluated. Length *n*.
25
* @param y Array of function values at the points in *x*. Length *n*.
26
* @param w Array of weights. If w == nullptr or w[0] < 0, then all the
27
* weights will be set to 1.0.
28
* @param[out] p Array of polynomial coefficients, starting with the constant
29
* term. Length *deg+1*.
30
* @returns the root mean squared error of the fit at the input points.
31
* @ingroup mathUtils
32
*/
33
double
polyfit
(
size_t
n,
size_t
deg,
const
double
* x,
const
double
* y,
34
const
double
* w,
double
* p);
35
36
}
37
#endif
ct_defs.h
This file contains definitions of constants, types and terms that are used in internal routines and a...
Cantera::polyfit
double polyfit(size_t n, size_t deg, const double *xp, const double *yp, const double *wp, double *pp)
Fits a polynomial function to a set of data points.
Definition
polyfit.cpp:14
Cantera
Namespace for the Cantera kernel.
Definition
AnyMap.cpp:595
include
cantera
numerics
polyfit.h
Generated by
1.9.7