0
$\begingroup$

i have been tinkering with some fir filters to bandpass-filter a signal. Even though the filter looks pretty descent in frequency domain, i receive a quite strange "filtered" signal in time-domain. I think, i'm oversseing something simple... Maybe one of you knows what i am doing wrong.

First of all, here's the code:

Fs          = 200; % hz
nyquistFreq = Fs/2;
frange      = [45 55];
order       = round( 30*Fs/frange(1) );
filtKern    = fir1(order,frange/nyquistFreq);
filtSignal  = filter(filtKern,1,signal);

I plotted the data stored in signal and filtSignal into one plot and the filter-shape is received at the beginning of the filtered signal:

raw and filtered signal

Here's a picture of the filter in time-domain, in frequency-domain and in frequncy-domain with logarithmic scale. According to the plot in frequency domain, the cut-off frequencies fit pretty much what i requested...

enter image description here

Thank you so much, i appreciate every input!

$\endgroup$
1
  • $\begingroup$ Are you providing all the code used? It is not clear how the filtSignal gains so much energy. It also will help if you can describe your signal and what you expect as an output $\endgroup$
    – Engineer
    Commented Dec 28, 2019 at 13:37

1 Answer 1

2
$\begingroup$

Since you are seeing your filter coefficients and much larger than your signal, this is indicative that you have a very large "impulse" at the start of your signal. The coefficients of your filter is the impulse response for the filter, so that is exactly what you are seeing: the response to an impulse.

Review the start of your time domain data for a very large offset in the first sample or near the start of the file.

$\endgroup$

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.