MATLAB: How can control the phase delay of the signal generated by “Pulse Generator” block externally

pulse generator blocksimulinksquare wave

Hi friends,
I want to generate a square wave by using pulse generator block in simulink where phase delay is coming from an external source. As you know the phase delay of the output signal of this block can be set internally. Is it possible to control the phase delay of this block by a external signal?
Regards Foad

Best Answer

If you have a limited range of number of samples that your signal should be delayed you could build a block for variable delay using a number of unit delays and a multiport switch. I have attached a model which could handle between 0 and 10 samples of delay (although I have not verified it more than that it is simulatable).