필터 지우기
필터 지우기

Matlab - debugging Fmincon

조회 수: 5 (최근 30일)
NAFTALI HERSCOVICI
NAFTALI HERSCOVICI 2022년 2월 15일
편집: John D'Errico 2022년 2월 16일
Hello,
I am trying to use fmincon. For some reason the variables provided to the routine that calculates the goal function are the same as the inititial values in all iterations.
I check to see if the initial values are different forn the lb and ub vectors and they are.
I understand the without seeing the coede would be difficult to advise but the code is very complex and I don't want to impose, still, any ideas?
Spent like a full day trying to debug this. I could really use a 'step back' debugging option, but I understand that's not possible in Matlab.
Thank you
  댓글 수: 3
John D'Errico
John D'Errico 2022년 2월 15일
You really need to show the actual problem for use to help more.
NAFTALI HERSCOVICI
NAFTALI HERSCOVICI 2022년 2월 15일
i understand. I need to simplify it and get rid of chunks that require additional apps

댓글을 달려면 로그인하십시오.

채택된 답변

NAFTALI HERSCOVICI
NAFTALI HERSCOVICI 2022년 2월 16일
I already set a breakpoint in the objective function. I already checked and saw that the variables provifded by Fmincon to the objective function are the same for all iterations
  댓글 수: 7
Walter Roberson
Walter Roberson 2022년 2월 16일
Are you using
format long g
in order to be able to see more than 4 digits?
NAFTALI HERSCOVICI
NAFTALI HERSCOVICI 2022년 2월 16일
not yet, will try

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Steven Lord
Steven Lord 2022년 2월 15일
Are the points provided to your function exactly the same as the initial guess or do they differ by a very small amount, small enough that the difference doesn't change how the points are displayed?

NAFTALI HERSCOVICI
NAFTALI HERSCOVICI 2022년 2월 16일
can anyone point me to the location in Fmincon where the gol function is called?
I figure if I set a break point I can at least check what is the variabke set sent to the goal function.
This way I can find out if the problem is in the setup of the run or in the goal function
Thank you
  댓글 수: 2
Torsten
Torsten 2022년 2월 16일
편집: Torsten 2022년 2월 16일
Why do you want to set a breakpoint in fmincon and not in the objective function you supply ?
John D'Errico
John D'Errico 2022년 2월 16일
편집: John D'Errico 2022년 2월 16일
Please don't ask a question by using an answer.
As Torsten says though, there is nothing stopping you from setting a breakpoint in your objective function itself. Then you know exactly what got passed in.
There will be multiple lines in fmincon where the objective function is called, so looking for ONE line in fmincon is wrong. Anyway, you can find each of those lines yourself with a search.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by