Author Topic: Reconstructing a waveform from its harmonics.  (Read 19492 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
Re: Reconstructing a waveform from its harmonics.
« Reply #50 on: March 10, 2018, 10:33:55 am »
I think really all I am missing is checking the phases of the 3 peaks and giving it a go.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #51 on: March 10, 2018, 10:45:20 am »
I see, if only my course taught me this stuff. Basically the frequency step is too large to resolve the exact frequency. I think that if this course was worth it's salt it would include lessons on the proper tools like matlab instead of trying to short cut it by hacking about with excel. I expect the fourier analysis was put into excel to keep the stock brokers hayy rather than the engineers.

Exactly correct.
I've attached my new fixed Excel spread sheet.  After correcting my formula, it turns out your base frequency is exactly 50Hz.  Who'd thought.

You will see a few green numbers inbetween the 2 tables.  Just edit those and the red line on the reconstruction will automatically update.

You may adjust the over all offset, the base frequency, and the amplitude + it's multiplier.  I used a -2 for the x5 and x7 to invert those cosines.

If you enter 0 for a gain figure, it will turn off that particular cosine.  The gains I took from the peak value of each cosine on the Fourier chart.  Then, tweaked them.  Now that you can easily play with them, you can see the effect of using chart values VS my numbers, VS any number you like.

The formula for the reconstruction is now compacted and you should have no trouble working it out.
« Last Edit: March 10, 2018, 10:48:13 am by BrianHG »
 

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 #52 on: March 10, 2018, 10:52:38 am »
Well yes as the preamble to these questions state that its' the current waveform of a VFD I guess they might just have a 50Hz supply ;) Thank you for your efforts
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #53 on: March 10, 2018, 11:02:04 am »
 :palm: The table was off by 1 column.  Here is the fix.  (It corrects that little tiny blue dot at the right of the table and corrects the waveform offset to 270.)
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11790
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #54 on: March 10, 2018, 11:21:53 am »
If you have not seen this video, it is really worth watching, and then many others by the same producer.

I have only ever had a general understanding of Fourier transforms (never needed to use them), and the explanation given in this video is a revelation. Those of us that grew up with books have always thought they were the way to learn, but this really shows how to use video content to go beyond what books can do!

 https://youtu.be/spUNpyF58BY
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #55 on: March 10, 2018, 11:24:24 am »
Well yes as the preamble to these questions state that its' the current waveform of a VFD I guess they might just have a 50Hz supply ;) Thank you for your efforts
Note that if you change you frequency column from:
=A3*18000/1024
to
=A3*18000/1030

The peaks hit their frequency much better, however, this might not be an error, just an artifact from such a small sample set.
 

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 #56 on: March 10, 2018, 11:33:27 am »
If you have not seen this video, it is really worth watching, and then many others by the same producer.

I have only ever had a general understanding of Fourier transforms (never needed to use them), and the explanation given in this video is a revelation. Those of us that grew up with books have always thought they were the way to learn, but this really shows how to use video content to go beyond what books can do!

 https://youtu.be/spUNpyF58BY

I am subscribed to that very channel and looked for a fourier video. yes he is excellent and I am currently going through his calculus series
 

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 #57 on: March 10, 2018, 11:40:55 am »
Yes I have seen that one, no math content but an interesting look
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #58 on: March 10, 2018, 02:42:57 pm »
I see, if only my course taught me this stuff. Basically the frequency step is too large to resolve the exact frequency. I think that if this course was worth it's salt it would include lessons on the proper tools like matlab instead of trying to short cut it by hacking about with excel. I expect the fourier analysis was put into excel to keep the stock brokers hayy rather than the engineers.

That's the traditional L2 (least summed squared error) transform view and you should have been taught that in the first lesson. 

 However, it turns out that you can compensate for the short time series length using what's called a sparse L1 (least summed  absolute error)  pursuit.  That's about 40 semester hours of mathematics from where you are now though.  No one knew that when I was in grad school 30 years ago.  It was only discovered around 2004.
 

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 #59 on: March 10, 2018, 02:52:53 pm »
The problem is that they are trying to condense it down and the material is actually quite old. I find them seeming to skip stuff. A work colleague who is going to do the mechanical equivalent has already found the same I did with the maths bridging module you do before any course.
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #60 on: March 10, 2018, 03:13:48 pm »
The Fourier transform goes back to 1810 although some of the mathematical details were not resolved until almost 100 years later.  The major work on the discrete case was done in the 30's by Wiener and Shannon.  So the age of the material is not an issue.  Quality  of instruction is.

The first lesson on the FFT should have explained the layout of the values in the frequency domain, how to determine the phase in  the complex plane, the effect of series length on frequency resolution and the relationship between multiplication and convolution between the two domains.  It should have also covered the periodicity outside the interval [-Pi:Pi), resampling by FFT and the need to pad the time series to prevent wraparound. 

If you're spending money on this I strongly urge you to look elsewhere if those things were not done.  Such instruction is worse than useless, it misleads the student.
 

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 #61 on: March 10, 2018, 08:29:23 pm »
The Fourier transform goes back to 1810 although some of the mathematical details were not resolved until almost 100 years later.  The major work on the discrete case was done in the 30's by Wiener and Shannon.  So the age of the material is not an issue.  Quality  of instruction is.

 

If you're spending money on this I strongly urge you to look elsewhere if those things were not done.  Such instruction is worse than useless, it misleads the student.

My employer is wasting their money on this because qualifications are everything in this tin pot country and education standards have been reduced to the lowest common denominator.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #62 on: March 10, 2018, 08:32:56 pm »
In my new Excel, in getting that global 'x-offset' value of 270, turn off COSines #2 & #3, then align it so that the COS on the table starts like a sine. 

COS( (270)*(50hz)*PI()/9000 ) =
COS( (13500 )*PI() / 9000 ) =
COS( PI()  * 1350 / 9000 ) =
COS( PI() * 3/2 )
COS( PI() * 1.5 )

Also, if you change all the COSines to SINes in my formula and make the multiplier for sine #3 a positive, the correct offset becomes 0.  Clearly a constructed waveform as the phases are perfectly lined up to a quadrant of PI.

« Last Edit: March 10, 2018, 08:36:49 pm by BrianHG »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #63 on: March 10, 2018, 08:36:55 pm »
Your courses are causing many of us to look back at things we might have known - four or more decades ago.  As well, we are looking at the new tools (Maxima, Octave, Matlab) and learning how much easier these problems are when using a computer as opposed to a slide rule.

I look forward to your homework problems.  They are helping me fill in some blanks.

 
The following users thanked this post: 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 #64 on: March 10, 2018, 08:38:26 pm »
I'm just going to do sine of the real parts and cosine of the imaginary parts on the 3 main frequencies which I think is what my "monkey see monkey do" course material coupled with the sazily laid out exercises seem to expect.
 

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 #65 on: March 10, 2018, 08:41:32 pm »
Your courses are causing many of us to look back at things we might have known - four or more decades ago.  As well, we are looking at the new tools (Maxima, Octave, Matlab) and learning how much easier these problems are when using a computer as opposed to a slide rule.

I look forward to your homework problems.  They are helping me fill in some blanks.



The thing is that I am not learning an awful lot here as it is reduced to "monkey see monkey do" and as evident from this thread it can take a combination of seasoned engineers to unravell the mess I am often given. Hopefully once I am through this and kept my employer happy I can start to learn to apply it properly.
 

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 #66 on: March 10, 2018, 09:19:39 pm »
So attached is the monkey see monkey do version. Next I will try the same with the corrected frequencies on a 50Hz fundamental.

Blue is using sine on the real parts, green is using cosine on the real parts, the blue seems to be right but out of phase
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3476
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #67 on: March 11, 2018, 01:14:00 am »
I was asked to sit on the external advisory board of the geoscience department where I got my MS.  During my 3 year tenure I tried numerous times to engage the faculty in a discussion of the mathematics requirements and very specifically asked about the mathematics component of the online courses in GIS that they offered.  I never got *any* replies.

But when I asked about the memorial fund to my MS supervisor in mid December, I got a reply in minutes.  What they did not know was that I had raised the subject with my supervisor several years before he died and he blistered my ears for suggesting such a thing.  The department had dropped mineralogy as a requirement so that kids could get "environmental sciences" degrees without being troubled by difficult subjects like what the earth was made of.  The most outrageous part was he taught all the hard rock courses.  I was one of 3 students in the igneous petrology class.  During  our labs he would sit and teach himself whole earth geophysics to prepare for the class he was teaching.  The stipend set up in his honor goes to students going into the oil industry!   I paid my way through grad school except for a $500 stipend.  I went into the oil industry because when I graduated in 1982 there were no mining jobs in the US and very few anywhere else.  Ultimately I moved into reflection seismology and learned a lot of DSP.

Ultimately I concluded that the only interest the faculty and I had in common was my money.  I declined to give them any.  The faculty's sole concern was making the courses easy so that they would have lots of students and nice offices.  Actually teaching was not even on their radar.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #68 on: March 11, 2018, 01:34:23 am »
So attached is the monkey see monkey do version. Next I will try the same with the corrected frequencies on a 50Hz fundamental.

Blue is using sine on the real parts, green is using cosine on the real parts, the blue seems to be right but out of phase

SPOILER (you should have realized this by now):
For the correct final product, use sine for the fundamental, negative sine for the 5x tone, and sine for the 7x tone.

These phase differences are understood because:

3   0.848      -7463.29135403605-14445.5266079862i            15.87850   3.98478   52.734375
                                at 52hz, a - multiplied by a - equals a positive, so for the 50hz, add a sine.

14   1.126      -5940.59149956592+6735.79475621755i            8.77068   2.96153   246.093750
                                at 246hz, a - multiplied by a + equals a negative, so for the 246hz, subtract a sine.

20   -0.568      -1429.15358218379-6241.73751283557i            6.25319   2.50064   351.562500
                                at 351hz, a - multiplied by a - equals a positive, so for the 351hz, add a sine.

so, to construct the exact final waveform, this is all you need:
(50hz Sine at 15.9 magnitude) - (250hz Sine at 8.8 magnitude) + (350hz Sine at 6.3 magnitude)
« Last Edit: March 11, 2018, 03:06:45 am by BrianHG »
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Reconstructing a waveform from its harmonics.
« Reply #69 on: March 11, 2018, 02:54:52 am »
Simon, with your course, ideally you do want fantastic teachers, but if you are expecting to learn this stuff by just listening, it will not stick anyway. Listening to a lecture will not make you feel comfortable or at home using the things you were taught now in 10 years time. If you can dive in and have some fun playing with the new ideas now, then in 10 years, you will think - "Great - Fourier Transforms - love it!".

You have to get in and start crunching numbers for yourself - just like people have done in this thread. We weren't even doing the course, but we had some fun. Build and test circuits. Every time you go into areas like Fourier Transforms, Laplace Transforms, Maxwell's Equations, Classical Filter theory, Bode plots and stability, Semiconductor Theory and so on it gives a new perspective to your understanding so you can start to see how electronics is working from new directions.

No matter how good or bad the lectures seem to you, if you can take the ideas from the current subject home and start to have some fun, you do start having some really big "Wow!" moments along the way and you do feel far more confident. You never want to let any course limit how much you learn. There is no reason why you can't be better then the lecturers - any lecturers. It is the same as thinking that no football player can ever be better then the coach.

There are plenty of Wow! moments with Fourier Transforms. If you put a pure sinewave into a circuit with terrible distortion, you get a mess out. But it looks very different when you look at a Fourier transform of the distorted output.

The lecturers are leading you on a path up a mountain, but it is up to you to look out at the ever-expanding view for yourself. It is your journey, not the lecturers. If you are staring at your feet the whole time you climb the mountain, you never see anything for yourself and you will never get much out of the course other then a piece of paper.

Richard
 
The following users thanked this post: 3db

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11790
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #70 on: March 11, 2018, 03:25:05 am »
Yes I have seen that one, no math content but an interesting look

When you say "no math content" I am very much afraid you have missed the point.

For me, watching that video I saw 100% maths content. Maths is all about the concepts and ideas and how they lead to deeper insights. If you think of maths as equations, you are in danger of seeing engineering as lathes and drills instead of the products they produce.
 
The following users thanked this post: 3db

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Reconstructing a waveform from its harmonics.
« Reply #71 on: March 11, 2018, 03:42:14 am »
Sorry for  :horse: , but, here is the last Excel file, using strictly 3 sines, with the add or subtract amplitude values decoded from my above phase decoding.  The reconstruction is now such a close match, that the difference is within 1/10th an amplitude value.  Don't bother zooming in on the graph, it shows all red at any zoom.

You can now also individually edit the frequency of each sine wave.
« Last Edit: March 11, 2018, 03:59:05 am by BrianHG »
 

Offline Tomorokoshi

  • Super Contributor
  • ***
  • Posts: 1212
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #72 on: March 11, 2018, 05:38:14 am »
Sorry for  :horse:

Not at all. It's been very interesting to follow. Perhaps there should be an aliasing a dead horse icon?
 

Offline Tomorokoshi

  • Super Contributor
  • ***
  • Posts: 1212
  • Country: us
Re: Reconstructing a waveform from its harmonics.
« Reply #73 on: March 11, 2018, 05:52:00 am »
You have to get in and start crunching numbers for yourself - just like people have done in this thread. We weren't even doing the course, but we had some fun. Build and test circuits. Every time you go into areas like Fourier Transforms, Laplace Transforms, Maxwell's Equations, Classical Filter theory, Bode plots and stability, Semiconductor Theory and so on it gives a new perspective to your understanding so you can start to see how electronics is working from new directions.

And those are just some of the topics you may encounter, although those certainly contain some of the highest densities of math. Going through school may seem to be slow now, but they are actually zooming through topics very quickly. It takes time to be away from that to realize just how much of a cursory approach there is to a lot of education, necessarily so because there is so much that has to be covered in just a few short years.

Try not to get too caught up on if your instructors are good or not. It's their individual style and capability. Some are natural educators, many are not. You will encounter those disparities in work also. Use the available resources to get up to speed on anything that isn't clear. This forum, their office hours, anything.

If it becomes the case that you would need to use any of those mathematical disciplines later on for a project, you are already at an advantage by knowing they exist; you can research their use later. If you need it for a job, you may get enough time to do it there. I've had projects that span 2 degrees worth of time.
 

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 #74 on: March 11, 2018, 08:43:24 am »
Yes I have seen that one, no math content but an interesting look

When you say "no math content" I am very much afraid you have missed the point.

For me, watching that video I saw 100% maths content. Maths is all about the concepts and ideas and how they lead to deeper insights. If you think of maths as equations, you are in danger of seeing engineering as lathes and drills instead of the products they produce.

I meant it is not explaining how to do much but more about how they work.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf