Forcing fit to use specific values

조회 수: 12 (최근 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