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 CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by