       Re: How to define and plot a periodic signal?

• To: mathgroup at smc.vnet.net
• Subject: [mg62597] Re: [mg62556] How to define and plot a periodic signal?
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Tue, 29 Nov 2005 04:44:48 -0500 (EST)
• Organization: Mathematics & Statistics, Univ. of Mass./Amherst
• References: <200511280557.AAA18435@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Surely you know how to define a function of some sort, e.g.:

f[x_] := x^2

And how to plot a function, e.g.:

Plot[f[x], {x, 0, 8}]

So I assume the only difficulty you're having is to define the
particular triangular function.

My suggestion is to first define it for one period; to do that, you
could use Piecewise (if you're using a recent enough version of
Mathematica) or else synthesize the function using UnitStep (in exactly
the same way one does that via formulas by hand).  Then extend it using
periodicity.  For example:

f[x_] := Piecewise[ { { x, 0 <= x <= 1}, { 2 - x, 1 <= x <= 2}}]
f[ x_ /; x > 2] := f[ x - 2]
f[ x_ /; x < 0] := f[ x + 2]

aza wrote:
> Hello,
>
> I need to define a function that is a single triangular pulse repeated
> periodically. How could I define this function and plot it?

--
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

```

• Prev by Date: Re: Problem in Exporting Mathematica graphics What service do we have to run?
• Next by Date: Bypassing built-in functions in differentiation
• Previous by thread: How to define and plot a periodic signal?
• Next by thread: Re: How to define and plot a periodic signal?