%----------------------------------------------------------
%参数拟合
%非线性最小二乘法拟合
% xdata = [3.6,7.7,9.3,4.1,8.6,2.8,1.3,7.9,10.0,5.4];
% ydata = [16,150.5,260.1,22.5,206.5,9.9,2.7,165.5,325.0,54.5];
% c0=[ 0 0 0];
% f_h=@(c, x) c(1)*x.^2 + c(2)*x.*sin(x) + c(3)*x.^3;
% [c, resnorm, r]=lsqcurvefit(f_h, c0,xdata,ydata);
%fittype曲线拟合
% clear; clc;
% x=[0,0.4,1.2,2,2.8,3.6,4.4,5.2,6,7.2,8,9.2,10.4,11.6,12.4,13.6,14.4,15]';%加转秩
% y=[1,0.85,0.29,-0.27,-0.53,-0.4,-0.12,0.17,0.28,0.15,-0.03,-0.15,-0.07,0.059,0.08,0.032,-0.015,-0.02]';%加转秩
% ft=fittype('a*cos(k*x)*exp(w*x)', 'independent','x');
% fo=fit(x, y, ft);
% xx=0:0.1:20;
% yy=fo(xx);
% plot(x, y, 'r*', xx, yy, 'b-');
%------------------------------------------------------------
%插值拟合
%y=interp1(x0,y0,x,’method’)
%Method 的选项有 ‘nearest’, ‘next’, ‘previous’, ‘linear’,‘spline’,‘pchip’, 和 'cubic'.
%缺省的机器设置为'linear&
matlab最小二乘法,一元,二元,散点插值函数模板总结
最新推荐文章于 2023-09-11 14:29:55 发布