File Exchange

## easyfit(x,y,varargi​n)

version 1.4.0.0 (18.5 KB) by Jean-Luc Dellis

### Jean-Luc Dellis (view profile)

pbest=easyfit(x,y)

Updated 30 May 2018

pbest=EASYFIT(x,y,varargin)
EASYFIT fits the experimental data (x,y) to a model function y = fun(p,x).
If a model function is not given as an input argument, a polynomial model is used.
Bounds (constraints) may be applied on the parameters pbest values returned by easyfit.
An optional plot can be generated which presents the data as well the
"best" curve and confidence intervals for data. the pbest and their uncertainties
are displayed in the command window. For programmatic purposes, this graphical mode can be switched off.

### Cite As

Jean-Luc Dellis (2019). easyfit(x,y,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/10625-easyfit-x-y-varargin), MATLAB Central File Exchange. Retrieved .

Jean-Luc Dellis

Hello all, that function can only handle REAL vectors X and Y. EASYFIT is like NLFIT from the stats tool box, but easier to use for not-expert-in-matlab. Have a look on the given examples. Regards.

Phil Wissgott

good work, but comments are suboptimal. LB and UB have to be the same size as pinit not x0(notation mismatch).
Phil

Tie Ling

I am a new user of Matlab. I will apply the mathematical model by using Matlab to match my experiment. This is very useful for me! Thank you very much!
Another question is: do you have some other example to show how to modify mathematical parameters to better match experiment data? I really need it!
Thanks again!

Tie Ling

I am a new user of Matlab. I will apply the mathematical model by using Matlab to match my experiment. This is very useful for me! Thank you very much!
Another question is: do you have some other example to show how to modify mathematical parameters to better match experiment data? I really need it!
Thanks again!

gok gok

i'm a new to this process.

Jean-Luc Dellis

Whithout response of Duane Hanselman to my email, I place it here:
>>help easyfit does not provide anything helpful.

This has been corrected.

>>Does not add value. Please consider removing this file or make signficant changes to it so it is useful and helpful.

Yes, there is no original or complex algorithm (the code itself takes exactly 7 lines!), just a useful application of nested functions as described by the Matlab Help itself. From this point of view Duane is right.
But, with its simplicity and the given examples, easyfit can be a great help for users who whish to fit experimental data and are not experts (as Duane) in Matlab.

Duane Hanselman

>> help easyfit does not provide anything helpful. No description of input arguments. No error checking. Does not add value. Please consider removing this file or make signficant changes to it so it is useful and helpful.

 30 May 2018 1.4.0.0 - the help lines and examples have been improved - the main results are displayed in the command window 26 Nov 2009 1.3.0.0 Fix minor points and add an example where one parameter is hold constant in fitting. 31 Mar 2008 1.0.0.0 - put VARARGIN to simplify the use - put UNCERTAINTIES as a subfunction to compute them as well the data confidence intervals 8 May 2006 It is now possible to set constraints on the parameters of the model-function. This was realized in using FMINSEARCHBND (from file exchange, author: John D'Errico). 11 Apr 2006 a) options set by OPTIMSET can be handled b) fval the value of the function DISTANCE can be returned by EASYFIT 5 Apr 2006 Help lines misplaced
##### MATLAB Release Compatibility
Created with R14
Compatible with any release
##### Platform Compatibility
Windows macOS Linux