Fit a piecewise function

Hi,

I have TH2 plot showing a clear pattern, however, fitting a function doesn’t help to model it. is there a way to fit a piecewise function based on a linear interpolation to connect the mean values in x-axis slices? Thanks!

I believe it is a duplicate of Linear interpolation TH2