Sie sind auf Seite 1von 42

2.050J/12.006J/18.

353J Nonlinear Dynamics I: Chaos, Fall 2012

MATLAB primer 2

The objective of this document is to get you to a position where you can complete the MATLAB portion
on the PSet 6.
In the previous assignments we were able to plot a phase portrait using the function streamslice. This
plotting tool does a good job of representing the qualitative features of the phase portrait. However the
user is at the mercy of the code and doesnt necessarily have the ability to control where trajectories
start. Additionally this function does not give any time dependent information. What will be explained
in this MATLAB primer is a function called ode45. This function numerically solves the system for a
given initial condition and lets the users manipulate the results however they please.

ode45 Set Up

When trying to solve a system with ode45, two codes will actually have to be developed. These two codes
are the system and solver codes. Both these codes will have to be in the same folder that you are
working out of. Within the system code you will create a set of state equations, which will be used by
the solver. These state equations must be of the form
dx1
dt
dx2
dt
...
dxn
dt

= f1 (x1 , x2 , ...)
= f2 (x1 , x2 , ...)
= ...
= fn (x1 , x2 , ...)

Within the solver code you will select the initial conditions and have the solver command line included.

The solver command line

A sample solver command line is as follows


> > [T Y] = ode45(@sys,[0:.1:10],[1 0]);
The solver ode45 has three inputs. The rst input @sys is a function handle. It tells ode45 which
function to use as the system (this example will call the m-le sys.m). The next input [0 : .1 : 10] is
the vector of time-steps. The system will be integrated from t0 = 0 to tf inal = 10 with a time-step 0.1.
Finally the last input is [1 0] is the vector of initial conditions. This example is a second order system,
which has the initial conditions x(0) = 1 and x (0) = 0.
There are two outputs for this command line. The rst is T which is the time output by the command
and the other output, Y , is the system values as a function of time. In this example there are 101 time
steps and the dimensions of T are 101x1 and the dimensions of Y are 101x2. In this case the value Y (3, 1)
is the value of the rst system variable (i.e. x) at the third time step and the value of Y (10, 2) is the
value of the second system variable (i.e. x ) at the tenth time step.

5
6

0
X

Figure 1: Phase plane created using ode45 starting a variety of initial conditions

5
6

0
X

Figure 2: Phase plane created using streamslice starting a variety of initial conditions

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012

Matlab primer

The objective of this document is to get you to a position where you can complete the MATLAB portion
on the second problem set. It is by no means a comprehensive introduction to MATLAB.

Figure 1: Example of a MATLAB window GUI

Download MATLAB

If you do not already have MATLAB on your computer you will need to download it on the MIT website
http://web.mit.edu/student-matlab/ . This is a free package that only requires you have an MIT
certicate on your computer. Downloading it might take a while. If you dont have a certicate, you can
use Matlab at Athena clusters.

Download MATLAB Codes from Course Website.

Once MATLAB is up and running on your computer you will need to download the codes from the course
website. Make sure you put this le in the Matlab working directory (to be discussed in the next section).
$WKHQDLV0,7
V81,;EDVHGFRPSXWLQJHQYLURQPHQW2&:GRHVQRWSURYLGHDFFHVVWRLW

Working in the MATLAB environment

After the download is completed, open the application. You will be brought to the MATLAB window
(see an example in Figure 1). At the top center of the GUI is the command directory location bar. You
can put in whatever directory you would like to work out of. Put the M-les you download from the
course website in the working directory. To the left of the GUI is the list of les in your Command
Directory; make sure that the M-les are there. Finally the command line is where you will start to run
dierent commands ( try a couple things in this window, for example: 1+1, sqrt(9), a = [1 2 3];
figure(1); plot(a); ). To make sure everything is working ne type in help name-of-the-file.m
in the command line. If the les are in place a brief message should come up in the Command Window.
If you need help and examples with any matlab function, for example plot, type in help plot . A
description of the function with several examples will appear.

Working with the M-les

Within MATLAB there is the ability to write programs which can complete certain tasks. These les are
called M-les, and you just downloaded the example ones for this Pset. You will start to write your own
M-les as the course goes along. In order to open the M-les, nd the le you would like to open in the
Current Directory window on the left side of the GUI. Alternatively you can use the Open selection in
the File drop down in the top left of the GUI. You will have to modify the le you got for this Pset a
little bit. The examples within the code that you can use as a template.

Comments

We will continue to use MATLAB on a regular basis and you will be expected to have developed a
certain skill set after each Pset. In this case we are expecting that you are capable of opening MATLAB,
working with M-les, inputing data, and working with plots. There is a great set of support les built
into MATLAB. Simply, type in helpdesk into the command line.
Also, within the help les there is a section on matrices and arrays that you should be familiar with. This
section is located in MATLAB >> Getting Started >> Matrices and Arrays. The opening page of this
section is shown in Figure 2.

Other Matlab resources at MIT

Software at MIT: http://web.mit.edu/matlab/www/

Figure 2: Example of Matrices and Arrays in helpdesk

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Before we used ode45 only for autonomous systems.


Here once you rewrite equation as a second-order system, there is
time dependence on the RHS (i.e. it's not autonomous).
To use ode45 the same way we did before, you can treat it as a 3-dim system,
where time is a new independent variable z:
x' = y
y' = g(x,y,z)
z' = 1
(here x = theta, y = theta', z = time).
What changes in the code:
- you have to give initial conditions z = 0 at t = 0
- in the program that computes the RHS, the vector of the RHS is 3-dimensional and the third
component = 1.

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012


Problem 1: 1D dynamical systems. Population growth. The Allee eect

Due at noon on Friday Sept 14th, in the box provided (to the right of the entrance).
No late psets are accepted. If you collaborated with another student, list their names on the title sheet.
The work that you submit must be your own.
Main concepts: phase space (phase line, phase plane), xed points, their stability, review of linear
algebra (matrices, eigenvectors, eigenvalues) and its application to linear systems of ODEs.
Reading: Strogatz Ch.2, 18.03 notes (LS.1-6) (see below)

Helpful review material from 18.03


Review of 2nd order ODEs with constant coecients video lectures see Lecture 9: http://ocw.
mit.edu/courses/mathematics/18-03-differential-equations-spring-2010/video-lectures/
18.03 notes are on http://math.mit.edu/suppnotes/suppnotes03/index.html.

Problem 1: 1D dynamical systems. Population growth. The Allee eect


Strogatz 2.3.4

Problem 2: 1D dynamical systems. Potentials. Intro to bifurcations.


The dynamics of rst order systems x = f (x), can be pictured as a particle sliding down the walls of a
potential well, where the potential V (x) is dened by f (x) = dVdx(x) (Reference: Strogatz ch. 2.7).
1. Given the system x = sin(x) + , where is a real number, nd the potential V (x), sketch it, show
graphically how a particle would move for dierent values of ( = 0, 0.9, 1, 1.1).
2. For the same values nd xed points, their stability, sketch a phase portrait (phase line) with
arrows representing the ow between the xed points, label the xed points as stable, unstable,
semistable.
3. Sketch a graph of the x-coordinate of the xed points as a function of , for 0 1.2. Describe
what happens when passes through 1? You just witnessed the phenomenon of a bifurcation.
1

How would you dene this concept based on the one example of a bifurcation that you just witnessed?
(Do not look this concept up in the book, it has to be your denition that results from what you
observe).
4. In another system x = (x + 1)(x ) with a parameter , sketch the graphs of the x-coordinate of
the xed points, mark on the graph where the xed point is stable or unstable
5. The phenomenon of a bifurcation occurs again at = 1. Describe what happens, and modify
your denition of a bifurcation that you had above to include this case in the denition. Sketch
the phase line for the values of slightly below, at, and slightly above the bifurcation value = 1.
6. For the system x = (x+1)(x), sketch the phase line for the two values of , before the bifurcation
and after the bifurcation.

Problem 3: Linear oscillators (review of 18.03)


Given the equations for linear oscillators,
nd the general solution,
classify the oscillators as underdamped, overdamped, critically damped or undamped,
plot several trajectories as a function of time with dierent initial conditions.
a) + 10 + 41 = 0,
b) + = 0,
c) + 11 + 30 = 0,
d) + 6 + 9 = 0.

Problem 4: Linear systems of ODEs


For each of the equations in Problem 3,
1. change variables to (x, y), where x = , and y = ,
2. rewrite the second order ODE as a system of rst order ODEs for x and y and a matrix A,
3. nd eigenvalues and eigenvectors of the matrix A,
4. nd a general solution to the ODE,
5. (matlab) in the (x, y) plane plot some solutions (with dierent initial conditions) for each of the
cases, plot eigenvectors (if they are real), and label the systems as underdamped, overdamped,
critically damped or undamped. What can you say about the stability of the origin (x, y) = (0, 0)?

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012


Problem Set 2

Due by the end of day on Thursday, in the box provided ( until 5pm)  No late psets are accepted.
I f you collaborated with other students in the class, list their names on the title sheet.
T he work that you submit must be your own.
Main concepts: phase portraits for linear systems, fixed points of nonlinear systems, their stability,
phase portraits in the vicinity of a fixed point.
Reading: Strogatz C h. 5, 6.1-6.4.
MATLAB help: there is a sample M AT L A B code with examples of how to plot phase portraits and
vector fields of a dynamical system on a plane.

Problem 1: Stability of fixed points of linear systems of ODEs


Strogatz 5.1.10

Problem 2: Romeo and Juliet. Linear systems of ODEs


If x is a measure of how attracted Juliet is to Romeo, and y is a measure of how attracted Romeo is to
Juliet, and we model the evolution of their relationship as a linear system x = ax + by, y = cx + dy, then
1. do opposites attract? (i.e. analyze x = ax + by, y = bx ay).
2. is there a happy ending in the story of romantic clones x = ax + by, y = bx + ay?

Problem 3: Rabbits versus Sheep. Phase portrait for nonlinear systems of ODEs
The evolution of the populations of rabbits (x 0) and sheep (y 0) is described by
x = x(3 2x y), y = y(2 x y).
Find xed points, linearize the system near the xed points, nd eigenvalues, eigenvectors, determine
the stability of the xed point, and sketch the local phase portrait.
Attempt to complete the sketch of the phase portrait for the full system
(MATLAB) plot the phase portrait. Compare the plot to your sketch, note any dierences.
Describe dierent scenarios that the populations of rabbits and sheep would undergo depending on
the populations at time zero.

Problem 4: Nonlinear systems which depend on a parameter (preview of bifurcations)


Find xed points, classify their stability (it will depend on ).
Identify the values of the parameter , such that when passes through , the phase portrait
qualitatively changes (xed points appear, disappear, change stability, etc.). We say that at these
values of the bifurcation phenomenon occurs.
Sketch (or plot with MATLAB) local phase portraits when is just below, at, and just above .
As passes through , does the vector eld far away from the xed points change a lot?
a) x = x x2 , y = y,
b) x = x + x3 , y = y.

Problem 5: Centers are not structurally stable


For the following nonlinear system x = y + x3 , y = x + y 3 one of the xed points is at the origin.
Which phase portrait should the point have? It turns out that for systems with Re(i ) = 0 at the xed
point the linear analysis is inconclusive. We demonstrate it below.
a) linearize the system at the xed point at the origin and conrm that linear analysis suggests that the
xed point is a center
b) change variables from (x, y) to polar coordinates (r, ) using x = r cos , y = r sin , and the fact that
x 2 + y 2 = r2 , and = tan1 (y/x)
c) for this new system r = f (r, ), = g(r, ), analyze the rst equation (which you will probably have in
the form r = f (r, x, y)) and the xed point r = 0. Show that for some values of the origin (x, y) = (0, 0)
(which corresponds to r = 0) is stable, while for other values it is unstable. Comment on why this
disagrees with the conclusion of the linear theory.

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012


Problem Set 3

Due at 12:01 pm on Friday, September 28th, in the box provided. No late


psets are accepted. If you collaborated with other students in the class, list their names on the title sheet.
The work that you submit must be your own.
Main concepts: xed points in nonlinear systems, their stability, phase portraits, conservative systems
and nonlinear centers, non-dimensionalization.
Reading: Strogatz Ch. 6.

Problem 1: NL systems, linearization, phase portraits


Strogatz 6.5.19

Problem 2: Conservative systems: Glider


Strogatz 6.5.14

Problem 3: Conservative systems: General relativity and planetary orbits


Strogatz 6.5.7

Problem 4: Conservative systems


For the following system x
= (2 cos x 1) sin x,
1. Find the potential and the conserved quantity,
2. Rewrite the equation as a system in the (x, y) plane using y = x , nd the xed points, their stability
3. Sketch the phase portrait, plot it in MATLAB.

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012

Problem Set 4

Due at 12:01 pm on Friday, October 5th, in the box provided. No late psets
are accepted. If you collaborated with other students in the class, list their names on the title sheet. The
work that you submit must be your own.
Main concepts: Three bifurcations in 1D dynamical systems (saddle-node, transcritical, and pitchfork).
Reading: Strogatz Ch. 3.

Problem 1: Bifurcations of 1D dynamical systems. Normal forms.


For each of the following problems,
sketch all the qualitatively dierent vector elds that occur as r is varied.
Find at which x and for which critical values of the parameter r the bifurcation occurs.
Which bifurcation is it (saddle-node, transcritical, supercritical pitchfork, or subcritical pitchfork)?
Finally, sketch or plot in MATLAB the bifurcation diagram of xed points x versus r, and mark
the stable branches as solid lines, while the unstable branches as dashed lines. (Note: for some of
the cases it is simpler to plot the bifurcation in MATLAB).
(a) x = r cosh x
(b) x = xr xex
(c) x = rx sinh x
(d) x = 5 rex
(e) x = rx +

x3
1+x2

(f) x = r cos x

Problem 2: Hierarchy of models of shery


(based on Strogatz 3.7.3 and 3.7.4)
To understand the underlying dynamics of a real-world problem, one frequently considers a hierarchy of
models from the simplest one to a more complicated one. In this problem we consider three models of
sheries of increasing complexity. Your task is to analyze them using the material from the class, and to
see if one model is better than the other (for example, the dynamics of which one is more physical).
The simplest model for shery would be that in the absence of shing the population of sh is assumed
to grow logistically N = rN (1 N/K). Then to model the shing rate the simplest choices are:
(a) N = rN (1 N/K) H, where the sh is harvested at a constant rate H,
(b) N = rN (1 N/K) HN ,
N
(c) N = rN (1 N/K) H A+N
,
1

1. Interpret physically the form of the harvesting rate in (b) and (c). What does the parameter A
stand for physically. Which model of a harvesting rate do you think is more physical?
2. Non-dimensionalize the models to obtain the forms

a) x = x(1 x) h

b) x = x(1 x) hx

x
c) x = x(1 x) h a+x
3. For models (a) and (b) nd the xed points and determine their stability for dierent values of h.
Are any of them unphysical?
4. (MATLAB) plot the bifurcation diagrams for the cases (a) and (b). Label stable, unstable branches
and bifurcation points.
5. Do the normal form analysis in the cases (a) and (b) and obtain analytically the results you got
using MATLAB in the item above.
For model (c):
6. Show that the system can have one, two, or three xed points, depending on the values of a and h.
Classify the stability of the xed points in each case.
7. Analyze the dynamics near x = 0 and show that the bifurcation occurs when h = a. What type of
bifurcation is it?
8. Show that another bifurcation occurs when h = 14 (a + 1)2 , for a < ac , where ac is to be determined.
Classify the bifurcation.
9. Plot the stability diagram of the system in (a, h) parameter space. (The stability diagrams in 2
dimensional parameter space will be shown in class on Tuesday). Can hysteresis occur in any of the
stability regions?
And nally, your conclusions:
10. Now that you know the dynamics of the three models and its dependence on parameters, conclude
which model is more realistic, and which important (or not) physical eects it takes into account.
Which, if any, important eects does it miss?

Matlab help:
There is an easy way to plot parametrized curves in MATLAB which, once you see it, is obvious. It is
very useful for plotting bifurcation curves.
Usually one is plotting a curve, for example
x = 0:0.1:10; plot(x,sin(x));
However, say you need to plot a bifurcation diagram for x = r + sin(x), where r is a parameter, on the

(r, x) plane. Then you can reverse the arguments in plot:

x = -2:0.2:2; plot(-sin(x),x);

In general, when given a parameterized curve x() = cos(), y() = sin(), to plot it in MATLAB do

theta = [0:0.1:2*pi]; x = cos(theta); y = sin(theta); plot(x,y); axis equal;

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012

Problem Set 5

Due at 12:01 pm on Friday, October 12th, in the box provided. No late psets
are accepted. If you collaborated with other students in the class, list their names on the title sheet. The
work that you submit must be your own.
Main concepts: Bifurcations in 2D. Index theory.
Reading: Strogatz Ch. 8.1, 6.8.

Problem 1: Bifurcations in higher dimensions


1. Find and classify all bifurcations for the system x = y ax, y = by + x/(1 + x). Plot or draw the
stability diagram.
2. (Preview of limit cycles) In polar form the system is given by r = r(r2 r + 1), = 1, where
is a parameter. Discuss the bifurcations of the r equation, treating it as a 1D system. In 2D (i.e. in
the plane (x, y)) sketch all the dierent phase portraits. What happens in 2D when goes through
a bifurcation value for the r-equation?

Problem 2: Index theory


1. Use index theory to show which of the systems cannot have a closed trajectory:

a) x = x(4 y x2 ), y = y(x 1)

b) x = x(4 y x2 ), y = y(x 1)

(Hint: paying attention to where the nullclines are is helpful in this problem).

2. A local bifurcation of a smooth vector eld happens, where two xed points are born out of the
blue sky. What kinds of points can these be (nodes, saddles, spirals, etc.)? Explain.
3. A local bifurcation of a smooth vector eld happens, where one saddle point becomes three other
xed points. What are the admissible types of these three points? Explain.
4. A smooth vector eld on the phase plane is known to have a closed trajectory C, inside of which
there are two other closed trajectories C1 and C2 , neither of them are inside of each other. Sketch
the arrangement of the orbits and conclude where and which kind of xed points must be present?
Note: the solution is not unique, so you can comment on what is the minimal number of xed points
should be present.

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012

Problem Set 6

Due at 12:01 pm on Friday, October 19th, in the box provided. No late psets
are accepted. If you collaborated with other students in the class, list their names on the title sheet. The
work that you submit must be your own.
Main concepts: Limit cycles. Van der Pol oscillator.
Reading: Strogatz Ch. 7

Problem 1: Limit cycles


1. Sketch the phase portrait in the (x, y)-plane for the system given in polar coordinates

= r2 2, r = r(1 r2 )(r + 3).

2. Sketch the phase portrait in the (x, y)-plane for the system = 1, r = r + r3 , for

= 1, 0.36, 0.01, 0, 0.3. Describe what happens when passes through 0.

Problem 2: Numerical study of the Van der Pol oscillator.


Consider an electric circuit shown in Figure 1 with the input-output relation for the tunnel diode given
by:
i = t (v) = (v E0 ) + I0
with (v) = v 3 v. Here i is current, and v is voltage. The equation for the circuit can be written as:
V

1
((V ) W ),
C
1
V
L

(1)

E0

i=t(v)

W
L

I0

I0

E0

Image by MIT OpenCourseWare.

Figure 1: An electrical circuit with a tunnel diode for the van der Pol oscillator.

1. Show that the two above equations can be rewritten as:

1 ( 3V 2 )V + 1 V = 0.
V
C
LC
Non-dimensionalize it and bring it to the standard form of the Van der Pol equation:
x
+ (x2 1)x + x = 0.
2. Show that for small << 1 the amplitude of the limit cycle is about 2. What is the period of the
limit cycle? Does the period depend on the initial conditions? Contrast this behavior to the limit
case = 0. Document your answers with graphs of both the phase space and the displacement.
3. For large >> 1 the oscillations become relaxation oscillations. Show (numerically) that in this
case the amplitude of the limit cycle is still equal to 2. To keep the values of the velocity bounded,
choose less than or about equal to 10. Again, document your answer with graphs of both the
phase space and the displacement. Does the period depend on the initial conditions? For very large
>> 1 one can nd an approximate period of the Van der Pol oscillator (see Strogatz, p. 212-215).
Estimate the period of the limit cycle from your computed graphs. How does this period compare
with the period derived for large >> 1 in Strogatz?

Problem 3: Ruling out the limit cycles


Show that there are no limit cycles in the system using Index theory, or (Tue lecture) Dulacs criterion,
Liapunov function or the fact that the system is a gradient system.
1. x = x + y 2 , y = sin x + 4y
2. x = x(1 y), y = y(1 x)
3. x = y x3 , y = x y 5
(Hint: try a Liapunov function of the form V (x, y) = ax2 + by 2 , with suitable a and b.)
4. x = 2xy + cos(y), y = x2 x sin(y)

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012


Problem Set 7

Due at 12:01 pm on Friday, November 2nd, in the box provided. No late


psets are accepted. If you collaborated with other students in the class, list their names on the title sheet.
The work that you submit must be your own.
Main concepts: Poincar
e-Bendixon theorem, trapping region, Hopf bifurcation
Reading: Strogatz Ch. 7.3, 8.2-3

Problem 1: Poincar
e-Bendixon theorem, constructing a trapping region
Consider the system
x = x y + x3 , y = x y + y 3 .
(a) Show that there exists a periodic orbit for = 1 by constructing a trapping region
(b) (MATLAB) Plot the phase portrait for = 1 and = 1
(c) Find the value of for which the Hopf bifurcation happens.

Problem 2: A circular limit cycle


Consider a nonlinear oscillator:
x
+ ax (x2 + x 2 1) + x = 0.
(a) Find and classify all xed points (in the phase plane (x, x )) for a > 0, a < 0 and a = 0.
(b) Plot the phase portrait for a = 1 and a = 1. (After plotting them in MATLAB write the command
axis equal; It scales the x and the y axis the same, so that your circular orbits look circular, and not
ellipsoidal.) The phase portraits look strikingly similar, what is the transformation to change one of them
into the other one?
(c) Show analytically that there is a limit cycle for a = 0. What is its stability for a > 0 and a < 0?
(d) Determine the radius of the limit cycle analytically.
(e) Determine the period of the limit cycle analytically; check the answer with your numerics.
(f) Check that the condition for the Hopf bifurcation for the eigenvalues near a = 0 is satised, is the
bifurcation supercritical, subcritical or degenerate?

Problem 3: Oscillating chemical reaction


Strogatz 8.3.2

Problem 4: Numerics versus a Liapunov function


For this system a Hopf bifurcation occurs at = 0,
x = x + y
y = x + y x2 y.
(a) MATLAB: Plot the phase portraits for some < 0 and > 0. Deduce if the bifurcation is supercritical
or subcritical. (Note: use ode45, since streamslice plots will be inconclusive).
(b) For = 0 check analytically if the origin is stable or not, does it give you the same prediction as
numerics? (Hint: for = 0 the system can be easily rewritten as a second-order equation for x which
models a nonlinear oscillator, this will help you to construct a Liapunov function).
(c) Sketch a bifurcation diagram.

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012


Problem Set 8

Due at 12:01 pm on Friday, November 9th, in the box provided. No late


psets are accepted. If you collaborated with other students in the class, list their names on the title sheet.
The work that you submit must be your own.
Main concepts: Bifurcations of limit cycles, Poicar
e map
Reading: Strogatz 8.2-3, 8.7

Problem 1: Global bifurcations of cycles


Strogatz 8.4.1

Problem 2: Global bifurcations of cycles


Discuss the bifurcations of the system r = r( + 5 r2 + 6r), = 1 + r. Plot all the possible topologically
dierent phase portraits in (x, y).
Note: If there are 3 of them for values of = 7, 8, 9, for example, to save time and paper you can plot
them in subplots:
mu = [7,8,9];
figure(123);
for i = 1:3,
subplot(2,2,i); streamslice(x,y,xdot,ydot);
axis equal; grid on; xlabel(x); ylabel(y); title([mu = , num2str(mu(i))]);
end

Problem 3: Poincar
e maps
Given a vector-eld:
J
x = x y x x2 + y 2 ,
J
y = x + y y x2 + y 2 ,
1. Plot the phase portrait in MATLAB. Do you see any periodic solutions?
2. Rewrite the system in polar coordinates. Is there a stable limit cycle?
3. You should obtain in (2) that the cycle makes one revolution in = 2. Given that, integrate the
r-equation between some value r1 for which = 0 to a value r2 for which = 2, then write r2 as
a function of r1 . You just obtained the analytical form of the Poincare map: rn+1 = f (rn ).
1

4. Use MATLAB or any other computational software to compute the rst 10 iterations of the Poincare
map (i.e. x1 = f (x0 ), x2 = f (x1 ), etc.) starting from the initial conditions r = 0.2, = 0. Submit
those numbers. Do they approach any particular value?
5. In MATLAB plot the function that you just obtained and on top of it plot rn+1 = rn . Use the
commands grid on; axis equal; Print this out and iterate this map by hand (cobwebs) from the
initial conditions r = 0.2, = 0. Is it the same as in the previous question?
6. Repeat the previous two items for a trajectory starting at r = 0.5, = 0. Does the trajectory
converge to the same number? You just found a stable xed point of a 1-dimensional map.
7. Compute the multipliers (Lecture on Tue).

Problem 4: Poincar
e maps iterating Poincar
e maps
Given two Poincare maps below
1. Print their graphs out as in Problem 3.5 (with the grid on; and the plotted diagonal rn = rn+1 ).
Iterate them by hand using graphical technique of cobwebs and nd the approximate values of the
stable and unstable xed points (which correspond to stable and unstable limit cycles).
2. Then iterate them using the computer from the same initial conditions as you did by hand, and this
will give you numerical values of the xed points. Report those.
3. What is the dierence in the way that the iterations approach a stable xed point in (a) versus in
(b)? What condition on the derivative of the map at the xed point would give you one type of
approach versus the other one?
(a)

rn+1 = rn + 0.5 sin(rn ),

(b)

rn+1 = rn ln(rn ),

0 rn 8,

0 < rn 3.

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012

Problem Set 9

Due at 12:01 pm on Friday, November 16th, in the box provided. No late


psets are accepted. If you collaborated with other students in the class, list their names on the title sheet.
The work that you submit must be your own.
Main concepts: Matthieus equation, Floquet theory
Reading: Lecture on Matthieus equation is posted online
In class analyzed a vertically driven pendulum described by the Matthieus equation. Physically this is a
frictionless pendulum in oscillating gravitational eld.
+ 02 (1 + h cos(2t)) = 0,

h 0.

(1)

For the pset you have to study the stability of the periodic solution with friction, i.e. equation
+ + 02 (1 + h cos(2t)) = 0,

> 0.

(2)

1. Describe what the terms mean physically, consider h = 0 and = 0 cases.


2. (Numerical) Pick some values of the constants (e.g. h = 0.2, 0 = 1), and look numerically for
the typical examples of the behavior of the system (both as a time-evolution (t) and on the phase
plane (, )). For the same initial conditions, plot in MATLAB both the time-evolution and the
trajectory in phase plane for dierent values of (for examples, = 0, 0.1 and 0.3). Try close
to 0 Describe which distinct physical regimes you have depending on the damping parameter,
amplitude and frequency of the forcing.
Note: this system has time-dependence in the coecients.
3. (Analytical) Since after adding damping this is still a linear system with periodic coecients, you
can apply the Floquet theory. It states that the solution can be written in the form of an exponential
function multiplying a periodic function, which we represent as a sum of cosines.
(t) = e

an cos(nt + n ).

n=1

Plug this expression in (2), collect the terms in front of a1 and set them equal to zero. Explain the
reason behind this.
Drop the high frequency terms (as in lecture, when we dropped cos(3t + )). It can be shown that
that term is negligible.
4. In the expression that you obtained, collect the terms in front of sin(t) and cos(t). Set both of
these groups equal to zero. Explain the reason behind the step.
5. The two equations that you obtained can be analyzed as a system of two linear equations for
cos() and sin(). When does this system have a solution? Deduce the criterion for existence of
a non-trivial (i.e. not identically zero) solution. This will be your fourth order equation for , the
coecients will depend on , 0 , and h.
1

6. Find the boundary of instability, i.e. nd where = 0 as a function of h and /0 . To which side
of that boundary will the solutions be unstable? Plot it on the (h, /0 ) plane for small h.
7. The criterion for instability in the undamped case derived in class was
h > 2
1

(3)

Plot it in Matlab, denote the regions of stability, instability. For innitesimally small h, what is the
frequency at which the pendulum is unstable? How does this frequency relate to the frequency of
unperturbed pendulum?
Note: It is not the same. Its a dierent instability threshold than that of the undamped forced
pendulum x
+ 02 x = cos(2t), for which the resonance happened when the forcing frequency 2
was equal to the natural frequency 0 . Because of the relation that youll nd, the instability is
called subharmonic.
8. On the same Matlab plot, plot the boundary of instability for the damped case for two values of
/0 = 0.1 and /0 = 0.5. Interpret the change of the instability domain physically.
9. Now that you analyzed the system analytically, check your numerical experiments in question 2 and
explain the behavior that you saw given that now you have a new perspective.

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012


MIDTERM (At-home portion)

Problem 1: Bifurcations a biochemical switch


A gene G, usually inactive, is activated by a biochemical substance S to produce a pigment or other gene
product when the concentration S exceeds a certain threshold.
Let g(t) denote the concentration of the gene product, and assume that the concentration s0 of S is fixed.
The model is
g = k1 s0 k2 g +

k3 g 2
k42 + g 2

(1)

where ks are positive constants. The production of g is stimulated by s0 at a rate k1 , and by autocatalytic
(positive) feedback process modeled by the nonlinear term. There is also a linear degradation of g at a
rate k2 .
1. Nondimensionalize the equations and bring them to the form
dx
x2
= s rx +
,
dT
1 + x2

r > 0,

s 0.

(2)

2. Show that if s = 0 there are two positive fixed points x if r < rc , where rc is to be determined.
3. Find parametric equations for the bifurcation curves in (r, s) space.
4. (MATLAB) plot quantitatively accurate plot of the stability diagram in (r, s) space
5. Classify the bifurcations that occur.
6. Assume that initially there is no gene product, i.e. g(0) = 0, and suppose that s is slowly increased
from zero (the activating signal is turned on); What happened to g(t)? What happens if s then
goes back to zero? Does the gene turn off again?

Problem 2: Nonlinear oscillator


Given an oscillator x
+ bx kx + x3 = 0, b, k can be positive, negative or zero.
1. Interpret the terms physically for different values of b and k.
2. Find the bifurcation curves in (b, k) plane, state which bifurcation happens and what kind of fixed
points one has to each side of the bifurcation curve.

Problem 3: Numerical study of the displaced Van der Pol oscillator


The equations for a displaced Van der Pol oscillator are given by
x = y a,

y = x + (1 x2 )y,

a > 0,

> 0.

Consider a small.
1. Show that the system has two equilibrium points, one of which is a saddle. Find approximate
formula for small a of this fixed point. Study this system numerically with ode45.
2. Submit the plots of phase plane with trajectories starting at different points (to illustrate the
dynamics) for = 2, a = 0.1, 0.2, 0.4, and observe that the saddle point approaches the limit cycle
of the Van der Pol equation.
3. Find numerically the value of the parameter a to two decimal points when the saddle point collides
with the limit cycle. What happens to the limit cycle after this collision?

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

2.050J/12.006J/18.353J Nonlinear Dynamics I: Chaos, Fall 2012

Midterm Practice Problems

The midterm exam will have a classroom written portion and a take-home computational
portion.
The best preparation for the exam is problem sets (the solutions are posted online). The solution to the
PSet 6 will be online on Friday just after it is due.

Topics
You now know how to analyze models of physical phenomena that are modeled as one and two-dimensional
systems of ODEs that can depend on parameter. The steps in the study are
1. Non-dimensionalize the system, thus reducing the number of parameters in the problem.
2. Find xed points, study the local phase portrait near these xed points
(a) if the xed points are hyperbolic, then the linear theory gives the correct phase portrait
(b) if the linear system predicts centers, then one has to do extra work. Nonlinear centers appear
in the cases of conservative systems, reversible systems. Otherwise more work is needed to
determine if the phase portrait is a spiral, or a center, or something else. (Strogatz Ch. 7).
(c) in case of zero eigenvalues one has to use dierent techniques (for example, graphical techniques)
to deduce the stability of a xed point. For example x = x2 (x = 0 is semi-stable), x = x3
(x = 0 is unstable), etc.
3. Deduce some of the characteristics of the global phase portrait (look at nullclines, fences and
funnels techniques from 18.03, perhaps you can nd a trapping region).
4. Check if there could be closed orbits in the system, or you can rule out their existence
(a) in case of Lienard systems, there exists a unique stable limit cycle
(b) check the index theory, perhaps you can show that there are no closed orbits
(c) check if the system is conservative (then in 2D you can only have saddles and centers)
(d) check if you can rule out closed orbits completely (Dulacs criterion, existence of a Liapunov
function, gradient systems)
5. Study dependence of the system on parameters bifurcation theory.
(a) Bifurcations we studied in both 1D and 2D are saddle-node, transcritical and pitchfork bifur
cations (but in PSets you had examples of others).
(b) Find where they occur (in 1D for x = f (x, r), r-parameter, can look at the system f (x, r) = 0,
f (x, r)/x = 0).
(c) Expand f (x, r) near a critical point x = x (xed point) and r = rc (where the bifurcation
happens), nd the normal form, deduce the type of the bifurcation
1

