Using solutions from Symbolic Math Toolbox as fit functions
Mostrar comentarios más antiguos
Using the Symbolic Math Toolbox, I am calculating the eigenvalues (or better the function for the eigenvalues) of an NxN matrix (2x2 for now for simplicity), e.g. :
M = [f a; a b];
Where f is a function that depends on my x-dataset and contains two parameters to fit. a is another fit parameter and b is a constant that I define earlier, so I have three fitting parameters in total.
I managed to let MatLab solve this, but now I want to convert the N solutions (2 in the above case) to simultaniously fit to my N (2) data sets. Fitting two data sets to two functions is possible by using for example "lsqcurvefit" following this thread ( https://de.mathworks.com/matlabcentral/answers/419277-simultaneous-fitting-of-two-plots-with-two-functions ).
Now I am missing the link between having a solution from the Symbolic Math Toolbox and automatically converting this to a usable fitting function. I am aware of the function "matlabFunction", but this results in having many parameters and for lsqcurvefit I need to somehow replace all parameters with x(1),x(2),x(3) (at least to my knowledge).
Any help is much appreciated!
1 comentario
Torsten
el 1 de Sept. de 2022
Don't use the symbolic toolbox to calculate eigenvalues for bigger values of N.
If you don't want to wait for hours during the fitting process, use the numerical function "eig" instead.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Get Started with Curve Fitting Toolbox 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!