Minimize difference between two data sets

4 次查看(过去 30 天)
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.

采纳的回答

Torsten
Torsten 2024-5-17
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 个)

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by