How to insert a function handle in simulink !?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi,
I wrote a function f(x)=a*x(1)+b*x(2) in Matlab (without Simulink) as an .m-file and let ga(@function,2) calculate an optimum for given a,b. My next step is to insert that situation into Simulink - so, that a closed loop delivers different a,b with every step. How can I now implement my genetic algorithm (ga(@function,2)) ?
I actually wrote the function as s-function (with two inputs for a,b). Do I maybe have to write an Block Property/Callback with the command ga(@function,2) or how can I place my gen. algo. !?
댓글 수: 0
답변 (2개)
Guy Rouleau
2011년 3월 11일
In a Level 2 MATLAB S-function, you should be able to use your function in the same way as you do in MATLAB.
Do you receive any error?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!