I have curve fit my data using the fit command as given below
Now my fitobject is in cfit.
Can I pass this fit object (cfit) as a variable to a function for using the lsqnonlin optimization function
X=___;Y=___;[cfit,gof,output] = fit(x,y,fitType) P0=[ ];%Initial estimation
a=__;%variable
b=__;%variablelb=[_,...,_];%Lower boundub=[_,...,_];%Upper bound[Widths,resnorm,res,eflag,output1] = lsqnonlin(@(P) function(P,a,b,cfit), P0, lb, ub,options);%%Function definition
[ ]=function(r,a,b,cfit){fit_result=cfit(r); %for finding the values using fitobject
}end
Please suggest me know if there is any possiblity for doing this
Best Answer