Created function to generate translation matrix.