Newer
Older
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
% main
t0 = 0;
w0 = [1,1,1];
T = 100;
h = 0.01;
sigma = 10;
rho = 28;
beta = 8/3;
F = @(s,w) Lorentz(s,w,sigma,rho,beta);
t = zeros(2000,1);
w = zeros(2000,max(size(w0)));
t(1) = t0;
w(1,:) = w0;
counter = 1;
figure;
az = 0; el = 45;
while t <= T
counter = counter + 1;
[t(counter), w(counter,:)] = RK4(t(counter-1),w(counter-1,:),h,F);
plot3(w(1:counter,1),w(1:counter,2),w(1:counter,3))
hold on;
plot3(w(counter,1),w(counter,2),w(counter,3),'*')
hold off
az = az + 0.5;
view(az,el)
pause(0.01);
end
t(counter+1:end) = [];
w(counter+1,:) = [];