功率定律功能y = a(x^b) c的曲线拟合



我是MATLAB的新手,我正在尝试通过数据集适应幂律。我一直在尝试使用ISQCurveFit函数,但是我不确定如何在通过Google找到的说明中进行的说明太过卷曲而无法进行初学者。我想从方程式y = a(x^b) c得出值b和c,任何建议都将不胜感激。谢谢。

您可以使用 lsqcurvefit通过最小二乘sense 中的测量数据点拟合非线性曲线:

% constant parameters
a = 1; % set the value of a
% initial guesses for fitted parameters
b_guess = 1; % provide an initial guess for b
c_guess = 0; % provide an initial guess for c
% Definition of the fitted function
f = @(x, xdata) a*(xdata.^x(1))+x(2);
% generate example data for the x and y data to fit (this should be replaced with your real measured data)
xdata = 1:10;
ydata = f([2 3], xdata); % create data with b=2 and c=3
% fit the data with the desired function
x = lsqcurvefit(f,[b_guess c_guess],xdata,ydata); 
%result of the fit, i.e. the fitted parameters
b = x(1)
c = x(2)

最新更新