ODE45: Adjusting the parameters in the state equations

조회 수: 6 (최근 30일)
Komal Rajana
Komal Rajana 2020년 1월 6일
편집: David Goodmanson 2020년 1월 8일
I would like to vary a parameter (o) in my ODE45 for a clutch mechanism. The clutch would enagaged when the velocity and acceleration are in the same direction (accel/Vel>0) and disengaged when the (accel/vel < 0). I am not sure how to implement the loop in the fuction file.
function [dy] = SS(t,y);
dy = NaN(4,1);
t = [0:0.001:4];
ug = 0.5*sin(pi*t/0.6); %input loading
plot(t,ug,'-r*');
hold on;
ug(t>0.5)=0; % values where t>0.5 will be assigned to zero
plot(t,ug,'-co');
legend('full sine load','desired load')
uu=1*ug;
u=1;
v=0.5;
o=0.5;
e1=0;
e2=0;
w1=2*pi;
w2=6.666*pi;
if dy(1)*dy(2)<0 %%% need the velocity and floor accleration in the same direction
o=0
else
o=0.5;
end
dy(1)= y(2);
dy(2)=(1/u)*(-1*(1-v)*uu-2*e1*w1*y(2)+2*v*e2*w2*y(4)-w1*w1*y(1)+v*w2*w2*y(3));
dy(3) = y(4);
dy(4) = (1/u)*((-o*uu)+2*e1*w1*y(2)-2*(1+o)*e2*w2*y(4)+w1*w1*y(1)-(1+o)*w2*w2*y(3));
  댓글 수: 3
Komal Rajana
Komal Rajana 2020년 1월 7일
편집: Komal Rajana 2020년 1월 7일
Hi David,
Would it be possible to specify the 'value' in the event as an acceleration instead of the state space variables (positions and velocity)?. I need my clutch system to engaed when the acceleration and velocity are in the same direction....
thanks
David Goodmanson
David Goodmanson 2020년 1월 8일
편집: David Goodmanson 2020년 1월 8일
This should be possible. The event is activated when the value of a function of the state vector [y; y'] reaches zero. Since (by the differential equation you are solving) the acceleration is a function of [y,y'] (and possibly t), you should be able to create the correct function to be detected. Doing 'type ballode' or (riskier, but with better fomatting) 'edit ballode', will bring up an example of how to detect an event and restart the integration with modified initial conditions and, potentially, with an altered ODE.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by