first try at obtaining the matrix