Question: Trouble with NonLinearFit of piecewise function

Hello again Maple forums, it's been a while but I'm confident I came to the right place :)

I'm trying to fit our data (attached: to this function of Z:


It has the linear parameters a-f and non-linear parameter Zc.  Now if I just try and fit this I get the error "complex value encountered" because when Z

piecewise(Z > Zc, f(Z))

but then the fit doesn't optimize the parameters properly.  I expect Zc to be around 0.91085 but when I give it my data it finds Zc to be the value of my lowest data point (0.95).

I know this is wrong because the residual standard deviation found with Zc forced to 0.9105 is about 5 orders of magnitude smaller than the standard deviation with Zc forced to 0.94999.

Thank you for taking the time to read this and help me out.  I've attached a maple file (attached: that does what I outline.  If you have any advice for me I'd love to hear it :)


From Mike Busuttil
University of Windsor

Please Wait...