필터 지우기
필터 지우기

Minimize difference between two data sets

조회 수: 4 (최근 30일)
Aidan McGlone
Aidan McGlone 2024년 5월 17일
답변: Torsten 2024년 5월 17일
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