Forcing fit to use specific values
조회 수: 12 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!