Available to me is a set of points which can be represented as shown in image 1:
Also available to me is a non-continuous path derived from this data. It is not important how this non-continuous path is obtained. It is however important, that it roughly represents a curve I intent to approximate. This non-continuous path is shown in image 2:
I want to approximate this data using a polynomial of either second or third degree. Examples of these approximations are shown in images 3, 4:
Problem / question
Now I am looking for a way to obtain the red curve. Some details confuse me, where my knowledge is likely to be simply lacking. For example, how to fit a polynomial, when technically what I require is not a function, at least not in this coordinate system, because there will be situations where an x value is being assigned two y values.
I thought of possibly using the ends of my path to define a new x-axis, but I consider this approach faulty. Another consideration are Splines.
How should I go about obtaining this red curve from the non-continuous path (preferred) or from original data? What sources should I look into?
Apologies if this is an already answered question which I suspect it might be. However I have been issuing search queries for this without success, hence my question.