how to store the intermediate result when using fmincon

조회 수: 6 (최근 30일)
xueqi
xueqi 2013년 1월 30일
답변: Daniel Frisch 2020년 10월 7일
Dear fellows, I am using fmincon to do optmization. Could you tell me how to look at and store the intermediate result when fmincon is trying different value? Well, I need to give an initial value for fmincon to start, and after that, it will try different value to find the optimized one. I want to check all those values that it tried and the corresponding results. Cheers

채택된 답변

Shashank Prasanna
Shashank Prasanna 2013년 1월 30일
You can use OutputFcn to access values at each iteration.
See the following link for more information:
In the optionset you can use the function as below:
options = optimset('OutputFcn',@outfun)
  댓글 수: 9
Shashank Prasanna
Shashank Prasanna 2013년 2월 5일
편집: Shashank Prasanna 2013년 2월 5일
I am not sure I follow you. I don't want the final output.
Just run your optimization and and even if it is stuck at an iteration, can you please paste what is on the screen? If you post it in the forum there may be other who may be able to help you better. If you don't provide enough information, no one will be able to help you.
xueqi
xueqi 2013년 2월 5일
It needs to read in data in excel file. I can I also put into excel file here? Thanks!

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

추가 답변 (3개)

xueqi
xueqi 2013년 2월 5일
It needs to read in data in excel file. I can I also put into excel file here? Thanks!

Alan Weiss
Alan Weiss 2013년 2월 5일
Use the xlswrite function to export data to an Excel file.
Alan Weiss
MATLAB mathematical toolbox documentation

Daniel Frisch
Daniel Frisch 2020년 10월 7일
You can use my function outputFcn_global that saves all the intermediate results in a global variable, so you can inspect them later on.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by