How to extend the line of 2 PolyFit from either side to intersect and get a combined fit line
问题 I am trying to get combined fit line made from two linear polyfit from either side (should intersect), here is the picture of fit lines: I am trying to make the two fit (blue) lines intersect and produce a combined fit line as shown in the picture below: Note that the crest can happen anywhere so I cannot assume to be in the center. Here is the code that creates the first plot: xdatPart1 = R; zdatPart1 = z; n = 3000; ln = length(R); [sX,In] = sort(R,1); sZ = z(In); xdatP1 = sX(1:n,1); zdatP1