COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### X-Y Interpolation with small numerical errors

• Follow

```My questions concerns interpolation and a method to assess if the interpolations I have made could be refined in regards of ill condition numbers etc.

I have the following x and y values:
X1: [243.6, 199.8, 166.8, 133.2, 16.4]
Y1: [1, 1.078,1.1184,1.1648, 1.238]

X2: [286.6, 253.2, 209.4, 183.6, 56.6]
Y2: [1, 1.06,1.1452,1.182,1.3]

X3: [333.6,310.2,259.8,240,113.6]
Y3: [1.0512,1.166,1.212, 1.348,1.3]
..
..
X8: [...]
X8: [...]

Using Excel I got the following (trend lines):

y = -0.000003623485 x2 - 0.000104061124 x + 1.240802644498
y = -0.000003689281 x2 - 0.000050097492 x + 1.314941155615
y = -0.000005138283 x2 + 0.000694149114 x + 1.335972900207
..
..
..

Using a constant called a and jotting down

a = -3.62E-06, -3.69E-06, -5.14E-06...a8
b = -0.000104061, -5.00975E-05, 0.000694149...b8
c  = 1.240802644, 1.314941156, 1.3359729...c8

and plotting all the a values I obtained the following higher order polynomial&#8230;

y = -0.021888102619 x6 + 0.081260616942 x5 - 0.121696999709 x4 + 0.093940463998 x3 - 0.039420446179 x2 + 0.008521813480 x - 0.000744464046

and for b
y = 18.562953566900 x6 - 68.758956799423 x5 + 102.790440490807 x4 - 79.186370651594 x3 + 33.144419473323 x2 - 7.144313735101 x + 0.619166739240

and for c

y = -4,074.658731371160 x6 + 15,081.496519386700 x5 - 22,571.220590122000 x4 + 17,426.445712900200 x3 - 7,311.335903832610 x2 + 1,580.188986737920 x - 136.160481054492

how can I make this interpolation better? I have read about interpolation techniques in Matlab but I don&#8217;t know which one to use&#8230;how can i assess the ill condition of such interpolation? Is the Lagrange polynomial interpolation the best one to use for this purpose?
```
 0

```can p = polyfit(x,y,n) be used for this purpose? Any thoughts???
```
 0

```Isn't there anyone who can help me with an effective way of interpolating in Matlab without large numerical errors? The X and Y data are listed above. How can I interpolate them most efficiently, which method should I use?
```
 0

```John wrote:
> Isn't there anyone who can help me with an effective way of
> interpolating in Matlab without large numerical errors? The X and Y data
> are listed above. How can I interpolate them most efficiently, which
> method should I use?

I plotted the three sample data sets given -- they appear to be roughly
parallel but offset (altho there's either a typo in the third dataset or
a sizable outlier).

_Assuming_ (and we all know the caveats there) that trend is consistent
with the remaining dat, the first thing I'd want to know is what is the
underlying variable causing the offset and why isn't it included in the
dataset.  It would also be desirable to know whether that offset
continues to be monotonic throughout the dataset

If there is nothing other than observation number, I'd start by
including it as a dummy variable in the estimator but far too little
context and lacking data to have much more specific suggestions.

--
```
 0

```"John " <energy2010@live.se> wrote in message <iamc20\$guu\$1@fred.mathworks.com>...
> Isn't there anyone who can help me with an effective way of interpolating in Matlab without large numerical errors? The X and Y data are listed above. How can I interpolate them most efficiently, which method should I use?

I don't think anybody knows what you are asking, nor, I think
do you. You seem to be at times confusing interpolation
with approximation of possibly noisy data that you have in
some not well explained form. Is there noise in the data that
you wish to smooth out? I can't tell from your question, nor
from the followup.

Do you want to do high order polynomial estimation with
polyfit? (A terribly poor choice in general.) Or high order
Lagrange polynomial interpolation? (Another terribly poor
choice in general.)

The point is, you don't know what you are trying to do. We
can't guess what you want to do. So start over and explain
CAREFULLY, SLOWLY, what you are doing. Do some reading

John
```
 0

