legendre.h

来自「Legendre正交多项式拟合,可对任意曲线进行拟合」· C头文件 代码 · 共 26 行

H
26
字号
/** \file Legendre.h
  * \brief Legendre多项式逼近
  */

#include <vector>

/** \brief 计算n次Legendre多项式在x点的值
  *
  * \param x 要获取其值的点
  * \param n Legendre多项式的阶数
  * \attention
  *(1)-1 <= x <= 1;
  *(2)为了使Legendre(x,n)*Legendre(x,n)=1,作了归一化处理
  */
float Legendre(float x, int n);

/** \brief 对(x, y)作Legendre多项式拟合,最高阶次为n
  *
  * \param x 所要逼近的函数的横坐标点集合
  * \param y 所要逼近的函数的纵坐标点集合
  * \param size (x,y)点的个数
  * \param n 所使用的Legendre多项式的最高阶数
  * \attention
  *(1)返回值是一个大小为n+1的向量组(包括零阶多项式系数)
  */
std::vector<float> BestLegendre(float* x, float* y, int size, int n);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?