Error: An error occurred while running the simulation and the simulation was terminated

Hii, so I have a simulation in Matlab that I need to run however I keep receiving this following error message :
Error:An error occurred while running the simulation and the simulation was terminated
Caused by:
Derivative of state '1' in block 'simulation/dynamics equation/Integrator' at time 0.0 is not finite. The simulation will be stopped. There may be a singularity in the solution.
If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
To put you in context, I am running a simulation controling a basic representation of a spacecraft system with a PD control law. The block that is giving me this error is the following block for the dynamic equations. I tried changing the tolerance and even the solver but it won't budge, the only time it doesn't notify me is when I choose a some random constants for the control gains, constants that do not actually give me the desired output I'm looking for and honestly I'm kind of lost on what I should do. I attach the picture of the dynamic equation block where the issue seems to be. I appreciate any help or guidance.
Thank you.

2 Comments

Hey, I did. I have a value of 10^(-7), can't go any lower because then it says i exceed the limit of storage that I have.

Sign in to comment.

 Accepted Answer

I fixed it by finding where exactly the error was by changing the configuration display of inf and NaN output block in configuration parameters > data validity. Turned out I had a matrix that was singular and by inverting it I was actually getting infinite values. Resolved the issue by changing the matrix!

3 Comments

Good to hear you have resolved the issue. I'd like to know if I_b is a diagonal matrix. What signals did you feed into the external torque tm?
I_b is indeed a diagonal matrix, it's an approximation of the inertia matrix. As per the external torque it's a data that I calculate in the actuactor subsystem (not mentioned here) to change the position of the global system.
Thanks @daisy. Since I_b is a diagonal matrix, the matrix equation shown in your Simulink model can be resolved into a system of three coupled differential equations:
It may be easier to monitor the individual signals and troubleshoot the system in the case of any error. Your work sounds like a data-driven control problem.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2023b

Asked:

on 27 Dec 2023

Commented:

on 28 Dec 2023

Community Treasure Hunt

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

Start Hunting!