User function (v1)


popu = userfun(popuin,figh,axsh);

nrow: number of subplot-rows

nind: number of individuals, size of population

The Easy-IEC toolbox calls this function in every loop to evaluate the population. Because the evaluation depends on the user's problem, hence it is the user's duty to write this function. The main task of the function: to evaluate the actual population and to display plots and texts for the operator.

The user function must evaluate all individuals of the population. The popuin.chrom contains the chromosomes for every individuals (population variable).

The function must return the resulted population in popu variable.

The popuin is the actual population variable.

The figh is the handle of the interactive figure which includes the subplots. The user must draw plots and write texts on these subplots.

The axsh matrix contains the handles of the subplots.


function popu = userfun(popuin,figh,axsh);

%User function:

global param tout yout1 yout2 %global variables -> simulation

figure(figh); %actual figure

nind = size(popu.chrom,1); %number of individuals (= columns)

popu = popuin;


for i = 1:nind,

%Evaulation (-> tout, yout1, yout2)

param = popu.chrom(i,:); %chromosome -> simulation

sim('usersimu',[0 10]);

%First subplot (1. output of simulation):



%Second subplot (2. output of simulation):



%Refresh the figure: