I have a set of data, which on plotting x vs y, will give the plot as in this figure.I want to fit a parabola to this data and I've tried using the curve fitting tool in MATLAB. The only problem is that I'm getting an answer as shown here. I know the coordinates what the center or the peak of the parabola should be at. But when I use the custom equation option, I get the error "this expression has no coefficients or non scalar coefficients". I am new to this. Is there any way to specify the center and get the fit correctly? The center points are (352,595). Thanks.
Asked
Active
Viewed 1,458 times
0
-
2But that is not a parabola! Well it is but in `x=a*y^2+b` fashion, instead that the standard one! Try swapping your X/Y coordinates – Ander Biguri May 19 '15 at 08:35
-
That actually works, thanks! But there's no way I can get the parabola fitted here? By specifying the center, like in the question? – Surya Rajan May 19 '15 at 09:17
1 Answers
0
The thing you drawn in black by hand is not a parabola. It doesn't follow y=a*x^2+b
equation thus you can not fit it. It actually follows y=±sqrt(a*x)+b
. I am not sure if you can fit a function to this equation (actually they are 2 equations).
What you can do, as suggested in the comments, is swap the X/Y coordinates and fit the data in that way. Then you can numerically interpolate the result parabola and swap the coordinates again to have it in the original form.
However, be aware that if you do this, you'll have 2 solutions for each X and none for lots of them also.

Ander Biguri
- 35,140
- 11
- 74
- 120
-
The paper I'm following gives the equation of the parabola to be formulated here. It's of the form x-xcenter=a(y-ycenter)^2 . What I was expecting was a C-shaped parabola fitted to the plot of my data. But it's not happening without specifying the xcenter and ycenter values. Swapping the axes does work, but it would have been better if I didn't have to do that. – Surya Rajan May 19 '15 at 10:18
-
@SuryaRajan If you swap the axes you can fit a parabola because the equation is `x-xcenter=a(y-ycenter)^2` <- that one now. Thats what you do when swaping X/Y, convert from `y-ycenter=±sqrt(a*x-xcenter)` to `x-xcenter=a(y-ycenter)^2` – Ander Biguri May 19 '15 at 11:33