Author Topic: Reconstructing a waveform from its harmonics.  (Read 19497 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17729
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Reconstructing a waveform from its harmonics.
« on: March 08, 2018, 08:03:57 pm »
I am set a question by my assignment that gives me a spreadsheet showing values of a signal at a time. Processed through Excel and the Fourier analysis tool this gives me the magnitudes of various frequency components. I am then asked to recompose the original waveform from these components. Presumably these all start at the same point in time? As all the information I have is the harmonic frequency and it's magnitude. So if a waveform were to start earlier or later rather than all of the cycle start together then it would not work out would it?
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5839
  • Country: de
Re: Reconstructing a waveform from its harmonics.
« Reply #1 on: March 08, 2018, 09:00:03 pm »
If you don't have information of the phase of the signals, you'll not be able to reconstruct the waveform.
I don't know what your "Excel and Fourier analysis tool" is, but it should give you frequency and magnitude as well as phase information. Otherwise you're lost...
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Reconstructing a waveform from its harmonics.
« Reply #2 on: March 08, 2018, 09:50:02 pm »
On a side note, for audio signals phase does not matter, it all sounds the same.

But keep in mind that it is better to add audio signals in a way that minimises peak amplitude to avoid clipping.
Alex
 
The following users thanked this post: mikerj

Online Benta

  • Super Contributor
  • ***
  • Posts: 5839
  • Country: de
Re: Reconstructing a waveform from its harmonics.
« Reply #3 on: March 08, 2018, 10:08:33 pm »
On a side note

That's what I call spreading noise in a thread...

Totally irrelevant :(
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Reconstructing a waveform from its harmonics.
« Reply #4 on: March 08, 2018, 10:12:39 pm »
Totally irrelevant :(
Why do you think it is irrelevant? It is very relevant if we are talking about audio applications. Original questions does not mention the topic of the assignment.
Alex
 
The following users thanked this post: mikerj

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #5 on: March 08, 2018, 10:37:39 pm »
If you don't have information of the phase of the signals, you'll not be able to reconstruct the waveform.
I don't know what your "Excel and Fourier analysis tool" is, but it should give you frequency and magnitude as well as phase information. Otherwise you're lost...
If you have done Fourier over time sample sets, when doing the reverse with the same step size, you will get the same output in theory, such is used in audio compression.  However, I don't think this is what Simon is asking about.  I believe he has a fixed single set of samples, with a single Fourier analysis of that 1 complete chunk.  Yes, the reverse can be closely approximated, depending on the sample size and depth of the Fourier analysis, though, there will be loss.

Now, onto Simon's gut of the question.  The most accurate point in the Fourier should be the center of your sample set.  IE, if you do an analysis of 1000 samples.  When reversing the Fourier, the center at sample 500 should be the most accurate, where as you go further before and after sample 500, the error in reproduction will grow.  This is assuming you are using a true Fourier conversion of the entire sample set from beginning to end.  This will not be true for some sequential Fourier conversion algorithms designed/used in sound or streamed sampled signals.

To answer Simon's question, does Excel's Fourier analysis tool equally weigh all the samples in his sample set.  If yes, then, using an equivalent reverse tool, the reconstructed samples will be 'in-phase' or, most accurate from the center sample, progressively loosing refinement as you spread out to the left and right of center.  Now, if your sample set is, say, only 200 samples or less, with integer values from -100 to +100, every value may be perfectly reconstructed with a well enough defined Fourier analysis and reconstruction.  Doing this with 10000 samples, with random integers from -10000 to +10000, you will not be able to get the true data back unless you have an absurd size of points & definition in your Fourier, but it is doubtful.  But you will get an approximation.

Such tools are used to predict future trends in many applications, such as the stock market, and those new bloody HFT (search 'high frequency trading') machines equipped with tons of NVIDIA commercial graphics cards doing nothing but FFT an top of FFT again and again with real-time stock data to gain an edge on the stock market.  It should be illegal.
 
« Last Edit: March 08, 2018, 10:48:18 pm by BrianHG »
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5839
  • Country: de
Re: Reconstructing a waveform from its harmonics.
« Reply #6 on: March 08, 2018, 10:44:51 pm »
It is very relevant if we are talking about audio applications.

We're not. Where on earth did you find a reference to audio in the original question?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Reconstructing a waveform from its harmonics.
« Reply #7 on: March 08, 2018, 10:47:52 pm »
Where on earth did you find a reference to audio in the original question?
Where did you find the reference to something else? The question is not clear. Since it is an assignment, it should have all the information required to complete it. Audio DSP applications often ignore the phase, assuming it is 0, so I just provided another option.
Alex
 
The following users thanked this post: mikerj

Online Benta

  • Super Contributor
  • ***
  • Posts: 5839
  • Country: de
Re: Reconstructing a waveform from its harmonics.
« Reply #8 on: March 08, 2018, 10:49:18 pm »
 :palm:  When you only have a hammer, everything looks like a nail...
« Last Edit: March 08, 2018, 10:52:03 pm by Benta »
 
The following users thanked this post: Chris-IP5

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Reconstructing a waveform from its harmonics.
« Reply #9 on: March 08, 2018, 10:53:10 pm »
But keep in mind that it is better to add audio signals in a way that minimises peak amplitude to avoid clipping.
It would be a good idea to use floating point rather then integer when adding the harmonics to avoid any clipping.

Reconstructing the waveforms is a simple numerical addition of each harmonic waveform for each point in time - providing you have the phase and amplitude data for the harmonics. For simple periodic waveforms, the phase and amplitude of harmonics can be constant.

I haven't used the Excel Fourier analysis tool, but doesn't it give the results as a complex number when the phase is not zero?

Say you get the third harmonic as 0.5 +i0.22.

That means to reconstruct the third harmonic waveform, you use 0.5cos(3omegaf) + 0.22sin(3omegaf). (My attempt at an omega character failed - just replace omega with 2 x pi).

Or you can use the Inverse Fourier transform tool to rebuild the waveform.

« Last Edit: March 08, 2018, 11:02:30 pm by amspire »
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #10 on: March 08, 2018, 10:57:38 pm »
Presumably these all start at the same point in time? As all the information I have is the harmonic frequency and it's magnitude. So if a waveform were to start earlier or later rather than all of the cycle start together then it would not work out would it?

Excel's Fourier is giving you a bunch of cosine waves (ie, the frequency of each sine wave (the cycle period of your data)) and amplitudes (the strength of the sine wave).  It's giving you a single snapshot of your data.  So, if your data has 100 points.  Start at point 50, and sum all your cosines, in both directions, 50 to 100 and 50 to 0, with point 50 being cosine(0) of frequency band.

(I hope it's cosine, and not sine.  but, if you give it a try for a small 20 samples of data, working from 10 to 20 and 10 to 0, you should find out pretty quick by looking at the results.)
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Reconstructing a waveform from its harmonics.
« Reply #11 on: March 09, 2018, 12:01:22 am »
In my previous post, I thought that Excel gave the Fourier Transform results as complex numbers. Looking at a Youtube video, it does. I don't have Excel installed myself.

So you do have amplitude and phase. Just sum the waveforms as I described previously.

Just make sure that when you do the Fourier transform, you select a sampling period that is an exact multiple of the waveform. In other words, go from, say, rising zero crossing to at the start of the FFT sample period to the sample before the rising zero crossing at the end of the FFT samples. The sampling period can be one waveform period or multiple periods. Use as much of the data as possible, but if you do a FFT of 2.35 waveform periods, you will get a poor result.
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #12 on: March 09, 2018, 12:34:43 am »
The discrete Fourier transform of a real series is a complex series.  This complex series may be described as the sum of a sine and cosine via Euler's relation.

There are two ways to do this:

Take the inverse discrete transform via the FFT (the fast way)

Convert the complex value at each frequency in the transform to a sine and cosine wave at each frequency and add them up (the slow way)

I'd be *very* wary of Excel.  A friend of mine published enough papers on Excel numerical errors to get tenure.  Use Octave or MATLAB for things like this.

The point of the exercise is to understand that the Fourier transform and its inverse are both integrals in the continuous case and sums in the discrete case.  The forward and inverse transforms differ by a scaling factor (i prefer sqrt(N) which is symmetric) and the sign of the exponent of the exponential.  Both signs are used for the forward and inverse transforms by different groups of people.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17729
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Reconstructing a waveform from its harmonics.
« Reply #13 on: March 09, 2018, 08:25:08 am »
Attached are the questions and the spreadsheet they provide, so I have run the excel analysis tool as requested, the harmonic distortion I make to be something like 89%. I don't know if the fact that results are given in complex numbers effectively give me more information about phase angles. it looks like as usual the questions open more cans of worms than I was taught to close by the module so I'm back on the road again.
« Last Edit: March 09, 2018, 08:27:32 am by Simon »
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Reconstructing a waveform from its harmonics.
« Reply #14 on: March 09, 2018, 09:17:14 am »
Attached are the questions and the spreadsheet they provide, so I have run the excel analysis tool as requested, the harmonic distortion I make to be something like 89%. I don't know if the fact that results are given in complex numbers effectively give me more information about phase angles. it looks like as usual the questions open more cans of worms than I was taught to close by the module so I'm back on the road again.
The first harmonic is w0  = 2 x pi x 17.57... rad/sec    (J3)

The equation for harmonic "n" is

Vn (t) = (Real part of Components/1024)cos( n x w0 x t) + (Imaginary part of Components/1024)cos( n x w0 x t)

Do it for each harmonic and add them together for each value of t. Looks like you have to divide the components by 1024 first.

The other way is to run the Inverse Fourier Transform (IFT probably).
« Last Edit: March 09, 2018, 10:40:38 am by amspire »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17729
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Reconstructing a waveform from its harmonics.
« Reply #15 on: March 09, 2018, 01:28:10 pm »

The point of the exercise is to understand that the Fourier transform and its inverse are both integrals in the continuous case and sums in the discrete case.  The forward and inverse transforms differ by a scaling factor (i prefer sqrt(N) which is symmetric) and the sign of the exponent of the exponential.  Both signs are used for the forward and inverse transforms by different groups of people.

The point of the exercise is for them to pretend they gave me something hard and for me to pretend I know how to do it. The result as they have been so lackadaisical that they have actually given me quite a complex waveform. The harmonics are not strictly speaking harmonics as they are not multiples of the fundamental. Presumably the fundamentalist the first peak at 52 Hz. What appear to be the second and third harmonic are not multiples of 52 Hz. In actual fact when I have tried to recreate the waveform in a graphical calculator after about five cycles the wave form starts to change. So this is not a repetitive cycle it varies over time which just makes things more complicated. They have taken real-life data which is random and are trying to abstract it into a waveform that perfectly repeats every cycle the result is that as always with this stupid university this is a big mess.
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Reconstructing a waveform from its harmonics.
« Reply #16 on: March 09, 2018, 02:40:07 pm »
I think they want to see the problems of reconstructing an abitrary waveform. The inverse fourier transform will generate a repetative waveform that is close to the original. It cannot be perfect since the samples start and end at different voltages, but with the number of harmonics, you should get a decent waveform.

The fact that the result is not perfect means you cannot just cheat and just repeat the original samples. They can check you did the exercise.

If you do the whole thing by adding the harmonics together, you will end up with DC (the zero frequency) plus 1023 different sinewaves with different phases. You have to evaluate every sinewave at each of 1024 points and add the 1023 results together. Luckily, in the question, they are not that cruel - they say to just use the principal harmonics. 17.578...Hz is the fundamental harmonic, and I would probably do all the harmonics to the 18th, as the low harmonics will give the fundamental shape. If you only do the 5 biggest harmonics, you will get a crude result. The higher harmonics will flatten lines, remove ringing and sharpen edges.

Or as I said, you can use the built in Inverse Fourier transform function to get the same result.

My problem with the spreadsheet is for the initial samples, it does not mention any time units, but it has to be the period of the first harmonic. So when you are calculating the inverse transform, you will do it for t0=0 to t1023=1/17.587... seconds. That must have been the timespan of the of the original 1024 samples.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17729
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Reconstructing a waveform from its harmonics.
« Reply #17 on: March 09, 2018, 02:46:44 pm »
So I'm a little confused as to why 17.5 Hz is the fundamental. I thought that the Fourier analysis showed you the strength of any particular frequency in a waveform. And in this case the first strongest waveform is at 52.73 Hz is there anything in particular I'm missing in this whole mess? Isn't the first significant frequency the fundamental? Why would fundamental be at 17.5 Hz? From what I can tell it just happens to be related to the amount of samples they have taken? I'm rereading their explanation of how to use Excel tool maybe they have hidden some clue there as to how I am supposed to solve this particular problem

What I could really do with is a shed load of time to study the subject properly instead I've been given a crash course and then this assignment so I can just move on and get my silly piece of paper. The fact that a silly piece of paper doesn't actually mean anything is of no interest to anybody I just need a silly piece of paper. The result is that I going round in circles trying to understand the subject properly rather than just pass the test.

 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #18 on: March 09, 2018, 03:04:11 pm »
. I don't know if the fact that results are given in complex numbers effectively give me more information about phase angles. it looks like as usual the questions open more cans of worms than I was taught to close by the module so I'm back on the road again.

You seem to expect them to ask a question and tell you the answer.  This is all *very* basic stuff.

Perhaps you should review the definition of the discrete and continuous Fourier transforms.

The discrete transform is defined on the semiclosed interval [-Pi:Pi} and periodic outside that interval.  It repeats on [Pi:2*Pi), etc.  There is no requirement that the signal be periodic inside [-Pi:Pi).

The subtlety of the semiclosed interval and its consequences are often neglected, but I shall leave that to the reader. along with the proper treatment of the amplitudes of the first and last  sample and the effects of series length and window choice. 

As remarked before, the appropriate tool is Octave, MATLAB or similar.  I am a little disturbed that you were encouraged to use Excel for such work.
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Reconstructing a waveform from its harmonics.
« Reply #19 on: March 09, 2018, 03:13:25 pm »
So I'm a little confused as to why 17.5 Hz is the fundamental. I thought that the Fourier analysis showed you the strength of any particular frequency in a waveform. And in this case the first strongest waveform is at 52.73 Hz is there anything in particular I'm missing in this whole mess?
There is no law that says the first fundamental has to be the biggest. If you look at every frequency, they exactly equal 17.5... x2, x3, x4, x5 up to x1022. That is why 17.5... is the fundamental and every other frequency is a harmonic.

The other thing if the inverse transform will try and make a repetitive waveform looking like the original samples but repeated. What frequency will this waveform have? It has to be 17.5... Hz. There is no lower frequency. It definitely cannot be higher  - the 17.5... component would then prevent the second waveform repetition from beeing the same as the first. That means the original 1024 samples must have been taken during one 17.5... Hz period.
Quote
Isn't the first significant frequency the fundamental? Why would fundamental be at 17.5 Hz? From what I can tell it just happens to be related to the amount of samples they have taken? I'm rereading their explanation of how to use Excel tool maybe they have hidden some clue there as to how I am supposed to solve this particular problem

What I could really do with is a shed load of time to study the subject properly instead I've been given a crash course and then this assignment so I can just move on and get my silly piece of paper. The fact that a silly piece of paper doesn't actually mean anything is of no interest to anybody I just need a silly piece of paper. The result is that I going round in circles trying to understand the subject properly rather than just pass the test.
It looks like Excel may not have an Inverse Fourier Transform, but you can look on Youtube tutes for clues. I do not use Excel. You may have to load the Data Analysys pack into Excel, and there may be both FFT and DFT. I do not know.

You can also use the sum of the cos + sin equations I mentioned not long ago, but that will need a bit if Excel skill. You have to do formulas with a variable in excel and loop it over 1024 values of t.

If you don't want to do any of it, that is fine with me. It is actually worth learning.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17729
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Reconstructing a waveform from its harmonics.
« Reply #20 on: March 09, 2018, 05:18:58 pm »
. I don't know if the fact that results are given in complex numbers effectively give me more information about phase angles. it looks like as usual the questions open more cans of worms than I was taught to close by the module so I'm back on the road again.

You seem to expect them to ask a question and tell you the answer.  This is all *very* basic stuff.

Perhaps you should review the definition of the discrete and continuous Fourier transforms.

The discrete transform is defined on the semiclosed interval [-Pi:Pi} and periodic outside that interval.  It repeats on [Pi:2*Pi), etc.  There is no requirement that the signal be periodic inside [-Pi:Pi).

The subtlety of the semiclosed interval and its consequences are often neglected, but I shall leave that to the reader. along with the proper treatment of the amplitudes of the first and last  sample and the effects of series length and window choice. 

As remarked before, the appropriate tool is Octave, MATLAB or similar.  I am a little disturbed that you were encouraged to use Excel for such work.

I don't expect answers I'm just trying to understand. Perhaps you should take a UK qualifications course in you would find out what a mess we are in here. I have gone round and round in circles with my material which has done nothing but add to the confusion and send me off in various directions looking for other material. This is a homestudy course that I do around a full-time job it has become the thing that absorbs all of my free time and I am still getting nowhere. Yes the choice of Excel might be unusual, welcome to UK education. The course material is quite old and I'm sure lots of other useful programs may not have even been available when it was first written.

I have just bought another entire book I could read on the subject but then in actual fact I need to get on with this crap before I'm kicked off the course for taking too long. But every time I try and solve one problem suddenly I discover there's a whole world out there that needs studying and that the course material thus far has not prepared me for it. I'm quite willing to learn but I only have so much time and it seems that every time I come to these assignments I spend more time trying to figure out what the heck they are on about then I spent studying the material in the first place that is supposed to teach me how to do the assignment. I don't have Matlab I don't understand these programs they are again another thing I would have to learn and I don't necessarily have the time right now. I've been looking at this for the last few evenings it is now going to absorb my entire weekend, for what?
« Last Edit: March 09, 2018, 05:23:20 pm by Simon »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17729
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Reconstructing a waveform from its harmonics.
« Reply #21 on: March 09, 2018, 05:26:46 pm »
So I'm a little confused as to why 17.5 Hz is the fundamental. I thought that the Fourier analysis showed you the strength of any particular frequency in a waveform. And in this case the first strongest waveform is at 52.73 Hz is there anything in particular I'm missing in this whole mess?
There is no law that says the first fundamental has to be the biggest. If you look at every frequency, they exactly equal 17.5... x2, x3, x4, x5 up to x1022. That is why 17.5... is the fundamental and every other frequency is a harmonic.

The other thing if the inverse transform will try and make a repetitive waveform looking like the original samples but repeated. What frequency will this waveform have? It has to be 17.5... Hz. There is no lower frequency. It definitely cannot be higher  - the 17.5... component would then prevent the second waveform repetition from beeing the same as the first. That means the original 1024 samples must have been taken during one 17.5... Hz period.
Quote
Isn't the first significant frequency the fundamental? Why would fundamental be at 17.5 Hz? From what I can tell it just happens to be related to the amount of samples they have taken? I'm rereading their explanation of how to use Excel tool maybe they have hidden some clue there as to how I am supposed to solve this particular problem

What I could really do with is a shed load of time to study the subject properly instead I've been given a crash course and then this assignment so I can just move on and get my silly piece of paper. The fact that a silly piece of paper doesn't actually mean anything is of no interest to anybody I just need a silly piece of paper. The result is that I going round in circles trying to understand the subject properly rather than just pass the test.
It looks like Excel may not have an Inverse Fourier Transform, but you can look on Youtube tutes for clues. I do not use Excel. You may have to load the Data Analysys pack into Excel, and there may be both FFT and DFT. I do not know.

You can also use the sum of the cos + sin equations I mentioned not long ago, but that will need a bit if Excel skill. You have to do formulas with a variable in excel and loop it over 1024 values of t.

If you don't want to do any of it, that is fine with me. It is actually worth learning.

I think Excel does do the reverse transform however as per the question I am supposed to graphically add up the harmonics. I'm still trying to establish what the fundamental is,  the great big spike at 52 Hz or four some mysterious reason 17.5 Hz just because that is the step in the analysis. I was given the whole spreadsheet mostly filled out so once again I'm told half the story and supposed to figure it out. I have already shown this to an experienced subcontractor we use at work who is also a member of this forum and he was completely baffled as to what the hell they are on about. Half the problem with these questions is that they are half cocked and not properly asked. I have to interpret them and try work out what they actually want.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #22 on: March 09, 2018, 06:12:05 pm »
Column J gives you the DC component (J-2), the first harmonic frequency (J-3) and all subsequent harmonic frequencies up to 1023.  There is no question about the fundamental frequency, it is given.

Column H gives you the magnitude of each harmonic from DC to 1023.  It is the square root of the sum of the squares of the Fourier values in column D divided by 1024.  This is the magnitude of the harmonic component.  It does not include phase.  You should be able to get the phase from column D by taking the arctan(imaginary/real).  I'm a little shaky on that...  If you don't need phase (as discussed above), column H has what you need for magnitude and column J has the frequency.

If you scan down column H, you can see the heavy hitter harmonics.

Your final function will have a DC offset because the magnitude at f=0 is not zero.

It should be pretty straightforward to get the magnitude and phase along with the frequency right out of the spreadsheet columns.

I think...
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #23 on: March 09, 2018, 06:42:48 pm »
OK I understand what they want and why they used Excel.

Evaluate each frequency in the transform at each time.  Graph it in time, add it to the graph of the previous frequencies.  You'll have to convert the exponentials to a cosine or sine and phase term.

A quick summary:

There are as many frequencies in the FFT as there are samples.  Half of the frequencies (-1 for even lengths) are negative.  The negative frequencies are the complex conjugate of the positive frequencies. The first value is DC.   The middle of an even length series is Nyquist.  For an odd length series the Nyquist is repeated.  It is common to compute and store the positive frequencies of a real series in the same array as the real series.  The algorithm is modified to accommodate this by computing the complex conjugate from the positive frequency values..  DC and the positive frequencies come first followed by the negative frequencies in reverse order for a general complex to complex transform.

With no window function (aka a rectangular, boxcar window) all the frequency samples are convolved with sinc(x) (i.e. sine(x)/x)  If a triangular, aka Bartlett, window is applied the frequencies are convolved with sinc(x)**2.  Wikipedia has a good page on this.  If you convolve any arbitrary function with a spike of unit area (a Dirac functional) the result is a copy of the function centered on the spike.  A Dirac functional has infinitessimal width, infinite amplitude and unit area.  A multiplication in time is a convolution in frequency and vice versa.  Because the series does not go on forever, it is implicitly multiplied by a window in time.  So smearing of the Fourier frequencies is unavaoidable.  All you can do is choose the shape of the  smearing operator.

The first bin is 0 Hz, the rest up to Nyquist are at (k/n)*(1/2*dt) for 1 <=k<=n/2.  Those frequencies are harmonically related, but they are not the signal.  They are the discrete Fourier frequencies.  They are not called "harmonics".

Never take serious courses without books and never get rid of the books.  They are your offline memory.  You can retrieve information much faster from the text you used for a course than anything else.  If there are no books for courses, a truly awful thing to do to the victims, research and find suitable texts.  I buy 3-4 books for any topic I'm trying to learn on my own.

I've not looked at the problem or spreadsheet.  I don't have Excel.  From the statements made you are being asked among other things  for THD in the presence of signals which are not harmonically related.  This is called a multitone signal and is used to evaluate nonlinearities in things like RF mixers. 


Education has become a scam which is a great shame.  The best reference I have  on the FFT is "The Fast Fourier Transform and Its Applications" by  E. Oran Brigham. Apparently it is out of print and people are asking absurd ($832 US!)  The previous edition which I also have  shows up for $11, so get that.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #24 on: March 09, 2018, 06:57:57 pm »
I just added a plot table of the data in column 'B' as shown in my screenshot.  It is clearly a perfectly constructed textbook example waveform from the Fourier data.  If Simon does the assignment Inverse Fourier correct as expected by the course, he should be able to reconstruct the red waveform 'EXACTLY' down to the dot, there can be no error here, phase mistakes, or excuses.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf