Loop ,Comparison for each element
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello everyone.. I would to ask a question regarding to optimization problem. I have 2 control variable denotes as x1 and x2. The fitness function is y=x1+x2..Value of x1 and x2 will be generate by random. Let say I have this value.. x1=(1,3,4,7,9) , x2=(2,4,6,8,10) , y=( 3,7,10,15,19). I want to compare each elements of y in order to update the new location of x1 and x2 which is y1<y1, y1<y2 & y2<y2 , y1<y3 & y2<y3 & y3<y3 , y1<y4 & y2<y4 & y3<y4 & y4<y4 and y1<y5 & y2<y5 & y3<y5 & y4<y5 & y5<y5. Can anybody help on how to write the algorithm.
tq
3 comentarios
Image Analyst
el 12 de Jul. de 2013
Editada: Image Analyst
el 12 de Jul. de 2013
We still don't understand "the new location of x1 and x2 which is y1<y1, y1<y2 & y2<y2 , y1<y3 & y2<y3 & y3<y3 , y1<y4 & y2<y4 & y3<y4 & y4<y4 and y1<y5 & y2<y5 & y3<y5 & y4<y5 & y5<y5. " First of all, you can never have y1<y1 or y2<y2 or y3<y3 or y4<y4 or y5<y5 so what you are trying to do? Secondly, the new location of x1 and x2 would be a boolean if you are doing all those comparisons. What does it mean that the new location is true or false? The new location must be an index, from 1 to "end" in integer steps, not a boolean.
Respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements 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!