Please show the code for 'center1'. Why can't you modify this code to simply use the t input to determine which value of Fy to use? Then you could do everything with one ode45 call.
overlapping time steps in ODE45
1 次查看(过去 30 天)
显示 更早的评论
Fy is a global variable, center1 is the function that is calling
Fy = 1000;
Y0 = [0 -0.025 0 0 0 0]';
tspan = 0:0.02:0.1;
[T1,Y1] = ode45('center1',tspan,Y0);
Fy=0;
Yspan = Y1(length(Y1(:,1)),:);
tspan = 0.1:0.02:0.2;
[T2,Y2] = ode45('center1',tspan,Yspan);
T=[T1' T2'];
Y=vertcat(Y1,Y2);
the issue that I am dealing with is that: when Fy=1000, the force is applying for [0-0.1] seconds, then the force is removed (Fy=0) the the behavior of the body is studied up to 0.2 seconds, which I should it like [0.1-0.2]. But at t=0.1 sec, there are two times calculation. How can I show that the second time interval starts after 0.1 second, in order to avoid repeating the result ?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!