too many output argument
Mostrar comentarios más antiguos
I am working on control of robot puma560 by using Matlab Simulink which contains 5 Matlab function blocks. when I run a genetic algorithm to tune PD, it says too many output argument. does ga conflict with Matlab function blocks in Simulink or what?
%fitness function
function y=fit2(x)
global kp kv
kp=x(1);
kv=x(2);
disp([kp kv])
sim('new_sim2qaex')
y= mean(abs(error));
Too many output arguments.
Error in fit2 (line 8)
y= mean(abs(error));
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in gamultiobjMakeState (line 27)
Score = FitnessFcn(state.Population(1,:));
Error in gamultiobjsolve (line 8)
state = gamultiobjMakeState(GenomeLength,FitnessFcn,ConstrFcn,output.problemtype,options);
Error in gamultiobj (line 274)
[x,fval,exitFlag,output,population,scores] = gamultiobjsolve(FitnessFcn,nvars, ...
Caused by:
Failure in initial fitness function evaluation. GAMULTIOBJ cannot continue.
2 comentarios
Walter Roberson
el 25 de Mzo. de 2019
global variables act differently in Simulink. You should avoid using them.
asmaa abdelstar
el 25 de Mzo. de 2019
Respuestas (1)
Walter Roberson
el 25 de Mzo. de 2019
0 votos
Assign a value to the variable error before calling sim
Otherwise, MATLAB will think you are referring to the function named error(), which does not have any outputs.
1 comentario
asmaa abdelstar
el 25 de Mzo. de 2019
Categorías
Más información sobre Genetic Algorithm en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!