- #1

- 727

- 1

I can get my program running when containing the individual starting points of each of the planets in a massive row vector (say, X(1:12) but would rather (for simplicity, efficiency and making the next stage much easier..) have X(1,1:3) and X(2,1:3) so i can have a separate area for each planet.

Hopefully i won't have to provide much code - essentially when i transfer into arrays i'm getting the following problem when run:

"

??? Index exceeds matrix dimensions.

Error in ==> forcesar at 8

DX(1,1:6) = [X(1,4:6); -X(1,1:3)*GM(1)/norm(X(1,1:3))^3];

"

forcesar being a function that adjusts the data for other planetary effects - previous to the above line i've initialised DX as a zeroes(3,6) matrix so i don't see what the problem with filling it up is? (as far as i'm aware the error is essentially telling me i'm trying to put too many values into a smaller matrix) clearly i'm doing something wrong, either that or it's just not possible to do it this way.

as always, help much appreciated.

-fasterthanjoao