How to do numerical fit
이전 댓글 표시
Hi all, I have some problems in fitting my experimental data. Say I have two columns of data, the independent variable X and the depedent one Y. I want to fit the following model: Y=y0 + a*X*integral(f(z);0,t*X), where integral(F(z);0,t*X) means that i'm integrating the function f(z) on the interval [0, t*X]. The parameters to be determined through the fitting are y0, a and t. The problem is that I have not an analytical expression for the function F: I have a file .dat containing two columns,expressing the value of F at certain points. The amount of points in which F is evaluated is very huge and I managed to do a very good cubic spline interpolation; however this does not solve my problem, because I don't know how to construct a fitting procedure for that model. Is there a way to do that with MATLAB?
댓글 수: 1
Megan
2023년 6월 9일
To get Matlab's "fit" function to work properly, your own fit function (let's say it is "piecewiseLine(x,a,b,c,d,k)")must be saved within your current directory, it cannot merely be defined within the confines of your code. This detail had me stuck for more time than I'd like to admit!
채택된 답변
추가 답변 (1개)
Michael Haderlein
2014년 7월 10일
1 개 추천
Please check out the help for the "fit"-function, there is a very helpful and intuitive example.
Easiest way is to save the file just in your default Matlab folder. Otherwise, you can add directories to the search path list by addpath or by right-clicking the desired folder in the Matlab-explorer window.
카테고리
도움말 센터 및 File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!