EzyFit Frequently Asked Questions |
to have the EzyFit menu by default in all your figures (this will automatically run efmenu at each Matlab restart).efmenu install
plotsample power showfit('a*x^n; n=-1','fitcolor','red','fitlinestyle','--'); showfit('a*x^n+c_0; n=-1','fitcolor','black','fitlinestyle','-.'); legend show
See this question to see how to get the fitted values from f.f = ezfit(x,y,'a*ln(x/c)+k');
which you want to fit with an exponential decay,x=1:10; y=[15 14.2 13.6 13.2 12.9 12.7 12.5 12.4 12.4 12.2]; plot(x,y,'*')
You will obtain:showfit('cste+a0*exp(-x/L)');
you now obtain:showfit('cste+a0*exp(-x/L); cste=10');
In this case, you should specify ALL the initial guesses, in the alphabetical order of the parameter names (here L, a0 and cste because L is a capital letter).showfit('cste+a0*exp(-x/L)',[10 1 1]);
If you tryplotsample power
the logarithm of the data is fitted. If you turn the Y-axis in linear scale (you may use swy for this) and fit again, you will obtain different values.showfit('power')
See the example:showfit('power;log','fitcolor','blue'); showfit('power;lin','fitcolor','red');
The structure f contains all the informations about your fit. The strings 'a' and 'b' of the parameter names are stored in f.param and their values are in f.m. This works also with showfit.f = ezfit('a*x+b');
This will create two variables, 'a' and 'b'. You can also set the option 'automakevarfit = on' in fitparam: This will call makevarfit each time ezfit (or showfit) is executed.makevarfit(f);
This will update the file 'userfit.mat' in the EzyFit directory, so your fit equation may be re-used in a future session. You can now fit your data using this user-defined fit,editfit(3,'myspectrum','E(k) = C*k^(-n); C=0.1; n=2; log');
Since a fit equation is a simple string, another way is to create a variable,showfit('myspectrum');
and to save it in a Mat-file,myfit = 'E(k) = C*k^(-n); C=0.1; n=2; log';
To fit your data with this fit definition, just typesave('myfits.mat','myfit');
showfit(myfit);
  |