# FFT Hanning Data

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.

#### BRSHiFi

I have some data exported from one of my spectrum analyzers placed into a CSV file. It basically contains 2048 samples of an FFT placed upon a 1K sine wave through one of my amplifiers.

I do not have my textbooks in front of me now so my question is how do you compute THD based upon this information using excel?

All I need is an equation for hanning. Also it would be helpful for hamming, blackman, and the other common windowing functions.

Thanks,
kingneb

#### BRSHiFi

The spectrum analyzer performs all the computation except for THD. The wiki does not provide the information (at least that I can recognize) that takes the points from a hanning windowed plot and computes the THD from that. It does however perform all the windowing math on what is coming into the analyzer.

What I am asking is how to compute the THD based upon a hanning computed series of points.

Paid Member

#### BRSHiFi

No that is not the question, the question is, through individual sample points run through the hanning windowing function.

#### jazbo8

Ok, mis-understood your question. As gpapag pointed out in the Wiki - THD is simply the square root of the sum of the squares of the harmonic components divided by the fundamental.

#### BRSHiFi

Yes, I know that.

The magnitude of the harmonics calculation I am aware of. I am talking about computing it based upon each point in sample time.

#### tomchr

Paid Member
The windowing is done to increase spectral resolution. The THD is calculated the same way it always is. It's the power of the harmonic content divided by the power of the fundamental.

Total harmonic distortion - Wikipedia, the free encyclopedia

I'm not aware of any way to get the original samples back once you've performed the windowing. If you don't like the windowing, use a rectangular window.

~Tom

#### BRSHiFi

All I have is a bunch of points from a *.CSV off the spectrum analyzer. I do not see how the magnitude of each harmonic can be easily deduced from that information alone.

Is there a way to determine the THD just from all the points sampled in time?

Last edited:

#### DF96

If I understand you correctly, you have the time samples - already processed by a Hanning window. You have to apply FFT to these to get frequency samples - or just code up a simpler but slower Fourier Transform. Then you determine things like harmonic levels from the FFT output. If you understand the discrete version of Fourier Transform then you can code it into a spreadsheet. If you don't understand it then you need to find someone to do it for you, or a library function in some suitable programming language. It may be (I'm not sure) that Excel or one of its extensions includes an FFT function.

Alternatively, you may already have the FFT output. Not clear from your description.

#### tomchr

Paid Member
What's in the .CSV? Time domain data? Frequency domain data? Garbage? You're not providing many details here...

If you have the time domain samples in your .CSV file, then apply the window function and run the FFT. This is fairly straight forward in MATLAB/Octave/FreeMAT or Mathcad. Good luck doing it in Excel. Not saying it can't be done, but it wouldn't be my first choice.

~Tom

#### tomchr

Paid Member
Fast Fourier transform - Wikipedia, the free encyclopedia

As DF96 points out, you can run a straight Fourier Transform or Discrete Fourier Transform (DFT) as well. They're slower than the FFT (Fast Fourier Transform). The Fourier transform transforms from time domain to frequency domain. From there you can get the the amplitudes of the harmonics and calculate the THD.

~Tom

Paid Member

#### Merlinb

You can indeed do FFT in Excel- it's in the Analysis Tookpak. It's a bit laborious, but not difficult.

For finding THD you may be better off with a flat top window, which has better amplitude resolution than Hanning.

#### jazbo8

Something to try... Assuming the windowing function has been done, then:

1) Find fundamental in the proper bin from your data points (the highest one);
2) Find harmonics in their bins;
3) Calculate THD = sum of the powers of the harmonics divided by the power of the fundamental and the harmonics.

Jaz

#### HpW

I have some data exported from one of my spectrum analyzers placed into a CSV file. It basically contains 2048 samples of an FFT placed upon a 1K sine wave through one of my amplifiers.
kingneb

OK, you have a calculated 2K FFT CSV data file from a 1K sine data stream & Hamming FFT Window applied... the used sample rate is also important while this defines the FFT Bin frequency distance (SR / FFT size).

I do not have my textbooks in front of me now so my question is how do you compute THD based upon this information using excel?
kingneb

Look at the attached picture, to have an glue or use an analyzer who is doing it for you

All I need is an equation for hanning. Also it would be helpful for hamming, blackman, and the other common windowing functions.
kingneb

Only possible if you current analyzer allows to apply your required FFT Window function PRIOR the FFT calculation. May download my SW & use a valuable sound card (Free or Evaluation) and may search within the help file.

Hp

#### Attachments

• FFFT2D01_RBW-1.png
7.9 KB · Views: 55

#### BRSHiFi

OK Guys, thanks for the help, I switched over to a different method.

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.