ode45 with multi functions

18 ビュー (過去 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 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