【问题标题】:Curvefitting for power law function y= a(x^b)+c幂律函数 y= a(x^b)+c 的曲线拟合
【发布时间】:2017-03-10 16:54:27
【问题描述】:

我是 MATLAB 新手,我正在尝试通过数据集拟合幂律。我一直在尝试使用 isqcurvefit 函数,但我不确定如何继续,因为通过 Google 找到的说明对于初学者来说太复杂了。我想从方程 y = a(x^b)+c 导出值 b 和 c,任何建议都将不胜感激。谢谢。

【问题讨论】:

标签: matlab curve-fitting power-law


【解决方案1】:

您可以使用lsqcurvefit最小二乘法通过测量数据点拟合非线性曲线,如下所示:

% 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)

【讨论】:

    猜你喜欢
    • 2020-05-15
    • 2016-06-24
    • 2015-11-23
    • 2017-04-07
    • 2015-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多