- Joined
- May 23, 2002
Hey all, I'm trying to do a complex simulation in Matlab and need some help!
I've created a program that takes a teams baseball batting average and creates a matrix (essential a CDF) for each battery with each row representing the batter and each column reprsents strikeout%, walk% etc...and runs it through a gaming simulation.
What I want to do, however, is change the batting order and re-run it for every different batting order to find the optimum order. Now I know there's 9! different ways to arrange the batters, but what I need is an easy way to code this and let the computer take care of the 360 million ways it's done.
So right now I have a 9x6 matrix that I want to rearange 9! ways with each row being the same.
I was thinking of two nested for loops but I can't think how to stop it when an order is set, run the simulation and repeat.
I don't think it's too hard to code, only a few lines, but just can't figure it out!
I've created a program that takes a teams baseball batting average and creates a matrix (essential a CDF) for each battery with each row representing the batter and each column reprsents strikeout%, walk% etc...and runs it through a gaming simulation.
What I want to do, however, is change the batting order and re-run it for every different batting order to find the optimum order. Now I know there's 9! different ways to arrange the batters, but what I need is an easy way to code this and let the computer take care of the 360 million ways it's done.
So right now I have a 9x6 matrix that I want to rearange 9! ways with each row being the same.
I was thinking of two nested for loops but I can't think how to stop it when an order is set, run the simulation and repeat.
I don't think it's too hard to code, only a few lines, but just can't figure it out!