function sincfit

Fit a sinc function to a set of data points. The function fit is y(x)=A+B*sinc((x+phi)/width)

Syntax
result = sincfit(X, Y, errors, estimate [, chisq])

Arguments
X:   A vector containing the x values to be fit
Y:   A vector containing the y values to be fit (in radians)
errors:   The errors in Y
estimate:   Initial estimate for the fit of the form [A,B,phi,width]
chisq:   If set to a named variable, the variable is overwritten with the chi-squared of the fit.


Returns
The returned vector contains the best-fit parameters in the form [A,B,phi,width,d_A,d_B,d_phi,d_width]