# Design of a filter with given bandwidth and sidelobe level using Parks–McClellan algorithm

I want to design a filter (beamformer) with a given bandwidth (beamwidth) and sidelobe level using Parks-McClellan algorithm. I use "firpm" function of MATLAB. however, I cannot reach a solution for my problem, since firpm function only accepts Frequency values and corresponding gains. Is there anyone who help me?

Specifically, how firpm function of MATLAB should be called (what values of arguments?) to obtain a given beam-width and sidelobe-level?

You can use Parks McClellen for beam-former shading for uniform line array.

Assuming broadside is $\theta =0$ degrees , change variables, $u_x= \cos( \theta)$. In Parks McClellen, the filter is of either odd or even symmetry and the frequency $f$ variable is given over a range of $0 \le f \le 1$ but implicitly because of the symmetry, the range is actually $-1 \le f \le 1$. While $-90 \le \theta \le 90$,$\Rightarrow$ $-1 \le u_x\le 1$, when the spacing $d= \frac{\lambda}{2}$, so $u_x$ corresponds to $f$ in Parks McClellen frequency axis.

Since $\theta=0$ at. broadside, the main lobe is symmetric around $u_x=0$, or for Parks McClellan $f=0$ which corresponds to a low pass filter.

Choose a desired beam-width $\theta_{BW}$ , define a transition band $\cos(\theta_{BW}/2) \pm \Delta$ for some small $\Delta$. and the rest is identical to a conventional Parks McClellan filter design specification, subject to the same filter order and stop-band considerations. The beam pattern should have the same constant side-lobes at broadside as the time domain filter.

• this is good, Stanley. it sorta begs the question for why there isn't a general Remes Exchange Algorithm utility in MATLAB. (or if there is, i am not aware of it.) – robert bristow-johnson Nov 12 '17 at 5:30
• Remez is more of a tradition at this point in time. You can do the same thing with Linear Programing which is older than Remez but back in the day when 32k of memory was something o brag about, Remez was a big deal. My personal opinion is that they should teach LP because its a general purpose tool that you can solve a lot more problems with. The only trick here is using cos theta space, which ties ULAs and FIR filters together. Most of the new filter design papers use general convex optimization anyway. – Stanley Pawlukiewicz Nov 12 '17 at 12:55
• @StanleyPawlukiewicz Thank you for your answer. Would you mind letting me know how to set the input parameters of the function 'firpm' in matlab? b = firpm(n,f,a,w) what are n,f,a,w for a given beam-width and sidelobe level? – user87882 Nov 12 '17 at 16:40
• doc. firpm. I showed you how. asking me to solve it is inappropriate – Stanley Pawlukiewicz Nov 12 '17 at 17:11
• @StanleyPawlukiewicz You have helped me, but some problem still remains unsolved. 1) According to your suggestion: $cos(\theta_{BW})$; the lower the beamwidth the higher the transition band. Is it reasonable? 2)When I use firpm to gerenate a filter, the time domain filter doesn't have sidelobes, then how can I find the sidelobe level? 3) You have shown how to choose transition band but how to choose the stop band frequency? Thanks – user87882 Nov 12 '17 at 18:39