how to use fminsearh on Simulink

조회 수: 3 (최근 30일)
kazuma hamano
kazuma hamano 2017년 10월 6일
댓글: Hongkai Liu 2017년 12월 24일
Please tell me, how to make this code by using Simulink .
fun=@(x)100*2(x(2)-x(1)^2)^2+(1-x(1))^2;%equation
x0 = [-1.2,1];%start point
x = fminsearch(fun,x0)%using fminsearch
On User-defined Functions,S-Function, I programmed
'fun = @(x)100*(x(2) - x(1)^2)^2 + (1 - x(1))^2;'
For this block, I want to adopt fminsearch on the Simulink in order to find out minimized point[x1 x2]=[1 1].
Sorry, I can't use English well, but I want someone's answer. So if you don't know the meaning of my question, please tell me where don't you know.

채택된 답변

Yoko
Yoko 2017년 10월 11일
Using Interpreted MATLAB Function block is the easiest way to execute fminsearch in Simulink. Write MATLAB Function to call fminsearch, and set the function to block parameter of Interpreted MATLAB Function.
  댓글 수: 1
Hongkai Liu
Hongkai Liu 2017년 12월 24일
Hi Yoko Miyazaki, I also want to use fminsearch in Simulink,but i need to build the model(code generate).So, interpreted MATLAB Functino does not work.Is there any other method that i can solve this problem? many thanks.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!