# Relationship between sampling frequency and number of coefficients [duplicate]

This question already has an answer here:

I have been designing a bandpass filter with a passband between $95\textrm{ kHz}$ and $105\textrm{ kHz}$ (using MATLAB's fdatool and scipy.signal.remez in Python) and have noticed that as I increase the sampling frequency the number of coefficients needed to implement my filter increase. I was wondering why this is?

• I presume it is either because the ratio between the band-pass size and the full frequency range (0 $\rightarrow$ Nyquist) gets lower and this causes it to be more difficult to achieve?

• Or because the filter has to filter out a larger range of frequencies (e.g. for a $400\textrm{ kHz}$ clock it has to have coefficients that cause attenuation from $0\rightarrow 95\textrm{ kHz}$ and $105\textrm{ kHz}\rightarrow 200\textrm{ kHz}$ but for a $1\textrm{ MHz}$ clock it has to have coefficients that cause attenuation from $0\rightarrow 95\textrm{kHz}$ and $105\textrm{ kHz} \rightarrow 500\textrm{ kHz}$) and thus requires a larger number of coefficients to achieve?

## marked as duplicate by Marcus Müller, Community♦Aug 17 '16 at 22:02

• just from a POV of dimensional analysis; consider an analog filter (or infinite sample rate). the impulse response may be infinitely long but practically it has a length to the point where the impulse response is indistinguishable from zero. that impulse response has a length in units of time (like seconds) and it turns out, dimensionally, to be inversely proportional to the transition bandwidths. now consider impulse-invariant method. then the number of samples of that impulse response must be equal to the length (in time) times the sample rate. proportional to sample rate. – robert bristow-johnson Aug 17 '16 at 19:25
• @robertbristow-johnson great argument! OP is a physicist: Dear Random Physicist: remember the uncertainty principle? That's exactly what's happening. A filter response of bandwidth $b=100\text{ kHz}$, observed with a high sample rate $r=100\text{ MHz}$ is very well-located in frequency domain, right? Hence, its Fourier transform, the time domain representation of the same system, is very widely distributed. The "sharper" your filter edges become, the longer the temporal dimension of the filter, and hence, the longer the filter. – Marcus Müller Aug 17 '16 at 19:51
• That completely makes sense Marcus and is a great way to think about it for us physicists, many thanks – SomeRandomPhysicist Aug 17 '16 at 21:55

For digital filters, all frequencies (and bandwidths) are relative to the sampling frequency. So a fixed bandwidth (in Hz) becomes relatively more narrow for a higher sampling frequency. You would get the same number of coefficients (for the same performance) if the ratio $B/f_s$ were constant, where $B$ is the filter's bandwidth and $f_s$ is the sampling frequency.