December 5th, 2012, 05:25 AM
Defining variables from arrays
Thanks for your interest on this post. I'm trying to model the spread of a circular wave coming out from a point and return an array that gives the amplitude of the wave at certain points.
So with a 4x4 grid, the centre of the wave would be at the centre where the middle lines cross, and in the centre of each space, the height of the wave will be shown by the array output in that position.
The thing is, does anyone know how to use the position in the array as a variable so that I can put it in a function and work out how far that position is from the centre?
Eternal love for you if you can put it in some fairly lay-man speak. Thanks so much
December 5th, 2012, 09:19 AM
First of all, in a 4x4 array, the center, where the diagonals cross, is not a cell, so there is no value there.
Now, let's start at the upper left cell, 0,0 (at least in 1970's conventions). We assume that each cell occupies "a" meters in x and "b" meters in y. So the center of cell, 0,1, being the adjacent cell to the right of the starting cell, is "a" meters from the center of the starting cell in the x-direction and 0 meters from the center of the starting cell in the y-direction. Generally, cell i,j is i*a meters in x and j*b meters in y from the starting cell.
Is that what you were asking?
December 5th, 2012, 09:57 AM