法1:多元非线性回归方法
scatter(unnamed(:,1),unnamed(:,2),10,'r','filled')
myfunc = inline('beta(1).*sign(x)+beta(2).*x','beta','x');
beta0=[0.5,0.5]';
beta=nlinfit(x,y,myfunc,beta0)
>> beta =
0.8869
0.7383
for i=1:length(x)
y(i)=beta(1)*sign(x(i))+beta(2)*x(i);
end
hold on
plot(x,y,'LineWeight',2)
法2:cftool拟合工具箱
拟合方法:
主要是指拟合所采用的函数,如线性拟合,多项式拟合,以及自定义函数拟合等等。具体如下:
- Custom Equations 用户自定义函数
- Expotential e指数函数
- Fourier 傅立叶函数,含有三角函数
- Gaussian 正态分布函数,高斯函数
- Interpolant 插值函数,含有线性函数,移动平均等类型的拟合
- Polynomial 多项式函数
- Power 幂函数
- Rational 有理函数
- Smooth Spline (光滑插值或者光滑拟合,不太清楚)
- Sum of sin functions 正弦函数类
- Weibull 威布尔函数
鲁棒性Robust:
- off:关闭,即采用传统的最小二乘方法进行拟合
- LAR:Least Absolute Residual(最小绝对残差),以残差平方最小为目标进行拟合。
- Bisquare:根据距离拟合线的距离加权,有些异常值权重为0,相当于对其进行剔除。
参考文献:
- https://blog.csdn.net/ljyljyok/article/details/81624496
- https://blog.csdn.net/zhangyugebb/article/details/84770303
- https://jingyan.baidu.com/article/67508eb40d47b09cca1ce4ce.html