Cut data when equilibrium begins

1 view (last 30 days)
Kevin Grønberg Poulsen
Kevin Grønberg Poulsen on 3 Jun 2014
Commented: Geoff Hayes on 4 Jun 2014
I am simulating the traveling samlsman problem(TSP) whit Metropolis (500000 sweeps) and i want to cut my data when it at the "equilibrium"
  3 Comments
Kevin Grønberg Poulsen
Kevin Grønberg Poulsen on 3 Jun 2014
I am sorry for openness of the question. To specify the question i am not interested in the large fall in tour length in the start of the data, but only in the part where it fluctuates around a specific tour length in this case 100, i want to cut off start data and save the part where it fluctuates around specific tour length.
I hope this more specific.
Geoff Hayes
Geoff Hayes on 4 Jun 2014
If tourLength is the vector of all tour lengths, then you could just find within it all indices for elements that are within a certain window around 100:
wdwLen = 10;
idcs = find(tourLength>(100-wdwLen) & tourLength<(100+wdwLen));
data = tourLength(idcs);
data are all the tour lengths that fluctuate around 100 (within 10 units). The catch here is that idcs would not have any index that refers to an element whose tour length is just outside of the window. So data will not be complete in the sense that it may be missing some tour lengths… A check for missing data could be
if (idcs(end)-idcs(1)+1) ~= length(idcs)
% then at least one element within the start and end of idcd
% falls outside of our window around 100
end

Sign in to comment.

Answers (0)

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!