Borrar filtros
Borrar filtros

about fitness function gatool

3 visualizaciones (últimos 30 días)
Natalia
Natalia el 21 de En. de 2012
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

Respuestas (2)

Egor
Egor el 9 de Abr. de 2012
Hi! Have you solved this problem? Any hints?

john
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

Categorías

Más información sobre Fuzzy Logic in Simulink en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by