Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Urgent Help Needed: Langrange Poly Error

Subject: Urgent Help Needed: Langrange Poly Error

From: sheldon

Date: 22 Jan, 2013 23:36:06

Message: 1 of 2

Hi All, I am trying to setup a curve fit using Lagrange. Here is my code, could I get some assistance with the error I am getting? Not sure what it wants from me.

    j = 1;
    num = 150;
    range = 0.1;
    for i=1:numel(C)
        if abs(abs(C(i)) - num) <= range
            x(j) = A(i);
            y(j) = B(i);
            j = j+1;
   hold all
[P,R,S] = lagrangepoly(x,y);
xx = 0.5 : 0.01 : 8.5;

Here is the error:
??? Error using ==> chckxy at 51
The data sites should be distinct.

Error in ==> spline at 55
[x,y,sizey,endslopes] = chckxy(x,y);

Error in ==> a at 24

I am using a demo Lagrange code and adapting it to my large data set which I used the for and if to pull only certain points out to put into the curve fit. Any help is appreciated, thanks!

Subject: Urgent Help Needed: Langrange Poly Error

From: Sadik

Date: 23 Jan, 2013 00:52:09

Message: 2 of 2

Hi Sheldon,

It tells you that you have repeated values in vector x, the first input to spline.


Tags for this Thread

No tags are associated with this thread.

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.

Contact us