Re: Rectangular function

• To: mathgroup at smc.vnet.net
• Subject: [mg14047] Re: [mg14036] Rectangular function
• From: BobHanlon at aol.com
• Date: Fri, 18 Sep 1998 03:50:30 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```One approach:

Needs["Calculus`DiracDelta`"];
rect[x_, intvl_:1] := Sum[(-1)^Floor[t/intvl] *
UnitStep[t/intvl], {t, 0, x, intvl}]; Plot[rect[x], {x, 0, 6}];
Plot[{rect[x, Pi/2], Sin[x]}, {x, 0, 4Pi}]; Plot[rect[x, Pi/2] * Sin[x],
{x, 0, 4Pi}]; Plot[{2rect[x, Pi/2]-1, Sin[x]}, {x, 0, 4Pi}];
Plot[(2rect[x, Pi/2]-1) * Sin[x], {x, 0, 4Pi}]; Plot[{2rect[x, Pi]-1,
Sin[x]}, {x, 0, 4Pi}]; Plot[(2rect[x, Pi]-1) * Sin[x], {x, 0, 4Pi}];
Plot[{2rect[x, 2Pi]-1, Sin[x]}, {x, 0, 4Pi}]; Plot[(2rect[x, 2Pi]-1) *
Sin[x], {x, 0, 4Pi}];

Bob Hanlon

In a message dated 9/16/98 6:21:32 PM, A.Strobel at gmx.net wrote:

>I'd like to simulate a rectangular voltage source. How can I define such
>a function in Mathematica?
>Example: It must be possible then to multiply a Sinus-function with the
>rectangular function.

```

• Prev by Date: Re: Rectangular function
• Next by Date: Re: EPS format problems
• Previous by thread: Re: Rectangular function