[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
interpolating large table of data
From: |
Dan McMahill |
Subject: |
interpolating large table of data |
Date: |
Mon, 23 Sep 2013 12:39:29 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
Hello,
I'm trying to do some data interpolation and feel like my code is
getting really ugly and it seems there should be a nice clean way. What
I have is a multidimensional array:
vals(a,b,c,i)
a takes on values of either 1 or 2
b from 1-18
c from 0-63
and for each combination of a,b,c I need a vector of about 200 data
points which represent the y values for a curve where all of my curves
share the same x values.
so I should be able, for example do do
plot(xvals, vals(1,3,14))
and get one of the plots.
The catch is that I do not have data for some values of 'c' and in that
case I need to fill in the missing data by interpolation. So
essentially what I have is a bunch of curves but some are missing. The
good news is that there is really no funny behavior. Each data point in
vals(1,3,14) should lie between the corresponding points in vals(1,3,13)
and vals(1,3,15) and linear interpolation should be good enough.
This nice behavior only applies to keeping a and b constant and varying
c. If I don't have data for a=1 then there is no interpolating to get
a=2 data and also if I don't have data for b=4 for example, I can't use
other b data.
So, is there a clean way to do this? I found myself headed down an
extremely ugly path with lots of for loops and that just seems wrong.
Thanks
-Dan
- interpolating large table of data,
Dan McMahill <=