Thanks for posting solid code. For an fft, to make the frequency grid n times finer, the boundaries of the time record (tmax, tmin) have to be increased by a factor of n. What you have now is
ts=0.001; fs=1/ts; x=-10:ts:10;
These particular pulses do not have to be described by anything as fine as ts = .001, so you could try, for example
ts=0.1; fs=1/ts; x=-100:ts:100;
ts=0.01; fs=1/ts; x=-100:ts:100;
ts=0.001; fs=1/ts; x=-100:ts:100;
with in all cases
Widening the time record by a factor of 10 cuts down the duty cycle of the pulse by that factor, so the frequency domain amplitude is down by 10 (but the shape has not changed). All three of the examples have the same finer frequency grid spacing, but they have progressively more extensive frequency grids.