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.

 採用された回答

Star Strider
Star Strider 2016 年 3 月 6 日
編集済み: Star Strider 2016 年 3 月 6 日

0 投票

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.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeChemistry についてさらに検索

質問済み:

2016 年 3 月 6 日

編集済み:

2016 年 3 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by