Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3591

Re: gnuplot (fitting of ellipse)

From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: gnuplot (fitting of ellipse)
Date 2017-03-24 11:28 +0100
Organization solani.org
Message-ID <ob2sc3$qbd$1@solani.org> (permalink)
References <1d68425b-6a98-4762-8f7a-3091b9198947@googlegroups.com>

Show all headers | View raw


Am 24.03.2017 um 10:24 schrieb vineeth25396@gmail.com:
> I'm trying to fit an ellipse using gnuplot.
> 
> However, when I defined my equation
> 
> f(x,y) = a*x*x + b*x*y + c*y*y + d*x + e*y + f
> and then proceed with the command plot:
> 
> plot f(x,y) lw 3 lc rgb 'black', 'text.dat' w l lc rgb 'black'
> 
> I get undefined variable: y. How can I fix it? text.dat has 3 columns: x, y, and z coordinates.
> 
> Or with is the best solution to fit ellipse using the above equation. 
> 
> Also, is there a way to find the values of the co-efficients i.e a,b,c,d,e,f


I take it your function should be named

  z(x,y) = a*x*x + b*x*y + c*y*y + d*x + e*y + f

right? But that's not an ellipse, it's a plane. An ellipse needs just
one independent variable, the angle or the circumference, and two functions.

  set param
  plot a*cos(t),b*sin(t)

gives you an example.

Btw. "plot" can only use a function with one independent variable, in
2D. You need to use "splot".

And "fitting" does just that, find out the parameters a...f:

  fit z(x,y) dataf us 1:2:3 via a,b,c,d,e,f

should do just that. You don't get an ellipse, but a plane in which the
ellipse lies. If you supply good starting parameters, that is.
Not sure if trying by hand will work. You should transform your equation
into sth with more meaningful variables.





Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar


Thread

gnuplot (fitting of ellipse) vineeth25396@gmail.com - 2017-03-24 02:24 -0700
  Re: gnuplot (fitting of ellipse) vineeth25396@gmail.com - 2017-03-24 03:01 -0700
    Re: gnuplot (fitting of ellipse) Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-24 12:25 +0100
      Re: gnuplot (fitting of ellipse) vineeth25396@gmail.com - 2017-03-24 17:55 -0700
        Re: gnuplot (fitting of ellipse) Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2017-03-25 14:22 +0100
  Re: gnuplot (fitting of ellipse) Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-24 11:28 +0100

csiph-web