0
$\begingroup$

I need a band-limited white noise to characterize a biological sensor that senses mechanical movement. For that, I am generating a Gaussian white noise (MATLAB Communications toolbox) of length 10 seconds. This 10-second array length varies with sampling rate which may be 20 kHz/ 100 kHz. But, to get a band-limited Gaussian white noise I am filtering this array with a lowpass Butterworth filter of order=10, cut-off at 300 Hz, and sampling rate of 10 kHz, which does not vary with the sampling rate used to determine the length of the array. I use the filtered signal to actuate a voice coil motor that stimulates the sensor. Since the sampling rates I have used are greater than 2 times the cut-off frequency, I have met the Nyquist criterion.

Does the sampling frequency used in the filter design limit the sampling frequency of the signal that I can use to actuate the motor? Will there be an aliasing effect in the signal to the motor (fs = 20 kHz/100 kHz) because of the lower sampling rate used in the filter (10 kHz)?

This is what I have done:

           gwn = wgn(1,length(time), attenuation = -20, load_impedence=1, seed=1); 
            
            d = designfilt('lowpassiir','FilterOrder',10, ...
                'HalfPowerFrequency',300, ...
                'SampleRate', 1e4);
            blgwn = filtfilt(d, gwn);

`

This is the visualization of the filter: enter image description here

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Actually, the filter you designed is not a lowpass filter with cut-off frequency of 300 Hz. You designed a digital lowpass filter of cut-off frequency at $\frac{300}{10000}\cdot2\pi=0.06\pi$ in digital frequency or equivalently $\frac{300}{10000/2}=0.06$ in normalized frequency. You designed it by matlab code [b, a] = butter(10, 0.06) right?

It doesn't care about the sampling frequency, and the analog cut-off frequency of it is relevant to the Nyquist frequency. When the sample rate is 10 kHz, the cut-off frequency is $0.06 * 10000 / 2 = 300$ which is what you need. But if you use different sampling frequency, the cut-off frequency changes. For 20 kHz you get 600 Hz and for 100 kHz you have 3000 Hz.

In summary, you will have to design different lowpass filter for different sampling frequency, otherwise the band-limited Gaussian white noise is not what you want. Passing those signals to your sensor will not cause aliasing, you just pass a white noise which is band-limited to 600 / 3000 Hz respectively.

You can hear the differences by modifying fs in the following code:

fs = 20e3;
[b, a] = butter(10, 300 / 10e3 * 2);
x = randn(10 * fs, 1);
y = filter(b, a, x);
sound(y, fs)
$\endgroup$
4
  • $\begingroup$ Some programs (such as MATLAB, scipy) prefer the Nyquist frequency as the frequency reference, making fs/2 normalized to 1. $\endgroup$
    – ZR Han
    Feb 19 at 8:09
  • $\begingroup$ I am not changing the sampling rate of the filter when I change the sampling frequency of the generated signal. Doesn't that mean the cut off is fixed at 300 Hz, independent of the signal being filtered? It is stupid that I didn't change the fs in the filter. All the experiments are done. Cannot go back on that. I want to know how this affects my analysis. $\endgroup$ Feb 19 at 8:46
  • $\begingroup$ I see. The cut off frequency is relevant to the sample rate and is not fixed at 300 Hz because you designed a digital filter and all frequencies are digital frequency. The effect is the same as you pass a white noise which is band-limited to 600 Hz and 3000 Hz respectively instead of 300 Hz to the biological sensor. If that causes alias to your sensor, then yes. I don't know the characteristic of your sensor but if it is a loudspeaker, I don't see any problem, you can filter out the higher frequency part in the output signal. $\endgroup$
    – ZR Han
    Feb 19 at 9:11
  • $\begingroup$ Thanks for the clarification. The output of the filter will be different based on the sampling rate of the input signal. So the outputs will be different. $\endgroup$ Feb 19 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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