Group Abstract Group Abstract

Message Boards Message Boards

Fitting a c-shaped curved with right-pointing parabola, ellipse or circle

Posted 2 years ago

Hi everyone,

I was trying to fit the following points:

ListPlot[points]

enter image description here

The objective is to reach a function that fits the points, something similar to this: enter image description here

In my understanding, this looks like a right-pointing parabola:

enter image description here right-pointing parabola

So I tried this function, but it didn't work (the fit was inaccurate):

curveFit= Plot[57.01032231556321` +4.524767722795246` *(-29.0814390274144`+x)^2,{x,28,29.33},PlotStyle->Orange]; 

Show[points, curveFit]

enter image description here

So I decided to try to fit an ellipse or circle instead, but I don't know how to do it in an automated way(maybe like a Monte Carlo simulation). so I drew an ellipse on top of the points:

h=29.01(*x-coordinate of the center*);
k=57.175(*y-coordinate of the center*);
a=0.13(*radius along the x-axis*);
b=0.2(*radius along the y-axis*);
ellipse = ParametricPlot[{h+a Cos[t],k+b Sin[t]},{t,0,2 Pi},PlotRange->All,AxesLabel->{"x","y"},AxesOrigin->{h-a,k-b},PlotStyle->Orange]

Show[ellipse, points]

enter image description here

I hope anyone can guide me on the right way to proceed. Thanks in advance.

POSTED BY: Mario F
8 Replies
Posted 2 years ago
Posted 2 years ago
POSTED BY: Mario F
Posted 2 years ago
POSTED BY: Jim Baldwin
POSTED BY: Henrik Schachner
Posted 2 years ago

Thank you so much Henrik. I will try it and let you know.

POSTED BY: Mario F
Posted 2 years ago

I have two updates:

I was able to fit equations in this [link][1] as follows:

![enter image description here][2]

Also, I discovered that I can use the drawing tool to draw ellipses on the points and then convert the cell with the plot (without the original) to input, then it will give the equation for the ellipse in terms of Graphics[Circle[{29.009734682576344, 57.18617339634879}, {0.12473528321493177, 0.2126919292376499}]]

But still, these two approaches are not the "best fit", it just a better guess.

POSTED BY: Mario F
Posted 2 years ago

Can you supply more specifics about your objective in "fitting" ? Here are some examples:

  • If the objective is to provide a curve that is an approximation of the the data with a formula (parabola, ellipse, or something else), how close must that approximation be?

  • If the objective is to predict future points, what is the mechanism for generating the current data and future data?

  • If the objective is "I'll know it when I see it", then know that we can't read your mind. I say this because of your statement "But still, these two approaches are not the 'best fit', it just a better guess."

POSTED BY: Jim Baldwin
Posted 2 years ago

Well thank you for your questions they helped me to think better about my objective.

The motion is a rotation of a robot about a center point. But there is an error that's why this ellipse is formed. i.e. it should be a point rather than an ellipse.

The data source is from sensor position data, then it is transformed using a transformation matrix to the center.

The objective is to predict the error so I would predict the motion without relaying on the sensor, just the difference between angles.

POSTED BY: Mario F
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard