Watch this Author's files
Unfortunately, I believe there are still problems with the function.
I emailed you an example (firstname.lastname@example.org) with estimation of real data. It uses your function and compares to estimation with nlinfit.m
[f,a,phi,ave] = sinfapm(y,100)