Hi,

This is really not a "getting started" sort of question, but I could find no other board to use in asking it.

When the PicoScope FFT spectrum analyzer is applied to an input signal, there is the option of selecting a window function to reduce spectral leakage from one bin to another. A general discussion of this problem is provided in this paper, which concentrates on power spectra, but the whole idea of spectral leakage applies to any FFT calculation, including that in which the spectral values are voltages or log voltages (i.e., dBV). I have had extensive discussions on this topic with Gerry in this thread and many of my questions were answered by him.

However, there is one question I failed to ask; specifically, when a windowing function is selected, are the data in the bins of the resulting spectrum adjusted by the effective noise bandwidth associated with that function. This is normally required when the spectrum comprises values associated with white noise. For power spectra, this adjustment comprises dividing the bin values by a constant associated with the windowing function. For example, if Blackman-Harris windowing is selected, the constant is 1.7.

The question is: does the PicoScope 6 software perform this correction, or is it the responsibility of the user to do so. This is important because if the PicoScope 6 software performs the correction, the user should not, because that would give an incorrect result.

This problem is illustrated by attempting to compute the noise floor of the PicoScope. If one puts a 50 ohm terminator on an input and then collects data from that input, the result will represent the noise floor of the instrument. However, it isn't clear whether that is the case, since if the PicoScope 6 software does not correct for spectral leakage due to the windowing function, then the results would have to be divided by the constant associated with it.

I have asked similar questions before and Gerry provided very detailed and informative answers. However, I failed to ask this specific question. I am computing the noise floor of the PicoScope 4262, so I need to know whether the PicoScope 6 software performs the correction or if I need to do so.

## Corrections for Windowing functions in FFT calculations

### Re: Corrections for Windowing functions in FFT calculations

Hi Dan,

Apologies for the delay in responding.

The Windowing functions are necessary to prevent spectral leakage of the signal where the signal contains frequency components that have not been sampled coherently. Incoherent sampling is where, for a specific frequency, the captured data does not result in an integer number cycles, and therefore results in transients being created by the Fourier transform process of repeating the the captured data. The transients in the Time Domain are transformed into wideband Magnitude components in the frequency domain which means that they are leaking across many bins (in fact all bins to some extent). The Windowing functions change the start and end of the data in a window so that when the captured data is repeated there is minimal disjoint, and therefore minimal transients and minimal wideband spectral leakage. Because the windowing functions alter the the actual data, it must be compensated, according to whether the spectrum is an Energy (Power) Spectrum, or Amplitude (Voltage) spectrum (because the correction values are different). PicoScope 6 applies coherent gain to the Window Function so that the Amplitude level is matched before and after the FFT is applied, because we plot an Amplitude (Voltage) spectrum.

If you need any further explanation of windowing then I fully recommend these 2 articles (2 of the best articles for simple explanations of the phenomenon that I have found): https://community.plm.automation.siemen ... a-p/432760, and https://community.plm.automation.siemen ... a-p/431775

The answer to your question regarding the noise floor is that you need to be very careful about measuring noise in a Spectrum plot created from a DFT or FFT. First of all when analysing noise in a Spectrum plot, most people are interested in noise power Spectrums as these tend to be how noise is analyzed, and the calculations of standardized measurements are straightforward to perform (as, for instance RMS is based on the squares of the magnitudes, which is what you get in a power spectrum, for which the appropriate windowing function correction will have been applied, i.e. for energy/power). Also, as I've mentioned in previous posts, you need to take into account Process Gain which reduces the noise floor as a proportional logarithm of the number of bins used for the plot. So, As PicoScope 6 computes the Voltage and applies the windowing correction for that, you would need to undo the windowing correction for voltage, square the component for power, and then apply the correction for power, if you want the power spectrum equivalent of each plotted value.

Regards,

Gerry

Apologies for the delay in responding.

The Windowing functions are necessary to prevent spectral leakage of the signal where the signal contains frequency components that have not been sampled coherently. Incoherent sampling is where, for a specific frequency, the captured data does not result in an integer number cycles, and therefore results in transients being created by the Fourier transform process of repeating the the captured data. The transients in the Time Domain are transformed into wideband Magnitude components in the frequency domain which means that they are leaking across many bins (in fact all bins to some extent). The Windowing functions change the start and end of the data in a window so that when the captured data is repeated there is minimal disjoint, and therefore minimal transients and minimal wideband spectral leakage. Because the windowing functions alter the the actual data, it must be compensated, according to whether the spectrum is an Energy (Power) Spectrum, or Amplitude (Voltage) spectrum (because the correction values are different). PicoScope 6 applies coherent gain to the Window Function so that the Amplitude level is matched before and after the FFT is applied, because we plot an Amplitude (Voltage) spectrum.

