Find F and Phi matrices in Matlab for AMA