(d) Sometimes it is easier to see graphically when a bifurcation occurs. For example, if
x = f (x) = ex (x + a), then the bifurcation occurs when the curve y = ex touches the
straight line y = x + a. The same graphical technique is applicable to the second order systems
when you can check when the nullclines start to intersect as you vary a parameter.
6. Last but probably the most important item: interpret your answer physically. For example, in
the laser system you nd a transcritical bifurcation, and that a stable xed point at zero loses
its stability at the bifurcation point and a new stable equilibrium exists for the larger value of
parameter. However, you should reinterpret your answer physically that below the critical value of
the parameter the system acts like a lamp, while above the laser threshold it acts like a laser.

Sample problems
1. Non-dimensionalization:
Pset 2, 3, 6
Extra sample problems: 3.7.5, 6.4.4-6, 6.4.7, 8.1.10 (these are all long problems, they all have good
examples of non-dimensionalization, but if you try to fully complete all the questions in them, it
will take a very long time)
2. Stability of xed points, linear phase portraits:

all psets. Special cases: Pset 2, problem 1.

Extra sample problems:

x = x3 , y = y

x = x2 , y = y

Strogatz problems: 5.2.3 - 5.2.10.

3. Nonlinear centers:
Pst 2, problem 5, Pset 3 (conservative systems), reversible systems (Strogatz, problems in 6.6).
Extra sample problems: 6.5.13
4. Using nullclines to deduce something about the system:
in case of bifurcations (Strogatz, example 8.1.1.), in case of a trapping region (Strogatz, Glycosis
example 7.3.2).
Extra sample problems:
8.1.6,
5. Closed orbits:
(1. prove that there are some) NL centers (pset 3), 6.5.3, 6.6.5, 6.1.1
(2. rule out closed orbits): Pset 6, 6.8.7, 7.2.6, 7.2.8, 7.2.12, 7.2.14
(3. limit cycles): Pset 6, 7.4.2, 7.1.7
(4. non-isolated periodic orbits): everything about linear and nonlinear centers
6. Closed orbits: limit cycle versus centers:

Pet 6, problem 1 (case = 0 versus > 0).

Extra sample problems:

7. Bifurcations in 1D, 1 parameter:


Pset 4,
Extra sample problems: 3.1.1-4, 3.2.1-4, 3.4.1-4, 3.4.5-10, 3.1.13. Plot bifurcation diagrams. 3.5.4.
8. Bifurcations in 1D, 2 parametrs:

Pset 4,

Extra sample problems: 3.7.5

9. Bifurcations in 2D:

PSet 5, problem 1

Extra sample problems: 8.1.1-7, 8.1.10, 8.1.13

10. Index theory:


Pset 5
Extra sample problems: 6.8.2-5 (unusual examples), 6.8.9, 6.8.6,
Can there be two xed points inside a limit cycle? If so, give an example (graphically, do not make
up equations for it).
11. Oscillators:

linear oscillators: (18.03) underdamped, undamped, critically damped oscillators (Pset 1),

nonlinear oscillators: x
+ bx + sin x = 0, Van der Pol, ... (Pset 6, rst lectures).

Matlab
For the take-home section, you should be able to plot things in Matlab and be able to use it to make
some research conclusions. Sample problems are of the type:
1. Use streamslice to plot the phase portrait for any of the 2D systems listed above
2. Use plot to plot bifurcation diagrams and trajectories x(t), y(t) as a function of time
3. For many problems streamslice does not give good results at all (examples in the last Matlab
primer). Use ode45 in those cases, and choose where you start the trajectories yourself.
You should be able to plot phase portraits for any one of the problems listed above and in the psets.
Make sure that your plots are *not* inconclusive. For example:
1. if you want to show that a trajectory converges to a xed point, and you compute the trajectory
via ode45, choose a long enough time-interval to show that it does.
2. if you want to show that trajectories are attracted to a xed point from all directions, pick the
initial conditions all around the xed point, and not in one small area to one side of the xed point
3. label your plots accordingly. It is useful to put the parameter value in the title when you vary the
parameter and have many plots. In the following example we vary between 0 and 1 in steps of
0.1, then plotting something with the title reading mu = 0.3:
4. We are dealing with solutions to ODEs. They are all dierentiable. Therefore in your plots the
solutions should never have any corners (which happen if you plot a function with low resolution, for
example x = [0:1:10]; plot(x,sin(x)); So always make sure that you have enough resolution
when you plot the trajectories (in phase space, or time-evolution plots).
mu = [0:0.1:1]; x = [0:0.1:3];

for i = 1:length(mu),

figure(1);

plot(x,sin(x)*mu(i));

title([mu = ,num2str(mu(i))]);

end

MIT OpenCourseWare
http://ocw.mit.edu

18.353J / 2.050J / 12.006J Nonlinear Dynamics I: Chaos


Fall 2012

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.