0
$\begingroup$

suppose I have the following discrete time signal $x\left(n\right)=0.7\sin\left(2\pi \times 623\:nT\right)$ where $N=4000$ and $T=\frac{1}{f_s}$, where $f_s=40$ kHz

I pass this signal through a simple IIR filter $ H\left(z\right)\:=\:\frac{0.2}{1-0.3z^{-1}}$

I calculate the power of the ouput signal $P_y\:=\:P_x\:\left|H\left(z\right)\right|^2_2$ basically am using the filter 2-norm in this case. for that my calculations would be as follows:

$P_y\:=\left(0.245\right)\left(\frac{0.2^2}{1-0.3^2}\right)\:=\:0.0108$

However when I develop this in Matlab, I get the output power as 0.0199 Here's my code in Matlab

fs = 40000;
f1 = 623;
N = 4000;
n = 1:N;
b = 0.2;
a = [1 -0.3];
x = 0.7*sin(2*pi*f1*n/fs);
P_x = var(x);
y = filter(b,a,x);
P_y = var(y);

I don't understand what I was doing wrong, would someone please clarify for me? I would appreciate it. Thank you in advance.

$\endgroup$
8
  • $\begingroup$ $H(z)|^2$ is a function of frequency not a single number. How did you come up with your expression for $H(z)|^2$ . The squared magnitude of the denominator is $1+0.3^2- 0.3(z^{-1}+z)$ $\endgroup$
    – Hilmar
    Apr 25 at 19:33
  • $\begingroup$ Because of the two-norm. That's how i learned it. $\endgroup$
    – JordenSH
    Apr 25 at 21:10
  • $\begingroup$ The 2-norm of a digital filter is defined as $||H(e^{j\omega})||_2 = (1/2\pi \int_{-\pi}^{\pi}|H(e^{j\omega})|^2 d\omega)^{1/2} = (\sum_n |h(n)|^2)^{1/2}$. The second equation is derived from Parseval's theorem. I think what you mean is just the magnitude $|H(z)|$. $\endgroup$
    – ZR Han
    Apr 26 at 3:12
  • $\begingroup$ @ZRHan you got it correct, I DID mean the 2-norm. That's what I mean and is getting me confused because I don't know why my matlab code is not giving the same result as the theory of the filter 2-norm. Will you please provide explanation or an answer? $\endgroup$
    – JordenSH
    Apr 26 at 6:43
  • $\begingroup$ I think what you need is the power of output signal through an IIR filter. The output has a frequency response $Y(e^{j\omega}) = X(e^{j\omega}) H(e^{j\omega})$ and its overall power is $\int_{-\pi}^\pi |Y(e^{j\omega})|^2d\omega = \int_{-\pi}^\pi |X(e^{j\omega})|^2|H(e^{j\omega})|^2d\omega$, which is obviously not equal to the power of input times the 2-norm of the filter. $\endgroup$
    – ZR Han
    Apr 26 at 7:15
2
$\begingroup$

The analog frequency $\Omega=2\pi\times 623$ and the digital frequency is $\omega = \Omega T = \Omega/f_s = 0.03115\pi$

The frequency response at this frequency is $$H(z)|_{z=e^{j\omega}} = H(e^{j0.03115\pi}) = \frac{0.2}{1-0.3 e^{-j0.03115\pi}}$$

and its square of magnitude is

$$ |H(e^{j0.03115\pi})|^2 = \Big|\frac{0.2}{1-0.3 e^{-j0.03115\pi}}\Big|^2 = 0.0812 $$

Now you'll see $P_y = P_x |H(e^{j0.03115\pi})|^2 = 0.0199$

$\endgroup$
3
  • $\begingroup$ This is so useful, thank you very much, but would you tell me how come the 2-norm did not work here? $\endgroup$
    – JordenSH
    Apr 26 at 16:31
  • $\begingroup$ also, why did the $0.03115\pi $ change to $0.1557\pi $? thank you $\endgroup$
    – JordenSH
    Apr 26 at 16:33
  • 1
    $\begingroup$ @JordenSH Sorry, it's $0.03115\pi$. The 2-norm describes the energy of entire digital filter including all frequencies. But you have a single frequency sine wave input and output. Essentially, it's math. Write down the definition of signal power in the frequency domain step by step and you'll find it out. $\endgroup$
    – ZR Han
    Apr 27 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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