# Expected plot didn't come out!

I did the following things:

• Generated a 2 Hz sine wave (s1) with sampling frequency 1000 hz
• Generated a 8 Hz sine wave (s2) with sampling frequency 1000 hz
• combined both of them to get a new waveform (s3)
• created a filter with cutoff 4 Hz and gave s3 as input.

filter used is :

[b,a] = fir1(7,4/fs);

filter_out = filter(b,a,s3);


where fs is sampling frequency .

I expected that the filter will remove the 8 Hz component from the composite waveform (s3) and the filter output will be a 2 Hz sinewave. ie both filter output and s1 will look alike. But this is what i got.

What is wrong with my understanding/expectation?

[b,a] = fir1(300,4/fs/2);