Interpolation error

Thank you,Mark.
In fact,the piecewise function is obtained by many data such as (xi,yi),and I just want to fit these data to a function.
In addition,I found a better way that is from

So I have solved this question.
Thank you very much.