//=== === === === === === === === === === === === === === = //函数说明 //函数名称:PolyFit //函数功能:最小二乘法曲线拟合 //使用方法:double *x ---- 存放n个数据点的X坐标 // double *y ---- 存放n个数据点的Y坐标 // int n -------- 给定数据点个数 // double *a ---- 返回m-1次拟合多项式的m个系数 // int m -------- 拟合多项式的项数,即拟合多项式的最高次为m-1。要求m<=n,且 // m<=20。若m>n或m>20,则本函数自动按m=min{n,20}处理 // double *dt --- dt[0]返回拟合多项式与各数据点误差的平方和;dt[1]返回拟合多 // 项式与各数据点的误差绝对值之和;dt[2]返回拟合多项式与各数据 // 点误差绝对值的最大值 //注意事项:拟合多项式的形式为 y = b0 + b1*(x-Xavr)...
上传时间: 2015-07-19
上传用户:waizhang
MATLAB插值与拟合(线性拟合函数:regress() 多项式曲线拟合函数:PolyFit( ) 多项式曲线求值函数:polyval( ) 多项式曲线拟合的评价和置信区间函数:polyconf( ) 稳健回归函数:robust( ) 向自定义函数拟合 )
标签: polyconf regress PolyFit polyval
上传时间: 2015-10-08
上传用户:qb1993225
函数说明 //函数名称:PolyFit //函数功能:最小二乘法曲线拟合
上传时间: 2014-01-06
上传用户:cjl42111
多项式曲线拟合 任意介数 Purpose - Least-squares curve fit of arbitrary order working in C++ Builder 2007 as a template class, using vector<FloatType> parameters. Added a method to handle some EMathError exceptions. If do NOT want to use this just call PolyFit2 directly. usage: Call PolyFit by something like this. CPolyFit<double> PolyFitObj double correlation_coefficiant = PolyFitObj.PolyFit(X, Y, A) where X and Y are vectors of doubles which must have the same size and A is a vector of doubles which must be the same size as the number of coefficients required. returns: The correlation coefficient or -1 on failure. produces: A vector (A) which holds the coefficients.
标签: Least-squares arbitrary Purpose Builder
上传时间: 2013-12-18
上传用户:宋桃子
function [R,k,b] = msc(A) % 多元散射校正 % 输入待处理矩阵,通过多元散射校正,求得校正后的矩阵 %% 获得矩阵行列数 [m,n] = size(A); %% 求平均光谱 M = mean(A,2); %% 利用最小二乘法求每一列的斜率k和截距b for i = 1:n a = PolyFit(M,A(:,i),1); if i == 1 k = a(1); b = a(2); else k = [k,a(1)]; b = [b,a(2)]; end end %% 求得结果 for i = 1:n Ai = (A(:,i)-b(i))/k(i); if i == 1 R = Ai; else R = [R,Ai]; end end
上传时间: 2020-03-12
上传用户:15275387185