8
Describing Function Analysis Using MATLAB and Simulink By Carla Schwartz and Richard Gran O ne of the earliest examples of feedback control is the escapement mechanism that provides the forces required to keep a mechanical clock prop- erly synchronized. Many famous mathematicians and physi- cists analyzed escapements during the 17th and 18th centuries. This article uses computer-aided design tools to develop a describing function analysis of a pendulum clock. We de- sign the escapement as a control system that allows the pen- dulum to provide the required time keeping and, at the same time, add enough energy to the pendulum to overcome the damping caused by friction. We use analysis tools in the MATLAB Control System Toolbox to accomplish the design and analysis. A by-prod- uct of our analysis is a simple MATLAB/Simulink model and a script that generates describing functions for any arbi- trary nonlinear system (including systems with multiple nonlinearities and with frequency-dependent describing functions). We also develop a Simulink model of the clock to verify the results of the analysis. The analysis described here uses some object-oriented programming features of MATLAB. Using a linear time-in- variant (LTI) system object that is part of MATLAB’s Control System Toolbox, we were able to integrate the describing function frequency response data with the transfer function of the clock mechanism in a natural way. Although these types of clock mechanisms are no longer designed, the computer-aided design techniques described here can be applied to controlling or predicting oscillations (limit cycles) in other nonlinear systems. The describing function analysis we present is applicable to a variety of nonlinear problems. Furthermore, it is always interesting to understand the history of control system developments in the abstract, and a clock is surely one of the earliest devices to be controlled and analyzed using the mathematics that controls engineers now take for granted. We begin with a brief history and a description of pendu- lum clocks. We then develop a model of the clock using a sim- ulation tool such as Simulink and use this simulation to understand the problem. We then present a simple code that combines MATLAB and Simulink to compute the describing function. The describing function is then encapsulated in a frequency response object that is combined with the transfer functions of the pendulum and the escapement to allow a classical Bode plot analysis. The result of the analysis is a feedback gain for the escapement that will ensure the pendulum swings at the desired frequency and amplitude. The results of the analysis are then verified by simulation. History of Pendulum Clocks Timekeepers that use either the sun or water have been built since at least 1400 BC. Sundials provided daylight time keeping, while at night, in some civilizations, water clocks were used. For example, the Egyptians had a “Clepsydra” (from the Greek kleptei, to steal, and hydor, water) that con- sisted of a bucket with a hole. When filled with water, the wa- ter level was a measure of the elapsed time. The first mechanical clocks appeared in the 13th century, with the earliest known device dating to about 1290. The in- ventor of the first clock is unknown, but the main develop- ment that made these devices possible is not—it is the escapement. An escapement is a gear with steep sloping teeth. Ori- ginally, the escapement provided a set of teeth that would “escape” from another gear as the pendulum oscillated. August 2001 IEEE Control Systems Magazine 19 LECTURE NOTES 0272-1708/01/$10.00©2001IEEE Figure 1. A typical pendulum clock (from [1]). Gran ([email protected]) is with Mathematical Analysis Co., 409 Birchington Lane, Melbourne, FL 32940, U.S.A. Schwartz is an independ- ent contractor. The MATLAB code and the Simulink models used in this article can be obtained by e-mail from Gran. Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

Embed Size (px)

Citation preview

Page 1: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

Describing Function Analysis Using MATLAB and SimulinkBy Carla Schwartz and Richard Gran

One of the earliest examples of feedback control isthe escapement mechanism that provides theforces required to keep a mechanical clock prop-

erly synchronized. Many famous mathematicians and physi-cists analyzed escapements during the 17th and 18thcenturies.

This article uses computer-aided design tools to developa describing function analysis of a pendulum clock. We de-sign the escapement as a control system that allows the pen-dulum to provide the required time keeping and, at the sametime, add enough energy to the pendulum to overcome thedamping caused by friction.

We use analysis tools in the MATLAB Control SystemToolbox to accomplish the design and analysis. A by-prod-uct of our analysis is a simple MATLAB/Simulink model anda script that generates describing functions for any arbi-trary nonlinear system (including systems with multiplenonlinearities and with frequency-dependent describingfunctions). We also develop a Simulink model of the clock toverify the results of the analysis.

