A rigor di logica, dovresti usare 'f' invece di 'n' come indice:

&mat[f][0],&mat[f][1],&mat[f][2],&vett_masse[f]);

(e anche per la printf)