# Magnitude spectrum and phase spectrum

Other languages:
Series Geophysical References Series Digital Imaging and Deconvolution: The ABCs of Seismic Exploration and Processing Enders A. Robinson and Sven Treitel 6 http://dx.doi.org/10.1190/1.9781560801610 9781560801481 SEG Online Store

What are the amplitude and phase characteristics of a digital filter? The filters we discussed in Chapter 5 operate in the time domain. Therefore, they can be called time-domain digital filters. The numerical examples presented there illustrate digital filtering in the time domain. However, many people are more accustomed to thinking about filtering in the frequency domain. One can study the action of filters profitably either in the time domain or the frequency domain or in a combination of both. The choice of a particular approach depends on the nature of the problem at hand. We shall now proceed to sketch the relation that exists between time-domain and frequency-domain filtering. Before doing so, a brief discussion of simple harmonic motion is in order.

A sinusoidal signal ${\displaystyle e^{i\omega n\Delta t}}$ represents simple harmonic motion. Now let this sinusoid be the input to the various digital filters that we considered in Chapter 5. First let us consider the constant filter ${\displaystyle b_{0}}$. We have the diagram shown in Figure 1.

Figure 1.  A constant filter.

The output is

 {\displaystyle {\begin{aligned}b_{0}e^{i\omega n\Delta {\rm {t}}}=b_{0}\left({\rm {\ cos\ }}\omega n\Delta t+i{\rm {\ sin\ }}\omega n\Delta t\right)=b_{0}{\rm {\ cos\ }}\omega n\Delta t+ib_{0}{\rm {\ sin\ }}\omega n\Delta t.\end{aligned}}} (1)

Hence, the output is a rotating vector of length ${\displaystyle b_{0}}$. For example, for ${\displaystyle b_{0}=0.5}$, we have the case illustrated in Figure 2.

Figure 2.  Constant filter ${\displaystyle b_{0}=0.5}$.

Because both the input vector at time n and the output vector at time n make the same angle with the horizontal axis, we say that the input and output are in phase. Here, we have assumed tacitly that ${\displaystyle b_{0}}$ is a positive constant. If, on the other hand, ${\displaystyle b_{0}}$ is a real positive constant, say, ${\displaystyle b_{0}=-{0.5}}$, we have the situation shown in Figure 3.

Figure 3.  Constant filter ${\displaystyle b_{0}=-0.5}$.

The output vector is ${\displaystyle -{0.5}e^{-i\omega n\Delta t}}$. Because ${\displaystyle -{1=}e^{i\pi }}$, the output vector can be written as

 {\displaystyle {\begin{aligned}{0.5}\left(-{1}\right)e^{i\omega n\Delta t}=0.5e^{i\pi }e^{i\omega n\Delta t}=0.5e^{i\left(\omega n\Delta t+\pi \right)}\end{aligned}}} (2)

Thus, we have converted the output vector into the product of the positive constant 0.5 times ${\displaystyle e^{i\left(\omega n\Delta t+\pi \right)}}$. The positive constant 0.5 is the length of the output vector and hence is called the magnitude of this output vector. Now the quantity

 {\displaystyle {\begin{aligned}e^{i\left(\omega n\Delta t+\pi \right)}={\rm {\ cos\ }}\left(\omega n\Delta t+\pi \right)+i{\rm {\ sin\ }}\left(\omega n\Delta t+\pi \right)\end{aligned}}} (3)

represents a rotating vector of length l. At time index n = 0, this vector is

 {\displaystyle {\begin{aligned}e^{i\pi }={\rm {\ cos\ }}\pi +i{\rm {\ sin\ }}\pi =-{1},\end{aligned}}} (4)

which shows that the vector lies on the horizontal axis in the negative direction and thus makes an angle of ${\displaystyle \pi }$ radians with the positive horizontal axis. The angle ${\displaystyle \pi }$ is called the phase lead of the vector (a lead represents the amount of advance of a rotating vector). For example, the input vector ${\displaystyle e^{i\omega n\Delta t}}$ is advanced by ${\displaystyle {18}0^{\rm {o}}}$ to produce the vector ${\displaystyle e^{i\left(\omega n\Delta t+\pi \right)}}$.

Returning now to our example of the filter ${\displaystyle b_{0}=-{0.5}}$, we can say that the filter output

 {\displaystyle {\begin{aligned}-{0.5}e^{i\omega n\Delta t}=0.5e^{i\left(\omega n\Delta t+\pi \right)}=0.5{\rm {\ cos\ }}\left(\omega n\Delta t+\pi \right)+i0.5{\rm {\ sin\ }}\left(\omega n\Delta t+\pi \right)\end{aligned}}} (5)

can be pictured as a rotating vector of amplitude +0.5 and phase lead ${\displaystyle \pi }$ radians. If we divide the output ${\displaystyle {0.5}e^{-i\left(\omega n\Delta t+\pi \right)}}$ by the input ${\displaystyle e^{i\omega n\Delta t}}$, we obtain the filter’s transfer function:

 {\displaystyle {\begin{aligned}{\frac {\rm {Output}}{\rm {Input}}}={\frac {{0.5}e^{i\left(\omega n\Delta t+\pi \right)}}{e^{l\omega n\Delta {\rm {t}}}}}=0.5e^{i\pi }.\end{aligned}}} (6)

