During his time at the company, Rawlins has held various leadership positions to learn all aspects of the business. Most recently, he led an 18-month process of evaluating, testing and implementing a new ERP (Enterprise Resource Planning) system to modernize and streamline the operational aspects of the business.

Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

As the length of the signal increases, the bandwidth of each bandpass filter decreases, making it a more selective filter, and improving the approximation of constant PSD over the bandwidth of the filter. This provides another interpretation of why the PSD estimate of the periodogram improves as the length of the signal increases. However, there are two factors apparent from this standpoint that compromise the accuracy of the periodogram estimate. First, the rectangular window yields a poor bandpass filter. Second, the computation of the power at the output of each bandpass filter relies on a single sample of the output signal, producing a very crude approximation.

Welch's method is implemented in the Signal Processing Toolbox by the pwelch function. By default, the data is divided into eight segments with 50% overlap between them. A Hamming window is used to compute the modified periodogram of each segment.

So in the spectrum of the finite-length signal, the Dirac deltas have been replaced by terms of the form , which corresponds to the frequency response of a rectangular window centered on the frequency fk.

SANTA ANA, Calif. — R&B Wire Products, a manufacturer of industrial material-handling products, including commercial laundry carts, has promoted Grant Rawlins to president, the company reports.

R&b wirereviews

As is the case for the correlation and covariance sequences, the toolbox estimates the PSD and CSD because signal lengths are finite.

The modified periodogram windows the time-domain signal prior to computing the FFT in order to smooth the edges of the signal. This has the effect of reducing the height of the sidelobes or spectral leakage. This phenomenon gives rise to the interpretation of sidelobes as spurious frequencies introduced into the signal by the abrupt truncation that occurs when a rectangular window is used. For nonrectangular windows, the end points of the truncated signal are attenuated smoothly, and hence the spurious frequencies introduced are much less severe. On the other hand, nonrectangular windows also broaden the mainlobe, which results in a net reduction of resolution.

The periodogram is asymptotically unbiased, which is evident from the earlier observation that as the data record length tends to infinity, the frequency response of the rectangular window more closely approximates the Dirac delta function (also true for a Bartlett window). However, in some cases the periodogram is a poor estimator of the PSD even when the data record is long. This is due to the variance of the periodogram, as explained below.

Cross-Spectral Density Function The PSD is a special case of the cross spectral density (CSD) function, defined between two signals xn and yn as As is the case for the correlation and covariance sequences, the toolbox estimates the PSD and CSD because signal lengths are finite. To estimate the cross-spectral density of two equal length signals x and y using Welch's method, the csd function forms the periodogram as the product of the FFT of x and the conjugate of the FFT of y. Unlike the real-valued PSD, the CSD is a complex function. csd handles the sectioning and windowing of x and y in the same way as the pwelch function: Sxy = csd(x,y,nfft,fs,window,numoverlap) Confidence Intervals You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0: [Sxy,Sxyc,f] = csd(x,y,nfft,fs,window,0,p) p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval [Sxy-Sxyc(:,1) Sxy+Sxyc(:,2)] covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable. Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

Thompson's multitaper method (MTM) builds on these results to provide an improved PSD estimate. Instead of using bandpass filters that are essentially rectangular windows (as in the periodogram method), the MTM method uses a bank of optimal bandpass filters to compute the estimate. These optimal FIR filters are derived from a set of sequences known as discrete prolate spheroidal sequences (DPSSs, also known as Slepian sequences).

You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0:

Because multiplication in the time domain corresponds to convolution in the frequency domain, the Fourier transform of the expression above is

The above discussion about resolution did not consider the effects of noise since the signal-to-noise ratio (SNR) has been relatively high thus far. When the SNR is low, true spectral features are much harder to distinguish, and noise artifacts appear in spectral estimates based on the periodogram. The example below illustrates this:

In the example above, where two sinusoids are separated by only 10 Hz, the data record must be greater than 100 samples to allow resolution of two distinct sinusoids by a periodogram.

The periodogram can be interpreted as filtering a length L signal, xL[n], through a filter bank (a set of filters in parallel) of L FIR bandpass filters. The 3 dB bandwidth of each of these bandpass filters can be shown to be approximately equal to fs / L. The magnitude response of each one of these bandpass filters resembles that of the rectangular window discussed in Spectral Leakage. The periodogram can thus be viewed as a computation of the power of each filtered signal (i.e., the output of each bandpass filter) that uses just one sample of each filtered signal and assumes that the PSD of xL[n] is constant over the bandwidth of each bandpass filter.

The plot displays a main lobe and several side lobes, the largest of which is approximately 13.5 dB below the mainlobe peak. These lobes account for the effect known as spectral leakage. While the infinite-length signal has its power concentrated exactly at the discrete frequency points fk, the windowed (or truncated) signal has a continuum of power "leaked" around the discrete frequency points fk.

If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.

In order to resolve two sinusoids that are relatively close together in frequency, it is necessary for the difference between the two frequencies to be greater than the width of the mainlobe of the leaked spectra for either one of these sinusoids. The mainlobe width is defined to be the width of the mainlobe at the point where the power is half the peak mainlobe power (i.e., 3 dB width). This width is approximately equal to fs / L.

“Grant is an exceptional leader who has developed a deep understanding of our business, from the day-to-day operations to the long-term goals and overall strategy,” says CEO Rick Rawlins, Grant’s father.

The Modified Periodogram The modified periodogram windows the time-domain signal prior to computing the FFT in order to smooth the edges of the signal. This has the effect of reducing the height of the sidelobes or spectral leakage. This phenomenon gives rise to the interpretation of sidelobes as spurious frequencies introduced into the signal by the abrupt truncation that occurs when a rectangular window is used. For nonrectangular windows, the end points of the truncated signal are attenuated smoothly, and hence the spurious frequencies introduced are much less severe. On the other hand, nonrectangular windows also broaden the mainlobe, which results in a net reduction of resolution. The periodogram function allows you to compute a modified periodogram by specifying the window to be used on the data. For example, compare a rectangular window and a Hamming window: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs/10)./fs; % One-tenth of a second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); periodogram(xn,rectwin(length(xn)),1024,fs); periodogram(xn,hamming(length(xn)),1024,fs); You can verify that although the sidelobes are much less evident in the Hamming-windowed periodogram, the two main peaks are wider. In fact, the 3 dB width of the mainlobe corresponding to a Hamming window is approximately twice that of a rectangular window. Hence, for a fixed data length, the PSD resolution attainable with a Hamming window is approximately half that attainable with a rectangular window. The competing interests of mainlobe width and sidelobe height can be resolved to some extent by using variable windows such as the Kaiser window. Nonrectangular windowing affects the average power of a signal because some of the time samples are attenuated when multiplied by the window. To compensate for this, the periodogram function normalizes the window to have an average power of unity. This way the choice of window does not affect the average power of the signal. The modified periodogram estimate of the PSD is where U is the window normalization constant which is independent of the choice of window. The addition of U as a normalization constant ensures that the modified periodogram is asymptotically unbiased. Welch's Method An improved estimator of the PSD is the one proposed by Welch [8]. The method consists of dividing the time series data into (possibly overlapping) segments, computing a modified periodogram of each segment, and then averaging the PSD estimates. The result is Welch's PSD estimate. Welch's method is implemented in the Signal Processing Toolbox by the pwelch function. By default, the data is divided into eight segments with 50% overlap between them. A Hamming window is used to compute the modified periodogram of each segment. The averaging of modified periodograms tends to decrease the variance of the estimate relative to a single periodogram estimate of the entire data record. Although overlap between segments tends to introduce redundant information, this effect is diminished by the use of a nonrectangular window, which reduces the importance or weight given to the end samples of segments (the samples that overlap). However, as mentioned above, the combined use of short data records and nonrectangular windows results in reduced resolution of the estimator. In summary, there is a tradeoff between variance reduction and resolution. One can manipulate the parameters in Welch's method to obtain improved estimates relative to the periodogram, especially when the SNR is low. This is illustrated in the following example. Consider an original signal consisting of 301 samples: randn('state',1) fs = 1000; % Sampling frequency t = (0:0.3*fs)./fs; % 301 samples A = [2 8]; % Sinusoid amplitudes (row vector) f = [150;140]; % Sinusoid frequencies (column vector) xn = A*sin(2*pi*f*t) + 5*randn(size(t)); periodogram(xn,rectwin(length(xn)),1024,fs); We can obtain Welch's spectral estimate for 3 segments with 50% overlap with pwelch(xn,rectwin(150),75,512,fs); In the periodogram above, noise and the leakage make one of the sinusoids essentially indistinguishable from the artificial peaks. In contrast, although the PSD produced by Welch's method has wider peaks, you can still distinguish the two sinusoids, which stand out from the "noise floor." However, if we try to reduce the variance further, the loss of resolution causes one of the sinusoids to be lost altogether: pwelch(xn,hamming(100),75,512,fs); For a more detailed discussion of Welch's method of PSD estimation, see Kay [2] and Welch [8]. Bias and Normalization in Welch's Method Welch's method yields a biased estimator of the PSD. The expected value can be found to be where Ls is the length of the data segments and U is the same normalization constant present in the definition of the modified periodogram. As is the case for all periodograms, Welch's estimator is asymptotically unbiased. For a fixed length data record, the bias of Welch's estimate is larger than that of the periodogram because Ls < L. The variance of Welch's estimator is difficult to compute because it depends on both the window used and the amount of overlap between segments. Basically, the variance is inversely proportional to the number of segments whose modified periodograms are being averaged. Multitaper Method The periodogram can be interpreted as filtering a length L signal, xL[n], through a filter bank (a set of filters in parallel) of L FIR bandpass filters. The 3 dB bandwidth of each of these bandpass filters can be shown to be approximately equal to fs / L. The magnitude response of each one of these bandpass filters resembles that of the rectangular window discussed in Spectral Leakage. The periodogram can thus be viewed as a computation of the power of each filtered signal (i.e., the output of each bandpass filter) that uses just one sample of each filtered signal and assumes that the PSD of xL[n] is constant over the bandwidth of each bandpass filter. As the length of the signal increases, the bandwidth of each bandpass filter decreases, making it a more selective filter, and improving the approximation of constant PSD over the bandwidth of the filter. This provides another interpretation of why the PSD estimate of the periodogram improves as the length of the signal increases. However, there are two factors apparent from this standpoint that compromise the accuracy of the periodogram estimate. First, the rectangular window yields a poor bandpass filter. Second, the computation of the power at the output of each bandpass filter relies on a single sample of the output signal, producing a very crude approximation. Welch's method can be given a similar interpretation in terms of a filter bank. In Welch's implementation, several samples are used to compute the output power, resulting in reduced variance of the estimate. On the other hand, the bandwidth of each bandpass filter is larger than that corresponding to the periodogram method, which results in a loss of resolution. The filter bank model thus provides a new interpretation of the compromise between variance and resolution. Thompson's multitaper method (MTM) builds on these results to provide an improved PSD estimate. Instead of using bandpass filters that are essentially rectangular windows (as in the periodogram method), the MTM method uses a bank of optimal bandpass filters to compute the estimate. These optimal FIR filters are derived from a set of sequences known as discrete prolate spheroidal sequences (DPSSs, also known as Slepian sequences). In addition, the MTM method provides a time-bandwidth parameter with which to balance the variance and resolution. This parameter is given by the time-bandwidth product, NW and it is directly related to the number of tapers used to compute the spectrum. There are always 2*NW-1 tapers used to form the estimate. This means that, as NW increases, there are more estimates of the power spectrum, and the variance of the estimate decreases. However, the bandwidth of each taper is also proportional to NW, so as NW increases, each estimate exhibits more spectral leakage (i.e., wider peaks) and the overall spectral estimate is more biased. For each data set, there is usually a value for NW that allows an optimal trade-off between bias and variance. The Signal Processing Toolbox function that implements the MTM method is called pmtm. Use pmtm to compute the PSD of xn from the previous examples: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs)/fs; % One second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); [P,F] = pmtm(xn,4,1024,fs); plot(F,10*log10(P)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); By lowering the time-bandwidth product, you can increase the resolution at the expense of larger variance: [P1,f] = pmtm(xn,3/2,1024,fs); plot(f,10*log10(P1)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); Note that the average power is conserved in both cases: Pow = (fs/1024) * sum(P) Pow = 2.4926 Pow1 = (fs/1024) * sum(P1) Pow1 = 2.4927 This method is more computationally expensive than Welch's method due to the cost of computing the discrete prolate spheroidal sequences. For long data series (10,000 points or more), it is useful to compute the DPSSs once and save them in a MAT-file. The M-files dpsssave, dpssload, dpssdir, and dpssclear are provided to keep a database of saved DPSSs in the MAT-file dpss.mat. Cross-Spectral Density Function The PSD is a special case of the cross spectral density (CSD) function, defined between two signals xn and yn as As is the case for the correlation and covariance sequences, the toolbox estimates the PSD and CSD because signal lengths are finite. To estimate the cross-spectral density of two equal length signals x and y using Welch's method, the csd function forms the periodogram as the product of the FFT of x and the conjugate of the FFT of y. Unlike the real-valued PSD, the CSD is a complex function. csd handles the sectioning and windowing of x and y in the same way as the pwelch function: Sxy = csd(x,y,nfft,fs,window,numoverlap) Confidence Intervals You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0: [Sxy,Sxyc,f] = csd(x,y,nfft,fs,window,0,p) p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval [Sxy-Sxyc(:,1) Sxy+Sxyc(:,2)] covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable. Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable.

The averaging of modified periodograms tends to decrease the variance of the estimate relative to a single periodogram estimate of the entire data record. Although overlap between segments tends to introduce redundant information, this effect is diminished by the use of a nonrectangular window, which reduces the importance or weight given to the end samples of segments (the samples that overlap).

R&b wirelaundry carts

Because the frequency response of a short rectangular window is a much poorer approximation to the Dirac delta function than that of a longer window, spectral leakage is especially evident when data records are short. Consider the following sequence of 100 samples:

which is similar to the first expression for XL(f) in Spectral Leakage, except that the expression here is in terms of average power rather than magnitude. This suggests that the estimates produced by the periodogram correspond to a leaky PSD rather than the true PSD.

To estimate the cross-spectral density of two equal length signals x and y using Welch's method, the csd function forms the periodogram as the product of the FFT of x and the conjugate of the FFT of y. Unlike the real-valued PSD, the CSD is a complex function. csd handles the sectioning and windowing of x and y in the same way as the pwelch function:

Nonrectangular windowing affects the average power of a signal because some of the time samples are attenuated when multiplied by the window. To compensate for this, the periodogram function normalizes the window to have an average power of unity. This way the choice of window does not affect the average power of the signal.

Rawlins, the third generation in his family to lead the business, has been with R&B Wire since graduating from Pepperdine University in 2016.

CSTR88G

Bias and Normalization in Welch's Method Welch's method yields a biased estimator of the PSD. The expected value can be found to be where Ls is the length of the data segments and U is the same normalization constant present in the definition of the modified periodogram. As is the case for all periodograms, Welch's estimator is asymptotically unbiased. For a fixed length data record, the bias of Welch's estimate is larger than that of the periodogram because Ls < L. The variance of Welch's estimator is difficult to compute because it depends on both the window used and the amount of overlap between segments. Basically, the variance is inversely proportional to the number of segments whose modified periodograms are being averaged. Multitaper Method The periodogram can be interpreted as filtering a length L signal, xL[n], through a filter bank (a set of filters in parallel) of L FIR bandpass filters. The 3 dB bandwidth of each of these bandpass filters can be shown to be approximately equal to fs / L. The magnitude response of each one of these bandpass filters resembles that of the rectangular window discussed in Spectral Leakage. The periodogram can thus be viewed as a computation of the power of each filtered signal (i.e., the output of each bandpass filter) that uses just one sample of each filtered signal and assumes that the PSD of xL[n] is constant over the bandwidth of each bandpass filter. As the length of the signal increases, the bandwidth of each bandpass filter decreases, making it a more selective filter, and improving the approximation of constant PSD over the bandwidth of the filter. This provides another interpretation of why the PSD estimate of the periodogram improves as the length of the signal increases. However, there are two factors apparent from this standpoint that compromise the accuracy of the periodogram estimate. First, the rectangular window yields a poor bandpass filter. Second, the computation of the power at the output of each bandpass filter relies on a single sample of the output signal, producing a very crude approximation. Welch's method can be given a similar interpretation in terms of a filter bank. In Welch's implementation, several samples are used to compute the output power, resulting in reduced variance of the estimate. On the other hand, the bandwidth of each bandpass filter is larger than that corresponding to the periodogram method, which results in a loss of resolution. The filter bank model thus provides a new interpretation of the compromise between variance and resolution. Thompson's multitaper method (MTM) builds on these results to provide an improved PSD estimate. Instead of using bandpass filters that are essentially rectangular windows (as in the periodogram method), the MTM method uses a bank of optimal bandpass filters to compute the estimate. These optimal FIR filters are derived from a set of sequences known as discrete prolate spheroidal sequences (DPSSs, also known as Slepian sequences). In addition, the MTM method provides a time-bandwidth parameter with which to balance the variance and resolution. This parameter is given by the time-bandwidth product, NW and it is directly related to the number of tapers used to compute the spectrum. There are always 2*NW-1 tapers used to form the estimate. This means that, as NW increases, there are more estimates of the power spectrum, and the variance of the estimate decreases. However, the bandwidth of each taper is also proportional to NW, so as NW increases, each estimate exhibits more spectral leakage (i.e., wider peaks) and the overall spectral estimate is more biased. For each data set, there is usually a value for NW that allows an optimal trade-off between bias and variance. The Signal Processing Toolbox function that implements the MTM method is called pmtm. Use pmtm to compute the PSD of xn from the previous examples: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs)/fs; % One second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); [P,F] = pmtm(xn,4,1024,fs); plot(F,10*log10(P)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); By lowering the time-bandwidth product, you can increase the resolution at the expense of larger variance: [P1,f] = pmtm(xn,3/2,1024,fs); plot(f,10*log10(P1)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); Note that the average power is conserved in both cases: Pow = (fs/1024) * sum(P) Pow = 2.4926 Pow1 = (fs/1024) * sum(P1) Pow1 = 2.4927 This method is more computationally expensive than Welch's method due to the cost of computing the discrete prolate spheroidal sequences. For long data series (10,000 points or more), it is useful to compute the DPSSs once and save them in a MAT-file. The M-files dpsssave, dpssload, dpssdir, and dpssclear are provided to keep a database of saved DPSSs in the MAT-file dpss.mat. Cross-Spectral Density Function The PSD is a special case of the cross spectral density (CSD) function, defined between two signals xn and yn as As is the case for the correlation and covariance sequences, the toolbox estimates the PSD and CSD because signal lengths are finite. To estimate the cross-spectral density of two equal length signals x and y using Welch's method, the csd function forms the periodogram as the product of the FFT of x and the conjugate of the FFT of y. Unlike the real-valued PSD, the CSD is a complex function. csd handles the sectioning and windowing of x and y in the same way as the pwelch function: Sxy = csd(x,y,nfft,fs,window,numoverlap) Confidence Intervals You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0: [Sxy,Sxyc,f] = csd(x,y,nfft,fs,window,0,p) p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval [Sxy-Sxyc(:,1) Sxy+Sxyc(:,2)] covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable. Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

