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?
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.
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.
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.
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.
Thanks Tim for reply. I am working on it
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.
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).