The x and y coordinates used in the get ground height are local to the matrix instead of 3D space (they start counting at the bottom left corner). If you position the matrix there you need to add 500 to both the x and z values like this.
sync on : sync rate 0
hide mouse : autocam off
make matrix 1, 1000, 1000, 20, 20
SET MATRIX HEIGHT 1, 10, 10, 50
SET MATRIX HEIGHT 1, 9, 9, 50
SET MATRIX HEIGHT 1, 10, 9, 50
SET MATRIX HEIGHT 1, 9, 10, 50
update matrix 1
position matrix 1, -500,0,-500
do
control camera using arrowkeys 0, 1, .5
position camera camera position x(), get ground height(1,camera position x()+500,camera position z()+500)+5, camera position z()
sync
loop