Filter löschen
Filter löschen

Minimize difference between two data sets

7 Ansichten (letzte 30 Tage)
Aidan McGlone
Aidan McGlone am 17 Mai 2024
Beantwortet: Torsten am 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.

Akzeptierte Antwort

Torsten
Torsten am 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])

Weitere Antworten (0)

Kategorien

Mehr zu Systems of Nonlinear Equations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by