When fitting a piecewise function with fitfun, The error, "Error: Illegal request for real part of scalar - this is bug!" is produced. So I submitted it with the function that I was trying to fit.
function that cause fitfun to produce error
I think the error comes if I fit a function in the form of f(x) and put in non uniform parameters for x. Always increasing but not with uniform spacing.