Replacing variable mat with x

Replacing mat variable with x so as to keep the function call consistent
with the one in the original Roger D Pend file