DSPRelated.com
Forums

interp1 command matlab

Started by rosy...@gmail.com January 16, 2006
<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.