2
$\begingroup$

I have developed a function which down samples an input signal.Say I have an input signal with a sampling rate of 512 samples/sec and would like to down sample it 128 samples/sec, then the down sampling factor is discrete and it is 4. In this case, I believe that the input signal will successfully be down sampled to 128 samples/sec without any loss of information.But, what if we have to down sample a signal from a sampling rate of 511 samples/sec to 127 samples/sec,then the down sampling factor 4.0236. When I run my code for a down sampling non integer factor, I still get the output down sampled signal,but I am sure that, since I down sampled the signal by an non-integer factor, the output may not be correct and would have lost information.Any methods to overcome this issue or Is there a way to approximate it without damaging the quality of the down sampled signal?

My Understanding - I found a method after a while of researching. In this case we have to initially up sample the input sampling rate followed by down sampling, known as "Multirate conversion". So here is my understanding, Input Sampling rate = 511 b/s and Desired output sampling rate = 127 b/s. So, 127*5 = 635 and 635 -511 = 124. Therefore, i need to up sample 511 b/s by a factor of L = 5 to get 635 and then down sample this 635 by a factor M = 124 to get the desired down sampled output of 127 b/s. What do you have to say?. Please correct me if its wrong or illogical.

$\endgroup$
  • $\begingroup$ The last paragraph beginning "My Understanding - I found...." is wrong and illogical. Your input has 511 (equally spaced) samples each second; you want 127 equally spaced samples in each second. If you upsample the input by a factor of 5, you have 511*5 = 2555 samples in each second. Yes, I know that 127*5 = 635 and that 635-511 = 124 but those numbers are irrelevant to the question. But if you did have 635 equally spaced samples in each second, your only downsampling choices are 5, 127, and 635. Downsampling by M means taking every Mth sample and discarding the rest. $\endgroup$ – Dilip Sarwate Jan 24 '15 at 3:06
  • $\begingroup$ I got an easy way to solve this problem, L/M = 127/511, LFs = 127*511 = 64897 and then LFs/M = 64897/511 = 127. But i am not sure if this will work or not. $\endgroup$ – PsychedGuy Jan 28 '15 at 9:40
  • $\begingroup$ Your "easy way" is the no-brainer theoretical approach but, as @BulentS. pointed out to you in a comment on his own answer, upsampling at such high rates is not easy to implement in practice because high-precision arithmetic must be used. You will be computing 126 new sample values between every two samples at 511 samples/second. Thus, numerically, two adjacent newly computed samples will differ by smaller amounts than two adjacent original samples. With low-precision arithmetic, such differences may well get lost in round-off error. $\endgroup$ – Dilip Sarwate Jan 28 '15 at 14:07
  • $\begingroup$ @Dilip,I understand the problem now. Can you please suggest some techniques to solve this issue apart from the below mentioned sinc interpolater?. $\endgroup$ – PsychedGuy Jan 29 '15 at 7:47
3
$\begingroup$

Resampling (by rational or even irrational ratios) can be done by low-pass filtering in conjunction with high quality interpolation of all the samples needed for the new rate, directly. No two-step up-sampling following by downsampling is required (although that is one possible implementation for simple ratios).

A Sinc kernel, being a reconstruction formula, is the ideal interpolator for band-limited sampled waveforms. In practice, a windowed Sinc interpolator is usually as good or better than the FIR or IIR filters used inside other resampling methods.

Also, information may be lost in going to any lower sample rate (even in your original 4:1 resampler) if the original sample data contains higher frequency spectrum that has to be removed by the anti-alias low pass filter (required to prevent aliasing at the lower sample rate).

$\endgroup$
  • $\begingroup$ So you mean to say that, we can interpolate the input signal(using certain interpolation techniques such as Sinc interpolator) to achieve both upsampling as well as downsampling rates and there is actually no need for two step processing i.e. Interpolation + Decimation?. $\endgroup$ – PsychedGuy Jan 28 '15 at 12:23
  • $\begingroup$ Thank you hotpaw. I finally understood your answer. Presently working on using cubic interpolation technique for resampling. $\endgroup$ – PsychedGuy Feb 5 '15 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.