Multitaper Method The periodogram can be interpreted as filtering a length L signal, xL[n], through a filter bank (a set of filters in parallel) of L FIR bandpass filters. The 3 dB bandwidth of each of these bandpass filters can be shown to be approximately equal to fs / L. The magnitude response of each one of these bandpass filters resembles that of the rectangular window discussed in Spectral Leakage. The periodogram can thus be viewed as a computation of the power of each filtered signal (i.e., the output of each bandpass filter) that uses just one sample of each filtered signal and assumes that the PSD of xL[n] is constant over the bandwidth of each bandpass filter. As the length of the signal increases, the bandwidth of each bandpass filter decreases, making it a more selective filter, and improving the approximation of constant PSD over the bandwidth of the filter. This provides another interpretation of why the PSD estimate of the periodogram improves as the length of the signal increases. However, there are two factors apparent from this standpoint that compromise the accuracy of the periodogram estimate. First, the rectangular window yields a poor bandpass filter. Second, the computation of the power at the output of each bandpass filter relies on a single sample of the output signal, producing a very crude approximation. Welch's method can be given a similar interpretation in terms of a filter bank. In Welch's implementation, several samples are used to compute the output power, resulting in reduced variance of the estimate. On the other hand, the bandwidth of each bandpass filter is larger than that corresponding to the periodogram method, which results in a loss of resolution. The filter bank model thus provides a new interpretation of the compromise between variance and resolution. Thompson's multitaper method (MTM) builds on these results to provide an improved PSD estimate. Instead of using bandpass filters that are essentially rectangular windows (as in the periodogram method), the MTM method uses a bank of optimal bandpass filters to compute the estimate. These optimal FIR filters are derived from a set of sequences known as discrete prolate spheroidal sequences (DPSSs, also known as Slepian sequences). In addition, the MTM method provides a time-bandwidth parameter with which to balance the variance and resolution. This parameter is given by the time-bandwidth product, NW and it is directly related to the number of tapers used to compute the spectrum. There are always 2*NW-1 tapers used to form the estimate. This means that, as NW increases, there are more estimates of the power spectrum, and the variance of the estimate decreases. However, the bandwidth of each taper is also proportional to NW, so as NW increases, each estimate exhibits more spectral leakage (i.e., wider peaks) and the overall spectral estimate is more biased. For each data set, there is usually a value for NW that allows an optimal trade-off between bias and variance. The Signal Processing Toolbox function that implements the MTM method is called pmtm. Use pmtm to compute the PSD of xn from the previous examples: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs)/fs; % One second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); [P,F] = pmtm(xn,4,1024,fs); plot(F,10*log10(P)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); By lowering the time-bandwidth product, you can increase the resolution at the expense of larger variance: [P1,f] = pmtm(xn,3/2,1024,fs); plot(f,10*log10(P1)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); Note that the average power is conserved in both cases: Pow = (fs/1024) * sum(P) Pow = 2.4926 Pow1 = (fs/1024) * sum(P1) Pow1 = 2.4927 This method is more computationally expensive than Welch's method due to the cost of computing the discrete prolate spheroidal sequences. For long data series (10,000 points or more), it is useful to compute the DPSSs once and save them in a MAT-file. The M-files dpsssave, dpssload, dpssdir, and dpssclear are provided to keep a database of saved DPSSs in the MAT-file dpss.mat. Cross-Spectral Density Function The PSD is a special case of the cross spectral density (CSD) function, defined between two signals xn and yn as As is the case for the correlation and covariance sequences, the toolbox estimates the PSD and CSD because signal lengths are finite. To estimate the cross-spectral density of two equal length signals x and y using Welch's method, the csd function forms the periodogram as the product of the FFT of x and the conjugate of the FFT of y. Unlike the real-valued PSD, the CSD is a complex function. csd handles the sectioning and windowing of x and y in the same way as the pwelch function: Sxy = csd(x,y,nfft,fs,window,numoverlap) Confidence Intervals You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0: [Sxy,Sxyc,f] = csd(x,y,nfft,fs,window,0,p) p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval [Sxy-Sxyc(:,1) Sxy+Sxyc(:,2)] covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable. Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

The variance of Welch's estimator is difficult to compute because it depends on both the window used and the amount of overlap between segments. Basically, the variance is inversely proportional to the number of segments whose modified periodograms are being averaged.

However, as mentioned above, the combined use of short data records and nonrectangular windows results in reduced resolution of the estimator. In summary, there is a tradeoff between variance reduction and resolution. One can manipulate the parameters in Welch's method to obtain improved estimates relative to the periodogram, especially when the SNR is low. This is illustrated in the following example.

The Signal Processing Toolbox function that implements the MTM method is called pmtm. Use pmtm to compute the PSD of xn from the previous examples:

WireLaundry Cart on wheels

However, if we try to reduce the variance further, the loss of resolution causes one of the sinusoids to be lost altogether:

Welch's method can be given a similar interpretation in terms of a filter bank. In Welch's implementation, several samples are used to compute the output power, resulting in reduced variance of the estimate. On the other hand, the bandwidth of each bandpass filter is larger than that corresponding to the periodogram method, which results in a loss of resolution. The filter bank model thus provides a new interpretation of the compromise between variance and resolution.

Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

An improved estimator of the PSD is the one proposed by Welch [8]. The method consists of dividing the time series data into (possibly overlapping) segments, computing a modified periodogram of each segment, and then averaging the PSD estimates. The result is Welch's PSD estimate.

R&B Wirecasters

Resolution.   Resolution refers to the ability to discriminate spectral features, and is a key concept on the analysis of spectral estimator performance.

Spectral Leakage.   Consider the power spectrum or PSD of a finite-length signal xL[n], as discussed in the Periodogram. It is frequently useful to interpret xL[n] as the result of multiplying an infinite signal, x[n], by a finite-length rectangular window, wR[n]:

