【问题标题】:nsqnonlin - Incorrect convergence - Fitted curve does not model my data at allnsqnonlin - 不正确的收敛 - 拟合曲线根本无法模拟我的数据
【发布时间】:2017-03-20 15:44:33
【问题描述】:

下面,红叉是数据,蓝线是拟合曲线。

Data and fit curve - image

这是适合的功能:

function diff = fit_simp(x,X,Y)

% This function is called by lsqnonlin.
% x is a vector which contains the coefficients of the
% equation.  X and Y are the option data sets that were
% passed to lsqnonlin.

A1 = x(1);
A2 = x(2);
mode1 = x(3);
mode2 = x(4);
sig1 = x(5);
sig2 = x(6);
alpha = x(7);
beta = x(8);
gamma = x(9);
diff = (A1/(sqrt(2*pi)*sig1))*exp(-0.5.*((X-mode1)/sig1).^2) + (A2/(sqrt(2*pi)*sig2))*exp(-0.5.*((X-mode2)/sig2).^2) + alpha + beta*X + gamma*X.*X

我的起始值是:

X0=[0.1 0.02 0.6 1.2 1 1 0.1 -0.2 0.011]

来自 MATLAB 的最后信息:

Optimization completed: The first-order optimality measure, 3.114006e-10,
is less than options.OptimalityTolerance = 1.000000e-06.

Optimization Metric                                       Options
relative first-order optimality =   3.11e-10  OptimalityTolerance =   1e-06 (default)

我有什么遗漏吗?它适用于更简单的功能。

【问题讨论】:

    标签: matlab curve-fitting non-linear-regression


    【解决方案1】:

    您没有使用您的Y 数据。现在,您的diff 是您的模型在X 点对参数x 的评估,但您应该返回diff - Ylsqnonlin 将最小化返回值的范数。这确实是你得到的,一个到处(几乎)为零的函数。

    【讨论】:

      猜你喜欢
      • 2015-03-02
      • 1970-01-01
      • 2021-02-16
      • 2020-03-06
      • 2022-01-07
      • 1970-01-01
      • 2018-04-27
      • 1970-01-01
      • 2019-02-20
      相关资源
      最近更新 更多