- 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.
lsqcurvefit: Errorfitted value units
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
AIZAT AKMAL BIN A.MOHAMAD BEDDELEE
el 29 de Mzo. de 2021
Comentada: AIZAT AKMAL BIN A.MOHAMAD BEDDELEE
el 29 de Mzo. de 2021
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 %?
0 comentarios
Respuesta aceptada
William Rose
el 29 de Mzo. de 2021
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.
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 comentarios
William Rose
el 29 de Mzo. de 2021
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Nonlinear Least Squares (Curve Fitting) en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
