Graphing Frequency Spectrum of Signal Over Time

In summary, the conversation discusses the process of graphing the frequency spectrum of a signal over time. This involves using a filter defined by a specific equation and finding the contribution of a certain variable to the signal over a set number of steps. The resulting equation can be written in multiple forms, one of which has a bug that was later identified and corrected.
  • #1
Gigasoft
59
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:
[tex]y_n = Ae^{i\omega_0}y_{n-1} + x_n[/tex]
This has a frequency response of [tex]\frac 1 {\sqrt{\left(1-A\right)^2+2A\left(1-cos\left(\omega-\omega_0\right)\right)}}[/tex], which peaks at [tex]\omega_0[/tex].

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

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

However, when I apply the last formula to the result of the first filter in my program, I don't get [tex]\widehat{x}[/tex]. If x is 0, then [tex]\widehat{x}[/tex] 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
  • #2
Oh, nevermind. I had a bug in the program where I accidentally used [tex]\widehat{x}[/tex] for [tex]\left|y_{-1}\right|[/tex] for the next iteration.
 

Related to Graphing Frequency Spectrum of Signal Over Time

What is the purpose of graphing frequency spectrum of a signal over time?

The purpose of graphing frequency spectrum of a signal over time is to visualize the changes in the frequency components of a signal over a specific period of time. This can help in identifying any patterns or trends in the signal and can also provide insights into the underlying causes of those changes.

What equipment is needed to graph frequency spectrum of a signal over time?

To graph frequency spectrum of a signal over time, you will need a signal generator, an oscilloscope, and a computer with software capable of performing spectral analysis. You may also need additional cables and connectors depending on the specific setup.

What are the steps involved in graphing frequency spectrum of a signal over time?

The steps involved in graphing frequency spectrum of a signal over time include setting up the equipment, connecting the signal generator to the input of the oscilloscope, setting the desired frequency range and resolution, and recording the data. This data can then be transferred to a computer for further analysis and visualization using software such as MATLAB or Python.

What factors can affect the accuracy of the frequency spectrum graph?

The accuracy of the frequency spectrum graph can be affected by various factors such as the quality of the equipment used, external noise or interference, and the resolution and range settings. It is important to calibrate the equipment and minimize any external factors to obtain an accurate representation of the signal's frequency spectrum.

How can graphing frequency spectrum over time be useful in scientific research?

Graphing frequency spectrum over time can be useful in scientific research as it allows for analysis and visualization of changes in signals over time. This can be applied in various fields such as telecommunications, signal processing, and acoustics, to name a few. It can also help in identifying anomalies or patterns in the data that may be missed by traditional time-domain analysis.

Similar threads

  • Differential Equations
Replies
1
Views
1K
Replies
7
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Differential Equations
Replies
1
Views
764
  • Differential Equations
Replies
3
Views
2K
  • Differential Equations
Replies
5
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
802
Replies
8
Views
2K
Replies
7
Views
2K
Replies
63
Views
1K
Back
Top