Forcing fit to use specific values

15 visualizaciones (últimos 30 días)
deniz
deniz el 11 de Jun. de 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.

Respuestas (0)

Categorías

Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by