How can I call a value from another function?
Mostrar comentarios más antiguos
I'm using Genetic Algorithm to solve my minimization problem. My fitness function has a variable that change to achieve my objective and other that is summed from the main function(where there are the constraints). The objective function is:
lanc_unicob=abs(v) +abs(z)
The GA will change variable v in the main function to active the objective. The value z will be changed in the main function according v changed(cause z depends on v). I wanna know how can I call z in the fitness function, 'cause that way above appear the message: "Undefined function or' variable 'z". I don't know how can I call z from the main function.
1 comentario
Geoff Hayes
el 16 de Ag. de 2017
Aline - can you post the complete fitness function (especially signature)? If you nest this function within your main function (see Nested Functions) then the fitness function will have access to z...though I'm not sure how your main function will interact with the GA...
Respuestas (0)
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!