Splines
Kearan Mc Pherson
kearan.mcpherson at gmail.com
Tue Oct 21 10:04:57 CDT 2008
Hi
Is there anyway i can draw the graph, of the path of the ball, in gnuplot
like in the attached image?
regards
On Wed, Oct 1, 2008 at 1:30 PM, Jaroslav Hajek <highegg at gmail.com> wrote:
> On Wed, Oct 1, 2008 at 1:15 PM, Carlo de Falco <carlo.defalco at gmail.com>
> wrote:
> >
> > On 01/ott/08, at 11:55, Jaroslav Hajek wrote:
> >
> >> On Wed, Oct 1, 2008 at 12:44 PM, Carlo de Falco <
> carlo.defalco at gmail.com>
> >> wrote:
> >>>
> >>> On 01/ott/08, at 10:56, Jaroslav Hajek wrote:
> >>>
> >>>>
> >>>> The interp1 functions *are* using splines when you specify "cubic"
> >>>> interpolation.
> >>>
> >>> not really, try...
> >>>
> >>>>> x = sortrows (rand(10,2));
> >>>>> xsp = linspace(min(x(:,1)), max(x(:,1)), 100);
> >>>>> plot(x(:,1),x(:,2),'x', xsp, interp1(x(:,1), x(:,2), xsp, 'cubic'),
> >>>>> xsp,spline(x(:,1), x(:,2), xsp))
> >>>
> >>
> >> OK, 'spline' was what I meant, but I think that even the 'cubic'
> >> method uses some kind of spline, though probably it doesn't ensure
> >> smoothness.
> >>
> > interp1(x, y, 'cubic') is just a wrapper to pchip which does piece-wise
> > cubic hermite interpolation
> > the matlab help page for pchip contains a detailed comparison of pchip
> and
> > spline, I think the algorithms in octave are the same as in matlab...
> >
>
> No, it's not - check out the current sources. What 'cubic' does is
> apparently for each query point determines 4 nearest neighbours, and
> does a Lagrange interpolation.
>
>
> > BTW there are different kinds of splines, try
> >
> > plot(x(:,1),x(:,2),'x', xsp, interp1(x(:,1), x(:,2), xsp, 'spline'), xsp,
> > ppval(catmullrom(x(:,1), x(:,2)), xsp),'g-')
> >
>
>
> > to see how catmullrom differs from the default not-a-knot spline.
> > For this particular application I think the less oscillatory behaviour
> makes
> > catmullrom preferable over spline
> >
> > c.
> >
> >
> >
>
>
>
> --
> RNDr. Jaroslav Hajek
> computing expert
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20081021/e0edfe95/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: out.jpg
Type: image/jpeg
Size: 15999 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20081021/e0edfe95/attachment-0001.jpg
More information about the Help-octave
mailing list