overlapping time steps in ODE45
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
James Tursa
on 9 Jun 2017
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.
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!