Instead of dealing with angular frequency ${\displaystyle \omega }$, one often deals with the cyclic frequency f in Hertz (Hz), where ${\displaystyle \omega =2\pi f}$. Thus, the transfer function B(f) of the filter ${\displaystyle b_{0}=0.5}$ now becomes

 {\displaystyle {\begin{aligned}{\frac {\rm {Output}}{\rm {Input}}}=B\left(f\right)={\frac {{0.5}e^{i\left({2}\pi fn\Delta f+\pi \right)}}{e^{i{2}\pi fn\Delta t}}}=0.5e^{i\pi }.\end{aligned}}} (7)

The frequency spectrum (or transfer function) can be written in polar form as ${\displaystyle B\left(f\right)={|}B\left(f\right){|}e^{i\psi (f)}}$, which generally is complex. The magnitude ${\displaystyle {|}B\left(f\right){|}}$ of the transfer function is called the filter’s magnitude spectrum (or amplitude spectrum), whereas its phase lead ${\displaystyle \psi \left(f\right)}$ is called the filter’s phase-lead spectrum. Thus, the magnitude spectrum of the filter ${\displaystyle b_{0}=-{0.5}}$ is 0.5, and its phase-lead spectrum is ${\displaystyle \pi }$.

We notice that both the magnitude spectrum and the phase-lead spectrum of this filter are independent of frequency (Figure 4). Because the phase-lead spectrum is constant and equal to ${\displaystyle \pi }$, we can say that this filter’s input and output are out of phase by ${\displaystyle \pi }$ for all f or simply that they are ${\displaystyle {18}0^{\rm {o}}}$ out of phase.

Figure 4.  Magnitude and phase-lead spectra for the constant filter ${\displaystyle b_{0}=-{0.5}}$.

In the same way, we can compute the transfer function of any constant filter ${\displaystyle b_{0}}$. The transfer function is

 {\displaystyle {\begin{aligned}B\left(f\right)={\frac {\rm {Output}}{\rm {Input}}}={\frac {b_{0}e^{i{2}\pi fn\Delta t}}{e^{j{2}\pi f\Delta t}}}=b_{0},\end{aligned}}} (8)

which is just the constant vector ${\displaystyle b_{0}}$.

The next filter we wish to consider is the unit-delay filter Z. The transfer function is now

 {\displaystyle {\begin{aligned}B\left(f\right)={\frac {\rm {Output}}{\rm {Input}}}={\frac {e^{i{2}\pi f\left(n-{1}\right)\Delta t}}{e^{i{2}\pi fn\Delta t}}}=e^{-i{2}\pi f\Delta t}.\end{aligned}}} (9)

That is, the transfer function of the unit-delay filter is the vector ${\displaystyle e^{-i{2}\pi f\Delta t}}$. The magnitude spectrum of a filter is equal to the magnitude of the filter’s transfer function (i.e., frequency spectrum). Because the vector ${\displaystyle e^{-i2{\pi }f\Delta t}}$ has unit magnitude, we see that the magnitude spectrum of the unit-delay filter is 1. The phase-lead spectrum of a filter is equal to the phase-lead of the transfer function of the filter. Because the vector ${\displaystyle e^{-i{2\pi }f\Delta t}}$ makes an angle of ${\displaystyle {-2}\pi f\Delta t}$ with the positive horizontal axis, we see that the phase-lead spectrum of this filter is ${\displaystyle {-2}\pi f\Delta t}$. Hence, the phase-lead spectrum of this filter is a linear function of frequency f, although its magnitude spectrum is independent of f.

The magnitude and phase-lead spectra are plotted in Figure 5 for ${\displaystyle 0\leq 2\pi f\Delta t\leq \pi }$, which is the range ${\displaystyle 0\leq f\leq 1/(2\Delta t)}$. Because we have specified that ${\displaystyle \Delta t=0.004}$, we have ${\displaystyle 0\leq f\leq 125}$. Summing up, we see that the transfer function of the filter ${\displaystyle b_{0}}$ is ${\displaystyle b_{0}}$ and that the transfer function of the filter Z is ${\displaystyle e^{-i{2}\pi f\Delta t}}$. For the causal FIR filter ${\displaystyle b_{1}Z}$, we have the transfer function

Figure 5.  Magnitude and phase-lead spectra of a unit-delay filter.

 {\displaystyle {\begin{aligned}B\left(f\right)={\frac {\rm {Output}}{{\rm {In}}{\rm {put}}}}={\frac {b_{1}e^{j{2}\pi f\left(n-{1}\right)\Delta f}}{e^{i{2}\pi fn\Delta {\rm {t}}}}}=b_{1}e^{-i{2}\pi f\Delta t}.\end{aligned}}} (10)

The causal FIR filter ${\displaystyle b_{0}+b_{1}Z}$ has the transfer function

 {\displaystyle {\begin{aligned}{\frac {\rm {Output}}{\rm {Input}}}={\frac {b_{0}e^{i{2}\pi fn\Delta t}+b_{l}e^{i{2}\pi f\left(n-{1}\right)\Delta t}}{e^{i{2}\pi fn\Delta {\rm {t}}}}}=b_{0}+b_{1}e^{-i{2}\pi f\Delta t}.\end{aligned}}} (11)