# MATLAB fvtool: Setting the passband ripple below 0dB for a FIR Filter

I'm new to using filter tools in MATLAB and I'm having a bit of difficulty. I'm designing a lowpass FIR filter and I'm trying to keep the passband ripple below 0dB in the magnitude response. So far, the passband ripple travels up above 0dB the same amount that it travels below. Any ideas on how to accomplish this using fvtool? I've been reading up on fvtool all day and I still can't figure it out. Thanks in advance for your help. Also, I apologize for this being so wordy for such a simple questions.

• fvtool is for visualizing your filter, not changing it. That said, if you have eg. 3dB passband ripples (going from 3dB above and 3dB below the 0dB passband gain), and would like everything to be below 0dB you can scale down all your coefficients by that same 3dB (dividing all FIR coefficients by $10^{3/20}\approx 1.4$). – SleuthEye Jan 31 '16 at 2:23

From your question I conclude that it is an equi-ripple filter that you designed, probably using the Parks-McClellan algorithm. Such an equi-ripple FIR filter has a magnitude response alternating between the values $1+\delta_p$ and $1-\delta_p$ in the pass band (where $\delta_p$ is the maximum approximation error in the pass band), and in the stop band it also has ripples of equal height $\delta_s$, where $\delta_s$ is the maximum stop band error. Note that all quantities I use here are linear, not in dB.
So, as mentioned by SleuthEye in a comment, after designing such a filter you can simply scale it to get the desired behavior. If $h[n]$ are your original filter coefficients, your desired filter has the coefficients
$$\tilde{h}[n]=\frac{1}{1+\delta_p}h[n]\tag{1}$$
The filter in $(1)$ will have a pass band magnitude alternating between the values $1$ (i.e., 0 dB) and $(1-\delta_p)/(1+\delta_p)$, and its minimum stopband attenuation will be $\delta_s/(1+\delta_p)$.