Hello Weilin,
I understand you are facing an issue while simulating a robot arm, related to the derivative of a state in the model.
I tried to reproduce the issue at my end with the given files and it ran smoothly without encountering any errors.
To address the error you are experiencing, I suggest following the steps outlined below:
- In the model configuration parameters, navigate to Solver and adjust the type of solver to ‘Variable-step’ and set the Solver to “ode15s” (stiff/NDF).
- If the issue still persists, proceed to the configuration parameters, and under Diagnostics > Data Validity > Signals, set the ‘Inf or NaN block output’ to ‘error’ and then rerun the model. This action will prompt an error message, which reads as follows:
- To address this issue, ensure that you eliminate the ‘divide by zero’ error in ‘simulink_test1/Torque prediction/MATLAB Function1’, which generates an ‘Inf’, leading to the error.
Kindly refer to the following MATLAB Documentation for further information on ‘ode15s’ solver and ‘NaN’
- https://www.mathworks.com/help/simulink/gui/solver.html
- https://www.mathworks.com/help/matlab/matlab_prog/infinity-and-nan.html
Hope this helps.
Best Regards,
Gowtham