If you need any further explanation of windowing then I fully recommend these 2 articles (2 of the best articles for simple explanations of the phenomenon that I have found): https://community.plm.automation.siemen ... a-p/432760, and https://community.plm.automation.siemen ... a-p/431775

The answer to your question regarding the noise floor is that you need to be very careful about measuring noise in a Spectrum plot created from a DFT or FFT. First of all when analysing noise in a Spectrum plot, most people are interested in noise power Spectrums as these tend to be how noise is analyzed, and the calculations of standardized measurements are straightforward to perform (as, for instance RMS is based on the squares of the magnitudes, which is what you get in a power spectrum, for which the appropriate windowing function correction will have been applied, i.e. for energy/power). Also, as I've mentioned in previous posts, you need to take into account Process Gain which reduces the noise floor as a proportional logarithm of the number of bins used for the plot. So, As PicoScope 6 computes the Voltage and applies the windowing correction for that, you would need to undo the windowing correction for voltage, square the component for power, and then apply the correction for power, if you want the power spectrum equivalent of each plotted value.

Regards,

Gerry

Gerry

Technical Specialist

Technical Specialist

### Re: Corrections for Windowing functions in FFT calculations

Hi Gerry,

Previously, I decided to ignore the corrections for ENBW associated with a particular window function, since they were small. Consequently, while I read and understood your response to my original question, I did not pursue it further. I have changed my mind and now wish to ensure these corrections are applied.

