Contents
What is the amplitude and phase spectra?
amplitude spectrum specifies the amplitude of signal components as a function of component. frequency. The phase spectrum specifies the phase of signal components as a function of. component frequency. This phase is measured with respect to a cosine reference.
How do you calculate the phase of a signal?
The phase shift equation is ps = 360 * td / p, where ps is the phase shift in degrees, td is the time difference between waves and p is the wave period. Continuing the example, 360 * -0.001 / 0.01 gives a phase shift of -36 degrees.
How to plot the magnitude and phase spectra of a signal?
I managed to plot the magnitude and phase spectrums of the signal, however I need to repeat this in range -fs/2:fs/2. What you are currently doing now is plotting the half spectrum, so from 0 <= f < fs/2 where fs is the sampling frequency of your signal, and so fs/2 is the Nyquist frequency.
How to plot the magnitude of a signal in Python?
That is frequency components of a periodic signal are plotted using Frequency Domain – frequencies plotted in X-axis and amplitude plotted in Y-axis. The pyplot module of the Python Matplotlib library provides the function magnitude_spectrum () that plots the spectral magnitude representation of a sine wave.
How to plot the half spectrum of a signal?
What you are currently doing now is plotting the half spectrum, so from 0 <= f < fs/2 where fs is the sampling frequency of your signal, and so fs/2 is the Nyquist frequency. Take note that considering the half spectrum is only valid if the signal is real.
How to plot the magnitude of a sine wave?
The pyplot module of the Python Matplotlib library provides the function magnitude_spectrum () that plots the spectral magnitude representation of a sine wave. The Magnitude Spectrum has both a positive frequency component and a negative frequency component. However, the magnitude_spectrum () function plots both the frequencies together.