ode45 with multi functions

조회 수: 19 (최근 30일)
ali
ali 2013년 12월 7일
Actually i want a problem with ode45, but there is three function which express the problem here is my script: tspan = 0 : 0.001 : 3; y0 = [0;0]; [t,y] = ode45(@nonlinsys, tspan,y0); function f = force(wn_sq,damping,Umax,ydot,y,x_desire) f = wn_sq*(x_desire-y)+ damping*(-ydot);
if f > Umax
f = Umax;
else
f < -Umax
f = -Umax;
end
end
function xd = x_desire(t)
xd = heaviside(t-0.5);
end
function dy = nonlinsys(t,y,wn_sq,damping,Umax,ydot,x_desire) dy(1)=y(2); dy(2) = force. dy = dy'; end
would you please help where the source errors are?

답변 (0개)

카테고리

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