MATLAB Answers

Simulink Solver Errors "Derivative of State..." or "Nonlinear iteration is not converging"

5 views (last 30 days)
Andrew Brown
Andrew Brown on 31 Mar 2020
Edited: Andrew Brown on 31 Mar 2020
What is causing the "Derivative of state '1' in block ... at time ... is not finite" (Error 1) or the "Nonlinear iteration is not converging with step size reduced to hmin" (Error 2) depending on the solver?
Using Simulink, model ball and beam with a PID controller and the system has to settle within 20 seconds. I followed this tutorial from the University of Michigan which works fine but my ball and beam has a gear train instead of a gear and lever. I also had to use a PID controller instead of the gain and lead compensator.
For MATLAB, all there was were inputs that I entered directly into the command line. I got rid of the length of beam and lever offset values and added in number of teeth values for the input gear and output gear.
For Simulink, I have attached the working tutorial file and then my modified file. I changed the gain inside the subsystem to negative gear ratio indeat of the ratio between the lever offset over the beam length. Then I subsituted the PID(s) block in to replace the gain and lead compensator in the main system. I tuned the system automatically using the tune button and accepted the automatic default and it works, however, it does not reach steady state before 20 seconds.
If I try to use the response time slider to make the system faster, the error starts popping up.
I have looked around online and found most people solve this error by changing solvers so I tried all of them.
  • discrete - can't be used
  • ode45 - error 1
  • ode23 - error 1
  • ode113 - error 1
  • ode15s - error 1
  • ode23s - freezes at 4%
  • ode23t - error 2
  • ode23tb - error 2
  • odeN - error 1
  • daessc - freezes at 1%
I am using MATLAB R2019b. It won't let me add it under the Release section.
Attached is a screen cap of the full error and the Simulink files. gear_ball_beam is my modified file, ballcl is the tutorial file.
From tutorial file (use in ballcl.slx)
m = 0.111;
R = 0.015;
g = -9.8;
L = 1.0;
d = 0.03;
J = 9.99e-6;
From modified file (use in gear_beall_beam.slx)
m = 0.093;
R = 0.014295;
g = -9.8;
t1 = 36;
t2 = 96;
J = 0.0000081796;

Answers (0)

Community Treasure Hunt

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

Start Hunting!