Here is my code for a two-toned signal, where I use a stop-band to remove the higher tone and then plotted the before (in blue) and after (in red) in the frequency domain after convolving my signal with the filter coefficients.
If you put this code into Matlab you can clearly see that the higher frequency has been successfully removed by the filter, yet for some reason the amplitude of the lower frequency has been cut in half, and the more I increase the # of filter coefficients, the more it just flattens my whole curve, why does this occur? And how can I prevent it so that the stop-band does not propagate outwards? Here is the image and the code:
fSampling = 8000; tSampling = 1/fSampling; t = 0:tSampling:0.005; F0 = 1000; F1 = 3000; xt = sin(2*pi*F0*t) + sin(2*pi*F1*t); ht = fir1(40,.25,'stop'); yt = conv(xt,ht); fAxis = -4000:125:4000-125; xF = fft(xt,64); MagXF = fftshift(abs(xF)); plot(fAxis,MagXF); hold on yF = fft(yt,64); MagYF = fftshift(abs(yF)); plot(fAxis,MagYF,'r')