<rosy27@gmail.com> wrote in message
news:1137529629.666388.12350@o13g2000cwo.googlegroups.com...
> Hi Mike
>
> Can u please explain me how i can interpolate my data (non uniform
> sampled) using triangular plates? I didnt get it!!!
>
The triangular plate thing is for a 2D sample grid. Basically you create a
surface by taking your real values on your irregular sample scheme, imagine
that you tesselate all the spaces between your sample locations with flat
plates ( all the spaces are triangular so you end up with a variable height
surface made of triangular plates) the height of the vertices of the
triangles is determined by your real values and the locations of the
vertices is determined by your sampling plan. Now you create a new, regular,
sample plan and you find out what the height of the triangular plate is at
all of your new sampling locations - this gives you your (linearly)
interpolated real values on the new regular grid. Then you repeat the whole
thing but using the imaginary values you have. You can do a whole lot of
other things like fitting conic sections over a more extended subset of your
original sample set but that gets complicated.
Your problem seems to be 1D so you needn't worry about the triangular plate
thing. You have already said that you are happy with the results you get
using matlab interp1 so all you need to do is write your own interpolator
which does the same thing. If you are happy with the interp1 default mode
which is linear then you only need to write your own 1D linear
interpolator - this could take in your input values and the location(time?)
at which they were obtained, decide whether it needs to output a value based
on your desired output time and output that value if needed - in general it
will need to calculate new interpolation "coefficients" for each output
calculation because the time relationship between the input values and your
desired output time will have changed. Personally, I would use this
approach but then I don't
know what your motivation is and I see that you would like to use a FIR
filter for some reason.
I haven't seen anyone try to use a FIR filter this way before so what
follows is guesswork - do not rely on it. -
If you are trying to use a digital FIR filter with fixed weights and a fixed
output rate then you effectively have a fixed input rate - how can you make
the input sample times coincide with your irregular sample times? what do
you tell the FIR is its input when you don't have an input sample that
corresponds to that time interval? You need to make this notionally regular
input rate >> your desired output rate so you can 'interpolate' by low pass
filtering and your filter cut-off needs to be substantially less than 1/2
your output sample rate. So you could try sample stuffing (effectively
interpolating but introducing loads of high frequency components that your
filter will then remove) at the input then strongly filtering before
decimating at the FIR filter output. Not very attractive really.
Alternatively you could look at a thread that appeared here a few weeks
back - concerning fitting a series of sinc functions to irregularly spaced
data and so being able to interpolate in some least squares sense over the
whole of the data set on a regular grid ( I can't remember what the subject
line was : at the end of the day it seemed to be equivalent to doing a
polynomial fit of order n-1 on your original n points data set then
generating your regularly sampled sequence).
Hope some of the above is helpful - Best of Luck - Mike.
Reply by Mike Yarwood●January 17, 20062006-01-17
<rosy27@gmail.com> wrote in message
news:1137529629.666388.12350@o13g2000cwo.googlegroups.com...
> Hi Mike
>
> Can u please explain me how i can interpolate my data (non uniform
> sampled) using triangular plates? I didnt get it!!!
>
The triangular plate thing is for a 2D sample grid. Basically you create a
surface by taking your real values on your irregular sample scheme, imagine
that you tesselate all the spaces between your sample locations with flat
plates ( all the spaces are triangular so you end up with a variable height
surface made of triangular plates) the height of the vertices of the
triangles is determined by your real values and the locations of the
vertices is determined by your sampling plan. Now you create a new, regular,
sample plan and you find out what the height of the triangular plate is at
all of your new sampling locations - this gives you your (linearly)
interpolated real values on the new regular grid. Then you repeat the whole
thing but using the imaginary values you have. You can do a whole lot of
other things like fitting conic sections over a more extended subset of your
original sample set but that gets complicated.
Your problem seems to be 1D so you needn't worry about the triangular plate
thing. You have already said that you are happy with the results you get
using matlab interp1 so all you need to do is write your own interpolator
which does the same thing. If you are happy with the interp1 default mode
which is linear then you only need to write your own 1D linear
interpolator - this could take in your input values and the location(time?)
at which they were obtained, decide whether it needs to output a value based
on your desired output time and output that value if needed - in general it
will need to calculate new interpolation "coefficients" for each output
calculation. Personally, I would use this approach but then I don't
know what your motivation is and I see that you would like to use a FIR
filter for some reason and I'm afraid that I'm not going to be much use to
you there as I know very little about them so what follows is complete
guesswork - do not rely on it.
If you are trying to use a digital FIR filter with fixed weights and a fixed
output rate then you effectively have a fixed input rate - how can you make
the input sample times coincide with your irregular sample times? what do
you tell the FIR is its input when you don't have an input sample that
corresponds to that time interval? You need to make this notionally regular
input rate >> your desired output rate so you can 'interpolate' by low pass
filtering and your filter cut-off needs to be substantially less than 1/2
your output sample rate. So you could try sample stuffing (effectively
interpolating but introducing loads of high frequency components that your
filter will then remove) at the input then strongly filtering before
decimating at the FIR filter output.
Alternatively you could look at a thread that appeared here a few weeks
back - concerning fitting a series of sinc functions to irregularly spaced
data and so being able to interpolate in some least squares sense over the
whole of the data set on a regular grid ( I can't remember what the subject
line was : at the end of the day it seemed to be equivalent to doing a
polynomial fit of order n-1 on your original n points data set then
generating your regularly sampled sequence).
Hope some of the above is helpful - Best of Luck - Mike.
Reply by Jerry Avins●January 17, 20062006-01-17
http://www-ccrma.stanford.edu/~jos/pasp/Matlab_Code_Lagrange_Interpolation.html
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
Reply by Jerry Avins●January 17, 20062006-01-17
rosy27@gmail.com wrote:
> Hi Mike
>
> Can u please explain me how i can interpolate my data (non uniform
> sampled) using triangular plates? I didnt get it!!!
Rose,
I don't know what what that method is either, but I'll guess that the
name is "obvious" once you know what it refers to. The simplest way is
considering the real and imaginary parts to be separate data sets, and
interpolating them separately with however much sophistication is needed
to be accurate enough. (linear, quadratic, cubic spline, sinc, Lagrange,
what have you. It seems straightforward, but tedious.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
Reply by rosy...@gmail.com●January 17, 20062006-01-17
Hi Mike
Can u please explain me how i can interpolate my data (non uniform
sampled) using triangular plates? I didnt get it!!!
Rose
Reply by Jerry Avins●January 17, 20062006-01-17
rosy27@gmail.com wrote:
> Hi Mike
>
> I tried using linear interpolation, spline..but nothing works. How can
> I find the coefficients of my FIR filter so that i can get the desired
> result. How can i decide the number of taps?
>
> Sorry for so many questions.
I'm just an ignorant amateur, but isn't the usual FIR designed on the
assumption that the signal it is to process is sampled uniformly? How
does the filter enter into the interpolating process? (I can think of a
way, but you won't like it.)
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
Reply by rosy...@gmail.com●January 17, 20062006-01-17
Hi Mike
I tried using linear interpolation, spline..but nothing works. How can
I find the coefficients of my FIR filter so that i can get the desired
result. How can i decide the number of taps?
Sorry for so many questions.
Thanks
Rose
Reply by Mike Yarwood●January 17, 20062006-01-17
<rosy27@gmail.com> wrote in message
news:1137511688.365199.22840@g49g2000cwa.googlegroups.com...
> Hi Mike
>
> I didnt get what triangular plate means. My data is like :
>
> Irregular data is a 1 d array like - [ 1 1.2 2 3 3.2 4 5 5.2 6
> 7....]. And data corresponding to these points is complex data.
> I want to interpolate complex data so that i can get complex values at
> points say: [1.1 3.1 5.1....]
Ah! I see - thought you had a very irregular 2D set of locations.
So this is straightforward you just do the same thing to the 'imaginary'
components that you do to the 'real' components then you add them back
together to get your complex output.
>
> I hope it makes sense!!!
yes - fine.
> If I use interp1 command, it works fine. But I want to write my own
> code maybe using any FIR filter.
Well if you can do that for a sequence of real values you can do it for a
sequence of complex valued inputs (as above).
Best of Luck - Mike
Reply by rosy...@gmail.com●January 17, 20062006-01-17
Hi Mike
I didnt get what triangular plate means. My data is like :
Irregular data is a 1 d array like - [ 1 1.2 2 3 3.2 4 5 5.2 6
7....]. And data corresponding to these points is complex data.
I want to interpolate complex data so that i can get complex values at
points say: [1.1 3.1 5.1....]
I hope it makes sense!!!
If I use interp1 command, it works fine. But I want to write my own
code maybe using any FIR filter.
Thanks
Rose
Reply by Mike Yarwood●January 16, 20062006-01-16
<rosy27@gmail.com> wrote in message
news:1137451491.263329.15260@g44g2000cwa.googlegroups.com...
> Hi
>
> Can anybody please describe me how "interp1" command in matlab works on
> nonuniform data? Does anybody know its algorithm? How can one
> interpolate complex data on a nonuniform grid to a uniform grid without
> using matlab's interp1 command directly?
>
> Thanks
> Rose
>
you can type "help interp1" or "type interp1" at matlabs command prompt to
find out what it is doing. When you do this it tells you what methods are
used and the restrictions on your data grids and suggests that you might
want to look at interp2 so type "help interp2". Not what you want? Why not?
If you want to avoid using someone elses code completely then one possible
method of interpolating from a very irregularly spaced set of data involves
finding where your regular grid ntercepts triangular plates set at the
nearest three neighbours in the irregular sample set so if your mesh point
(1,1,z) had nearest neighbours at (-2.2 , 1, 12+i3.3),(-1,-0.4,12+i3.3) and
(1.1,1.77, -2+i3.3) you would find the real part of z by finding the height
of the plate defined by (-2.2 , 1, 12),(-1,-0.4,12) and (1.1,1.77, -2) at
(1,1) and the imaginary part by getting the intercept with the plane defined
by (-2.2 , 1, 3.3),(-1,-0.4,3.3) and (1.1,1.77, 3.3) at (1,1) - hey it's
3.3! so the interpolated value at this point will be something+i3.3.
I don't know whether this method will suit you but it's simple so you can
try it out quickly and it's been around a long time (so it probably has one
or more names - I don't know what or I would have googled and passed you a
link to a better explanation - sorry).
Best of Luck - Mike