What is the difference between polyfit and curve fitting

Hi
What is the difference between polyfit and curve fitting ?
would you please see this page explain me these command:
modelFun = @(p,x) p(3) .* (x ./ p(1)).^(p(2)-1) .* exp(-(x ./ p(1)).^p(2));
startingVals = [10 2 5];
coefEsts = nlinfit(time, conc, modelFun, startingVals);
xgrid = linspace(0,20,100);
line(xgrid, modelFun(coefEsts, xgrid), 'Color','r');
And The Page Is:

 Respuesta aceptada

Shashank Prasanna
Shashank Prasanna el 21 de Mzo. de 2013
I would encourage you to look at the documentation page of the functions you are you using to get a better idea of what each function is suited for.
POLYFIT:
As Matt J mentioned is used to fit polynomials
NLINFIT:
Is non linear fitting/regression for models that need not be polynomials, but can be. Go through the examples in the above links to get a better idea.

3 comentarios

Masoud Ghanbari
Masoud Ghanbari el 21 de Mzo. de 2013
Editada: Masoud Ghanbari el 21 de Mzo. de 2013
Hi Dear Shashank and thanks Dear Matt J
there is still a misunderstanding for me. i have a set of (x,y) dots and i want the function passes them as the best way .
which kind of fitting and regression should i use???
Or Which command (to be more clear)?
Matt J
Matt J el 22 de Mzo. de 2013
Editada: Matt J el 22 de Mzo. de 2013
You need to decide first what kind of function gives a good model for your (x,y) data. If the (x,y) data come from a polynomial, use POLYFIT. If they come from a more complicated function, use NLINFIT.
Thanks Dear Matt J

Iniciar sesión para comentar.

Más respuestas (1)

Matt J
Matt J el 20 de Mzo. de 2013
POLYFIT applies to polynomial fitting only.

1 comentario

That's correct! POLYFIT is a function specifically designed for fitting polynomial curves to data.
POLYFIT returns the coefficients of the fitted polynomial. These coefficients can be used to create the equation of the polynomial curve, getaway shootout can then be used for various purposes such as prediction, interpolation, or smoothing.

Iniciar sesión para comentar.

Categorías

Más información sobre Linear and Nonlinear Regression en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 20 de Mzo. de 2013

Comentada:

el 8 de En. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by