Simple double integration of square wave question

In summary, the conversation discusses the mathematical description and properties of a triangular wave and its relationship to a square wave. The conversation also touches on the integration of a square wave and the resulting curve. The participants also inquire about the potential closeness of a parabola to a sine wave and how to approximate a small part of a half circle using a quadratic equation.
  • #1
tim9000
867
17
Hi,
Simple question, sort of:

I see that according to the internet the mathematical description of a triangular wave is rather complex, so I'll try to stay as far away from that as I can, because I'm a bit rusty.

I understand that if you integrate a square wave you get a triangular wave on the x-axis. But If you integrate that triangular wave you get something resembling a sineusoid. (something about it being the first harmonic of the triangular wave I believe)

My questions are: How close is that to a sine wave? What does it look like graphically? (I don't have matlab)
Secondly, are there different slopes of triangular waves, including asymmetrical triangular waves, which are closer to a sine wave?

I am so rusty on Fourier transforms / series, it's not funny. But regarding this:
http://mathworld.wolfram.com/FourierSeriesTriangleWave.html

I see the asymmetrical figure, which is kind of what I have in mind, but I'm not sure what the red sine wave is indicating.

Cheers
 
Physics news on Phys.org
  • #2
You can see immediately what successive integrals of a square wave form look like if you remember that one definition of integration is simply the area under a curve .

Just draw graphs of the integrated area under the curves as you progress along the x-axis . Take integrated areas above the y=0 line as positive and below as negative .

You can do square to triangular and triangular to the next one using simple geometric calculation of areas . Gets a bit difficult for higher levels of integration so you have to do some proper calculus for these .

You might like to conjecture what the curve looks like after a large number of successive integrations of the original square wave form .
 
  • #3
I guess you integrate over pieces of the original function, e. g. ##g(x) = \int_{x-c}^{x+c} f(x') dx'##? If f(x) is a triangle function, you can evaluate this integral analytically. You get parabolic parts, potentially with linear pieces in between. To answer how close that is to a sine you first have to define what "close" means.
 
  • #4
Nidum said:
You can see immediately what successive integrals of a square wave form look like if you remember that one definition of integration is simply the area under a curve .

Just draw graphs of the integrated area under the curves as you progress along the x-axis . Take integrated areas above the y=0 line as positive and below as negative .

You can do square to triangular and triangular to the next one using simple geometric calculation of areas . Gets a bit difficult for higher levels of integration so you have to do some proper calculus for these .

You might like to conjecture what the curve looks like after a large number of successive integrations of the original square wave form .
Not meaning to sound entitled/lazy and narcissistic but I want to see it graphically, but I don't have all day (hardly 5 spare minutes in fact) to do the calculations and graphing (nor do I have wolfram or matlab).

mfb said:
I guess you integrate over pieces of the original function, e. g. ##g(x) = \int_{x-c}^{x+c} f(x') dx'##? If f(x) is a triangle function, you can evaluate this integral analytically. You get parabolic parts, potentially with linear pieces in between. To answer how close that is to a sine you first have to define what "close" means.

I can imagine how you'd get parabolic parts, but what sort of parabola? And why are there linear pieces in between, at the inflection points?

Yes, 'how close' IS an interesting question. Aside from graphical inspection/opinion, can you have a section of parabola curve-fit to part of a sine wave? Or is that a mathematical impossibility?

Thanks all.
 
  • #5
There is just one sort of parabola.
tim9000 said:
And why are there linear pieces in between, at the inflection points?
If your whole integration range is on the slope of the triangle, the integral is linear with respect to the position of the center of the integration.
tim9000 said:
can you have a section of parabola curve-fit to part of a sine wave?
Not exactly, but the difference can be very small.
 
  • #6
mfb said:
There is just one sort of parabola.
Thanks for the reply. Okay, I just did something I would have done the other day I was on PF if I'd have had the time, which was to wiki 'parabola'. It has been a long long time since I'd thought of parabolas in a non-trivial way (I basically just remembered locus and focus). The same thing almost goes for integration :P
Anyway, the picture of https://upload.wikimedia.org/wikipe...rabeln-var-s.svg/330px-Parabeln-var-s.svg.png
as was the family of conic sections. Basically a parabola is a graph of a quadratic function. So what I meant in my last post, was 'what [sort of] quadratic equation.
mfb said:
If your whole integration range is on the slope of the triangle, the integral is linear with respect to the position of the center of the integration.
So does this mean that the [type] of parabola y = x2 with no 'a' coefficient or +/- 'constant' ?

mfb said:
Not exactly, but the difference can be very small.
Interesting, is there a way I can construct a quadratic equation which is really close to that of a half circle? I suppose this would mean that the conic section slides right down the cone close to the base.

Thanks
 
  • #7
tim9000 said:
So does this mean that the [type] of parabola y = x2 with no 'a' coefficient or +/- 'constant' ?
What you quoted was about a part that is not a parabola.
Interesting, is there a way I can construct a quadratic equation which is really close to that of a half circle? I suppose this would mean that the conic section slides right down the cone close to the base.
No. You can approximate a small part reasonably well, but a parabola will never look like a half circle.
 
  • #8
mfb said:
What you quoted was about a part that is not a parabola.
No. You can approximate a small part reasonably well, but a parabola will never look like a half circle.
I understand that, it must be bounded to leave only part of the parabola which approximates the half-circle, relevant. I want to make that clear.

My inquiry now is, how to I mathematically articulate this? How do I construct or arrive at a quadratic which is close to a half circle, i.e. varying the coefficients and constants of the equation, and how [or where] do I bound the quadratic?

Thank you!
 
  • #9
I'm missing too much context to understand what exactly you are asking.
 
  • #10
mfb said:
I'm missing too much context to understand what exactly you are asking.
No worries, I'll elaborate.
Before I do, I just thought of something: if you were integrating a square wave from 0 to 2π from A to -A. Then would the result not be a triangular wave sitting on top of the x-axis. But then, wouldn't the resulting 'parabolic wave' also be sitting completely on top of the x-axis?

Anyway, what I was getting at before in my last post was: To find the parabola you'd integrate the triangular wave from x-axis [0] to x-axis [2π].
Say we were integrating this triangular wave; since y = mx + b for a line; I think it would be something like:

0π mx + b dx -
π mx + b dx = [mx2 + bx - mx2 + bx ]

does this mean that 'm' (the slope) is, the equivalent of 'a' here:
https://upload.wikimedia.org/wikipe...rabeln-var-s.svg/330px-Parabeln-var-s.svg.png
??

Which would mean the smaller 'm' is, the lower down the cone the parabola is, and so the closer it is to a half circle? (as per https://upload.wikimedia.org/wikipe...nic_Sections.svg/330px-Conic_Sections.svg.png)

Thanks
 
  • #11
P.S. I was thinking today, wouldn't ∫0π mx + b dx just exponentially rise? (Until it reaches π)

So wouldn't the parabolic wave actually be something like:
[ A - 1/∫0π (A/π)*x dx ] - [ A + 1/∫π (A/π)*x dx ] ?
Where 'A' is amplitude.

Also, according to
http://www.embedded.com/electronics-blogs/programmer-s-toolbox/4025567/Rosetta-Stone-explained

This is what the integral of the triangular wave looks like, also in the attached picture is what I would have expected it to look like:
integral of triangle.png
I assume I'm mistaken, could you please explain how?
Thanks
 
Last edited:
  • #12
test - edit has quit saving changes
hmmmm got 'em all that time . Feast or famine. Computers are just that way; never trust one.
tim9000 said:
Hi Jim,
I heard that some signal generators use the double integral of a square wave to generate a sine-wave.

Anyway, I contemplated this then realized I didn't understand how this could be, specifically integrating the triangular wave. If you've got a second, could you drop by this and tell me what I'm modelling wrong with my basic maths:

https://www.physicsforums.com/threa...-of-square-wave-question.922938/#post-5825751

The thread seems to have gone dead unfortunately.

Thanks in advance if you can.

i'll just reply to the thread. There's far better math folks than me on PF.
tim9000 said:
in the attached picture is what I would have expected it to look like:
Methinks you're not integrating properly in your head

integral-of-triangle-png.png


Intuitively,

So long as your top trace is positive, ie above the abscissa, integration proceeds upward so bottom trace should have positive slope for entire first, third, fifth half cycles of top trace, and negative slope for the even ones. You've reversed slopes in the wrong place.

Bottom trace should have zero slope directly under top one's zero crossings not under its peaks.

Bottom trace's maxima and minima should lie underneath top one's zero crossings because zero crossings demark the end of an integration period that went in one direction..

In that picture i'd expect bottom trace to never get below zero - it integrates up for a half cycle then back down for another half cycle. It should swing between zero and some positive value, just like transformer inrush .

Next look at Fourier transform of a triangle wave

for some reason system refuses to show the wikipedia link ipasted it in four times.
Look for wikipedia triangle wave
https://en.wikipedia.org/wiki/Triangle_wave


upload_2017-8-26_15-32-7.png

Fundamental plus odd harmonics...Much easier approach using Fourier

Integration can be thought of as low pass filtering. It attenuates not removes higher harmonics.
So integrating once attenuates harmonics, integrating again attenuates them more. As you cascade stages of integration and attenuate the harmonics you approach just the fundamental which would be a pure sine wave.
Apparently some people are happy enough with two stages to claim it's a sine wave. Really it only resembles one.

Then there's the practical problem of keeping an integrator zeroed - it'll integrate its offset error and eventually saturate.
So if you build one use a low pass filters instead of integrators. Signal after each successive stage will more closely resemble a sinewave. After just a few your eye will be unable to detect the difference.

Would be interesting to see what the ear picks up ?
 
Last edited:
  • #13
Thanks for the reply Jim!

That is extremely frustrating when the machine won't comply.

jim hardy said:
test - edit has quit saving changes

Methinks you're not integrating properly in your head
...So long as your top trace is positive, ie above the abscissa, integration proceeds upward so bottom trace should have positive slope for entire first, third, fifth half cycles of top trace, and negative slope for the even ones. You've reversed slopes in the wrong place.

Yes, yes, a thousand times: of course!

Is this more accurate:
abscissa.png

Sorry it's a pretty rubbish drawing, but hopefully you get the picture.

Jim, to get you up to speed, we were previously discussing the result of the integration as being that of a parabola section.

But the result of the above picture doesn't look much like a parabola to me because it exponentially rises and falls sharply after the gradual rises and falls, which makes it look not quite smooth at the point where the triangular wave crosses the axis. Is this a fair representation?

I STILL think this would be described by:

Anyway, what I was getting at before in my last post was: To find the parabola you'd integrate the triangular wave from x-axis [0] to x-axis [2π].
Say we were integrating this triangular wave; since y = mx + b for a line; I think it would be something like:

0π mx + b dx - ∫π mx + b dx = [mx2 + bx - mx2 + bx ]
Correct?

tim9000 said:
I was thinking, wouldn't ∫0π mx + b dx just exponentially rise? (Until it reaches π)

So wouldn't the parabolic wave actually be something like:
[ A - 1/∫0π (A/π)*x dx ] - [ A + 1/∫π (A/π)*x dx ] ?
Where 'A' is amplitude.

Is this a fair description of a parabolic wave?

jim hardy said:
Bottom trace should have zero slope directly under top one's zero crossings not under its peaks.

Bottom trace's maxima and minima should lie underneath top one's zero crossings because zero crossings demark the end of an integration period that went in one direction..

In that picture i'd expect bottom trace to never get below zero - it integrates up for a half cycle then back down for another half cycle. It should swing between zero and some positive value, just like transformer inrush .

Next look at Fourier transform of a triangle wave

for some reason system refuses to show the wikipedia link ipasted it in four times.
Look for wikipedia triangle wave
https://en.wikipedia.org/wiki/Triangle_wave


View attachment 209818
Fundamental plus odd harmonics...Much easier approach using Fourier

Integration can be thought of as low pass filtering. It attenuates not removes higher harmonics.
So integrating once attenuates harmonics, integrating again attenuates them more. As you cascade stages of integration and attenuate the harmonics you approach just the fundamental which would be a pure sine wave.

That is very interesting that it is the a Fourier series, so I suppose that means it isn't really like a parabolic wave? (due to aforementioned reasons and harmonics)

I might explore this further for fun; if you integrated this one more time, in your opinion would you be able to see the difference between this an a pure sin wave?

Thanks !
 
Last edited:
  • #14
Why not just integrate from 0 to pi, a half cycle make that 0 to pi/4, a quarter cycle ??
Symmetry says next one is just its mirror image.
if
y = ax
∫y = ax2/2
and it's going to be some conic section.

I'm not too sure about integrating discontinuous functions anyway isn't that a ground rule ?
Intuitively an ellipse looks continuous a parabola does not.

But you can integrate a triangle wave's Fourier series term by term
https://ocw.mit.edu/courses/mathematics/18-03sc-differential-equations-fall-2011/unit-iii-fourier-series-and-laplace-transform/operations-on-fourier-series/MIT18_03SCF11_s22_4text.pdf
upload_2017-8-27_10-11-47.png


Integrate that twice !
I'll wager the denominators get bigger, representing suppressed harmonics . If so intuition is confirmed.
 
Last edited:
  • #15
here i cut and pasted together four y = x2 segments
used Paint to snip, flip and connect them
just to see how much y=x2 looks like a ¼ cycle of a sinewave ...
then i drew a triangle underneath just to relate it to what you're doing in this thread. .
integratedtriangle4tim9k.jpg


Not bad. eh ? You could peddle that as a sinewave but it's not.
I wonder what another integration would do? y = x3 ?

g-mat-graph-dia04.gif


Got a graphing program ? Plot all 3 over first quadrant and see how close they come.
In my younger days i'd have done a longhand least-squares fit...old jim
 
Last edited:
  • #16
jim hardy said:
here i cut and pasted together four y = x2 segments
used Paint to snip, flip and connect them
just to see how much y=x2 looks like a ¼ cycle of a sinewave ...
then i drew a triangle underneath just to relate it to what you're doing in this thread. .
View attachment 209896

Not bad. eh ? You could peddle that as a sinewave but it's not.
I wonder what another integration would do? y = x3 ?

View attachment 209897

Got a graphing program ? Plot all 3 over first quadrant and see how close they come.
In my younger days i'd have done a longhand least-squares fit...old jim

I need to get MATLAB again, maybe there are free graphing programmes on the net. Because I'm not quite sure how your #14 Example 2. is a sawtooth wave, so I'll need to graph it to believe it (and the harmonics). I get that it's f(t) = t for the region -π to π, but I don't see how this is repeating.

Okay, so the drawing I made in #13 was not quite good enough.
You did an excellent job of cutting and pasting the x2's. It does look much more like a sine wave than I thought.

Honestly, I forgot about the denominators, that's how rusty my basic maths is, but yes, the denominators would grow with successive integrations.

jim hardy said:
y = ax
∫y = ax2/2
and it's going to be some conic section.

What I am still confused about, is that I'm interpretation what you said as to mean that the conical section wave (which is being generated from the triangular wave), IS the same as a Sine wave, but it's a Sinusoidal fundamental WITH harmonics. So a parabola = a circle part + harmonic?

Does this mean that some signal generator (or whatever device) which generates sine waves by this integral method, would just use a DC offset, to push the bottom half of the wave below the X-axis?

Sorry (very rushed post), thanks again!
 
  • #17
tim9000 said:
what you said as to mean that the conical section wave (which is being generated from the triangular wave), IS the same as a Sine wave,

no, i don't think i said that.

Quadratics describe conic sections
https://en.wikipedia.org/wiki/Conic_section
300px-Conic_Sections.svg.png


upload_2017-8-29_1-16-18.png


Conic sections are curved as is sine but i do not believe any simple quadratic describes a sine.
If it did the Taylor series for sine would be much simpler
upload_2017-8-29_0-55-19.png

http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf
that doesn't look like the formula for a parabola.

I graphically pieced together segments of y=X2 which is curved and it indeed resembles a sine wave but is not one.
tim9000 said:
Does this mean that some signal generator (or whatever device) which generates sine waves by this integral method, would just use a DC offset, to push the bottom half of the wave below the X-axis?
More likely it'd use DC feedback to force the output to be centered at zero. You have to do that with analog integrators, actively zero them ..
 
  • #18
Let go of mathematics and move to literature because very little math serves real life
 
  • #19
Hi Jim, sorry I took so long to reply; hopefully I'll be more active on PF this coming week.

jim hardy said:
no, i don't think i said that.

Quadratics describe conic sections
https://en.wikipedia.org/wiki/Conic_section
View attachment 209940

View attachment 209941

Conic sections are curved as is sine but i do not believe any simple quadratic describes a sine.
If it did the Taylor series for sine would be much simpler
View attachment 209938
http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf
that doesn't look like the formula for a parabola.

I graphically pieced together segments of y=X2 which is curved and it indeed resembles a sine wave but is not one.
More likely it'd use DC feedback to force the output to be centered at zero. You have to do that with analog integrators, actively zero them ..

Yes I think you're right, that 'x' being squared as well as the 'y', makes all the difference in distinguishing a circle from a quadratic [parabola]. I suppose what I was remiss in was that any wave can be expressed as a series of sine components, but only a circle or sine wave can exist as only a sine wave. So the fact that a conical section wave has a sine component is irrelevant and insignificant compared to any other wave.

Thanks

luatthienma12 said:
Let go of mathematics and move to literature because very little math serves real life
Okay, first and foremost, it's maths. Secondly, I'm not sure I understand what you're getting at. Yeah quality humanist pursuits is just as important as anything else, but in quantity of production far less useful to mankind. Given that the minority of fiction writers, wanna-be philosophers, sociologists, artists, music and communication don't produce uplifting or useful, transcendent pieces of work. Today it seems to be mostly this post-modern rubbish. [Because these fields have a low-bar and should be reserved for the Noam Chomsky, Bertrand Russell and Buckminster Fuller types, IMO.] However, quality engineering and science is quality, 100% of the time...And yes, it serves my real life every day.
 
  • Like
Likes jim hardy
  • #20
tim9000 said:
Today it seems to be mostly this post-modern rubbish. [Because these fields have a low-bar and should be reserved for the Noam Chomsky, Bertrand Russell and Buckminster Fuller types, IMO.] However, quality engineering and science is quality, 100% of the time...And yes, it serves my real life every day.
There does seem to be a lot of money in mediocrity - just look at the fortunes of Zuckerberg and Gates ...

We need more Robert Pirsigs .

old jim
 
  • Like
Likes tim9000

1. What is the definition of double integration?

Double integration is a mathematical process of calculating the area under a curve by performing two successive integration operations. It is used to find the volume of a solid or the area of a surface in three-dimensional space.

2. How is double integration used to solve square wave problems?

In the context of square wave problems, double integration is used to find the area under the square wave curve. This area represents the displacement or distance traveled by the wave over a specific time period.

3. What is a square wave and how does it relate to double integration?

A square wave is a non-sinusoidal periodic waveform that alternates between two levels. In terms of double integration, the square wave can be represented as a piecewise function, and the double integral of this function is used to find the area under the curve.

4. Can double integration be used to calculate the average value of a square wave?

Yes, the average value of a square wave can be calculated by dividing the area under the curve by the length of the time period. This can be found using double integration to find the area and then dividing by the time period.

5. Are there any limitations to using double integration for square wave problems?

One limitation of using double integration for square wave problems is that it assumes the waveform is continuous. In reality, square waves have sharp corners which can affect the accuracy of the calculated area. Additionally, double integration may not be suitable for more complex waveforms with irregular shapes.

Similar threads

Replies
139
Views
4K
Replies
78
Views
3K
Replies
38
Views
3K
Replies
15
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
29
Views
3K
Replies
2
Views
152
Replies
9
Views
4K
Replies
8
Views
934
Replies
13
Views
975
  • Electrical Engineering
Replies
20
Views
3K
Back
Top