about fitness function gatool
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
john
el 1 de Feb. de 2013
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 comentarios
Ver también
Categorías
Más información sobre Fuzzy Logic in Simulink en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!