H2 design of generalized sampling and hold functions with waveform constraints