comparison +time/Ode45.m @ 816:b5e5b195da1e feature/timesteppers

Add getState to timesteppers, returning the relevant state of the timestepper - Add getState which returns the 'state' of the specialized timestepper.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 10 Sep 2018 16:19:16 +0200
parents 48b6fb693025
children f5e14e5986b5
comparison
equal deleted inserted replaced
580:2ce903f28193 816:b5e5b195da1e
46 function [vt,t] = getVt(obj) 46 function [vt,t] = getVt(obj)
47 vt = obj.w(end/2+1:end); 47 vt = obj.w(end/2+1:end);
48 t = obj.t; 48 t = obj.t;
49 end 49 end
50 50
51 function state = getState(obj)
52 [v, t] = obj.getV();
53 [vt] = obj.getVt();
54 state = struct('v', v, 'vt', vt, 't', t, 'k', obj.k);
55 end
56
51 function obj = step(obj) 57 function obj = step(obj)
52 [t,w] = ode45(@(t,w)(obj.F(w,t)),[obj.t obj.t+obj.k],obj.w); 58 [t,w] = ode45(@(t,w)(obj.F(w,t)),[obj.t obj.t+obj.k],obj.w);
53 59
54 obj.t = t(end); 60 obj.t = t(end);
55 obj.w = w(end,:)'; 61 obj.w = w(end,:)';