Forcing fit to use specific values

14 views (last 30 days)
deniz
deniz on 11 Jun 2011
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.

Answers (0)

Categories

Find more on Linear and Nonlinear Regression in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!