overlapping time steps in ODE45

1 回表示 (過去 30 日間)
Modess Seyednezhad
Modess Seyednezhad 2017 年 6 月 9 日
回答済み: James Tursa 2017 年 6 月 9 日
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 ?

回答 (1 件)

James Tursa
James Tursa 2017 年 6 月 9 日
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.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by