How to do numerical fit
Mostrar comentarios más antiguos
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 comentario
Megan
el 9 de Jun. de 2023
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!
Respuesta aceptada
Más respuestas (1)
Michael Haderlein
el 10 de Jul. de 2014
1 voto
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.
Categorías
Más información sobre Spline Construction en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!