# Reducing sampling rate by a non-integer factor

I have data that is sampled at 12 kHz. The downsample function in software such as MATLAB only allow you to downsample by an integer factor, i.e. from $12\to{6,4,3,2,1,\ldots}$ kHz. How would I downsample by a non-integer factor, say, from $12\to{10,9,8,7,5,...}$ kHz (pseudocode/description is fine)? You can assume that the signal has been appropriately lowpass filtered prior to downsampling. Also, the desired new sampling rate (after downsampling) is a "nice" number (i.e., I'm not trying to do $12 \to 9.7432$ or something like that).

## 2 Answers

I can recommend the resample command in MATLAB. It's a combination of up- and down-sampling. To get from 12kHz to a sampling rate of 9kHz, you upsample by 3 and downsample by 4. resample just needs your signal and the two factors for up- and down-sampling. Remember, when downsampling, to first low-pass filter out everything between 4.5 kHz and 6 kHz. Very little energy should exist above the resulting Nyquist frequency.

• Ah, thanks. It should be up first and then down, but that's fine.
– user5839
Oct 31, 2013 at 16:43
• good point! according to the docu of matlab, it first samples up and afterwards down. the other way round, it wouldn't make much sense. Oct 31, 2013 at 16:50

Another common method of downsampling is low-pass filtering followed by Sinc interpolation of the new sample point set. These methods can be approximated and combined by choosing an appropriate width windowed Sinc as the interpolation kernel. For a rational downsampling ratio, this interpolation kernel can be precalculated into a polyphase FIR filter bank.