# finding position by regression fit

I try to estimate an underfloor pipe position based on a temperature distribution on a surface of the floor.

I know there is the pipe emitting a hot temperature all way along. I can measure a distribution of this temperature in a rectangular room. I know that the pipe can be in two shapes only as a straight line or a bended section – second order polynomial.

When I plot the data it shows that the pipe comes into the room as the straight section, after while it bends and it becomes the straight section again The coordinates for each sampled temperature is as a Cartesian coordinates (x,y) in the room. And in addition I have the temperature in the sample point, hence I have points: $s_1(x_1,y_1,t_1), s_2(x_2,y_2,t_2),… s_n(x_n,y_n,t_n)$ I have many sample points in this grid and can measure more if necessary.

I am thinking to apply a regression fit to this data, but can’t find appropriate information how to apply it to such problem. I want to finish with three equations for three section each, as 1st and 2nd order polynomials.

I have two problems:

I am not sure how to formulate it as a regression to prove I am correct (I want to do it in R later on)

I don’t know how to separate three sections by an algorithm instead of imprecisely read it from the plot.

Can you point me to solution or some additional information about problem like that?

• It seems like it would be better to envision the centreline of a pipe as piecewise linear (perhaps joined by sections that are arcs of circles). You could try writing an expected temperature in terms of distance from the centerline and construct a nonlinear least squares problem from that. – Glen_b Jan 18 '14 at 6:07