Problem with step fixed-variable

Hi everyone.

I’m i’m having a problem with my simulation, at this point, i was using Fixed-step with 1e-8 step size to make my simulations, but i have the following problem:

If i change to variable-step, i get the correct result:

I’m using a couple of ZOH to discretize signals, then, i feed a c-script with this signals to make the control of the converter (the sample time of C-Script is 1/50k [s]). My problem is, when i finish this simulation, i need to program the control and everything in a microcontroller, so, how i can fix the fixed-step simulation???

i’m think is something about the plecs fixed-step solver, but i can change it.

Matias, you should be using the variable step solver in this instance. The variable-step solver supports mixing of fixed rate tasks (your digital controller running at 50 kHz) along with accurate modeling of continuous systems (your power stage).