Skip to content
Snippets Groups Projects
Commit 45fac2c8 authored by JB's avatar JB
Browse files

code prepared for course

parent ea3c9d97
Branches main
No related tags found
No related merge requests found
......@@ -58,18 +58,17 @@ F = integrator('F', 'cvodes', ode, opts);
figure; grid on; hold on;
xi = [2; 0];
trajectory_vals = [xi];
traj_vals = [xi];
for i = 1:floor(T / T_sample)
if (T_sample * i < T_star)
trajectory = F('x0', trajectory_vals(:, end), 'p', 1);
trajectory = F('x0', traj_vals(:, end), 'p', -1);
else
trajectory = F('x0', trajectory_vals(:, end), 'p', -1);
trajectory = F('x0', traj_vals(:, end), 'p', 1);
end
trajectory_vals = [trajectory_vals, full(trajectory.xf)];
traj_vals = [traj_vals, full(trajectory.xf)];
end
%get the trajectory samples
plot(trajectory_vals(1, :), trajectory_vals(2, :));
plot(traj_vals(1, :), traj_vals(2, :));
%% If else instruction
% Saturate function
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment