aurc89 - find the indices ofx1 andx2 within yourx vector and then fit the curve againstx andy using these indices. For example, ifidx1 andidx2 are the indices ofx1 andx2 such thatx(idx1)==x1 andx(idx2)==x2 then fit the curve between these two points as
Best Answer