about fitness function gatool
1 回表示 (過去 30 日間)
古いコメントを表示
Hello! I have a fitness function
function z = my_fun(x)
Visot1 = readfis('Visot1'); %read fis-file to workspace
Visot1.input(1,1).mf(1,1).params=[x(1),x(2),x(3)]; %rewrite params of fis-file
sim('sfundebug.mdl'); %simulate a simulink model, which use fis-file and write to workspace "simout.signals.values"
z = sqrt(sum((simout.signals.values).^2)/(length(simout.signals.values)));
But then I use it, I have an error "Error due to multiple causes." When I do 'dbstop if error', it stop at sim('sfundebug.mdl'); and simulate don't work. If I do Visot1 = readfis('Visot1'); in command line before use gatool, sim('sfundebug.mdl'); is work, but it use the old params of Visot1. Do not rewrite params of fis-file... Do not understand... Thanks for any answer :) Natalia
0 件のコメント
回答 (2 件)
john
2013 年 2 月 1 日
I have same problem but fortunately problem Solved! :D I used below commands instead of sim() command :
opt = simset('solver','ode45','SrcWorkspace','Current');
[tout,xout,yout] = sim('YourModelName',[0 20],opt);
also you should add some 'outport' to your model in order to save their values during the optimization for calculating Objective Function. you can find more information about this on page 36 (1-20) of below link:
I'll hope it works for you either good luck
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Fuzzy Logic in Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!