Performance of the Periodogram The following sections discuss the performance of the periodogram with regard to the issues of leakage, resolution, bias, and variance. Spectral Leakage.   Consider the power spectrum or PSD of a finite-length signal xL[n], as discussed in the Periodogram. It is frequently useful to interpret xL[n] as the result of multiplying an infinite signal, x[n], by a finite-length rectangular window, wR[n]: Because multiplication in the time domain corresponds to convolution in the frequency domain, the Fourier transform of the expression above is The expression developed earlier for the periodogram, illustrates that the periodogram is also influenced by this convolution. The effect of the convolution is best understood for sinusoidal data. Suppose that x[n] is composed of a sum of M complex sinusoids: Its spectrum is which for a finite-length sequence becomes So in the spectrum of the finite-length signal, the Dirac deltas have been replaced by terms of the form , which corresponds to the frequency response of a rectangular window centered on the frequency fk. The frequency response of a rectangular window has the shape of a sinc signal, as shown below. The plot displays a main lobe and several side lobes, the largest of which is approximately 13.5 dB below the mainlobe peak. These lobes account for the effect known as spectral leakage. While the infinite-length signal has its power concentrated exactly at the discrete frequency points fk, the windowed (or truncated) signal has a continuum of power "leaked" around the discrete frequency points fk. Because the frequency response of a short rectangular window is a much poorer approximation to the Dirac delta function than that of a longer window, spectral leakage is especially evident when data records are short. Consider the following sequence of 100 samples: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs/10)/fs; % One-tenth of a second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); periodogram(xn,[],1024,fs); It is important to note that the effect of spectral leakage is contingent solely on the length of the data record. It is not a consequence of the fact that the periodogram is computed at a finite number of frequency samples. Resolution.   Resolution refers to the ability to discriminate spectral features, and is a key concept on the analysis of spectral estimator performance. In order to resolve two sinusoids that are relatively close together in frequency, it is necessary for the difference between the two frequencies to be greater than the width of the mainlobe of the leaked spectra for either one of these sinusoids. The mainlobe width is defined to be the width of the mainlobe at the point where the power is half the peak mainlobe power (i.e., 3 dB width). This width is approximately equal to fs / L. In other words, for two sinusoids of frequencies f1 and f2, the resolvability condition requires that In the example above, where two sinusoids are separated by only 10 Hz, the data record must be greater than 100 samples to allow resolution of two distinct sinusoids by a periodogram. Consider a case where this criterion is not met, as for the sequence of 67 samples below: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs/15)./fs; % 67 samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); periodogram(xn,[],1024,fs); The above discussion about resolution did not consider the effects of noise since the signal-to-noise ratio (SNR) has been relatively high thus far. When the SNR is low, true spectral features are much harder to distinguish, and noise artifacts appear in spectral estimates based on the periodogram. The example below illustrates this: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs/10)./fs; % One-tenth of a second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 2*randn(size(t)); periodogram(xn,[],1024,fs); Bias of the Periodogram.   The periodogram is a biased estimator of the PSD. Its expected value can be shown to be which is similar to the first expression for XL(f) in Spectral Leakage, except that the expression here is in terms of average power rather than magnitude. This suggests that the estimates produced by the periodogram correspond to a leaky PSD rather than the true PSD. Note that essentially yields a triangular Bartlett window (which is apparent from the fact that the convolution of two rectangular pulses is a triangular pulse). This results in a height for the largest sidelobes of the leaky power spectra that is about 27 dB below the mainlobe peak; i.e., about twice the frequency separation relative to the non-squared rectangular window. The periodogram is asymptotically unbiased, which is evident from the earlier observation that as the data record length tends to infinity, the frequency response of the rectangular window more closely approximates the Dirac delta function (also true for a Bartlett window). However, in some cases the periodogram is a poor estimator of the PSD even when the data record is long. This is due to the variance of the periodogram, as explained below. Variance of the Periodogram.   The variance of the periodogram can be shown to be approximately which indicates that the variance does not tend to zero as the data length L tends to infinity. In statistical terms, the periodogram is not a consistent estimator of the PSD. Nevertheless, the periodogram can be a useful tool for spectral estimation in situations where the SNR is high, and especially if the data record is long. The Modified Periodogram The modified periodogram windows the time-domain signal prior to computing the FFT in order to smooth the edges of the signal. This has the effect of reducing the height of the sidelobes or spectral leakage. This phenomenon gives rise to the interpretation of sidelobes as spurious frequencies introduced into the signal by the abrupt truncation that occurs when a rectangular window is used. For nonrectangular windows, the end points of the truncated signal are attenuated smoothly, and hence the spurious frequencies introduced are much less severe. On the other hand, nonrectangular windows also broaden the mainlobe, which results in a net reduction of resolution. The periodogram function allows you to compute a modified periodogram by specifying the window to be used on the data. For example, compare a rectangular window and a Hamming window: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs/10)./fs; % One-tenth of a second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); periodogram(xn,rectwin(length(xn)),1024,fs); periodogram(xn,hamming(length(xn)),1024,fs); You can verify that although the sidelobes are much less evident in the Hamming-windowed periodogram, the two main peaks are wider. In fact, the 3 dB width of the mainlobe corresponding to a Hamming window is approximately twice that of a rectangular window. Hence, for a fixed data length, the PSD resolution attainable with a Hamming window is approximately half that attainable with a rectangular window. The competing interests of mainlobe width and sidelobe height can be resolved to some extent by using variable windows such as the Kaiser window. Nonrectangular windowing affects the average power of a signal because some of the time samples are attenuated when multiplied by the window. To compensate for this, the periodogram function normalizes the window to have an average power of unity. This way the choice of window does not affect the average power of the signal. The modified periodogram estimate of the PSD is where U is the window normalization constant which is independent of the choice of window. The addition of U as a normalization constant ensures that the modified periodogram is asymptotically unbiased. Welch's Method An improved estimator of the PSD is the one proposed by Welch [8]. The method consists of dividing the time series data into (possibly overlapping) segments, computing a modified periodogram of each segment, and then averaging the PSD estimates. The result is Welch's PSD estimate. Welch's method is implemented in the Signal Processing Toolbox by the pwelch function. By default, the data is divided into eight segments with 50% overlap between them. A Hamming window is used to compute the modified periodogram of each segment. The averaging of modified periodograms tends to decrease the variance of the estimate relative to a single periodogram estimate of the entire data record. Although overlap between segments tends to introduce redundant information, this effect is diminished by the use of a nonrectangular window, which reduces the importance or weight given to the end samples of segments (the samples that overlap). However, as mentioned above, the combined use of short data records and nonrectangular windows results in reduced resolution of the estimator. In summary, there is a tradeoff between variance reduction and resolution. One can manipulate the parameters in Welch's method to obtain improved estimates relative to the periodogram, especially when the SNR is low. This is illustrated in the following example. Consider an original signal consisting of 301 samples: randn('state',1) fs = 1000; % Sampling frequency t = (0:0.3*fs)./fs; % 301 samples A = [2 8]; % Sinusoid amplitudes (row vector) f = [150;140]; % Sinusoid frequencies (column vector) xn = A*sin(2*pi*f*t) + 5*randn(size(t)); periodogram(xn,rectwin(length(xn)),1024,fs); We can obtain Welch's spectral estimate for 3 segments with 50% overlap with pwelch(xn,rectwin(150),75,512,fs); In the periodogram above, noise and the leakage make one of the sinusoids essentially indistinguishable from the artificial peaks. In contrast, although the PSD produced by Welch's method has wider peaks, you can still distinguish the two sinusoids, which stand out from the "noise floor." However, if we try to reduce the variance further, the loss of resolution causes one of the sinusoids to be lost altogether: pwelch(xn,hamming(100),75,512,fs); For a more detailed discussion of Welch's method of PSD estimation, see Kay [2] and Welch [8]. Bias and Normalization in Welch's Method Welch's method yields a biased estimator of the PSD. The expected value can be found to be where Ls is the length of the data segments and U is the same normalization constant present in the definition of the modified periodogram. As is the case for all periodograms, Welch's estimator is asymptotically unbiased. For a fixed length data record, the bias of Welch's estimate is larger than that of the periodogram because Ls < L. The variance of Welch's estimator is difficult to compute because it depends on both the window used and the amount of overlap between segments. Basically, the variance is inversely proportional to the number of segments whose modified periodograms are being averaged. Multitaper Method The periodogram can be interpreted as filtering a length L signal, xL[n], through a filter bank (a set of filters in parallel) of L FIR bandpass filters. The 3 dB bandwidth of each of these bandpass filters can be shown to be approximately equal to fs / L. The magnitude response of each one of these bandpass filters resembles that of the rectangular window discussed in Spectral Leakage. The periodogram can thus be viewed as a computation of the power of each filtered signal (i.e., the output of each bandpass filter) that uses just one sample of each filtered signal and assumes that the PSD of xL[n] is constant over the bandwidth of each bandpass filter. As the length of the signal increases, the bandwidth of each bandpass filter decreases, making it a more selective filter, and improving the approximation of constant PSD over the bandwidth of the filter. This provides another interpretation of why the PSD estimate of the periodogram improves as the length of the signal increases. However, there are two factors apparent from this standpoint that compromise the accuracy of the periodogram estimate. First, the rectangular window yields a poor bandpass filter. Second, the computation of the power at the output of each bandpass filter relies on a single sample of the output signal, producing a very crude approximation. Welch's method can be given a similar interpretation in terms of a filter bank. In Welch's implementation, several samples are used to compute the output power, resulting in reduced variance of the estimate. On the other hand, the bandwidth of each bandpass filter is larger than that corresponding to the periodogram method, which results in a loss of resolution. The filter bank model thus provides a new interpretation of the compromise between variance and resolution. Thompson's multitaper method (MTM) builds on these results to provide an improved PSD estimate. Instead of using bandpass filters that are essentially rectangular windows (as in the periodogram method), the MTM method uses a bank of optimal bandpass filters to compute the estimate. These optimal FIR filters are derived from a set of sequences known as discrete prolate spheroidal sequences (DPSSs, also known as Slepian sequences). In addition, the MTM method provides a time-bandwidth parameter with which to balance the variance and resolution. This parameter is given by the time-bandwidth product, NW and it is directly related to the number of tapers used to compute the spectrum. There are always 2*NW-1 tapers used to form the estimate. This means that, as NW increases, there are more estimates of the power spectrum, and the variance of the estimate decreases. However, the bandwidth of each taper is also proportional to NW, so as NW increases, each estimate exhibits more spectral leakage (i.e., wider peaks) and the overall spectral estimate is more biased. For each data set, there is usually a value for NW that allows an optimal trade-off between bias and variance. The Signal Processing Toolbox function that implements the MTM method is called pmtm. Use pmtm to compute the PSD of xn from the previous examples: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs)/fs; % One second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); [P,F] = pmtm(xn,4,1024,fs); plot(F,10*log10(P)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); By lowering the time-bandwidth product, you can increase the resolution at the expense of larger variance: [P1,f] = pmtm(xn,3/2,1024,fs); plot(f,10*log10(P1)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); Note that the average power is conserved in both cases: Pow = (fs/1024) * sum(P) Pow = 2.4926 Pow1 = (fs/1024) * sum(P1) Pow1 = 2.4927 This method is more computationally expensive than Welch's method due to the cost of computing the discrete prolate spheroidal sequences. For long data series (10,000 points or more), it is useful to compute the DPSSs once and save them in a MAT-file. The M-files dpsssave, dpssload, dpssdir, and dpssclear are provided to keep a database of saved DPSSs in the MAT-file dpss.mat. Cross-Spectral Density Function The PSD is a special case of the cross spectral density (CSD) function, defined between two signals xn and yn as As is the case for the correlation and covariance sequences, the toolbox estimates the PSD and CSD because signal lengths are finite. To estimate the cross-spectral density of two equal length signals x and y using Welch's method, the csd function forms the periodogram as the product of the FFT of x and the conjugate of the FFT of y. Unlike the real-valued PSD, the CSD is a complex function. csd handles the sectioning and windowing of x and y in the same way as the pwelch function: Sxy = csd(x,y,nfft,fs,window,numoverlap) Confidence Intervals You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0: [Sxy,Sxyc,f] = csd(x,y,nfft,fs,window,0,p) p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval [Sxy-Sxyc(:,1) Sxy+Sxyc(:,2)] covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable. Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

