[Top][All Lists]

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

Re: interp1 - bug

From: Søren Hauberg
Subject: Re: interp1 - bug
Date: Sat, 12 Sep 2009 14:15:48 +0200

lør, 12 09 2009 kl. 08:04 -0400, skrev John W. Eaton:
> Suppose I have a set of points that approximate a circle:
>   theta = 0:0.2:2*pi;
>   x = cos(theta);
>   y = sin(theta);
>   plot (x, y);
> and I want to interpolate between two of these points.  If I leave the
> points ordered as they are, I need to pick a range where the
> interpolation will make sense.  If I just blindly sort the X and Y
> values, I get something that doesn't look a lot like a circle, so
> interpolating between two of the points is not likely to give me the
> result I'm looking for:
>   [x, idx] = sort (x);
>   y = y (idx);
>   plot (x, y);

Good point! I was only considering surjective data.


reply via email to

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