Electronic – Why simulink step response differs from matlab’s step function

controlMATLABsimulinkstability

step response is different in simulink showing oscillatory behavior unlike in matlab step function

Transfer function

enter image description here

Step response

enter image description here

Block diagram in simulink

enter image description here

Simulink scope

enter image description here

Best Answer

This is a numeric issue caused by the simulation step size. The system poles have real parts in -0.4e6, and as can be seen in the matlab 'step()' result, the settling time is lower than 2e-5.

Using simulink default simulation parameters, the system response will be evaluated in time-steps that are larger than what is necessary to describe what is really going on, similar to a Nyquist sampling criteria.

To get correct simulation results with your system, I've done the following:

  1. Open the 'Model Configuration Parameters' (cog icon);
  2. Change 'Stop Time' to 2e-5;
  3. In 'Solver Options', change 'Type' to 'Fixed-step' and 'Solver' to 'ode8 (Dormand-Prince)';
  4. In 'Additional options', change 'Fixed-step size (fundamental sample time)' to 1e-7.

Now the simulation runs as expected. Proof:

enter image description here