Figure 1:
Matlab/Simulink model