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.

 Akzeptierte Antwort

Star Strider
Star Strider am 6 Mär. 2016
Bearbeitet: Star Strider am 6 Mär. 2016

0 Stimmen

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.

Weitere Antworten (0)

Kategorien

Mehr zu Chemistry finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by