-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimex_cnlf.m
More file actions
32 lines (27 loc) · 797 Bytes
/
imex_cnlf.m
File metadata and controls
32 lines (27 loc) · 797 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
function [time_vector, solution] = imex_cnlf(F, G, start, step, end_time)
a = [-1 0 1];
b = [0 2 0];
c = [1 0 1];
% FIXME handle better the case of
if (step > end_time)
disp("Warning: Couldn't reach multistep phase. Not enough steps")
[time_vector, solution] = imex_euler111(F, G, start, end_time, end_time);
return;
end
[tt, bootstrap] = imex_euler111(F, G, start, step, step);
[time_vector, solution] = multistep_imex_solver(F, G, bootstrap, step, end_time, a, b, c);
end
%!test
%!
%! step = 0.05;
%! time_vector = 0:(step):1;
%!
%! F = @(t, x) ones(size(x)) .* t;
%! G = [-1 0; 0 -1];
%! handle = @(t, x) G * x + F(t, x);
%!
%! [t, y] = ode45(handle, time_vector, [0.5 0.5]);
%!
%! [tt, yy] = imex_cnlf(F, G, [0.5; 0.5], step, 1);
%!
%! assert(yy, y', step);