# What if the Down sampling factor is not an integer?

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.

• 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. Jan 24 '15 at 3:06
• 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. Jan 28 '15 at 9:40
• 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. Jan 28 '15 at 14:07
• @Dilip,I understand the problem now. Can you please suggest some techniques to solve this issue apart from the below mentioned sinc interpolater?. Jan 29 '15 at 7:47