0
$\begingroup$

I came across a concept that says we can design LPH and HPF from APF when the transfer function of the two APFs given as

$$\begin{align}A_0(z)&=1\\ A_1(z)&=\frac{-a+z^{-1}}{1-az^{-1}}\\\\ H_{LP}(z)&=A_0(z)+A_1(z)\\ H_{HP}(z)&=A_0(z)-A_1(z)\end{align}$$

i tried to implement this in matlab but i did not get the desired frequency response..kindly help me with the matlab code for the same..

$\endgroup$
5
  • $\begingroup$ Your A1 formula is ambiguous. Please add more () to make clear what you divide by which (come on, this is basic "how to write down a formula"). $\endgroup$ Commented Jan 16, 2016 at 14:27
  • $\begingroup$ i didnt understand what is the ambiguity in A1..are you asking me the value for a?? $\endgroup$ Commented Jan 16, 2016 at 18:13
  • $\begingroup$ With Gilles edit, it's now clear that you meant A1 = (-a+z^(-1))/(1-az^(-1)) with your formula, and not A1= -a + (z^(-1))/(1-az^(-1)), which obviously is something completely different! $\endgroup$ Commented Jan 17, 2016 at 10:15
  • $\begingroup$ but i did not get the desired frequency response: What did you get instead? Where's your Matlab code? Please make it easy to answer your question! $\endgroup$ Commented Jan 17, 2016 at 10:24
  • $\begingroup$ Does your title how to design LPH and HPF from APF really reflect your question well? I feel your question is about understanding and analyzing the resulting filter, not designing it. $\endgroup$ Commented Jan 17, 2016 at 10:54

1 Answer 1

1
$\begingroup$

Since you don't say what response you're actually getting from Matlab, this is all guesswork.

So let's do the basics: A little formula juggling.

$$\begin{align}A_0(z)&=1\\ A_1(z)&=\frac{-a+z^{-1}}{1-az^{-1}}\\[4em] H_{LP}(z)&=A_0(z)+A_1(z)\\ &= 1 + \frac{-a+z^{-1}}{1-az^{-1}}\\ &= \frac{{1-az^{-1}}-a+z^{-1}}{1-az^{-1}}\\ &= \frac{(1-a)\quad +\quad (1-a)z^{-1}}{1-az^{-1}}\\[4em] H_{HP}(z)&=A_0(z)-A_1(z)\\ &= 1 - \frac{-a+z^{-1}}{1-az^{-1}}\\ &= \frac{{1-az^{-1}}+a-z^{-1}}{1-az^{-1}}\\ &= \frac{(1+a)\quad +\quad (-1-a)z^{-1}}{1-az^{-1}} \end{align}$$

So, taken from these formulas, the filter coefficients for $H_{LP}$ are $b=[1-a,1-a]$, $a=[1,-a]$, and for $H_{HP}$ it's $b=[1+a,-1-a]$, $a=[1,-a]$ for the canonical form of recursive filters

$$H= \frac{\sum\limits_{i=0}^N b_i z^{-i}}{\sum\limits_{i=0}^M a_i z^{-i}}\text.$$

Plugging that into scipy's scipy.signal.freqz for different $a$ yielded (abscissa: normalized frequency $\in[0,\pi[$, ordinate: magnitude):

$H_{LP,a}$ for $a\in\{0,0.1,\dots,0.9,1\}$:

LPFs

$H_{HP,a}$ for $ a\in\{0,0.1,\dots,0.9,1\}$:

HPFs

which both very nicely match the terms low and high pass filters, respectively.

$\endgroup$
15
  • $\begingroup$ what is that scipy.signal.freqz..i didnt find that function in matlab documentation.. $\endgroup$ Commented Jan 19, 2016 at 14:40
  • $\begingroup$ unfortunately i am not able to copy the matlab code which i wrote..i have used the coefficients which you suggested but though i am getting the response. its not varying when i change the parameter a.. $\endgroup$ Commented Jan 19, 2016 at 14:49
  • $\begingroup$ here is my mail id: [email protected] you kindly send me the matlab code..thanks :) $\endgroup$ Commented Jan 19, 2016 at 14:50
  • $\begingroup$ @pavansunder: why can't you share your Matlab code? This sounds like the lamest excuse to get someone else to do your homework ever. $\endgroup$ Commented Jan 19, 2016 at 16:32
  • $\begingroup$ i tried to copy and paste my matlab code....but was unable to do..can u share your mail id so that i ll send my code.. $\endgroup$ Commented Jan 19, 2016 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.