The problem was that fit.m function of the Matlab Curvefit toolbox was shadowed by the other fit.m functions of the other Matlab toolboxes. Here, there is a solution with minimal intervention (no filename or no on-the-fly path correction is required). A new function handle is assigned to the fit.m function of the Matlab Curvefit toolbox. The solution is based on the discussions in the links below, and the credit goes to the contributors to those discussions.
The solution:
% first locate the correct fit.m of the Matlab Curvefit toolbox
current_pwd = pwd;
cd([[matlabroot, '\toolbox\curvefit\curvefit']])
exist('fit', 'file');
org_curvefit_fit = str2func('fit');
cd(current_pwd)
% use it
CDF_for_fit = fittype('a*(x-b)');
paramhat = org_curvefit_fit(t_0, CDF_empirical, CDF_for_fit, ...
'StartPoint', [5.6, 1.5], 'Lower', [0, 0], 'Robust', 'LAR');
Links:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/264354
http://www.mathworks.com/matlabcentral/answers/208
No comments:
Post a Comment