-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulation.m
47 lines (33 loc) · 976 Bytes
/
simulation.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
clear
close all
addContainingDirAndSubDir();
% Load data and X0
initial_data;
tspan = 5*data.orbit.T;
%tspan = 1*3600;
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
start = tic;
disp('Simulation started');
[t, X] = ode15s(@model, [0 tspan], X0, options, data);
disp('Simulation finished');
toc(start)
start = tic;
disp('Calculating parameters');
[~, parout] = model(0, X0, data);
parout = zeros(length(t), length(parout));
for k = 1:length(t)
[~, parout(k, :)] = model(t(k), X(k, :), data);
end
toc(start);
disp('Calculation finished');
states_parameters; % get the variables form the X and parout arrays.
%%%%%%%%%%% Plots %%%%%%%%%%%%%%%%%%%
sim_figs;
% plot_graph('forces', t, X, parout);
% plot_graph('height', t, X, parout);
% plot_graph('x_acc', t, X, parout);
% plot_graph('x_fcv', t, X, parout);
% plot_graph('a1+a2', t, X, parout);
% plot_graph('w', t, X, parout);
% plot_graph('Omega', t, X, parout);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%