The analysis described here uses some object-orientedprogramming features of MATLAB. Using a linear time-in-variant (LTI) system object that is part of MATLAB’s ControlSystem Toolbox, we were able to integrate the describingfunction frequency response data with the transfer functionof the clock mechanism in a natural way.

Although these types of clock mechanisms are no longerdesigned, the computer-aided design techniques describedhere can be applied to controlling or predicting oscillations(limit cycles) in other nonlinear systems. The describingfunction analysis we present is applicable to a variety ofnonlinear problems. Furthermore, it is always interesting tounderstand the history of control system developments inthe abstract, and a clock is surely one of the earliest devicesto be controlled and analyzed using the mathematics thatcontrols engineers now take for granted.

We begin with a brief history and a description of pendu-lum clocks. We then develop a model of the clock using a sim-ulation tool such as Simulink and use this simulation tounderstand the problem. We then present a simple code thatcombines MATLAB and Simulink to compute the describingfunction. The describing function is then encapsulated in afrequency response object that is combined with the transferfunctions of the pendulum and the escapement to allow aclassical Bode plot analysis. The result of the analysis is a

feedback gain for the escapement that will ensure thependulum swings at the desired frequency and amplitude.The results of the analysis are then verified by simulation.

History of Pendulum ClocksTimekeepers that use either the sun or water have beenbuilt since at least 1400 BC. Sundials provided daylight timekeeping, while at night, in some civilizations, water clockswere used. For example, the Egyptians had a “Clepsydra”(from the Greek kleptei, to steal, and hydor, water) that con-sisted of a bucket with a hole. When filled with water, the wa-ter level was a measure of the elapsed time.

The first mechanical clocks appeared in the 13th century,with the earliest known device dating to about 1290. The in-ventor of the first clock is unknown, but the main develop-ment that made these devices possible is not—it is theescapement.

An escapement is a gear with steep sloping teeth. Ori-ginally, the escapement provided a set of teeth that would“escape” from another gear as the pendulum oscillated.

August 2001 IEEE Control Systems Magazine 19

LECTURE NOTES

0272-1708/01/$10.00©2001IEEE

Figure 1. A typical pendulum clock (from [1]).

Gran ([email protected]) is with Mathematical Analysis Co., 409 Birchington Lane, Melbourne, FL 32940, U.S.A. Schwartz is an independ-ent contractor. The MATLAB code and the Simulink models used in this article can be obtained by e-mail from Gran.

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Page 2: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

This escape caused a count to be registered by the clock.Later it was realized that the escapement couldalso impart energy to the oscillating pendulumto keep it going.

Christiaan Huygens invented the escape-ment, shown in Fig. 1, in 1656. This type ofmechanism was responsible for the emer-gence of accurate mechanical clocks in the18th century. The mechanism uses the es-capement (parts 9-15 ) to achieve its accuracy.With the pendulum as the time reference, and the es-capement providing the regulation, Huygens was able tobuild a clock that was accurate to within 10 seconds per day.Previous clocks could vary by more than an hour if theywere not reset daily because the mechanisms did not havethe regulation capability of the Huygens escapement. Theywould slow down as the springs or weights that drove theclock lost energy.

Mechanics of a Pendulum ClockHow does an escapement work? The pendulum is mountedon a rigid structure in the clock called a “back cock” (Fig. 1,(1)). This structure allows the pendulum to swing freely, un-encumbered by the mechanism that drives the hands andthe escapement. The pendulum suspension (2) is carefullydesigned to allow the pendulum to swing with minimal fric-tion. The escapement imparts its force to the pendulum

through the crutch (3) and the crutch pin(4). The pendulum itself (5 and 7) moves

back and forth with a period that is deter-mined solely by its length (as shown by Gali-leo Galilei in 1582). The pendulum includes anut (8) at its bottom that can be adjusted tochange the effective length, thereby adjust-ing the period of the pendulum.

The escapement wheel (9) is linked to all ofthe gears in the clock (both the hands and the

windings) through gears not shown in the figure. Theescapement wheel is the mechanism we are designing here.