The effect of the convolution is best understood for sinusoidal data. Suppose that x[n] is composed of a sum of M complex sinusoids:

Note that essentially yields a triangular Bartlett window (which is apparent from the fact that the convolution of two rectangular pulses is a triangular pulse). This results in a height for the largest sidelobes of the leaky power spectra that is about 27 dB below the mainlobe peak; i.e., about twice the frequency separation relative to the non-squared rectangular window.

WireLaundry Baskets

This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function.

Welch's Method An improved estimator of the PSD is the one proposed by Welch [8]. The method consists of dividing the time series data into (possibly overlapping) segments, computing a modified periodogram of each segment, and then averaging the PSD estimates. The result is Welch's PSD estimate. Welch's method is implemented in the Signal Processing Toolbox by the pwelch function. By default, the data is divided into eight segments with 50% overlap between them. A Hamming window is used to compute the modified periodogram of each segment. The averaging of modified periodograms tends to decrease the variance of the estimate relative to a single periodogram estimate of the entire data record. Although overlap between segments tends to introduce redundant information, this effect is diminished by the use of a nonrectangular window, which reduces the importance or weight given to the end samples of segments (the samples that overlap). However, as mentioned above, the combined use of short data records and nonrectangular windows results in reduced resolution of the estimator. In summary, there is a tradeoff between variance reduction and resolution. One can manipulate the parameters in Welch's method to obtain improved estimates relative to the periodogram, especially when the SNR is low. This is illustrated in the following example. Consider an original signal consisting of 301 samples: randn('state',1) fs = 1000; % Sampling frequency t = (0:0.3*fs)./fs; % 301 samples A = [2 8]; % Sinusoid amplitudes (row vector) f = [150;140]; % Sinusoid frequencies (column vector) xn = A*sin(2*pi*f*t) + 5*randn(size(t)); periodogram(xn,rectwin(length(xn)),1024,fs); We can obtain Welch's spectral estimate for 3 segments with 50% overlap with pwelch(xn,rectwin(150),75,512,fs); In the periodogram above, noise and the leakage make one of the sinusoids essentially indistinguishable from the artificial peaks. In contrast, although the PSD produced by Welch's method has wider peaks, you can still distinguish the two sinusoids, which stand out from the "noise floor." However, if we try to reduce the variance further, the loss of resolution causes one of the sinusoids to be lost altogether: pwelch(xn,hamming(100),75,512,fs); For a more detailed discussion of Welch's method of PSD estimation, see Kay [2] and Welch [8]. Bias and Normalization in Welch's Method Welch's method yields a biased estimator of the PSD. The expected value can be found to be where Ls is the length of the data segments and U is the same normalization constant present in the definition of the modified periodogram. As is the case for all periodograms, Welch's estimator is asymptotically unbiased. For a fixed length data record, the bias of Welch's estimate is larger than that of the periodogram because Ls < L. The variance of Welch's estimator is difficult to compute because it depends on both the window used and the amount of overlap between segments. Basically, the variance is inversely proportional to the number of segments whose modified periodograms are being averaged. Multitaper Method The periodogram can be interpreted as filtering a length L signal, xL[n], through a filter bank (a set of filters in parallel) of L FIR bandpass filters. The 3 dB bandwidth of each of these bandpass filters can be shown to be approximately equal to fs / L. The magnitude response of each one of these bandpass filters resembles that of the rectangular window discussed in Spectral Leakage. The periodogram can thus be viewed as a computation of the power of each filtered signal (i.e., the output of each bandpass filter) that uses just one sample of each filtered signal and assumes that the PSD of xL[n] is constant over the bandwidth of each bandpass filter. As the length of the signal increases, the bandwidth of each bandpass filter decreases, making it a more selective filter, and improving the approximation of constant PSD over the bandwidth of the filter. This provides another interpretation of why the PSD estimate of the periodogram improves as the length of the signal increases. However, there are two factors apparent from this standpoint that compromise the accuracy of the periodogram estimate. First, the rectangular window yields a poor bandpass filter. Second, the computation of the power at the output of each bandpass filter relies on a single sample of the output signal, producing a very crude approximation. Welch's method can be given a similar interpretation in terms of a filter bank. In Welch's implementation, several samples are used to compute the output power, resulting in reduced variance of the estimate. On the other hand, the bandwidth of each bandpass filter is larger than that corresponding to the periodogram method, which results in a loss of resolution. The filter bank model thus provides a new interpretation of the compromise between variance and resolution. Thompson's multitaper method (MTM) builds on these results to provide an improved PSD estimate. Instead of using bandpass filters that are essentially rectangular windows (as in the periodogram method), the MTM method uses a bank of optimal bandpass filters to compute the estimate. These optimal FIR filters are derived from a set of sequences known as discrete prolate spheroidal sequences (DPSSs, also known as Slepian sequences). In addition, the MTM method provides a time-bandwidth parameter with which to balance the variance and resolution. This parameter is given by the time-bandwidth product, NW and it is directly related to the number of tapers used to compute the spectrum. There are always 2*NW-1 tapers used to form the estimate. This means that, as NW increases, there are more estimates of the power spectrum, and the variance of the estimate decreases. However, the bandwidth of each taper is also proportional to NW, so as NW increases, each estimate exhibits more spectral leakage (i.e., wider peaks) and the overall spectral estimate is more biased. For each data set, there is usually a value for NW that allows an optimal trade-off between bias and variance. The Signal Processing Toolbox function that implements the MTM method is called pmtm. Use pmtm to compute the PSD of xn from the previous examples: randn('state',0) fs = 1000; % Sampling frequency t = (0:fs)/fs; % One second worth of samples A = [1 2]; % Sinusoid amplitudes f = [150;140]; % Sinusoid frequencies xn = A*sin(2*pi*f*t) + 0.1*randn(size(t)); [P,F] = pmtm(xn,4,1024,fs); plot(F,10*log10(P)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); By lowering the time-bandwidth product, you can increase the resolution at the expense of larger variance: [P1,f] = pmtm(xn,3/2,1024,fs); plot(f,10*log10(P1)) % Plot in dB/Hz xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); Note that the average power is conserved in both cases: Pow = (fs/1024) * sum(P) Pow = 2.4926 Pow1 = (fs/1024) * sum(P1) Pow1 = 2.4927 This method is more computationally expensive than Welch's method due to the cost of computing the discrete prolate spheroidal sequences. For long data series (10,000 points or more), it is useful to compute the DPSSs once and save them in a MAT-file. The M-files dpsssave, dpssload, dpssdir, and dpssclear are provided to keep a database of saved DPSSs in the MAT-file dpss.mat. Cross-Spectral Density Function The PSD is a special case of the cross spectral density (CSD) function, defined between two signals xn and yn as As is the case for the correlation and covariance sequences, the toolbox estimates the PSD and CSD because signal lengths are finite. To estimate the cross-spectral density of two equal length signals x and y using Welch's method, the csd function forms the periodogram as the product of the FFT of x and the conjugate of the FFT of y. Unlike the real-valued PSD, the CSD is a complex function. csd handles the sectioning and windowing of x and y in the same way as the pwelch function: Sxy = csd(x,y,nfft,fs,window,numoverlap) Confidence Intervals You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0: [Sxy,Sxyc,f] = csd(x,y,nfft,fs,window,0,p) p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval [Sxy-Sxyc(:,1) Sxy+Sxyc(:,2)] covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable. Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

