ode45 with multi functions

18 vues (au cours des 30 derniers jours)
ali
ali le 7 Déc 2013
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?

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by