least squares for fitting experimetal data

I am an undergrad in chemistry and do not have a strong background in coding. Anyways my question is I have to to make a lot of linear fits form experimental data and I was wondering if there is an easy way to do this using least squares (which I do understand. At least more than coding) I am trying to avoid using the basic fit option to enhance my repertoire.

 Respuesta aceptada

Star Strider
Star Strider el 6 de Mzo. de 2016
Editada: Star Strider el 6 de Mzo. de 2016

0 votos

There are three straightforward ways to do linear least-squares fitting in MATLAB:
1. The mldivide,\ operator (or function),
2. The polyfit function,
3. The fminsearch function (although you have to code the objective function for it)
Admittedly, fminsearch is serious overkill for a linear problem, but I want to be certain I cover all the options. It is quite useful for small nonlinear problems (fewer than about 6 parameters) that you will eventually encounter in Chemistry.
EDIT There are a number of other options in the Statistics and Machine Learning Toolbox, but assuming you’re interested in only the functions available in core MATLAB, they’re all I covered here.

Más respuestas (0)

Preguntada:

el 6 de Mzo. de 2016

Editada:

el 6 de Mzo. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by