For the remainder of this description, we focus on the es-capement anchor (13) and its two sides. On the left side of theanchor is a triangular face called the entrance pallet (12) andon the right side is the exit pallet (15). As the pendulummoves to the left, it forces the anchor to rotate and ultimatelydisengage its face (11) from the escapement wheel (9). Whenit does, the exit pallet (15) engages the next tooth of the es-capement wheel and the gears move. If the pendulum is set toswing at a period of 1 s, the result of the motion of the escape-ment gear is to move the hands on the clock by one. When theright face of the anchor engages the gear at (15), the anchorand the escapement wheel interact. The escapement wheel,which is torqued by the winding mechanism, applies a forceback through the anchor, and then through the crutch andcrutch pin (3 and 4), to the pendulum. The alternate release

20 IEEE Control Systems Magazine August 2001

Pend. Angle

Model of a Pendulum Clock

Pendulum AngleForce

Esc. Accel.Esc. Spring Accel.Damping Accel.Gravity Accel.Pend. Angle

Esc. Accel.

EscapementDynamics

DisplayVariables

EscapementModel

Force

Design Gain

100+100s

Theta2dot

Damping Accel.

Gravity Accel.

1s

dampcoef 0.2

1xo s

InitialPend.Angle

Pend. Angleg*sin( )u

Gravity Forceg*sin(Theta)

1/plength

1/length

c/(m*len^2)

-K-

dampcoef=0.01g=9.8

plength=0.2485

Design Problem: Specify the amplitude of the force (through the design gain block)so the amplitude of the pendulum is 14° (0.2443 rad).

Thetadot

Figure 2. Simulink model for the pendulum clock. The subsystem block that contains the model of the escapement is shown in Fig. 3.

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Page 3: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

and reengagement of the anchor and escape wheel providethe energy to the pendulum that compensates for the energylost to friction. A by-product of this interplay of the pendulumand the escapement wheel is the distinctive, and comforting,“tick tock” sound that a clock makes.

The Escapement as a Control SystemTo analyze the interaction of the pendulum with the escape-ment, the pendulum can be treated as the plant in a controlsystem with the escapement acting as a feedback control.The escapement provides the energy to the pendulum sothe swing does not stop because of friction. The control alsocompensates for variations in the force from the driver (thewinding springs or weights) and the wear in the various me-chanical parts.

Thus, the clock model has two parts: 1) the plant model,the pendulum, and 2) the controller model, the escapement.

The pendulum model comes from the application of New-ton’s laws by balancing the force due to the accelerationwith the forces created by gravity. If the pendulum angle isθ,the mass of the pendulum is m, the length of the pendulum isl, the inertia of the pendulum is J (if we assume that the massof the pendulum is concentrated at the end of the shaft, theinertia is given by J = ml2), and the damping force coefficientis c (Newtons/rad/s), then the equation of motion of the pen-dulum is

J c mgl&& & sin( )θ θ θ+ = .

Equivalently, substituting for J, the model is

&& & sin( ).θ θ θ=− +cml

gl2

A Simulation Model for the ClockThe clock dynamics are simulated in the pendulum clockSimulink model shown in Fig. 2.

This model was built using integrators, gains, a summingjunction, and a mathematical function block that calculatesthe sine function.

The angular acceleration of the pendulum, Theta2dot, isformed at the right of the sum block and is calculated usingthe following three terms (clockwise in the summing junc-tion starting at the output):

• The damping acceleration from the equation above(dampcoef*Thetadot)

• The gravity acceleration from the equation above(g/plength*sin(Theta))

• The acceleration created by the escapement.The Simulink model creates the variables representing

the angular position and velocity, Theta and Thetadot, by in-tegrating the angular acceleration Theta2dot. A pendulumclock only sustains its oscillation if the pendulum is moved

to an angle that causes the escapement to operate; conse-quently, an initial pendulum angle of 0.2 rad (about 11.5°) isprovided to start the clock.

The Simulink subsystem that models the nonlinear es-capement mechanism is shown in Fig. 3.

The attributes of the escapement that are modeled are:• The angle of the pendulum at which the escapement

engages (applies an acceleration) is denoted byPenlow (this has a value of 0.1 rad).

• Penhigh denotes the angle of the pendulum at whichthe escapement disengages (jumps from one tooth tothe next; its value is 0.15 rad).

• The force is applied only when the pendulum is accel-erating (i.e., when the pendulum angle has a deriva-tive that is positive).

• Since the pendulum motion is symmetric, calcula-tions are only made for positive angles (the absolutevalue function block in Fig. 3). The force applied isgiven the correct sign by multiplying it by +1 or −1, de-pending on the sign of the angle.

The Escapement Control Design ProblemThe design problem is to create an escapement gear whosetooth slope imparts enough force into the pendulum at ev-ery swing to maintain its oscillation but at the same time lim-its the force so that the pendulum’s swing does not hit theclock’s case. Using the Simulink model in Fig. 2, this problemcan be interpreted in terms of selecting the value of the pa-rameter Design Gain. This parameter can be readily con-verted into a slope on the escapement gear’s teeth.

August 2001 IEEE Control Systems Magazine 21

Definition of the Describing FunctionAssume the nonlinearity is denoted by f(x,t). The inputx(t) is assumed to be

x t E t( ) sin ( )= ω ,

which results in the output

y t f E t t( ) ( sin( ), ).= ω

The describing function gain, K E( , )ω , is the fundamen-tal of the Fourier series representation of this periodicoutput, y(t), divided by the input amplitude E. Thus, thedescribing function gain is given by

{ }K ETE

f E t t t j t dtT

( , ) ( sin( ), ) sin( ) cos( )ω ω ω ω= +∫2

0

.

It should be easy to see how this definition is imple-mented in Fig. 4.

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Page 4: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

This control gain must be adjusted so that the system is un-stable (i.e., oscillates), and the oscillation must also be smallenough so that the pendulum doesn’t hit the walls of the clock.

We have established that the pendulum oscillationshould be 0.24 rad (or about 14°) to have the swing remainwithin the clock case. This amplitude is arbitrary, but forthe escapement to work, it must be greater thanthe value Penhigh in the Simulink model for the es-capement (Fig. 3).

The parameter Design Gain value must also besufficiently large so that the pendulum sustains theoscillation while the driving force drops as thespring on the clock unwinds.

The units of the gain are radians per secondsquared (rad/s2) per unit input (length over inertia).

Another attribute of the escapement, also mod-eled in Fig. 2, is the spring dynamics associated withthe escapement. These dynamics can be quite complex. For-tunately, the clock doesn’t require that these dynamics bemodeled accurately. A simple first-order time constant (of0.01 s) is used to model the escapement spring dynamics.

Finding the Gain UsingDescribing Function AnalysisThe describing function for a nonlinear system is a gain thatis derived by forcing the nonlinearity with an input of the

form E tsin( )ω . The resulting output of the nonlinearity is aperiodic function that can be analyzed using a Fourier se-ries. The first sinusoidal component (the fundamental) ofthis series is used to define the describing function gain.This gain always depends on the input amplitude and some-

times on the input frequency (see “Definition of the De-scribing Function” on the previous page).

Describing function methods have tradi-tionally been used as a technique for predict-ing limit cycles in systems with nonlinearities

(see [2]-[4]).Despite these dependencies, we can treat the

describing function as a linear gain for the purposeof this analysis. The gain depends on the amplitude

of the input, so when the oscillation is predicted forthe system, the amplitude of the oscillation will also

be determined. We will use the describing function topredict the value of the amplitude using the parameter De-sign Gain that results in the desired sustained oscillation.

When a nonlinearity is embedded in a system, it mayseem odd to use sinusoidal inputs to analyze the response.This procedure is justified whenever the nonlinear dynam-ics are such that the output of the nonlinear element is fil-tered in such a way that the higher frequencies arenegligible. That is indeed the case for the clock model, as aresult of the pendulum and escapement dynamics.

22 IEEE Control Systems Magazine August 2001

RestoreSign

<= =1 When Angle < Penhigh

=1 When Angle > Penlow>=

10.15 Penhigh

|u|

Abs

1PendulumAngle

0.1 Penlow

du dt/

Derivative

0 Penlow1

<

RelationalOperator3

=1 When Angle Decreasing

Product1

Force

Model of EscapementForce = 1 when Pendulum Angle is between Penlow and Penhigh and decreasing

Figure 3. Simulink subsystem that models the escapement dynamics.

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Page 5: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

Computing Describing Functionsfor Nonlinear ModelsA combination of MATLAB and Simulink is used to computethe describing function of the nonlinear model. The model,called GenerateDescribingFunction, is shown in Fig. 4. Thismodel implements the mathematical definition of the de-scribing function shown in the sidebar. This model is exe-cuted from within the function GetDF.m, which is written inMATLAB (Fig. 5). The use of Simulink to calculate the describ-ing function provides a visual aid for both the understandingof the calculation and for subsequent analyses.

It is easy to peruse Fig. 4 and understand what one is cal-culating and what one needs to change to calculate the de-scribing function for a different nonlinearity. The readershould be able to easily extract from Figs. 4 and 5 a methodfor calculating a describing function for any nonlinearity. Touse the Simulink model and the MATLAB function to gener-ate the describing function for any nonlinearity you choose,follow this procedure:

• Substitute the model of your nonlinearity for the blocklabeled “Nonlinearity Under Test” in theGenerateDescribingFunction Simulink model.

• Specify the vector of amplitudes, E, and frequencies,omega, in the file GetDF.m.

• Type GetDF at the command line.

Designing the Escapementwith MATLAB and SimulinkThe MATLAB Control System Toolbox is used to analyzethe clock. This Toolbox can represent linear systems as LTIobjects; LTI objects store all of the data for an LTI model.The object can be created in one of four forms:

• Transfer function model

• Zero-pole gain model• State-space model• Frequency response data (frd) model.The frd model stores frequency response data as a table

that consists of the complex amplitude at specified frequen-cies. If only frequency response data are available, you canuse frd models to represent linear system behavior in a feed-back control system. As is the case for all MATLAB objects,

August 2001 IEEE Control Systems Magazine 23

Division by 2T

pi./omega1

1s

E

23 23 23 Trigger at Stop

Stop Simulationat the End of One Cycle

In1

In2

Save Data

1./E/T

1./E/T

23

23

23

23

23

23

23

231s

cos(omega1*t)

–sin(omega1*t)

sin(omega1*t)

Gain

–1

E'*u In1 In223 23

AmplitudeVector "E"

fromWorkspace

NonlinearityUnder Test

23 23–f(t)*sin

pi./omega1

Divide by E to get DF

Divide by 2T

f(t)*cos

Figure 4. Simulink “GenerateDescribingFunction” model used to calculate the describing function for a fixed ω.

function [array]=GetDF(modelname)% This function will generate a describing function for the nonlinear element% in the Simulink block with the name given by the ASCII string modelname.% To call the function, use:% output_array = GetDF('modelname')% The output returned is an array whose dimensions are:% outputs by inputs by length(E) by length(omega)% where:% outputs = number of outputs from the nonlinearity% inputs = number of inputs into the nonlinearity% E is the vector of input amplitudes defined in this m-file% omega is the vector of input frequnecies (in rad/sec) defined in this m-file% To change E and omega, edit this m-file.E=[[0.15:.01:0.25],[0.3:0.1:0.9],[1:.5:3]];omega=[.5:.5:5 5.5:.1:6.2 2*pi 6.2:.1:7.5 7:.5:10];Nf=length(omega);array=zeros(1,1,length(omega),length(E));s=zeros(length(omega),length(E));for j=1:Nf omega1=omega(j); sim('GenerateDescribingFunction'); DF = (DFreal+sqrt(-1)*DFimag); s(j,:)=DF; array(1,1,j,:)=DF;endfigure(1); surf(E,omega,abs(s))shading interpylabel('Frequency (rad/sec)'); xlabel('Amplitude');zlabel('Describing Function Gain')title('Describing Function Amplitude vs. Frequency and Amplitude of Input')figure(2)surf(E,omega,angle(s))shading interpylabel('Frequency (rad/sec)'); xlabel('Amplitude');zlabel('Describing Function Phase')title('Describing Function Phase vs. Frequency and Amplitude of Input')

Figure 5. MATLAB code that generates the describing functionfrom the Simulink model of Fig. 4.

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Page 6: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

you can apply the usual operations ∗, /, +, and − to concate-nate frd models with any of the other LTI model types.

Because describing functions depend on the input ampli-tude (and possibly frequency), an frd object is an ideal wayto represent the describing function gain.

This is exactly what we do in the m-file GetDF, in which aset of frd models is stored in the variable called “array.”

The code in GetDF.m collects the describing functiongain and phase data by driving the simulation with sinu-soids at different frequencies and amplitudes. The ampli-tudes are all computed at once by vectorizing the Simulinkmodel. The frequency of the sine wave is changed in the loopin the GetDF m-file.

The m-file then performs the following tasks:• Drives the describing function Simulink models with

sinusoids whose amplitudes range from 0.15 to 3 rad.• Collects the amplitude-dependent frequency re-

sponse data in the variable “array,” which is then con-verted into a 1 by 1 frd object for every inputamplitude simulated.

Describing Functions and OscillationsThe result of running the GetDF m-file in Fig. 5 is the describ-ing function shown in Fig. 6.

The describing function gain in Fig. 6(a) starts at zerowhen the amplitude is zero and increases to a maximumvalue, after which it decreases. Only the value of the gain af-ter the maximum is plotted in Fig. 6 for clarity.

Let’s examine how the system operates in this region ofthe gain plot (where the gain decreases as the input ampli-tude increases). When the system gain is set to the value atwhich the system oscillates, the amplitude will be at somevalue. If the system were to change so that the effective gaindecreased (as, for example, when the clock unwinds), thenin this region of the frequency response curve the describ-ing function gain would increase. In a similar way, if the sys-tem gain were to increase (the user winds the clock), theamplitude would increase and the describing function gainwould decrease. This reasoning implies not only that the os-cillation is sustained, but that it is stable as well (in the sensethat the amplitude does not increase without bound).

For similar reasons, the region in which the describingfunction gain increases as the amplitude of the input in-creases represents unstable oscillations. This particularnonlinearity does not have a fundamental Fourier compo-nent that varies with frequency, so the describing functiongain is constant for all frequencies. However, it does have aphase shift, so the describing function is complex. In [2], ananalytic representation of this function was developed, andthe results from this computation are the same.

Conditions for Sustained OscillationThe conditions for having a sustained oscillation at a partic-ular frequency ω0 are that the signal that is fed back at thesumming junction (after the minus sign in Fig. 3) is exactly inphase at this frequency. Mathematically, this is equivalent tothe condition that at the frequency ω0 , the open-loop trans-fer function has unity gain and a phase of 180° or

GH j e j( )ω π0 = .

Therefore, to analyze the clock, we need to find the gainat which this condition is satisfied and then use the describ-ing function to calculate the amplitude of the oscillation thatthis gain produces.

The variable array generated in the GetDF program is atransfer function for each amplitude of the input. This is con-verted into an frd model using the command DFsys = frd(ar-ray,omega), where omega is the vector that contains thefrequencies at which the describing function was computed.

Once DFsys is available, it is concatenated with the trans-fer function of the pendulum and the spring and a frequencyresponse display tool called the “lti” viewer is opened to dis-play the result. The code to do this is as follows:

24 IEEE Control Systems Magazine August 2001

0 0.51

1.52 2.5

3

02

46

8100

0.5

1

1.5

2

2.5

3

3.5

Amplitude

Amplitude

Frequency (rad/s)

Frequency (rad/s)

Des

crib

ing

Fun

ctio

n G

ain

Des

crib

ing

Fun

ctio

n P

hase

–0.2

–0.4

–0.6

–0.8

–1

–1.2

–1.4

–1.610

86

42 0 0 0.5 1 1.5 2 2.5 3

(a)

(b)

Figure 6. The magnitude and phase of the describing function areplotted as functions of the amplitude and frequency of the input.

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Page 7: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

• dynamics = tf(1, [1 .01 (2∗pi)^2]) ∗ tf(100, [1 100]);• clocksys = DFsys∗dynamics• ltiview(‘bode’,clocksys)These instructions create the model of the clock dynam-

ics from the transfer function of the pendulum and thespring and store the series combination in the object called“clocksys.” Then the series combination of the describingfunction and the transfer function is created. The operator∗ used to perform this calculation is an overloaded methodthat can be applied to these types of objects in MATLAB.This operator behaves as the series concatenation oftransfer functions or systems (and frd arrays, as in the caseof DFsys).

Most operations in the Control System Toolbox are over-loaded. The last instruction, for example, opens the ltiviewer, displaying the Bode plots of the entire set of LTI ob-jects in the array DFsys to produce the plot in Fig. 7. Thereare 23 plots, since the describing function was created for 23values of the input E.

Analyzing the Array ofFrequency Response DataThe Bode plots of Fig. 7 come from the display of the ltiviewer in MATLAB. When you import an array of LTI modelsinto the viewer, the plots for the entire collection of modelsare displayed on the same plot.

In creating the transfer functions of the pendulum in theprevious section, we assumed that the value of Design Gainwas one. Among the array of Bode plots in Fig. 7 should be atleast one that has a 0 dB crossing with a phase shift that is180°. If this is the case (and it is), then one of the Bode plotswill just have a gain of 0 dB when the phase is 180°. We needto find this Bode plot and determine what input, E, it corre-sponds to.

Features of the lti viewer allow you to filter a set of Bodeplots for a set of models that have specified characteristics.

We can filter for those Bode plots that have a maximum thatis slightly below 0 dB and also slightly above 0 dB. Since thedescribing function was determined for only a small number(23 to be exact) frequencies, it is very likely that we do nothave precisely the input amplitude that would correspondto exactly 0 dB.

Fig. 8 shows the Bode plot for the 12th and 13th inputs inthe array of frd models. These two Bode plots satisfied ourselection criteria. As can be seen, the phase rapidly changesfrom about −50 to −250° within about 0.1 rad/s. Thus theclock oscillation will be at the desired 6.28 rad/s (one sec-ond period).

August 2001 IEEE Control Systems Magazine 25

Bode Diagram

Frequency (rad/s)

Mag

nitu

de (

dB)

Pha

se (

deg)

50

0

–50

–1000

–90

–180

–270

–36010

010

1

Figure 7. Bode plots of all 23 models in the LTI array clocksysusing the LTI Viewer.

Bode DiagramSystem: clocksys(:,:,16)Frequency (rad/s): 6.28Magnitude (dB): 0.41320

100

–1020304050607080

–––––––−

45

90

135

180

225

270

−10

010

1

Frequency (rad/s)

Mag

nitu

de (

dB)

Pha

se (

deg)

System: clocksys(:,:,17)Frequency (rad/s): 6.28Magnitude (dB): –1.94

Figure 8. The LTI Viewer displaying the Bode plots of the twomodels corresponding to the input amplitudes that are just aboveand below 0 dB.

950 951 952 953 954 955 956 957 958 959 960

950 951 952 953 954 955 956 957 958 959 960

0.2

0

–0.2

0.2

0

–0.2

0.2

0

–0.2

10

0

–10

0.5

0

–0.5

950 951 952 953 954 955 956 957 958 959 960

950 951 952 953 954 955 956 957 958 959 960

950 951 952 953 954 955 956 957 958 959 960

Escapement Acceleration

Escapement Spring Acceleration

Damping Acceleration

Gravity Acceleration

Pendulum Angle

Time

Figure 9. Simulation results for the final design gain.

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.

Page 8: Describing Function Analysis Using MATLAB and · PDF file · 2014-10-04Describing Function Analysis Using MATLAB and Simulink ... Although these types of clock mechanisms are no longer

The range from the 12th to the 13th models correspondsto amplitudes of pendulum swing between 0.3 and 0.4 rad,which is too large (we want 0.24 rad).

Selecting the GainThe last part of the analysis is to determine the value of theDesign Gain that will cause the oscillation to be 0.24 rad. Thearray of Bode plots contains an input amplitude of 0.24 rad,so we can look at this plot to find out how much higher than0 dB its peak is at the 6.28 rad/s resonance. The Bode plot forthe tenth model in the frd array has a peak of 18.8 dB. Thus,the required Design Gain is simply the amount that the peakmust be reduced to just have its value be 0 dB. From the factthat the Bode gain is 20 log10(H(jω)), the gain needed to re-duce the peak from 18.8 dB to 0 dB is

1

100114818 8

20

. . .=

Simulating the Pendulum with the Design GainThe simulation of Fig. 2 can now be modified to use the De-sign Gain of 0.1148 determined in the previous section.When this is done, the results are shown in Fig. 9. The ampli-tude of pendulum oscillation is indeed 0.28 rad, and the fre-quency of oscillation is almost exactly 6.28 rad/s.

In fact, the simulation can be used to verify that the es-capement controller has the desired properties of being in-sensitive to the driving force by varying the Design Gain upand down. We have seen that as a consequence of the de-sign, the only effect this will have is a change in the ampli-tude of the pendulum swing—the frequency of thependulum swing will not change.

ConclusionsWe have provided a means for calculating describing func-tions using computational tools. We applied these tech-niques to the control design of a pendulum clock with anonlinear escapement gear. Using object-oriented tech-niques, we analyzed the feedback control system design us-ing Bode plots, and from the plots calculated the requiredescapement gain that could be used to design the escape-ment gear.

The use of computer-aided design tools for complexcontrol analysis and synthesis has been recognized forsome time. There are features of computer-aided design,however, that to some extent are not fully appreciated bythe control community. This example, though relativelysimple, illustrates how a complex nonlinear system can beanalyzed with describing functions. The describing func-tions can be developed using the exact same tools we usedon this example.

From this exercise we were able to observe the following:

• The ability to analyze the system using both simula-tion and analysis tools is greatly enhanced if thesetools are the same.

• Object-oriented techniques aid in the analysis of non-linear systems when describing functions are used.

• There is a significant coding advantage when a visualenvironment is used.

It was not necessary that we use Simulink to compute thedescribing function. We could have coded the calculationusing other languages; however, having done so we can eas-ily reuse the code for generating describing functions forother nonlinear systems. It is easy for any user to do so sincethe visual representation allows the new user to rapidlycomprehend the code.

In our opinion, the reuse of computer code only takesplace when the new user can rapidly convince herself thatthe code does what it is advertised to do. We believe thatthis is the case for the Simulink model that computes the de-scribing function. The reader should be able to understandwhat is being done in this calculation by simply followingthe flow through the diagram. Thus, even though this calcu-lation could have been done entirely in MATLAB, the advan-tages of comprehension, error detection, and reuse makethis approach far better.

The ability to do computer-aided design using a visual pro-gramming environment like Simulink is only just beginning.The future of this approach to system design is unlimited.

References[1] British Horological Institute, (4 Dec. 1997) “Know your terminology–clocktime train,” [Online]. Available: http://www.bhi.co.uk/hints/clock.htm[2] J.E. Gibson, Nonlinear Automatic Control. New York: McGraw-Hill, 1963.[3] J-J.E. Slotine and W. Li, Applied Nonlinear Control. Englewood Cliffs, NJ:Prentice-Hall, 1991.[4] M. Rimer and R. Gran, “Analysis of systems with multiple nonlinearities,”IEEE Trans. Automat. Contr., vol. AC-10, no. 1, Jan. 1965.

Carla Schwartz received her Ph.D. in electrical engineeringfrom Princeton University. She has held faculty positions atMcGill University, the University of Vermont, and the Univer-sity of Florida, as well as visiting scholar positions atUniversité Catholique de Louvain in Belgium and the Univer-sity of Newcastle, NSW, Australia. She was also an AFOSR visit-ing faculty fellow at Wright Patterson AFB. For the past fouryears she has held senior writing positions at software compa-nies in the greater Boston area, including The MathWorks, Inc.

Richard Gran is President and CEO of the MathematicalAnalysis Co., a consulting company. He retired from TheMathWorks in 1999, where he was an Executive ConsultantHe received his bachelor’s, master’s, and Ph.D. degrees fromPolytechnic Institute of Brooklyn in 1961, 1965, and 1969, re-spectively. For 33 years after graduation, he was withGrumman Corporation. He retired from Grumman in 1985 asDirector of Advanced Concepts.

26 IEEE Control Systems Magazine August 2001

Authorized licensed use limited to: University of Michigan Library. Downloaded on May 19,2010 at 20:38:51 UTC from IEEE Xplore. Restrictions apply.