How to insert a function handle in simulink !?
1 回表示 (過去 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!