I am fitting two different curves to a set of data to determine which of them is the better fit. I'm using
myfit1 = fittype('-2^(a.*x+b)+c','coefficients',{'a','b','c'});fit1 = fit(scantimes,data,myfit1,'StartPoint',[0.005,-2,0.4])myfit2 = fittype('exp(-d.*x+f)+g','coefficients',{'d','f','g'});fit2 = fit(scantimes,data,myfit2,'StartPoint',[0.04,1,0])
in a try and catch sequence such that the code is able to compute a fit for each equation. The data will follow one or the other of these patterns, however, I need a way to analyse which is the closer fit. scantimes and data are both just a list of points and I have guessed the start point from observation of data. How would I go about making a comparison between the two fits? Should this use chi squared or is there an easier/better way?
Best Answer