Timeline for Is interpolation (interp1) better than FIR filtering when rational integers are close to 1?
Current License: CC BY-SA 3.0
18 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 28, 2013 at 13:37 | history | edited | Peter K.♦ | CC BY-SA 3.0 |
then -> than :-(
|
Jul 16, 2013 at 15:35 | comment | added | Jason R |
@endowdly: I agree with Wandering Logic that you're not measuring "accuracy" in a meaningful way. However, one other place where I think you're confusing the discussion is when you talk about the type of interpolation interp1 is doing. You call it nearest-neighbor, but its default mode is linear interpolation. The example Wandering Logic gave with the $\sin$ function assumed nearest-neighbor resampling as you had said you were using.
|
|
Jul 16, 2013 at 14:06 | answer | added | user5026 | timeline score: 3 | |
Jul 3, 2013 at 18:34 | answer | added | Wandering Logic | timeline score: 6 | |
Jul 3, 2013 at 15:37 | comment | added | endowdly |
If I make two time vectors as above, but set the number of samples to say, 200, then create a pure sine as s0 = sin(2*pi*12e6*t0) then resample using both interp1 and resample I do not see what you're speaking of (no 12.6MHz signal???). With interp1 I see a 12 MHz signal resampled at 26.25Msamples with a negligible discontinuity at every 21st symbol. With resample I see something horrible, and not at all recognizable as a 12Mhz pure sine wave.
|
|
Jul 3, 2013 at 15:05 | comment | added | endowdly |
I understand what you're saying. But while there maybe LPF occuring mathmatically behind the function, interp1 is straight table look up that averages two values. What I'm trying to ask is WHY is this more accurate when rational integers approach unity. It's clearly less accurate when rational integers are not near unity. But it seems to clearly be more accurate in transforming a signal around unity. Try it for yourself; it demonstrates well on pure sine waves as well.
|
|
Jul 3, 2013 at 15:00 | comment | added | Wandering Logic | And if you try a pure sine wave of, say, 12MHz, you'll see that nearest-neighbor interpolation is creating something horrible: a signal that looks like it is mostly 12.6MHz but with a horrible discontinuity every 21st sample. | |
Jul 3, 2013 at 14:54 | comment | added | Wandering Logic | You're not measuring difference in a meaninful way. If you compare sample-by-sample on the first 20 samples of nearest-neighber then the samples will be identical. But if you compare $s_{4000000}$ vs $t_{4000000}$ and $s_{4000001}$ vs $t_{4000001}$ you will see that they are completely unrelated. Rather, something like $s_{3809523}$ will be equal to $t_{4000000}$. Linear interpolation (or any other interpolation) is doing some low-pass filtering. You can figure out how much by trying the interpolation function on a pure sine-wave. | |
Jul 3, 2013 at 14:06 | comment | added | endowdly | You're very right. However there are two ways you can do it. The first, and preferred method is to simply plot s0 with t0 and s1 with t1 on the same plot and visually compare. If you only plot a handful of symbols, it's very easy to see the difference. Another way is to "stretch" the original signal to the length of the transformed signal. That way the indices will line up, and you can perform by-element subtractation with the RMS (abs) values. | |
Jul 3, 2013 at 12:56 | comment | added | Wandering Logic | How can you be taking the difference between the original signal and the transformed signal? The samples don't line up any more. | |
Jul 3, 2013 at 12:24 | comment | added | endowdly | By closer I mean the difference is less. Much less. I have also tested with different sampling rates, and I can confirm that as the rational integer ratio approaches unity, nearest neighbor outperforms filtered linear interpolation. However, as the ratio increases away from unity in either direction, linear interpolation is easily the way to go. | |
Jul 3, 2013 at 12:22 | comment | added | endowdly |
That's correct. The RMS difference between the original signal, s0 , and the resampled signal, s1 , is much closer when interpolated with 'nearest' than with filtered linear interpolation. For GPS, this is problematic, since the noise floor is so high. It could have something to do with the signal being complex? And your description of 'nearest' is off a little bit; it doesn't duplicate the 21st. 'nearest' takes the mean of the 20th and 21st original samples to produce the resampled 21st sample.
|
|
Jul 2, 2013 at 12:13 | comment | added | Wandering Logic |
In what way is interp1(x,Y,xi,'nearest') giving a more accurate resample of your signal? Define "more accurate". Is it that the RMS difference with the known answer is better? nearest chooses the nearest sample, so it will just give you 20 of your original samples and then the 21st will duplicate the 20th, and then repeat. I can't imagine how that could be more accurate than using linear interpolation.
|
|
Jul 1, 2013 at 22:59 | history | tweeted | twitter.com/#!/StackSignals/status/351837397354430464 | ||
Jul 1, 2013 at 15:42 | history | edited | endowdly | CC BY-SA 3.0 |
formatting
|
Jul 1, 2013 at 15:19 | review | First posts | |||
Jul 1, 2013 at 16:08 | |||||
Jul 1, 2013 at 15:05 | history | edited | endowdly | CC BY-SA 3.0 |
added 62 characters in body
|
Jul 1, 2013 at 15:00 | history | asked | endowdly | CC BY-SA 3.0 |