When I read your last post on this topic, you indicated that the PicoScope 6 software applies the window corrections to the amplitude data in order to compensate for spectral leakage. Just be clear, I am displaying the spectrum in dBV units and capturing that data to a csv file (I have moved to a Windows based version of PicoScope 6, since the Linux version doesn't seem to correctly capture csv data, as we are discussing in this topic). However, you say in order to properly compute power spectrum data, I need to back out the voltage corrections, square the voltages and then apply the window corrections associated with power spectra.

In order to do that, I need to know the correction factor (for Blackman-Harris) PicoScope 6 applied to the voltage data. I also need to know what variation of Blackman-Harris you are using (e.g., 3-term, 4-term, etc.), so I can apply the correct power correction factor.

In addition, there is another issue concerning the PicoScope 6 software that I need to understand. According to this this paper (see section entitled "Computing Power Level and Spectral Noise Density"), the correction that should be applied is division by the the Noise Power Bandwidth of the window

Regards,

Dan

Previously, I decided to ignore the corrections for ENBW associated with a particular window function, since they were small. Consequently, while I read and understood your response to my original question, I did not pursue it further. I have changed my mind and now wish to ensure these corrections are applied.

When I read your last post on this topic, you indicated that the PicoScope 6 software applies the window corrections to the amplitude data in order to compensate for spectral leakage. Just be clear, I am displaying the spectrum in dBV units and capturing that data to a csv file (I have moved to a Windows based version of PicoScope 6, since the Linux version doesn't seem to correctly capture csv data, as we are discussing in this topic). However, you say in order to properly compute power spectrum data, I need to back out the voltage corrections, square the voltages and then apply the window corrections associated with power spectra.

In order to do that, I need to know the correction factor (for Blackman-Harris) PicoScope 6 applied to the voltage data. I also need to know what variation of Blackman-Harris you are using (e.g., 3-term, 4-term, etc.), so I can apply the correct power correction factor.

In addition, there is another issue concerning the PicoScope 6 software that I need to understand. According to this this paper (see section entitled "Computing Power Level and Spectral Noise Density"), the correction that should be applied is division by the the Noise Power Bandwidth of the window

**times**the bin width. So, if the bin width is, say 19 mHz, the denominator correcting the power value would be .019*1.7 (assuming a 3-term Blackman-Harris window). You did not mention whether the PicoScope 6 software uses the bin width in the correction computation. I need to know this, since if the bin width is used, I need to back out the correction by multiplying by the Noise Power Bandwidth of the window**times**the bin width of the window.Regards,

Dan

### Re: Corrections for Windowing functions in FFT calculations

Hi Dan,

To answer your question, the correction factor is correcting the amount that a windowed data element represents so, for example, for a Hanning window you would need to multiply the data element by 2 in order to convert the amplitude peak represented in a power spectrum to what it should be in an amplitude spectrum. So, as you apply a windowing function to a bin, by definition, the correction is applied according to the number of bins that there are, which is obviously inversely proportional to the bin width. So, the bin width

Regards,

Gerry

To answer your question, the correction factor is correcting the amount that a windowed data element represents so, for example, for a Hanning window you would need to multiply the data element by 2 in order to convert the amplitude peak represented in a power spectrum to what it should be in an amplitude spectrum. So, as you apply a windowing function to a bin, by definition, the correction is applied according to the number of bins that there are, which is obviously inversely proportional to the bin width. So, the bin width

**must be**(indirectly) taken into consideration in computing a correction (for plotting or conversion) and, as mentioned previously, we apply the amplitude correction to the bins as we ensure that the level is matched before and after computation of the plotted values.Regards,

Gerry

Gerry

Technical Specialist

Technical Specialist

### Re: Corrections for Windowing functions in FFT calculations

Hi Gerry,

Thanks for the response. Just to make sure I understand correctly, the adjustment PicoScope 6 makes to the data is to divide by the factor associated with the window,

However, I still lack the necessary information to convert the amplitude based measurement (with window correction) to a power based measurement. In particular, I am using Blackman-Harris windowing. The links you gave in a previous message (from siemans) do not specify an amplitude correction factor for Blackman-Harris, so I don't know what value to use as a multiplier to back out the correction PicoScope 6 has applied. Also, there are variations of Blackman-Harris (see table 1 in this paper by Harris). It identifies two variants: 1) minimum 3-sample Blackman-Harris, and 2) minimum 4-sample Blackman-Harris. These variants have different power correction factors. I need to know which of these (or perhaps another) variant PicoScope 6 is using in order to apply the appropriate correction.

Regards,

Dan

Thanks for the response. Just to make sure I understand correctly, the adjustment PicoScope 6 makes to the data is to divide by the factor associated with the window,

**not**by this factor times the bin width. So, to back it out, I multiply by that factor. Correct?However, I still lack the necessary information to convert the amplitude based measurement (with window correction) to a power based measurement. In particular, I am using Blackman-Harris windowing. The links you gave in a previous message (from siemans) do not specify an amplitude correction factor for Blackman-Harris, so I don't know what value to use as a multiplier to back out the correction PicoScope 6 has applied. Also, there are variations of Blackman-Harris (see table 1 in this paper by Harris). It identifies two variants: 1) minimum 3-sample Blackman-Harris, and 2) minimum 4-sample Blackman-Harris. These variants have different power correction factors. I need to know which of these (or perhaps another) variant PicoScope 6 is using in order to apply the appropriate correction.

Regards,

Dan

### Re: Corrections for Windowing functions in FFT calculations

Hi Dan,

We actually use a library function that takes configuration data, one element of which is the number of bins and another element being the sample rate, so as the bandwidth is up to the nyquist frequency the library can calculate the bin width as bandwidth/number of bins. In my last reply I was telling you what information we make use of (to show you that we

We use the most popular form of Blackman-Harris which is the min 4-term variant.

Regards,

Gerry

We actually use a library function that takes configuration data, one element of which is the number of bins and another element being the sample rate, so as the bandwidth is up to the nyquist frequency the library can calculate the bin width as bandwidth/number of bins. In my last reply I was telling you what information we make use of (to show you that we

**do**take the bin width into account), the calculation will still be "times the bin width", or "times the bandwidth divided by the number of bins".We use the most popular form of Blackman-Harris which is the min 4-term variant.

Regards,

Gerry

Gerry

Technical Specialist

Technical Specialist

### Re: Corrections for Windowing functions in FFT calculations

Thanks Gerry,

I am now missing only one thing I need to convert windowed data with amplitude correction to windowed data with power correction. The amplitude correction factor for 4-term Blackman-Harris. As this is probably hidden in the library function PicoScope 6 calls, I figured you might not be able to tell me what this factor is. So, I began a long search for this value with no luck.

Fortunately, during my search I ran across a [url=http://blog.prosig.com/2009/09/01/amplitude-and-energy-correction-a-brief-summary/]short blog note[/url] that solves the problem. At the end of this note is a discussion how to convert amplitude corrected spectra to power corrected spectra. If you look at the equation in the section "Converting Amplitude to Energy Correction Scaling" and assume you are summing over a single bin, then the RMS voltage value equals amplitude_RMS divided by the square root of the ENBW, where ENBW = window effective bandwidth * bin width. So, there is no reason to back out the amplitude correction. Just divide the amplitude corrected bin value by this conversion factor and the result is the uncorrected voltage value.

So, for 4-term Blackman-Harris (effective bandwidth= 2, see Table 1 in [url=http://www.cs.cmu.edu/afs/cs/user/bhiksha/WWW/courses/dsp/spring2013/WWW/schedule/readings/windows_comparison2_harris.pdf]this paper by Harris[/url]), take the result returned in the CSV file by PicoScope 6 operating in amplitude mode, divide by the square-root of (2*bin_width)) and square the result. Or more simply, square the result and then divide by 2*bin_width.

Added after submitting post: I don't know why the forum software is not properly formatting the URLs. The second one is a copy/paste of the source I used in a previous message that worked correctly.

Added 5-25-2019: I reread the blog post this morning and I believe the analysis above is wrong. Using the character "_" to represent subscripting, Total power = sum-over-all-bins(Power_i/ENBW). If the sum is over exactly one bin, then the correct Power value will be: Power_i/ENBW, where "i" identifies the bin. The values returned by amplitude correction are RMS_amplitude/sqrt(ENBW), again this is apparent by using the formula in the last section and summing over one bin. So, if these values are squared, the result is: RMS_amplitude^2/ENBW, which is Power_i/ENBW. If this analysis is correct, I need do no further ENBW correction to the amplitude corrected values in order to obtain the equivalent power value.

However, there is another issue that isn't so easy to analyze. The amplitude values returned by PicoScope 6 are averages. In other words, for n samples, a_i, the value returned would be: (a_1+a_2+...+a_n)/(n*sqrt(ENBW)) The power values returned by PicoScope 6 are also averages. For n samples, p_1, the value returned would be: (p_1+p_2+...+p_n)/(n*ENBW). But, p_i = a_1^2, so the power value is: (a_1^+a_2^+...+a_n^)/(n*ENBW). So, just squaring the summed amplitude values doesn't give the correct power value. The ENBW correction is fine, but the square of the amplitude sum is not the sum of the amplitude squares. I am not sure how to get around this.

I am now missing only one thing I need to convert windowed data with amplitude correction to windowed data with power correction. The amplitude correction factor for 4-term Blackman-Harris. As this is probably hidden in the library function PicoScope 6 calls, I figured you might not be able to tell me what this factor is. So, I began a long search for this value with no luck.

Fortunately, during my search I ran across a [url=http://blog.prosig.com/2009/09/01/amplitude-and-energy-correction-a-brief-summary/]short blog note[/url] that solves the problem. At the end of this note is a discussion how to convert amplitude corrected spectra to power corrected spectra. If you look at the equation in the section "Converting Amplitude to Energy Correction Scaling" and assume you are summing over a single bin, then the RMS voltage value equals amplitude_RMS divided by the square root of the ENBW, where ENBW = window effective bandwidth * bin width. So, there is no reason to back out the amplitude correction. Just divide the amplitude corrected bin value by this conversion factor and the result is the uncorrected voltage value.

So, for 4-term Blackman-Harris (effective bandwidth= 2, see Table 1 in [url=http://www.cs.cmu.edu/afs/cs/user/bhiksha/WWW/courses/dsp/spring2013/WWW/schedule/readings/windows_comparison2_harris.pdf]this paper by Harris[/url]), take the result returned in the CSV file by PicoScope 6 operating in amplitude mode, divide by the square-root of (2*bin_width)) and square the result. Or more simply, square the result and then divide by 2*bin_width.

Added after submitting post: I don't know why the forum software is not properly formatting the URLs. The second one is a copy/paste of the source I used in a previous message that worked correctly.

Added 5-25-2019: I reread the blog post this morning and I believe the analysis above is wrong. Using the character "_" to represent subscripting, Total power = sum-over-all-bins(Power_i/ENBW). If the sum is over exactly one bin, then the correct Power value will be: Power_i/ENBW, where "i" identifies the bin. The values returned by amplitude correction are RMS_amplitude/sqrt(ENBW), again this is apparent by using the formula in the last section and summing over one bin. So, if these values are squared, the result is: RMS_amplitude^2/ENBW, which is Power_i/ENBW. If this analysis is correct, I need do no further ENBW correction to the amplitude corrected values in order to obtain the equivalent power value.

However, there is another issue that isn't so easy to analyze. The amplitude values returned by PicoScope 6 are averages. In other words, for n samples, a_i, the value returned would be: (a_1+a_2+...+a_n)/(n*sqrt(ENBW)) The power values returned by PicoScope 6 are also averages. For n samples, p_1, the value returned would be: (p_1+p_2+...+p_n)/(n*ENBW). But, p_i = a_1^2, so the power value is: (a_1^+a_2^+...+a_n^)/(n*ENBW). So, just squaring the summed amplitude values doesn't give the correct power value. The ENBW correction is fine, but the square of the amplitude sum is not the sum of the amplitude squares. I am not sure how to get around this.