Article 58B25 Driving oscillations with square waves

Driving oscillations with square waves

by
John
from John D. Cook on (#58B25)

What happens when you drive a vibrating system with a square wave rather than a sine wave? Do you still see the same kinds of behavior, such as beats and resonance? When does the difference between a square wave and a sine wave matter most? Those are the questions this post will address.

Background

Basic mechanical oscillations are modeled by the equation

m u'' + u' + k u = F sin(t + )

You can think of m, , and k as mass, damping, and spring constant. The same equation describes non-mechanical oscillations, such as electrical systems. Sometimes the terms such as mass" are still used when they are metaphorical rather than literal. I wrote a four-part series of posts on mechanical vibrations a while back starting here.

The term on the right hand side is the forcing function. F is the amplitude of the driving force and is its frequency.

The natural frequency of a system modeled by the equation above is

02 = k/m.

When F = 0, the solutions to the differential equation will have this frequency. When F is not zero, the solutions a component with the natural frequency and a component with the driving frequency. When the two frequencies are different, you get beats. When the two frequencies are the same, you get resonance. More on beats and resonance here.

In this post we will look at solutions to the equation above where the forcing function is a square wave rather than a sine wave. That is, we will replace

sin(t + )

with

sign( sin(t + ) )

where

sign(x)

is 1 when x is positive and -1 when x is negative.

Exploration

To simplify things a little, we will set the damping term to zero, and set the phase in the driving function to zero. Also, we will set m, k, and F all equal to 1. We will focus on varying only the driving frequency .

We need initial conditions for our differential equations, so let's pick u(0) = 1 and u(0) = 0.

When we drive the system at its natural frequency, i.e. with = 1, we get the same kind of resonance from a sine wave and a square wave.

square_resonance.svg

Update: There are more resonant frequencies [1].

When we lower the driving frequency to = 0.5 we see more of a difference.

square_beats05.svg

In general we see more difference as gets smaller, and more difference when the period 1/ is not an integer. For example, here is = 0.25, period T= 4:

square_beats025.svg

And here is = 0.3, period T = 1.66.

square_beats030.svgHere's an example of driving a system with a square wave at a frequency higher than the natural frequency.

square_beats170.svg

Here the difference between the solutions for the square wave and sine wave are closer together. Apparently the higher frequency makes more difference than the non-integer period.

In the examples above, the solution with a square wave forcing function starts out flat. That's because of our initial conditions u(0) = 1 and u(0) = 0. If we change the initial velocity condition to u(0) = 1, we get smoother solutions.

Here are the solutions with u(0) = 1 and = 0.25

square_beats1125.svg

and = 0.3.

square_beats1130.svg

Changing the initial velocity made more of a difference when the period was an integer.

See the next post for systems driven by a sawtooth wave rather than a square wave.

Related posts

[1] Sine-driven systems exhibit resonance if and only if the driving frequency matches the natural frequency. While writing the next post on sawtooth forcing functions, I accidentally discovered resonance at lower frequencies. The same can happen here with square wave-driven systems if = 1/(2n + 1). For example, here's a plot with = 1/5. The reason resonance shows up for odd periods is that the square wave has Fourier components at every odd frequency.

square_beats020.svg

The post Driving oscillations with square waves first appeared on John D. Cook.

gfSauk4yZKk
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments