Search code examples
matlabsignal-processingfrequencysampling

Sampling Frequency sine wave


I am trying to design a bandpass FIR filter using the fdatool in matlab. The input signal is a sine wave at 2kHz corrupted by white noise with zero mean and 0.01 variance. I have the required specs for the FIR filter to enhance the sine wave and reduce noise but I am left wondering what sampling frequency should I use. This is what i tried and its not working very well.

Fs=10000;
t=0:1/Fs:0.005;
x = sin(2*pi*2000*t);
signal = x + sqrt(0.01)*randn(size(t));
plot(t,signal);
hold on;
output=filter(Hd,signal);
plot(t,output);

Solution

  • For a digital FIR filter you should have a certain number of 'taps', or filter coefficients which define the filter. The number of taps will depend on a few things:

    1.) the signal sampling frequency

    2.) the filter's frequency response

    Given that you seem to be choosing an arbitrary Fs in your example, I'm left to assume that you haven't chosen an Fs on the fdatool interface. You should make sure that the sampling frequency of the filter and that of the signal you're generating are the same.