Forcing fit to use specific values

6 次查看(过去 30 天)
deniz
deniz 2011-6-11
I'm trying to fit an equation to a data set. I got a function file which contains the equation lets call it function_eq and i have a main function. Main function is like this :
ops1 = fitoptions('Method','nonlinearleastsquares');
ftyp1 = fittype( 'function_eq(x,lx)' ,'options',ops1,'independent','x','coefficients',{'lx'});
fitted1 = fit(xdata,ydata,ftyp1);
Let's say xdata=[1 2 3 4 5 6] and ydata=[3 5 8 9 10 14]. In this situation main function is trying to pass x values like 0.33,0.66,1.33 to function_eq to solve the fit. But my function_eq is valid only on the exact values of x=1,2,3,4,5,6. I have to force fit algorithm to use only these x values but i couldn't find how to do that.
Note: function_eq calculates a complex numerical integration by given values so another function you recommend may not be suitable but i'm open to new ideas.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by