-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiUDE_explodes.m
More file actions
73 lines (50 loc) · 920 Bytes
/
iUDE_explodes.m
File metadata and controls
73 lines (50 loc) · 920 Bytes
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
function iUDE_explodes()
ude(800)
ude(2000)
end
function ude(many)
% x = x 1
% y = x 2
% w = theta 1
% z = theta 2
figure
hold on
dt = 0.001;
x0 = 1.2;
y0 = 1.1;
w = 3;
z = 1;
x = x0;
y = y0;
X = 1:many;
Y = 1:many;
for t = 1:many
dxdt = w .* x .* (1 - y);
dydt = z .* x .* y - z .* y;
x = x + dxdt * dt;
y = y + dydt * dt;
X(t) = x;
Y(t) = y;
end
plot((1:many)*dt, X, (1:many)*dt, Y)
% do the interval-based calculations
x0 = [1.2, 1.2];
y0 = [1.1, 1.1];
w = [2.99, 3.01];
z = [0.99, 1.01];
x = x0;
y = y0;
X = [1:many; 1:many]';
Y = [1:many; 1:many]';
for t = 1:many
dxdt = w .* x .* (1 - y(2:-1:1));
dydt = z .* x .* y - z(2:-1:1) .* y(2:-1:1);
x = x + dxdt * dt;
y = y + dydt * dt;
X(t,:) = x;
Y(t,:) = y;
end
t = (1:many)*dt;
plot(t, X(:,1), '-c', t, Y(:,1), '-m')
plot(t, X(:,2), '-c', t, Y(:,2), '-m')
end