help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: Curve Fitting and Plotting]


From: Fredrik Lingvall
Subject: [Fwd: Re: Curve Fitting and Plotting]
Date: Mon, 29 Sep 2008 12:38:41 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080926)

Forgot to CC the help list so here it is.

/F

Kearan Mc Pherson wrote:
> HI
>
> i am capturing two video streams of a moving cricket ball. one view
> from the side and the other from above. after image processing i
> obtain the two data.dat files. from here i want to do curve fitting in
> order to achieve the data points/coordinates of the moving ball in 3D.
> after this i want to plot the graph in 3D

If you need accurate results then you could introduce a model for the
motion of the ball (it must follow the physical laws of motion) and
estimate the model parameters from  your data. You could, of course, 
simply use some standard interpolation method but then you don't use all
the prior info that you have.

/F


>
>
> On Fri, Sep 26, 2008 at 3:28 PM, Fredrik Lingvall <address@hidden
> <mailto:address@hidden>> wrote:
>
>     Ben Abbott wrote:
>     > On Sep 26, 2008, at 6:32 AM, Kearan Mc Pherson wrote:
>     >
>     >
>     >> Hi
>     >>
>     >> I am new to Octave and Gnuplot. I need help on fitting a curve
>     >> through a data.dat file, that contains values x an y in column
>     format.
>     >> Any ideas where to start?
>     >>
>     Can you describe your problem i little bit more? If a
>     "quick-and-dirty"
>     method, like using polyval, is not sufficient then I can recommend
>     reading, for example, "Bayesian Interpolation", David J. C. MacKay,
>     Neural Computation, May 1992, Vol. 4, No. 3, Pages 415-447.
>
>     https://eprints.kfupm.edu.sa/28027/1/28027.pdf
>
>     /F
>
>     >
>     > If the data is in two columns, and you'd like a simple polynomial
>     > fit ...
>     >
>     > ## Load the data into (x,y)
>     > data = load ('data.dat');
>     > xdata = data(:,1);
>     > ydata = data(:,2):
>     >
>     > ## Fit a 2nd order polynomial
>     > order = 2;
>     > p = polyfit (xdata, ydata, order);
>     >
>     > ## Evaluate the fitted polynomial
>     > x = linspace (min(xdata), max(xdata), 101)
>     > y = polyval (p, x);
>     >
>     > ## Plot
>     > plot (x, y, '-' xdata, ydata, 's')
>     > legend ('Fitted polynomial', 'Original Data')
>     >
>     > Ben
>     >
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]