how to generate pulse function ?
- To: mathgroup at smc.vnet.net
- Subject: [mg41908] how to generate pulse function ?
- From: "sabrina" <mystery at newbie.com>
- Date: Mon, 9 Jun 2003 05:20:53 -0400 (EDT)
- Organization: Case Western Reserve University, Cleveland, OH, USA
- Reply-to: "sabrina" <hxs61 at po.cwru.edu>
- Sender: owner-wri-mathgroup at wolfram.com
Hello all: I use the following code to generate the pulse function, but it is not right: u[x_,step_,nPulse_]:= Module[ {tlist={},func}, tlist=Table[t,{t,0,nPulse*step,step}]; func=1-UnitStep[Apply[Times,(x-#)&/@tlist]]; Return[func]; ]; s=u[t, 500,4]; Plot[s,{t,0,2200}]; The problem is when the nPulse is odd number, it shows the right answer, but when the nPulse is even, the plot is not right. Would you please help me to make the function right? Thanks a lot! Sabrina