# How to find a 'square root filter' such that $d*\overline{d}=f$ given $f$?

I have a desired frequency response $F(\omega)$. I know how to create a FIR filter (say, with linear phase) $f(n)$ with this frequency response.

But how can I get a filter $d(n)$ such that $D(\omega)D^*(\omega)=|D(\omega)|^2=F(\omega)$, or equivalently in the time domain, $(d*\overline d)(n)=f(n)$, i.e. the 'square root' of $f$? (here $\overline d$ is the filter $d$ with reversed order of coefficients)

I would like to get a real filter with compact support, preferably using MATLAB.

Thanks.

• If you can do the calculation of f(n) from $F(\omega)$, why cant you do it from $\sqrt{F(\omega)}$? – Maximilian Matthé Nov 22 '16 at 6:53
• Won't it give me a filter such that $D^2=F$, instead of $D D^*=F$? – yoki Nov 22 '16 at 7:04
• If you choose $D=\sqrt{F}$ and F is real (it is real according to your assumptions), then D can also be chosen to be real and $DD*=DD$ – Maximilian Matthé Nov 22 '16 at 7:43

If you can design an FIR filter with arbitrary magnitude response $F(\omega)$, then you can easily design the filters that you're looking for. Just break the design into two pieces: magnitude and phase.
If the desired magnitude response of the cascade is $|F(\omega)| = |D(\omega)||D^*(\omega)| = |D(\omega)|^2$, then, as was pointed out already, you can simply take the square root of the desired overall magnitude response to yield the magnitude response of your square-root filter $D(\omega$).
With the magnitude response defined, then it's up to you to pick what kind of phase response you want to give $D(\omega)$. The phase responses of $D(\omega)$ and $D^*(\omega)$ will be conjugates of one another, so they will cancel when the two square-root filters are cascaded. You would typically pick the phase response to aid in implementation or to give you some other nice property along the way.
One common choice, as you pointed out, is using linear-phase FIR filters. So, you can pick a filter length, set the filter group delay to $\frac{N}{2}$ (where $N$ is the filter order), and use the resulting phase delay curve as the desired phase response in your square-root filter design. You should end up with a filter with a symmetric impulse response (which can provide implementation advantages due to the redundancy in the structure of the taps).
One other thing I should note is that the question as posed will yield a non-causal structure in one of the subfilters. Take the case where $D(\omega)$ has linear phase (so a constant group delay). Its conjugate will have the opposite phase response, so if $D(\omega)$ corresponds to a delay of $N$ samples, then $D^*(\omega)$ will have a phase response that corresponds to an advance of $N$ samples, so it will be non-causal.
What the OP was probably looking for was a structure where $D^2(\omega) = F(\omega)$ instead. This would be similar to the root-raised cosine filter structure used in digital communications, for example.