how to fix ode45 parameters?

1 次查看(过去 30 天)
Valeria Leto
Valeria Leto 2021-3-6
Error using derivative
Expected state to be finite.
Error in jointSpaceMotionModel/derivative (line 251)
validateattributes(state, {'double'}, {'nonempty', 'vector', 'numel', 2*obj.NumJoints,
'finite', 'real'}, 'derivative', 'state');
Error in file_verifica_controllori>@(t,y)derivative(computedTorqueMotion,y,qDesComputedTorque) (line
31)
[tComputedTorque,yComputedTorque] =
ode45(@(t,y)derivative(computedTorqueMotion,y,qDesComputedTorque),tSpan,initialState);
Error in ode45 (line 299)
f2 = odeFcn_main(t2, y2);
Error in file_verifica_controllori (line 31)
[tComputedTorque,yComputedTorque] =
ode45(@(t,y)derivative(computedTorqueMotion,y,qDesComputedTorque),tSpan,initialState);
Hi! what's the problem with ode45? I tried to reduce the step size but didn't work.

回答(1 个)

Cam Salzberger
Cam Salzberger 2021-7-7
The value of "y" (the "state" input to "derivative") is going infinite or NaN at some point. I'd suggest creating a helper function that calls derivative, and use the helper function as the ode45 function. Then you can either add some printout statements or insert a breakpoint so you can see when the state is going infinite and possibly why.
-Cam

类别

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