how to fix ode45 parameters?

조회 수: 3 (최근 30일)
Valeria Leto
Valeria Leto 2021년 3월 6일
답변: Cam Salzberger 2021년 7월 7일
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