legend('Continuous','Discretized with ZOH','Discretized with Tustin',...
'Location','NorthWest')
The ZOH method has significant distortion and prewarped Tustin should be used instead.
To do this, specify the desired rate conversion method for the notch filter block:
setBlockRateConversion(ST2,'Notch','tustin',wn(1))
writeBlockValue(ST2)
writeBlockValue now uses Tustin prewarped at the notch frequency to discretize the
notch filter and write it back to Simulink. Verify that this gets rid of the oscillations.
sim('rct_dmcNotch');
t = yout.time;
Tuning of a Digital Motion Control System