Controlling NEMA 23 speed with Arduino
I remember these drives need a comparatively long pulse width. Checking the datasheet (page 9) of this drive confirmes this. The minimum low time is specified to be 2.5 microseconds. In your code you set the pulse immediately high after setting low. This might explain the jerky operation, every now and then it misses pulses, resulting in inconsistent driving.

Caveat to my assumptions:
I think your code is not the actual code, the posted version will not compile!
(Missing/inconsistent variable names.)