R&b wireproducts

In addition, the MTM method provides a time-bandwidth parameter with which to balance the variance and resolution. This parameter is given by the time-bandwidth product, NW and it is directly related to the number of tapers used to compute the spectrum. There are always 2*NW-1 tapers used to form the estimate. This means that, as NW increases, there are more estimates of the power spectrum, and the variance of the estimate decreases. However, the bandwidth of each taper is also proportional to NW, so as NW increases, each estimate exhibits more spectral leakage (i.e., wider peaks) and the overall spectral estimate is more biased. For each data set, there is usually a value for NW that allows an optimal trade-off between bias and variance.

which indicates that the variance does not tend to zero as the data length L tends to infinity. In statistical terms, the periodogram is not a consistent estimator of the PSD. Nevertheless, the periodogram can be a useful tool for spectral estimation in situations where the SNR is high, and especially if the data record is long.

The periodogram function allows you to compute a modified periodogram by specifying the window to be used on the data. For example, compare a rectangular window and a Hamming window:

Confidence Intervals You can compute confidence intervals using the csd function by including an additional input argument p that specifies the percentage of the confidence interval, and setting the numoverlap argument to 0: [Sxy,Sxyc,f] = csd(x,y,nfft,fs,window,0,p) p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval [Sxy-Sxyc(:,1) Sxy+Sxyc(:,2)] covers the true CSD with probability p. If you set numoverlap to any value other than 0, you generate a warning indicating that the sections overlap and the confidence interval is not reliable. Transfer Function Estimate One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by An estimate of the transfer function between x(n) and y(n) is This method estimates both magnitude and phase information. The tfe function uses Welch's method to compute the CSD and power spectrum, and then forms their quotient for the transfer function estimate. Use tfe the same way that you use the csd function. Filter the signal xn with an FIR filter, then plot the actual magnitude response and the estimated response: h = ones(1,10)/10; % Moving average filter yn = filter(h,1,xn); [HEST,f] = tfe(xn,yn,256,fs,256,128,'none'); H = freqz(h,1,f,fs); subplot(2,1,1); plot(f,abs(H)); title('Actual Transfer Function Magnitude'); subplot(2,1,2); plot(f,abs(HEST)); title('Transfer Function Magnitude Estimate'); xlabel('Frequency (Hz)'); Coherence Function The magnitude-squared coherence between two signals x(n) and y(n) is This quotient is a real number between 0 and 1 that measures the correlation between x(n) and y(n) at the frequency . The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions. The coherence function of xn and the filter output yn versus frequency is cohere(xn,yn,256,fs,256,128,'none') If the input sequence length nfft, window length window, and the number of overlapping data points in a window numoverlap, are such that cohere operates on only a single record, the function returns all ones. This is because the coherence function for linearly dependent data is one.   Nonparametric Methods Parametric Methods

