Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Help needed for code in matlab
Posted:
Nov 23, 2012 6:35 PM
|
|
I have a m-file (File 1) in matlab that generates me two vectors Sx = [a1 a2 a3] and Sy = [b1 b2 b3]. I have another m-file (File 2) with genetic algorithm code in it that generates X1 and X2 for minimum solution of a function to be minimized. The function to be minimized is in another m-file (Fle 3) that calculates the distance D = Sum (1/ sqrt[ (X1 - a1)^2 + (X2 - b1)^2] + sqrt[ (X1 - a2)^2 + (X2 - b2)^2] +sqrt[ (X1 - a3)^2 + (X2 - b3)^2]).
I would like to make it a general, to be user decision on the size of the vectors Sx and Sy. Ideally would be to run the genetic algorithm file few times to get different solutions.
Anybody can help with the code will be greatly appreciated.
|
|
|
|