MATLAB: Switching systems simulations

simulink

Hello, I would like to simulate a switching system in simulink, i.e. a time continuous system with feedback where the output is a two level signal. The rise and fall edges time positions of the outputs are quite important for my simulations, so I'm obliged to force a maximum time step very small to get good results, but in this case the simulations become very slow (I'm using ode45 Variable step) One possibility for me could be to force small time step in particular simulation times, while relaxing it in other moments, but I don't know exactly how I can do that. Do someone have some suggestion?
BR Luca

Best Answer

Good question! My advice is to try increasing the maximum time step limit and enable zero crossing detection at all applied blocks.