```"John " <energy2010@live.se> wrote in message <iakssj\$jjp\$1@fred.mathworks.com>...
> My questions concerns interpolation and a method to assess if the interpolations I have made could be refined in regards of ill condition numbers etc.
> I had the following dataset...
>
> I have the following x and y values:
> X1: [243.6, 199.8, 166.8, 133.2, 16.4]
> Y1: [1, 1.078,1.1184,1.1648, 1.238]
>
> X2: [286.6, 253.2, 209.4, 183.6, 56.6]
> Y2: [1, 1.06,1.1452,1.182,1.3]
>
> X3: [333.6,310.2,259.8,240,113.6]
> Y3: [1.0512,1.166,1.212, 1.348,1.3]
> .
> .
> X8: [...]
> X8: [...]
>
> Using Excel I got the following (trend lines):
>
> y = -0.000003623485 x2 - 0.000104061124 x + 1.240802644498
> y = -0.000003689281 x2 - 0.000050097492 x + 1.314941155615
> y = -0.000005138283 x2 + 0.000694149114 x + 1.335972900207
> .
> .
> .
>
> Using a constant called a and jotting down
>
> a = -3.62E-06, -3.69E-06, -5.14E-06...a8
> b = -0.000104061, -5.00975E-05, 0.000694149...b8
> c  = 1.240802644, 1.314941156, 1.3359729...c8
>
> and plotting all the a values I obtained the following higher order polynomial&#8230;
>
> y = -0.021888102619 x6 + 0.081260616942 x5 - 0.121696999709 x4 + 0.093940463998 x3 - 0.039420446179 x2 + 0.008521813480 x - 0.000744464046
>
> and for b
> y = 18.562953566900 x6 - 68.758956799423 x5 + 102.790440490807 x4 - 79.186370651594 x3 + 33.144419473323 x2 - 7.144313735101 x + 0.619166739240
>

What exactly are you modeling here? EXPLAIN YOURSELF!

What allows you to derive this high order polynomial for y
as a function of x?

John
```
 0

```John,
Let me try another time.
>Is there noise in the data that
> you wish to smooth out? I can't tell from your question, nor
> from the followup.
Yeah I am trying to smooth out the data I have in my X and Y vectors. And, I am  trying to use an interpolation technique.

X1: [243.6, 199.8, 166.8, 133.2, 16.4]
Y1: [1, 1.078,1.1184,1.1648, 1.238]

The fact is that I have eight X vectors and eight Y Vectors. I have explained how I interpolated these using Excel (see above). But right now I am interested to assess whether or not Matlab has a function/methods for which I can check if the errors associated with the interpolation processes are large or not. I just thought polyfit could give me that error as it includes polyval. I am still uncertain about the method i should use.

> Do you want to do high order polynomial estimation with
> polyfit? (A terribly poor choice in general.) Or high order
> Lagrange polynomial interpolation? (Another terribly poor
> choice in general.)
I want to do a high order polynomial estimation with maybe two methods where I can compare which one has smaller numerical errors associated with it. I have read about numerical problems such as Runge's phenomenon in interpolation. I basically want to avoid these...or be able to find a way to estimate if they occur for the interpolation I have made (in terms of error estimation not only a deviation from the original data).
```
 0

```John wrote:
> John,
> Let me try another time.
>> Is there noise in the data that
>> you wish to smooth out? I can't tell from your question, nor
>> from the followup.
> Yeah I am trying to smooth out the data I have in my X and Y vectors.
> And, I am  trying to use an interpolation technique.
> X1: [243.6, 199.8, 166.8, 133.2, 16.4]
> Y1: [1, 1.078,1.1184,1.1648, 1.238]
>
> The fact is that I have eight X vectors and eight Y Vectors. I have
> explained how I interpolated these using Excel (see above). But right
> now I am interested to assess whether or not Matlab has a
> function/methods for which I can check if the errors associated with the
> interpolation processes are large or not. I just thought polyfit could
> give me that error as it includes polyval. I am still uncertain about
> the method i should use.
....

That's an indeterminate question only you can answer as only you (at
least so far) know what the data are, where they came from, how they
were collected, etc., etc., etc., ...

I commented earlier on one possible approach but there's too little
information provided to know whether that's reasonable or not (and the
_crystal_ball_(tm) doesn't work weekends and it's not been brought out
of the storage yet this Monday AM).

Certainly you _can_ use polyval and the data provided in the optional
return arguments.  It is a truism that if you increase the order of a
polynomial fit the R-square value will go down and w/ enough terms you
can introduce enough wiggle to bend it thru all of them.  Whether the
result has any real meaning or utility is another issue altogether.

Again, as John says, need to look more into the philosophy and meaning
of the data as before delving too deeply into the mechanics.

at least a start...

--
```
 0

