Filter löschen
Filter löschen

How can m-file neglect the error "There maybe a singularity in the solution" , produced by Simulink, and does not stop?

1 Ansicht (letzte 30 Tage)
I am running an optimization code in m-file that includes a command to run a Simulink file in every iteration.
sim('Controller_tune_pd',[0:10]);
The program will run Simulink more than 2000 times with different input values. Sometimes these values will cause the singularity in solution and produces the error that stops my m-file.
??? Error using ==> sim Derivative input 3 of 'P_PID/PLANT/Integrator2' at time 0.3750000000000001 is Inf or NaN. Stopping simulation. 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).
Please inform me how may the m-file neglect this error and continue to the program. I am using fixed step size and I can not reduce it. I do not want to remove the error. I want it to be neglected by m-file during running.
  1 Kommentar
Yao Li
Yao Li am 14 Mai 2013
That is expected. Add memory block to the closed loop which will give an initial value. Also, double check your model to make sure in every step any denominators won't be zero.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Yao Li
Yao Li am 13 Mai 2013
You can try warning('off','message_id'). However, this warning indicates that there may be a singlarity in certain closed loop. You'd better add a memory block to give an initial value of each closed loop.

Kaustubha Govind
Kaustubha Govind am 14 Mai 2013
How about using try/catch to catch and ignore the exception thrown by the SIM command.
  1 Kommentar
Saeed
Saeed am 26 Mai 2013
Bearbeitet: Saeed am 26 Mai 2013
Can try/catch command be used for several similar try statements and one catch statements? Ex:
try
create model1(option1)
create model2(option2)
create model3(option3)
catch exception
error
end

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by