MATLAB: I have inverse bending test data which vary randomly from positive to negative. I have drawn poly curve fitting dividing each cycle into two section of maxima and minima. but the fitting curve at end near maxima and minima deviate from each other.

piecewise fittingregression

I have inverse bending test data which vary randomly from positive to negative. I have drawn poly curve fitting dividing each cycle into two section of maxima and minima. but my fitting curve at end near maxima and minima deviate from each other.I want to connect end of two fitting line. how i can do it.

Best Answer

Concatenate the two vectors:
overallVector = [leftVector, rightVector];
By the way, see my code for finding the optimal pairs of lines for doing a piecewise linear fit on data like yours.