Author Topic: What is this glitch in my square wave graph?  (Read 5221 times)

0 Members and 2 Guests are viewing this topic.

Offline nbrittonTopic starter

  • Frequent Contributor
  • **
  • Posts: 443
  • Country: us
What is this glitch in my square wave graph?
« on: September 18, 2015, 12:04:38 am »
In the attached screenshot, which is a graph of the Fourier series summation of a square wave to the 999 harmonic, there is a blip at the top center of the waveform, is this a glitch in the software or is this part of the waveform?
 

Offline nbrittonTopic starter

  • Frequent Contributor
  • **
  • Posts: 443
  • Country: us
Re: What is this glitch in my square wave graph?
« Reply #1 on: September 18, 2015, 12:18:20 am »
Also what is the formula to calculate the period of the sine wave that is riding on top of the square wave for any given harmonic?
 

Offline nbrittonTopic starter

  • Frequent Contributor
  • **
  • Posts: 443
  • Country: us
Re: What is this glitch in my square wave graph?
« Reply #2 on: September 18, 2015, 12:28:25 am »
Also what is the formula to calculate the period of the sine wave that is riding on top of the square wave for any given harmonic?

Wouldn't it just be the period of the square wave multiplied by the order of the harmonic. i.e. 25 MHz square wave * 11th harmonic = 275 MHz ???
 

Offline nbrittonTopic starter

  • Frequent Contributor
  • **
  • Posts: 443
  • Country: us
Re: What is this glitch in my square wave graph?
« Reply #3 on: September 18, 2015, 01:24:53 am »
Here's a pretty graph I made.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: What is this glitch in my square wave graph?
« Reply #4 on: September 18, 2015, 01:45:42 am »
I'm pretty sure the blip that you see is not mathematically correct. I.e., it is a "glitch in your software" (or, a consequence of the way that floating point maths works, which would appear in any software [except, slight differences in how other software works might hide this issue maybe]).
 

Offline tec5c

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: au
Re: What is this glitch in my square wave graph?
« Reply #5 on: September 18, 2015, 08:41:30 am »
I'm pretty sure the blip that you see is not mathematically correct. I.e., it is a "glitch in your software"

+1. As this is not mathematically correct.

Which software are you using? If you have access to Matlab then I'm certain you would not see said glitch.
 

Offline RogerRowland

  • Regular Contributor
  • *
  • Posts: 193
  • Country: gb
    • Personal web site
Re: What is this glitch in my square wave graph?
« Reply #6 on: September 18, 2015, 08:51:06 am »
Also what is the formula to calculate the period of the sine wave that is riding on top of the square wave for any given harmonic?

Wouldn't it just be the period of the square wave multiplied by the order of the harmonic. i.e. 25 MHz square wave * 11th harmonic = 275 MHz ???

That's correct, the 11th harmonic of a 25MHz square wave is 25 * 11 = 275MHz. Also, its amplitude should be whatever the square wave amplitude is multiplied by 2/(pi * 11).
« Last Edit: September 18, 2015, 08:52:42 am by RogerRowland »
 

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: What is this glitch in my square wave graph?
« Reply #7 on: September 18, 2015, 12:51:37 pm »
The gibbs effect /or phenomenon) seems to explain your results.
Take a look here:
https://en.wikipedia.org/wiki/Gibbs_phenomenon
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: What is this glitch in my square wave graph?
« Reply #8 on: September 18, 2015, 12:54:00 pm »
The gibbs effect /or phenomenon) seems to explain your results.
Take a look here:
https://en.wikipedia.org/wiki/Gibbs_phenomenon

No, we're talking about the spike on the middle of the plot, where it's supposed to be dead flat.
 

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: What is this glitch in my square wave graph?
« Reply #9 on: September 18, 2015, 04:02:51 pm »
The gibbs effect /or phenomenon) seems to explain your results.
Take a look here:
https://en.wikipedia.org/wiki/Gibbs_phenomenon

No, we're talking about the spike on the middle of the plot, where it's supposed to be dead flat.

I had to look very carefully to saw it, didnt see it before.
+1 to a software glitch.
 

Offline onlooker

  • Frequent Contributor
  • **
  • Posts: 395
Re: What is this glitch in my square wave graph?
« Reply #10 on: September 19, 2015, 12:07:54 am »
The middle peak is the mathematical result of the given sum at x=0.5  0.25; it is not software glitch.

For x=0.5  0.25, the formula = 1/pi*(1/1-1/3+1/5-1/7...) >= 1/3*(1-1/3) = 2/9 = 0.22.
If we include 2 and 3 more terms, we get the bounds: 0.230 < peak <0.266

The mistake is to apply the formula beyond the physically valid domain of 0<=x<0.5  0.25. This 0.5  0.25  is related to the Nyquist frequency's 1:2 relation or call it the limitation of discrete FT/FFT (Here, x is the frequency to observe; while 1  0.5 (due to 2k in use) is the sample frequency).

Edited: Wrong reasoning. x  is in time domain. If the plot was extended to x=1.0 to show a  full period of the square wave, I would have realized earlier that this is not a spectrum plot. 
« Last Edit: September 19, 2015, 02:17:35 am by onlooker »
 

Offline tec5c

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: au
Re: What is this glitch in my square wave graph?
« Reply #11 on: September 19, 2015, 12:31:38 am »
The middle peak is the mathematical result of the given sum at x=0.5; it is not software glitch.

For x=0.5, the formula = 1/pi*(1/1-1/3+1/5-1/7...) >= 1/3*(1-1/3) = 2/9 = 0.22.

For x = 0.5, the sum results in 0?
 

Offline onlooker

  • Frequent Contributor
  • **
  • Posts: 395
Re: What is this glitch in my square wave graph?
« Reply #12 on: September 19, 2015, 12:35:20 am »
Quote
For x = 0.5, the sum results in 0?
You are right and thanks, it is my typo. I should say for x=0.25. That is where the middle peak is. Another typo/mistake is sample frequency. it is 0.5 not 1. since 2k is in use.
« Last Edit: September 19, 2015, 12:40:31 am by onlooker »
 

Offline tec5c

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: au
Re: What is this glitch in my square wave graph?
« Reply #13 on: September 19, 2015, 01:03:55 am »
Mathematically, I am having a hard time in representing that peak at x = 0.25.

For x = 0.1, sum = 0.2499...

For x = 0.2, sum = 0.25007...

For x = 0.21, sum = 0.25007...

For x = 0.22, sum = 0.25008...

For x = 0.23, sum = 0.25008...

For x = 0.24, sum = 0.25008...

For x = 0.25, sum = 0.25008...

For x = 0.26, sum = 0.25008...
.
.
.
For x = 0.30, sum = 0.25007...
 

Offline tec5c

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: au
Re: What is this glitch in my square wave graph?
« Reply #14 on: September 19, 2015, 01:16:44 am »
For some reason my copy of Matlab isn't working on this PC so I had to resort to other options (some online graphing tool).

 

Offline onlooker

  • Frequent Contributor
  • **
  • Posts: 395
Re: What is this glitch in my square wave graph?
« Reply #15 on: September 19, 2015, 01:29:32 am »
Ya, My mistake again to read the line at vertical to be 0. The calculation was right, but the reasoning was wrong.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf