Download - Phase portraits
-
8/12/2019 Phase portraits
1/27
Mathematical Models - DN2266
Homework 3 - Phase portraits
Teachers
Anna-Karin TORNBERG
Rikard OJALA
Authors
Pierre-Alexandre BEAUFORT
Hadrien VAN LIERDE
October 2013
-
8/12/2019 Phase portraits
2/27
Contents
1 Scaling a differential equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Homogeneous differential equation. . . . . . . . . . . . . . . . . . . . . . 11.2 Non-homogeneous differential equation . . . . . . . . . . . . . . . . . . . 2
2 Stability of a first order ODE-system . . . . . . . . . . . . . . . . . . . . . . . . 32.1 Manifolds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Asymptotical behaviour . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Prey-predator model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 Setting the equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.2 Behavior of the solution . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.3 Critical points. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.4 Scaling of the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 113.5 Analysis of the critical points . . . . . . . . . . . . . . . . . . . . . . . . 12
A Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17A.1 Proposition1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17A.2 Proposition 1bis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18A.3 Proposition2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18A.4 Figures for the second set of datas. . . . . . . . . . . . . . . . . . . . . . 20
A.5 Phase_Portrait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
0
-
8/12/2019 Phase portraits
3/27
1 Scaling a differential equation
In this section, we show how to scale a homogeneous and a non-homogeneous differential equa-tion.
1.1 Homogeneous differential equation
The following differential equation describes damped free oscillations:
md2u
dt2 +c
du
dt +ku = 0
where u [m] is the deviation from a stationary position and t [s] is the time. Under thisform, the equation contains three parameters: the mass m [kg], the damping constant c [kg
s],
and the spring constant k [Nm
].
We first define the two following quantities:
0, the undamped frequency such that [0] =s1 (we will give the value of0 further),
=0t, a dimensionless time.
With this new variable, the equation becomes(i):
m20u+c0u
+ku = 0
Dividing the two members of the equality by m20 , we obtain:
u+ c
m0u+
k
m20u= 0
To simplify this expression, we choose 0 =
km
and we introduce the critical damping c0 =
2
km. We then obtain the following equation:
u+ 2c
c0u+u= 0
This equation only depends on one parameter, which we note = cc0
. The final equation is:
u+ 2u+u= 0
(i)Here, we note u = dud
(). As u is normally a function oft, the exact form would be dd
[u( 0
)].
1
-
8/12/2019 Phase portraits
4/27
1.2 Non-homogeneous differential equation
In the case of forced oscillations, the equation is:
md2u
dt2 +c
du
dt +ku = Fcos(t)
We introduced two additional parameters. We follow the same steps as before but we introducea few more constants.We first define the four following quantities:
0, the undamped frequency such that [0] =s1 (we will give the value of0 further),
L [m], a reference length of displacement,
=0t, a dimensionless time.
u= uL
, a scaled displacement
With this new variable, the equation becomes(ii):
m20Lu+c0Lu
+kLu= Fcos(
0)
Dividing the two members of the equality by m20L, we obtain:
u+ c
m0 u+
k
m20 u= F
m20Lcos(
0 )
To simplify this expression, we choose 0 =
km
, L = Fm2
0
= Fk
and we introduce the critical
damping c0= 2
km. We then obtain the following equation:
u+ 2c
c0u+ u= cos(
0)
This equation only depends on two parameters, which we note = cc0
and = 0
. The finalequation is:
u+ 2u+ u= cos()
(ii)Here, we note u = dud
() = dd
[ 1L
u( 0
)].
2
-
8/12/2019 Phase portraits
5/27
2 Stability of a first order ODE-system
We study here the stability of the linear system of differential equations :
u=
1 1P 1
Au (1)
where P . First, we determine the type of phase portrait according to the value ofPand -if it is possible - the slopes of the manifolds. Then, we compute lim
tu(t) and lim
tyx
(t) (iii),i.e.
the asymptotical behaviour of the integral curve(iv) .
2.1 Manifolds
The characteristic polynomial ofAis2 + 2+ (1 P), whose the roots are 1,2 = 1
P.Observe if1,2 0, the fast manifold is this with the smallest eigenvalue. According to thevalue ofP, the phase portrait is : P >0: eigenvectors are v1 = (1,
P) and v2= (1,
P).
P (0;1) 2< 2 < 1< 1 < 0 Stable node with fast manifold along v2 and slow along v1
P = 1 1,2= 0,2 Marginallystable node(v)
P (1;+) < 2< 2< 0 < 1 < + Saddle point with stable manifold along v2 and unstable along v1
P= 0 1,2 = 1Matrix A is defective since there is a single eigenvector (; 0) (vi) according to
(A+I)z1= 0 =
0 10 0
xy
Then, we have to compute the solution in the defective case:
(A+I)z2 = z1
If we take = 1, we get (;
1) (vii). Let = 0. The solution of this system is given by:
u(t) = (az1+b(tz1+ z2))exp(t)
Observe the solution is asymptotically stable(viii).
P
-
8/12/2019 Phase portraits
6/27
Now, we are going to compute the slopes of manifolds, if it is possible. Therefore, we have tocompute the nullspace of(A I):
1 + 1P 1 +
Bz= 0
As we know the case P = 0 gives a defective matrix A, we consider P= 0. The nullspacehas non-zero vector only if B is not full rank. We check thus if the second row is a linearcombination of the first and itself:
1 + 1
0 P(1+)2
P
It is the case ifP= (1 +)2.
Actually, it is always the case since is the solution of(1 + )2P = 0. Let z:= (x; y). Then,Kerf(B) y= (1 +)x. As 1,2 = 1P, the slopes of manifolds areP (ifP 0).
2.2 Asymptotical behaviour
We study the asymptotical behaviour owing to :
eigenvalues 1,2 = 1
P
associated eigenvectors v1,2 y=
P ; here, v1,2 = (1,
P) (ix)
solution u(t) =av1exp(1t) +bv2exp(2t)
initial conditions u0:= u(t= 0) =av1+bv2
Our study focuses on limt
u(t) and limt
yx
(t). Then, we notice these asymptotical behaviors
depends on the value ofPand the initial conditions(x). In all cases, we assume that(a, b) = (0, 0)(this case leads to the trivial solution u(t) = 0).
P (0;1) u= a
1
P
exp(1t) +b
1
P
exp(2t), with 2< 1
-
8/12/2019 Phase portraits
7/27
P (1;) u= a
1
P
exp(1t) +b
1
P
exp(2t), with 2 < 0 < 1.
ifa = 0, both components ofu are unbounded ; ifa= 0,ut
0
y
x=
Pb exp(2t) a exp(1t)b exp(2t) +a exp(1t)
=
Pb exp((2 1)t) ab exp((2 1)t) +a
y
xt
P ifa = 0 ; ifa= 0 and b = 0, y
xt
P
P= 0 u=
a
10
+b
t
10
+
01
exp(t)
ut
0a, by
x=
ba+bt
yxt
0 if(a, b) = 0
P P0= 1, ifu0
= (;
P ),
C0. The following table1 gives the type of phase
portrait on either side.
P
-
8/12/2019 Phase portraits
8/27
3 Prey-predator model
In this section, we consider the following two-species model:
dx
dt = a(x, y)x
dy
dt = b(x, y)y
(2)
where x and y denote the populations of two species and a and b denote the correspondinggrowth rate.
3.1 Setting the equation
Let us assume that y denotes the predator population and xdenotes the prey population. Weintroduce the following assumptions (both in english and in mathematics):
1. if there is not enough prey, the predator population declines:
for a certain 1 R+0, x < 1 b(x, y)< 0y R+
2. an increase in the prey population increases the growth rate of the predator:
b
x(x, y)> 0x, y R+
3. if no predators are present, a small prey population will increase: there exists >0 suchthat
a(x, 0)> 0x ]0, [4. if the prey population goes beyond a certain size, it must decrease:
for a certain 2 R+0, x > 2 a(x, y)< 0y R+
5. if the predator population increases, the growth rate of the prey population declines:
a
y(x, y)< 0x, y R+
Many types of functions could satisfy these assumptions. We thus consider the specific model
a(x, y) = y xb(x, y) = x y
with ,, ,, , >0.
Let us show that this model respects the five assumptions given above. First of all, we intro-duce an obvious assumption based on the definition of a prey-predator model: it is obvious
that, for a given population of prey, if the predator population increases a little bit, then thegrowth rate of the predator population should decrease which can be expressed as by
0. To justify the presence of all other constants, we use assumptions 1 to 5:
6
-
8/12/2019 Phase portraits
9/27
2) bx
>0 >0;3) If we choose 0, then a(x, 0) < 0x > 0, we thus have to choose > 0, in which casecondition 3 is verified;5) a
y0
4) for a certain y 0, ifx > y , then a(x, y)< 0; in particular, ify = 0, this inequalitymust also be verified for x large enough; but, as > 0, if < 0, x > is never verified for
anyx >0; for this reason, we necessarily have >0;1) for a certainy >0, ifx < +y, we haveb(x, y)< 0; this must be true for0 < y < >0;as >0, we must have x < +y
; let us assume 0, find u= (x, y) C1([0,
[) such that
dxdt
= ( y x)x
dy
dt = (x y)y
x(0) = x0y(0) = y0
(3)
We want to show that the solution of this problem is strictly positive: x(t), y(t) > 0
t. To
prove this, we are going to use the following propositions:
Proposition 1
Let u0 R2. We define the following problem: findu C1([0,[) such thatdxudt
= ( yu xu)xu
dyudt
= (xu yu)yu
u(0) = u0
(4)
Then there exists a unique solution u to this problem andu C([0,[).
7
-
8/12/2019 Phase portraits
10/27
Proposition 2
Let u0,v0 R2 such that u0= v0 andu= (xu, yu),v= (xv, yv) C1([0,[) verifying:
dxudt
= ( yu xu)xu
dyudt
= (xu yu)yu
u(0) = u0
(5)
dxvdt
= ( yv xv)xv
dyvdt
= (xv yv)yv
v(0) = v0
(6)
Then u(t) = v(t)t. Moreover, fort1 t2, u(t1) = v(t2) ifu(t) = v0t t1.
The proofs of propositions1and2are in appendicesA.1andA.3. Let u = (x, y)be the solutionof3. Let us assume that
t2>0 such that x(t2) 0 or y(t2) 0
then, by continuity of the solution, there exists t1
]0, t2[ such that exactly one of the three
following conditions is verified:
case 1: (x(t1), y(t1)) = (0, 0) and x(t), y(t)> 0t < t1 case 2: x(t1) = 0, y(t1)> 0 and x(t), y(t)> 0t < t1 case 3: x(t1)> 0, y(t1) = 0 and x(t), y(t)> 0t < t1
In each case, we will prove that there exists one other curve that verifies 3but with different
initial conditions and that verifies one of the three conditions above. This leads to a contradic-tion according to proposition2 which proves that x(t), y(t)> 0. Let us analyze the three casesone by one.
Case 1: (x(t1), y(t1)) = (0, 0) and x(t), y(t)> 0t < t1
Let u1= (x1,y1) be the solution of
dx1dt
= ( y1 x1)x1
dy1dt
= (x1 y1)y1
u1(0) = (0, 0)
(7)
8
-
8/12/2019 Phase portraits
11/27
Then, by proposition1, the unique solution to this problem is u1(t) = (0, 0) t. We verify thusu(t1) = (0, 0) =u1(t1) which contradicts proposition2.
Case 2: x(t1) = 0, y(t1)> 0 and x(t), y(t)> 0t < t1
Let u2= (x2,y2) be the solution of
dx2dt
= ( y2 x2)x2
dy2dt
= (x2 y2)y2
u2(0) = (0, 2y(t1))
(8)
Then, one can prove the three following properties:
1. x2
C([0,
[) by proposition1,
2. dx2
dt(0) = 0 (obvious),
3. dnx2
dtn(0) = 0n: if d
n1x2dtn1
(0) = 0 then
dnx2dtn
(0) = dn1
dtn1
dx2dt
(0)
= ( y2(0) x2(0))dn1x2
dtn1(0) + ( d
n1y2dtn1
(0) dn1x2
dtn1 (0))x2(0) = 0
As dx2
dt(0) = 0,
dnx2dtn
(0) = 0n.
The first condition above allows us to write x2 in terms of its Taylor polynomial evaluated in0 and this expression is equal to 0 according to the third condition: x2(t) =
n=0
1n!
dnx2(0)dtn
tn = 0.
We may then reduce the problem, to determine the only nonzero component:
dy2dt
= ( y2)y2y2 = 2y(t1)
(9)
One can prove the two following properties of the solution of the equation above:
1.t, y2(t)> 0: if not then u2(t) = (0, 0) for some t. Then u2(t) = (0, 0) =u1(t) whichcontradicts proposition2.
2.t, dy2dt
(t)< 0: since y(t)< 0, dy2
dt = ( y2)y2 < 0 ; y2 is thus strictly decreasing.
Owing to these conditions, there exists K 0 such that limt
y2 = Kwhere (0, K) has to be
a critical point of the system. Obviously, the only positive value ofK such that (0, K) is acritical point is K = 0 and lim
ty2 = 0. Then by continuity of y2, there exists t3 such that
2y(t1)> y2(t3) =y(t1)> 0. Thus u2(t3) = u(t1) which contradicts proposition2.
9
-
8/12/2019 Phase portraits
12/27
Case 3: x(t1)> 0, y(t1) = 0 and x(t), y(t)> 0t < t1
For x0 > 0, let u3= (x3,y3) be the solution of
dx3dt
= ( y3 x3)x3
dy3dt
= (x3 y3)y3
u3(0) = (x0, 0)
(10)
As in case 2 for the componentx2, one can prove that y3(t) = 0 t. The only nonzero componentsatisfies then the following equation:
dx3dt
= ( x3)x3
x3(0) = x0
(11)
We then distinguish the three following cases:
case 3.1: x(t1) =
case 3.2: x(t1)>
case 3.3: x(t1)
With x0 = 2x(t1), one can show that by proposition 2 x3(t) >
and that x3(t) is strictlydecreasing. Then x3 tends to a critical point K with K . Obviously, the only possiblevalue ofK is
. Thus there existst3 such that 2x(t1)> x3(t3) =x(t1)>
which contradictsproposition 2as u3(t3) = u(t1).
Case 3.3: x(t1)< With x0 = x(t1)/2, one can show that by proposition 2 x3(t) 1.Then, u Cn([0,[):
dnxu
dtn =
dn1
dtn1[
dxu
dt ] = ( yu xu) d
n1xudtn1
+ ( dn1yu
dtn1 d
n1xudtn1
)xu
dnyu
dtn =
dn1
dtn1[
dyu
dt ] = (xu yu) d
n1xudtn1
+ (dn1xudtn1
dn1yu
dtn1 )yu
(16)
As u C1([0,[), we know by recursion that u C([0,[).
Let us prove the uniqueness of the solution. Assume that u and v both satisfy the differentialequation above. Let us note e= (xe, ye) = u v. Then e satisfies the following system:
dxe
dt = ( ye xe)xe
dye
dt = (xe ye)ye
e(0) = (0, 0)
(17)
One can prove the three following properties of e
:1. As u,v C([0,[), e C([0,[)2.
dne
dtn(0) = (0, 0)n. This is true for n = 1. For n > 1, let us assume it is true for n 1.
Then,
dnxe
dtn (0) =
dn1
dtn1[
dxe
dt (0)]
= ( ye(0) xe(0)) dn1xe
dtn1(0) + ( d
n1yedtn1
(0) dn1xe
dtn1 (0))xe(0)
= 0dnye
dtn (0) =
dn1
dtn1[
dye
dt (0)]
= (xe(0) ye(0)) dn1xe
dtn1(0) + (
dn1xedtn1
(0) dn1ye
dtn1 (0))ye(0)
= 0
17
-
8/12/2019 Phase portraits
20/27
3. e(t) = 0t. Owing to point 1 above, e can be written in terms of its Taylor polynomialwhich is zero according to point 2: e(t) =
n=0
1
n!
dne
dtn(0)tn = 0.
The last properties of e shows that u(t) = v(t)t which proves the uniqueness of the solution.
A.2 Proposition 1bis
This proposition is very similar to the preceding proposition. We just change the signs of theright hand terms of the differential equation.
Proposition (1bis)
Let u0 R2. We define the following problem: findu= (xu, yu) C1([0,[) such thatdxu
dt
=
(
yu
xu)xu
dyudt
= (xu yu)yu
u(0) = u0
(18)
Then the solution u to this problem is unique andu C([0,[).
We will not prove this proposition as the proof is essentially the same as for proposition 1.
A.3 Proposition2Here is the proof of proposition2in section 2.
Proposition 2
Let u0,v0 R2 such that u0= v0 andu= (xu, yu),v= (xv, yv) C1([0,[) verifying:
dxudt
= ( yu xu)xu
dyudt
= (xu yu)yu
u(0) = u0
dxvdt
= ( yv xv)xv
dyvdt
= (xv yv)yvv(0) = v0
Then,
1. u(t) = v(t)t.
2. fort1 t2, u(t1) = v(t2) ifu(t) = v0t t1.
18
-
8/12/2019 Phase portraits
21/27
Proof :
Let us prove the first conclusion. Let us assume there existst1 > 0 such that u(t1) = v(t1) = u1.Then, we consider the following problem: findw= (xw, yw) C1([0,[) such that
dxw
dt = ( yw xw)xw
dyw
dt = (xw yw)yw
w(0) = u1
According to the proposition 1 bis (in appendixA.2), the solution of this problem is unique. Onecan show that u(t) = u(t1 t) andv(t) = v(t1 t) are both solutions of this problem. But,u(t1) = u(0) = v(0) = v(t1). Which contradicts the fact the solution is unique.
Let us prove the second conclusion. Let t1 t2 and u(t1) = v(t2). Then, we formulate a newproblem: findw C1([0,[) such that
dxw
dt = ( yw xw)xw
dyw
dt = (xw yw)yw
w(0) = u(t1 t2)
Then, according to proposition 1, the solution of this problem is unique. One can show thatw(t) = u(t + (t1 t2))is the unique solution of this problem. Comparingwandv, we see that theinitial conditions are different: w(0) = u(t1 t2) = v(0) as0< t1 t2 < t1 (see the assumptionsof the second conculsion). Thus, according to the first conclusion, we havew(t)= v(t)t. Thiscontradicts the fact that w(t2) = u(t1) = v(t2).
19
-
8/12/2019 Phase portraits
22/27
A.4 Figures for the second set of datas
On the figures here, the phase portrait shows that the manifolds describe well the behavior ofthe solution in the case of the linear approximation. But, in the non linear model, the curvedoes not follow the pattern suggested by the manifolds obtained in the linear model. To geta better analysis of the behaviour of the solution around the critical point, we could plot the
curves for negative initial conditions but we did not do it as it does not make sense for apopulation model.
0 0.5 1 1.5 2 2.5 30
0.5
1
1.5
2
2.5
3phase portrait in the nonlinear case (vectors)
u component
vcomponent
Figure 5: Phase portrait with vectors showing the direction and magnitude of the derivativesvectors in various points (20 times 20 points between 0.1 and 3).
20
-
8/12/2019 Phase portraits
23/27
0.5 0 0.5 1 1.5 2 2.5 30.5
0
0.5
1
1.5
2
2.5
3phase portrait in the nonlinear case (curves)
u coordinate
v
coordinate
Figure 6: Phase portrait with the curve representing the solution for several initial conditions(5 times 5 points between 0.1 and 3).
21
-
8/12/2019 Phase portraits
24/27
3 2 1 0 1 2 3 41
0.5
0
0.5
1
1.5
2
2.5
3phase portrait with linear approximation (curves)
u coordinate
v
coordinate
Figure 7: Phase portrait with the curve with linear approximation representing the solution forseveral initial conditions (5 times 5 points between 0.1 and 3). The manifolds are in red
22
-
8/12/2019 Phase portraits
25/27
A.5 Phase_Portrait
1 f u n c t i o n Phase_Portrait()2 %PHASE_PORTRAIT
3 % P lo ts t h e p h as e p o rt ra it s f o r t he t w o s e ts o f p ar am et er s ( A ,B a n d C )
4 % b ot h w i th a rr ow s ( g i vi ng t he n or m a n d d i re ct io n o f t h e d e ri va ti ve i n
5 % e ac h p oi nt ) a nd w i th t he c u rv e i ts el f.
6 c l o s e a l l7
8 % % c a s e 1 n o nl i ne a r
9 u1 =l i n s p a c e(0.1,3,20);10 v1 =l i n s p a c e(0.1,3,20);11 [u,v]= me s hgrid (u1,v1);12 du = z e r o s (s i z e( u ) ) ;
13 dv = z e r o s (s i z e( v ) ) ;14 f o r i=1:numel(u)15 dU=f1(0,[u(i),v(i)]);
16 du(i)=dU(1);
17 dv(i)=dU(2);
18 en d19 f i g u r e20 q u i v e r ( u , v , d u , d v ,r )
21 t i t l e( p ha s e p o rt r ai t i n t he n o nl i ne a r c as e ( v e ct o rs ) )22 x l a b e l ( u c o m p o ne n t )23 y l a b e l ( v c o m p o ne n t )
24
25 u1 =l i n s p a c e(0.1,3,5);26 v1 =l i n s p a c e(0.1,3,5);27 [u,v]= me s hgrid (u1,v1);
28 f i g u r e
29 f o r i=1:numel(u)30 [~,Yout]= ode45 ( @ f1 , [ 0 1 0 0] , [ u ( i ) ; v ( i ) ] ) ;31 uout=Yout(:,1);
32 vout=Yout(:,2);
33 p l o t ( u o u t , v o u t )34 hold on
35 en d36 t i t l e( p ha s e p o rt r ai t i n t he n o nl i ne a r c as e ( c u rv e s ) )
37 x l a b e l ( u c o o r d in a t e )38 y l a b e l ( v c o o r d in a t e )39
40 % % C a se 1 l in ea r
41 u1 =l i n s p a c e(0.1,3,20);42 v1 =l i n s p a c e(0.1,3,20);43 [u,v]= me s hgrid (u1,v1);
44 du = z e r o s (s i z e( u ) ) ;
45 dv = z e r o s (s i z e( v ) ) ;46 f o r i=1:numel(u)47 dU=f1lin(0,[u(i),v(i)]);
48 du(i)=dU(1);
49 dv(i)=dU(2);
50 en d51 f i g u r e52 q u i v e r ( u , v , d u , d v ,r )
53 t i t l e( p h a se p o r t ra i t w i th l i n e ar a p p r o xi m a t i o n ( v e c t o r s ) )54 x l a b e l ( u c o m p o ne n t )55 y l a b e l ( v c o m p o ne n t )
56
57 u1 =l i n s p a c e (0.1-3/4,3-3/4,5);58 v1 =l i n s p a c e (0.1-1/4,3-1/4,5);59 [u,v]= me s hgrid (u1,v1);
60 f i g u r e61 f o r i=1:numel(u)62 [~,Yout]= ode45 (@f1lin ,[0 100],[u(i);v(i) ]);63 uout=3/4+Yout(:,1);
64 vout=1/4+Yout(:,2);
65 p l o t ( u o u t , v o u t )66 hold on67 en d
68 t i t l e( p h a se p o r t ra i t w i th l i n e ar a p p r o xi m a t i o n ( c u r v e s ) )
23
-
8/12/2019 Phase portraits
26/27
69 x l a b e l ( u c o o r d in a t e )
70 y l a b e l ( v c o o r d in a t e )71
72 % % C a s e 2 n o nl i ne a r
73 u1 =l i n s p a c e(0.1,3,20);
74 v1 =l i n s p a c e(0.1,3,20);75 [u,v]= me s hgrid (u1,v1);76 du = z e r o s (s i z e( u ) ) ;
77 dv = z e r o s (s i z e( v ) ) ;78 f o r i=1:numel(u)79 dU=f2(0,[u(i),v(i)]);
80 du(i)=dU(1);
81 dv(i)=dU(2);
82 en d83 f i g u r e84 q u i v e r ( u , v , d u , d v ,r )
85 t i t l e( p ha s e p o rt r ai t i n t he n o nl i ne a r c as e ( v e ct o rs ) )
86 x l a b e l ( u c o m p o ne n t )87 y l a b e l ( v c o m p o ne n t )88
89 u1 =l i n s p a c e(0.1,3,5);
90 v1 =l i n s p a c e(0.1,3,5);91 [u,v]= me s hgrid (u1,v1);92 f i g u r e93 f o r i=1:numel(u)94 [~,Yout]= ode45 ( @ f2 , [ 0 1 0 0] , [ u ( i ) ; v ( i ) ] ) ;95 uout=Yout(:,1);
96 vout=Yout(:,2);
97 p l o t ( u o u t , v o u t )98 hold on99 en d100
101 t i t l e( p ha s e p o rt r ai t i n t he n o nl i ne a r c as e ( c u rv e s ) )102 x l a b e l ( u c o o r d in a t e )103 y l a b e l ( v c o o r d in a t e )104
105 % % C a se 2 l in ea r
106 u1 =l i n s p a c e(0.1,3,20);107 v1 =l i n s p a c e(0.1,3,20);108 [u,v]= me s hgrid (u1,v1);
109 du = z e r o s (s i z e( u ) ) ;110 dv = z e r o s (s i z e( v ) ) ;111 f o r i=1:numel(u)112 dU=f2lin(0,[u(i),v(i)]);
113 du(i)=dU(1);
114 dv(i)=dU(2);
115 en d116 f i g u r e
117 q u i v e r ( u , v , d u , d v ,r )118 t i t l e( p h a se p o r t ra i t w i th l i n e ar a p p r o xi m a t i o n ( v e c t o r s ) )119 x l a b e l ( u c o m p o ne n t )120 y l a b e l ( v c o m p o ne n t )
121
122 u1 =l i n s p a c e (1-17/18,3.9-17/18,5);123 v1 = l i n s p a c e (0.1-1/18,3-1/18,5);124 [u,v]= me s hgrid (u1,v1);
125 f i g u r e126 f o r i=1:numel(u)127 [~,Yout]= ode45 (@f2lin ,[0 100],[u(i);v(i) ]);128 uout=17/18+Yout(:,1);
129 vout=1/18+Yout(:,2);
130 p l o t ( u o u t , v o u t )131 hold on132 en d
133 t i t l e( p h a se p o r t ra i t w i th l i n e ar a p p r o xi m a t i o n ( c u r v e s ) )134 x l a b e l ( u c o o r d in a t e )135 y l a b e l ( v c o o r d in a t e )136 en d137 f u n c t i o n F = f 1 ( t , u )138 F= z e r o s(2,1);139 F(1)=(1-2*u(1)-u(2))*u(2);
24
-
8/12/2019 Phase portraits
27/27