function [tout,yout]= f_cal_kernel(eqs,ini_cdt,tstart,tfinal)
refine = 4;
options = odeset('RelTol',1e-5,'AbsTol',1e-6,...
'Events', @f_cal_kernel_impact_events,...
'InitialStep',1e-6, 'MaxStep',1e-1,...
'Refine',refine);
y0 =ini_cdt;
tout = tstart;
yout = y0;
teout = [];
yeout = [];
ieout = [];
t_mini=1e-2;
while t_mini<(tfinal-tstart)
[t,y,te,ye,ie] = ode23tb(eqs,[tstart tfinal],y0.',options);
nt = length(t);
tout = [tout; t(2:nt)];
yout = [yout; y(2:nt,:)];
teout = [teout; te];
yeout = [yeout; ye];
ieout = [ieout; ie];
y0(1) = 1e-6;
y0(2) = -0.8*y(nt,2);
y0(3) = y(nt,3);
tstart = t(nt);
end
end
欢迎使用CSDN-markdown编辑器
最新推荐文章于 2024-05-15 00:21:20 发布