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

Thread Subject:
Plotting with repeated X values

Subject: Plotting with repeated X values

From: Jose Valerio

Date: 27 Mar, 2009 14:00:18

Message: 1 of 3

Hello,

I'm trying to plot the following data:

clear
clc

Ref_T1_Oph = [76.1 75.6 71.7 70.9 77.4 76.0 76.6 76.8 76.4 76.7];
avg_T1_Oph = mean(Ref_T1_Oph);
Ref_T1_HD = [85.79 85.79 85.79 85.79 85.76 85.79 85.79 85.79 85.79 85.76];
avg_T1_HD = mean(Ref_T1_HD);
Ref_T1_Tx = (Ref_T1_Oph ./ Ref_T1_HD).*100;
Ref_T1_Iref = [882];

plot(Ref_T1_HD,Ref_T1_Oph)

When I select tools, basic fittings and try to create the spline interpolant graph an error comes up saying that "Repeated X values are not permitted when fitting with a cubic interpolating spline, remove repeated values". I'm I doing something wrong here?

Subject: Plotting with repeated X values

From: John D'Errico

Date: 27 Mar, 2009 14:48:01

Message: 2 of 3

"Jose Valerio" <lapenda@gmail.com> wrote in message <gqim5i$8um$1@fred.mathworks.com>...
> Hello,
>
> I'm trying to plot the following data:
>
> clear
> clc
>
> Ref_T1_Oph = [76.1 75.6 71.7 70.9 77.4 76.0 76.6 76.8 76.4 76.7];
> avg_T1_Oph = mean(Ref_T1_Oph);
> Ref_T1_HD = [85.79 85.79 85.79 85.79 85.76 85.79 85.79 85.79 85.79 85.76];
> avg_T1_HD = mean(Ref_T1_HD);
> Ref_T1_Tx = (Ref_T1_Oph ./ Ref_T1_HD).*100;
> Ref_T1_Iref = [882];
>
> plot(Ref_T1_HD,Ref_T1_Oph)
>
> When I select tools, basic fittings and try to create the spline interpolant graph an error comes up saying that "Repeated X values are not permitted when fitting with a cubic interpolating spline, remove repeated values". I'm I doing something wrong here?

An INTERPOLATING spline goes exactly through the
data points. So can you show me a function, f(x),
such that for a given value of x, has TWO distinct
values of y?

How will the spline go through both such points,
taking on two or more different values of y at those
repeated points?

Since an interpolating spline cannot predict two
or more values of the dependent variable for a
single x, it returns an error. No surprise there.

John

Subject: Plotting with repeated X values

From: Jose Valerio

Date: 27 Mar, 2009 17:28:02

Message: 3 of 3

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <gqiov1$idh$1@fred.mathworks.com>...
> "Jose Valerio" <lapenda@gmail.com> wrote in message <gqim5i$8um$1@fred.mathworks.com>...
> > Hello,
> >
> > I'm trying to plot the following data:
> >
> > clear
> > clc
> >
> > Ref_T1_Oph = [76.1 75.6 71.7 70.9 77.4 76.0 76.6 76.8 76.4 76.7];
> > avg_T1_Oph = mean(Ref_T1_Oph);
> > Ref_T1_HD = [85.79 85.79 85.79 85.79 85.76 85.79 85.79 85.79 85.79 85.76];
> > avg_T1_HD = mean(Ref_T1_HD);
> > Ref_T1_Tx = (Ref_T1_Oph ./ Ref_T1_HD).*100;
> > Ref_T1_Iref = [882];
> >
> > plot(Ref_T1_HD,Ref_T1_Oph)
> >
> > When I select tools, basic fittings and try to create the spline interpolant graph an error comes up saying that "Repeated X values are not permitted when fitting with a cubic interpolating spline, remove repeated values". I'm I doing something wrong here?
>
> An INTERPOLATING spline goes exactly through the
> data points. So can you show me a function, f(x),
> such that for a given value of x, has TWO distinct
> values of y?
>
> How will the spline go through both such points,
> taking on two or more different values of y at those
> repeated points?
>
> Since an interpolating spline cannot predict two
> or more values of the dependent variable for a
> single x, it returns an error. No surprise there.
>
> John

I understand what you saying now, but I don't know how to create the function. I was trying it with vander? is taht correct?

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