DSPRelated.com
Forums

amplitude of passband frequencies in FIR bandpass filter

Started by naumankalia 5 years ago9 replieslatest reply 4 years ago391 views

Hi all

I wanted to generate broadband noise of specific amplitude for my simulations. To do so, i generated a random noise using MATLAB randn command and then design FIR filter using fir1 command to get filter coefficients against desired pass band frequencies and then apply filter on random noise using these coefficients. To check whether i got the desired band limited noise, i applied FFT on filtered data and the output was band limited according to desired specifications.

However, on more requirement is that pass band frequencies should have certain amplitude level, say x dB. I am lost how to do it?. Is there any way to design filter coefficients such that i got desired x dB levels in filtered output i.e. how to control amplitude levels of frequencies in pass band?

Thanks

[ - ]
Reply by kazNovember 20, 2019

Amplitude level in dB is only relevant as ratio to stop band. This is purely related to filter performance irrespective of any scaling (within reason). If you mean controlling gain of filter then you need to scale it and this depends whether it is low pass, high pass or band pass. Doing fft on filtered output could be misleading due to fft scaling itself which in turn is related to fft size.

[ - ]
Reply by Tim WescottNovember 20, 2019

Absolute amplitude matters if there's some nonlinear process -- even if it's "just digital" like truncation or saturation.

But if the OP is assessing purely linear phenomenon, then yes, the absolute amplitude doesn't matter.

[ - ]
Reply by kazNovember 20, 2019

Yes amplitude does matter but the op is about how to control filter scaling.

The best way and since they do offline fft is to do fft of input and fft of output then get power ratio of output to input and scale filter by square root of power ratio.

This applies to any filter(low pass or high pass or bandpass). The best input is just an impulse or random noise. Practically better input may be the expected input in the application as this may be used to tailor the gain specifically for the system.

[ - ]
Reply by timburnettNovember 20, 2019

Are you trying to scale the different pass band frequencies differently (1), or just normalize the pass band gain for all frequencies (2)? 

If the answer is (2), the solution is quite easy, just multiply the data by a normalizing factor, either before or after the filter (quantization concerns for fixed point processing tends to dictate after). Alternatively you can multiply all of the filter coefficients by the normalizing factor, instead of the data. 

If the answer is (1), then you need to be able to pass your frequency/gain pairs into the filter design tool, and then the resulting filter coefficients should be optimized for your custom response. Matlab has several options for this. 

Regards, Tim

[ - ]
Reply by naumankaliaNovember 20, 2019

Thanks Tim for reply. I am working on it

[ - ]
Reply by jbrowerNovember 20, 2019

Naumankalia-

Are you saying you need multiple passbands, each with different amplitude ?  If so that would be arbitrary frequency response FIR filter design.  You can do a search on the Parks-McClellan design method.  I'm pretty sure MATLAB supports that.

-Jeff

[ - ]
Reply by naumankaliaNovember 20, 2019

Thanks

[ - ]
Reply by Rick LyonsNovember 20, 2019
Hi naumankalia. Perhaps the material at the following link will be of some use to you:

https://www.dsprelated.com/showcode/263.php
[ - ]
Reply by wolf22November 20, 2019

to naumankalia:

dBm is a relation - a logarithmic relation. dBm is related to 1 mW (milli Watt) But electrical power (in german: "Leistung") is not related to digital signal prodessing - here we have only numbers. Usually all your samples are in the range of 1.0 > sample > -1.0 and so they enter your FIR filter. FIR Filter kernels are usually scaled so that the sum of the taps equals 1.0, so the gain of the filter is also 1.0 and therefore the amplitude of what's coming out of the filter over frequency depends only on the filter's characteristic.

You cannot expect, that the gain of your filter inside the passband is exactly 1.0 from one edge to the opposite - this would require a infinite number of taps. So your filter is always somewhat "round" in it's edges. But you can expect, that it is flat inside the passband, if you choose a characteristic like sinx/x or so. This does not apply for Chebychev-characteristics.

To control amplitude, simply apply a factor to the output (or to the coefficients).

regards

wolf