lsqcurvefit: Errorfitted value units

3 次查看(过去 30 天)
i am using the lsqcurvefit function in my coding and there is errorfitted that reflecting the local fit different. Let say the errorfitted value is 28.2524. May I know what is the errorfitted value unit perhaps %?

采纳的回答

William Rose
William Rose 2021-3-29
The Matlb help for lsqcurvefit() does not show any output variable with the name errorfitted. The outputs available from lsqcurvefit() are shown under Syntax, below. Which of these output variables corresponds to the quantity which you are calling errorfitted?
My guess is that you are referring to resnorm or to residual.
  • resnorm is a scalar. It equals the sum of the squared differences between ydata and f(xdata). Therefore the units for resnorm are squared (y-units).
  • residual is a vector or array, if ydata is a vector or array. It equals the differences between ydata and f(xdata). Therefore the units for residual are y-units.
Syntax
x = lsqcurvefit(fun,x0,xdata,ydata)
x = lsqcurvefit(fun,x0,xdata,ydata,lb,ub)
x = lsqcurvefit(fun,x0,xdata,ydata,lb,ub,options)
x = lsqcurvefit(problem)
[x,resnorm] = lsqcurvefit(___)
[x,resnorm,residual,exitflag,output] = lsqcurvefit(___)
[x,resnorm,residual,exitflag,output,lambda,jacobian] = lsqcurvefit(___)
  3 个评论
William Rose
William Rose 2021-3-29
When lsqcurvefit() is called as
[xfitted,errorfitted] = lsqcurvefit(fitfcn,p0,xdata,ydata,lb,ub)
then the arguments correspond, in order, to the arguments in the manual for that function, even though the names may be diferent. This is an important idea that applies whenever you are calling funcitons or readin other people's code. The manual page here shows that (when we combine the function call examples with 2 args on the left and 6 args on the right):
[x,resnorm] = lsqcurvefit(fun,x0,xdata,ydata,lb,ub)
Therefore errorfitted is the variable name used above to receive the resnorm output - as I guessed in my initial answer. Therefore the units for errofitted are the units for resnorm: squared (y-units). Therefore you may compute the root mean square error (average error per point):
RMSerr=sqrt(errorfitted/N);
where N=number of elements in ydata(), and RMSerror has units of y-units.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Nonlinear Least Squares (Curve Fitting) 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by