Graphing Frequency Spectrum of Signal Over Time

Gigasoft
Messages
59
Reaction score
0
I am trying to graph the frequency spectrum of a signal over time. To do this, for each frequency I use a filter defined by the following equation:
y_n = Ae^{i\omega_0}y_{n-1} + x_n
This has a frequency response of \frac 1 {\sqrt{\left(1-A\right)^2+2A\left(1-cos\left(\omega-\omega_0\right)\right)}}, which peaks at \omega_0.

Now, for every m steps I want to find out how much x_n contributed to |y_n| during the last m steps. I define \widehat{y}_n=H\left[n\right]\left|y_n\right|, where n=0 is the first of the last m steps and H is the unit step function, and I let \widehat{x} be the contribution of x to |y|, which I assume to be constant for the m samples under consideration. This gets me the equation \widehat{y}_n=A\widehat{y}_{n-1}+\delta\left[n\right]A\left|y_{-1}\right|+H\left[n\right]\widehat{x}.

The Z-transform of this equation is:
\left(1-Az^{-1}\right)\widehat{Y}\left(z\right)=A\left|y_{-1}\right|+\frac{\widehat{x}}{1-z^{-1}}
In other words,
\widehat{Y}\left(z\right)=\frac{A\left|y_{-1}\right|\left(1-z^{-1}\right)+\widehat{x}}{\left(1-z^{-1}\right)\left(1-Az^{-1}\right)}
This can be written as:
\widehat{Y}\left(z\right)=\frac C{1-z^{-1}}+\frac D{1-Az^{-1}}=\frac{C\left(1-Az^{-1}\right)+D\left(1+z^{-1}\right)}{\left(1-z^{-1}\right)\left(1-Az^{-1}\right)}
From the two equations about, A\left|y_{-1}\right|+\widehat{x}-A\left|y_{-1}\right|z^{-1}=C+D-ACz^{-1}-Dz^{-1} for all z, and we must have A\left|y_{-1}\right|+\widehat{x}=C+D and Ay_{-1}=AC+D.
The inverse transform of \frac C{1-z^{-1}}+\frac D{1-Az^{-1}} is H\left[n\right]\left(C+DA^n\right). So, we have C+DA^{m-1}=\widehat{y}_{m-1}.
This gives:
D=A\left|y_{-1}\right|-AC=\frac{\widehat{y}_{m-1}-C}{A^{m-1}}
A\left|y_{-1}\right|-\frac{\widehat{y}_{m-1}}{A^{m-1}}=C\left(A-\frac 1{A^{m-1}}\right)
\left|y_{-1}\right|-\widehat{y}A^{-m}=C\left(1-A^{-m}\right)
C=\frac{\left|y_{-1}\right|-\widehat{y}_{m-1}A^{-m}}{1-A^{-m}}=\frac{\left|y_{-1}\right|A^m-\widehat{y}_{m-1}}{A^m-1}=\left|y_{-1}\right|+\frac{\widehat{y}_{m-1}-\left|y_{-1}\right|}{1-A^m}
\widehat{x}=C+A\left|y_{-1}\right|-AC-A\left|y_{-1}\right|=\left(1-A\right)C=\left(1-A\right)\left(\left|y_{-1}\right|+\frac{\widehat{y}_{m-1}-\left|y_{-1}\right|}{1-A^m}\right)

However, when I apply the last formula to the result of the first filter in my program, I don't get \widehat{x}. If x is 0, then \widehat{x} should be 0 as well, but it isn't. The formula looks correct. I have tried with a value of m as low as 2, but it still doesn't work. What could be the problem.
 
Last edited:
Physics news on Phys.org
Oh, nevermind. I had a bug in the program where I accidentally used \widehat{x} for \left|y_{-1}\right| for the next iteration.
 
Thread 'Direction Fields and Isoclines'
I sketched the isoclines for $$ m=-1,0,1,2 $$. Since both $$ \frac{dy}{dx} $$ and $$ D_{y} \frac{dy}{dx} $$ are continuous on the square region R defined by $$ -4\leq x \leq 4, -4 \leq y \leq 4 $$ the existence and uniqueness theorem guarantees that if we pick a point in the interior that lies on an isocline there will be a unique differentiable function (solution) passing through that point. I understand that a solution exists but I unsure how to actually sketch it. For example, consider a...
Back
Top