-
Notifications
You must be signed in to change notification settings - Fork 2
/
Isolated_control.m
89 lines (70 loc) · 2.14 KB
/
Isolated_control.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
%--------------------------------------------------------------------------
% Stabilizing unstable periodic orbits
% -------------------------------------------------------------------------
% Application to the planar system:
%
% x' = -om*y + x*(x^2 + y^2 - mu^2)*(16 - x^2 - y^2)
% y' = om*x + y*(x^2 + y^2 - mu^2)*(16 - x^2 - y^2)
%
% Here om > 0 and 0 < mu < 4 are parameters. Focal parameter value is mu =
% 2.
%
% This code is associated with the paper "Data-driven stabilization of
% periodic orbits" by Jason J. Bramburger, Steven L. Brunton, and J. Nathan
% Kutz (2020).
% This script is used to obtain the results in Section 4.2.
%--------------------------------------------------------------------------
% Clean workspace
clear all
close all
clc
format long
% model parameters
N = 100;
om = N*pi; % frequency
% Return time
T = 2/N;
% Control parameters
K = 1.3;
eta = 0.1;
% Controlled trajectory
m = 2; %Dimension of ODE
dt = 0.0001;
tspan = 0:dt:T;
options = odeset('RelTol',1e-12,'AbsTol',1e-12*ones(1,m));
% Initial condition close to unstable orbit
x0(1,:) = [2.005; 0];
% Controlled parameter
if abs(x0(1,1) - 2) <= eta
mu(1) = 2 + K*(x0(1,1) - 2);
else
mu(1) = 2;
end
% Initialize trajectory
[~,sol] = ode45(@(t,x) isolated(x,om,mu),tspan,x0(1,:),options);
% Controlled solution
xc = sol(:,1).*cos(sol(:,2));
yc = sol(:,1).*sin(sol(:,2));
% Controlled orbit
for k = 2:100
x0(k,:) = [sol(end,1); 0];
if abs(x0(k,1) - 2) <= eta
mu(k) = 2 + K*(x0(k,1) - 2);
else
mu(k) = 2;
end
[~,sol] = ode45(@(t,x) isolated(x,om,mu(k)),tspan,x0(k,:),options);
% Controlled solution
xc = [xc; sol(:,1).*cos(sol(:,2))];
yc = [yc; sol(:,1).*sin(sol(:,2))];
end
% Plot solution
plot(xc,yc,'k','LineWidth',2)
xlabel('$x(t)$','Interpreter','latex','FontSize',20,'FontWeight','Bold')
ylabel('$y(t)$','Interpreter','latex','FontSize',20,'FontWeight','Bold')
grid on
%% Subcritical Hopf right-hand-side in polar coordinates
function dx = isolated(x,om,mu)
% Stable origin, unstable orbit at x(1) = mu, stable orbit at r = 4
dx = [x(1)*(x(1)^2 - mu^2)*(16 - x(1)^2); om];
end