関数fitting_exp マニュアル

(The documentation of function fitting_exp)

Last Update: 2021/12/1


◆機能・用途(Purpose)

データを指数関数でフィットする。
Fit a data by an exponential function.


◆形式(Format)

#include <fitting.h>
inline double ∗fitting_exp
(const int N,const double ∗x,const double ∗y)


◆引数(Arguments)

N フィットするデータ点数。
The number of data points to fit.
x フィットするデータのxの値のリスト。 N個の要素から成る配列で与える。
The list of data values of x to fit, given as an array composed of N components.
y フィットするデータのyの値のリスト。 N個の要素から成る配列で与える。 全ての値が正でなければならない。
The list of data values of y to fit, given as an array composed of N components. All the data must be positive.


◆戻り値(Return value)

データを指数関数y=aebxでフィットしたときの aを第1要素、bを第2要素とする配列。
An array composed of a and b of the fitting line y=aebx as the first and second components.


◆使用例(Example)

double x[]={1.0,2.0,3.0,4.0,5.0};
double y[]={10000.1,1000.2,100.3,10.4,1.5};
double ∗exppara;
exppara=fitting_exp(5,x,y);


◆計算式とアルゴリズム (Formula and algorithm)

(x,y)平面上のN個のデータ点(x1,y1),,(xN,yN)を 指数関数y=aebxでフィットすることを考える。 観測方程式は (1)lnyi=lna+bxi(i=1,2,,N) と書けるので、新しいデータセット(x1,lny1),,(xN,lnyN)を 関数fitting_lineを用いて直線フィッティングすれば、 その傾きがb、切片がlnaとなる。
Consider a problem to fit N data points on (x,y) plane, (x1,y1),,(xN,yN), by an exponential curve y=aebx. The observation equation is given by Eq. (1). Fitting a new data set (x1,lny1),,(xN,lnyN) by a straight line using the function fitting_line gives the slope b and the intercept lna.