```What i am trying to model are lines on a compressor map. you can think of the x values as pressure values and y values as non dimensional massflow values. Typically, you want to have smooth lines when plotting the whole map and the X1..X8 and Y1...Y8 allow for the buildup for the whole map. I am aware of the fact that this high polynomial approach I have chosen is not the best method (I am referring to the long x6 terms for a, b and c...), and therefore I am interested to know if I can interpolate with less error. Hope this clarifies the problem. Further, the values are obtained as an output from a performance program so I cant change the X  and Y values.
```
 0

```John wrote:
> What i am trying to model are lines on a compressor map. you can think
> of the x values as pressure values and y values as non dimensional
> massflow values. Typically, you want to have smooth lines when plotting
> the whole map and the X1..X8 and Y1...Y8 allow for the buildup for the
> whole map. I am aware of the fact that this high polynomial approach I
> have chosen is not the best method (I am referring to the long x6 terms
> for a, b and c...), and therefore I am interested to know if I can
> interpolate with less error. Hope this clarifies the problem. Further,
> the values are obtained as an output from a performance program so I
> cant change the X  and Y values.

OK, that's at least a start.

Now, what is/are the variable/s that aren't shown that are the inputs to
the model between the eight parameteric cases shown?  It/they are the
missing factor.

What you need is a multi-dimensional model of some sort--what, precisely
is still not determinate from the little information available.

One possibility (certainly not the only and probably not even the best)
would be to use the performance program and a response surface designed
to generate points for a response surface.

More likely would be to use more knowledge of the actual system and try
to derive a functional form from basic engineering principles and then
either linearize that solution for a polynomial approximation or use a
nonlinear interpolation scheme.

In short, still missing key information...

--
```
 0

```"John " <energy2010@live.se> wrote in message <iamh1c\$erm\$1@fred.mathworks.com>...
> What i am trying to model are lines on a compressor map. you can think of the x values as pressure values and y values as non dimensional massflow values. Typically, you want to have smooth lines when plotting the whole map and the X1..X8 and Y1...Y8 allow for the buildup for the whole map. I am aware of the fact that this high polynomial approach I have chosen is not the best method (I am referring to the long x6 terms for a, b and c...), and therefore I am interested to know if I can interpolate with less error. Hope this clarifies the problem. Further, the values are obtained as an output from a performance program so I cant change the X  and Y values.

By the way, this is NOT!!!!!! interpolation.

Interpolation (look it up) is the process of predicting
intermediate values from a process or system, wherein the
original data points are exactly reproduced. Interpolation
presumes there is no noise in your data, or that you are
willing to assume the data is exactly correct.

http://en.wikipedia.org/wiki/Interpolation

Once you start to model your process using regression
techniques, you have left the realm of interpolation
behind.

So you have an additional parameter in this, that you
wish to use to model these distinct curves? Of course,
you have not told us what the parameter is, or what
values it takes on. Call that (as yet unknown to us)
parameter p.

Really, you are attempting to model a surface, y(x,p).
This is a 2-d surface model. You are trying to do so by
fitting the coefficients of the separate models as a
function of p.

So why not model the problem as a 2-d modeling
problem? For example, you might consider use of a
tool like griddata, or my own gridfit (look on the File
exchange)to build the surface. Or you might use radial
basis functions (also found on the FEX.) Or you might
use the curvefitting toolbox, or neural nets.

John
```
 0

```John wrote:
> What i am trying to model are lines on a compressor map. you can think
> of the x values as pressure values and y values as non dimensional
> massflow values. Typically, you want to have smooth lines when plotting
> the whole map and the X1..X8 and Y1...Y8 allow for the buildup for the
> whole map. ...

What good would it do you anyway unless you do include the as yet unamed
mysterious 'p' as John denoted it?

IOW, how could you modify the response even if you were to find an
approximating polynomial to reflect which one of the curves 1 to 8 is
applicable for the desired case w/o that parameter being part of the model?

--
```
 0

11 Replies
179 Views

Similiar Articles:

7/11/2012 1:06:50 AM