Thread Subject: Spline through non uniformly spaced points

Subject: Spline through non uniformly spaced points

From: David Doria

Date: 7 May, 2008 18:05:09

Message: 1 of 3

I want to do something like this:

a=axes;
set(a,'xlim',[-2 2]);
set(a,'ylim',[-2 2]);
[x y] = ginput;

%click a bunch of points

%draw a spline through the points
xx=-2:.01:2;
yy=spline(x, y, xx);

the problem seems to be that the points I have clicked are
not uniformly spaced (clearly) so i get the following:
"The data sites should be distinct."

I've used meshgrid before, but it seems to be more for
plotting 3d functions.. i'm not sure how to "snap" these
coordinates to a grid without giving them some kind of "z"
value.

Any suggestions?

Thanks,

Dave

Subject: Spline through non uniformly spaced points

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 7 May, 2008 18:13:41

Message: 2 of 3

In article <fvsr0k$n1h$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>I want to do something like this:

>a=axes;
>set(a,'xlim',[-2 2]);
>set(a,'ylim',[-2 2]);
>[x y] = ginput;

>%click a bunch of points

>%draw a spline through the points
>xx=-2:.01:2;
>yy=spline(x, y, xx);

>the problem seems to be that the points I have clicked are
>not uniformly spaced (clearly) so i get the following:
>"The data sites should be distinct."

Not having the points uniformly spaced does not cause that problem.
What -would- cause that problem is clicking the same location twice,
such as if you were to close a curve. The message is telling you
that all of the point pairs must be unique.
--
  "And that's the way it is." -- Walter Cronkite

Subject: Spline through non uniformly spaced points

From: David Doria

Date: 7 May, 2008 18:45:06

Message: 3 of 3

ah ok , great - I don't think I had clicked exactly in the
same point, I think two points just had the same X
coordinate - is this indeed the reason for that error?

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com