p must be a scalar between 0 and 1. This function assumes chi-squared distributed periodograms of the nonoverlapping sections of windowed data in computing the confidence intervals. This assumption is valid when the signal is a Gaussian distributed random process. Provided these assumptions are correct, the confidence interval

which is independent of the choice of window. The addition of U as a normalization constant ensures that the modified periodogram is asymptotically unbiased.

One application of Welch's method is nonparametric system identification. Assume that H is a linear, time invariant system, and x(n) and y(n) are the input to and output of H, respectively. Then the power spectrum of x(n) is related to the CSD of x(n) and y(n) by

“I am honored and excited to take on this new role as president,” says Grant Rawlins. “What motivates me every day is my responsibility to continuously improve all aspects of our business — from our team and culture to our products, infrastructure and processes. This is all made possible with our team’s dedication and hard work.”

R&b Wire100E

In the periodogram above, noise and the leakage make one of the sinusoids essentially indistinguishable from the artificial peaks. In contrast, although the PSD produced by Welch's method has wider peaks, you can still distinguish the two sinusoids, which stand out from the "noise floor."

It is important to note that the effect of spectral leakage is contingent solely on the length of the data record. It is not a consequence of the fact that the periodogram is computed at a finite number of frequency samples.

You can verify that although the sidelobes are much less evident in the Hamming-windowed periodogram, the two main peaks are wider. In fact, the 3 dB width of the mainlobe corresponding to a Hamming window is approximately twice that of a rectangular window. Hence, for a fixed data length, the PSD resolution attainable with a Hamming window is approximately half that attainable with a rectangular window. The competing interests of mainlobe width and sidelobe height can be resolved to some extent by using variable windows such as the Kaiser window.

This method is more computationally expensive than Welch's method due to the cost of computing the discrete prolate spheroidal sequences. For long data series (10,000 points or more), it is useful to compute the DPSSs once and save them in a MAT-file. The M-files dpsssave, dpssload, dpssdir, and dpssclear are provided to keep a database of saved DPSSs in the MAT-file dpss.mat.

where Ls is the length of the data segments and U is the same normalization constant present in the definition of the modified periodogram. As is the case for all periodograms, Welch's estimator is asymptotically unbiased. For a fixed length data record, the bias of Welch's estimate is larger than that of the periodogram because Ls < L.

The following sections discuss the performance of the periodogram with regard to the issues of leakage, resolution, bias, and variance.

The cohere function takes sequences x and y, computes their power spectra and CSD, and returns the quotient of the magnitude squared of the CSD and the product of the power spectra. Its options and operation are similar to the csd and tfe functions.