Minimize difference between two data sets
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aidan McGlone
le 17 Mai 2024
Réponse apportée : Torsten
le 17 Mai 2024
I have two data sets, one will not change while the other depends on two variables, say A and B. I have a function that takes A and B, recomputes the one data set using A and B using a seperate function (i.e. it calls another function), then spits out a value for how well the two data sets compare. The function I described works alone (call it my_func). When I try to minimize, is when it fails. I have tried multiple methods: lsqnonlin, fminsearch, and fminunc. All follow a similar format being [output] = [method](@(A,B) my_func(A,B), [A B]) and they all return a failure to continue due to not enough input arguments.
Am I using these methods incorrectly? I am not sure why the will not begin to solve. Is there another method that I am unaware of that would work better for this application? Thank you for any guidance.
0 commentaires
Réponse acceptée
Torsten
le 17 Mai 2024
Use
[output] = [method](@(AB) my_func(AB(1),AB(2)), [A B])
instead of
[output] = [method](@(A,B) my_func(A,B), [A B])
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!