MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Triangle function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14451] RE: [mg14410] Triangle function
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Wed, 21 Oct 1998 03:32:48 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Andrew Strobel 
>
>Has Mathematica got a triangle function where I can choose the frequency
>and the amplitude?
>
>The function is necessary to describe a voltage source. It must be an
>analytical function. 
>
>
>like this:
>
>
>  /\    /\
>-/--\--/--\---->t
>/    \/    \
>
>

I don't think so, but you can write a program for a function that will
do what you want.  For example the program below defines a piecewise
linear function f[x].  I am not going to program the triangle wave for
you because it may very well be a homework assignment.

In[1]:=
f[x_?NumericQ]:=If[x<2,3, x-4]/;(Im[x]==0)&&(0<=x<5)
f[x_?NumericQ]:=f[Mod[x,5]]/;Im[x]==0

In[2]:=
Plot[f[x],{x,0,13}];

(* Plot of a periodic function not shown. *)

____________________
Note:
If you need to work with the Laplace transform of Fourier Series you
have to define the function in terms of the UnitStep function since
those operations do not deal with definitions like those above.

The UnitStep function is in the standard package Calculus`DiracDelta`.

Cheers,
Ted Ersek



  • Prev by Date: RE: FactorInteger
  • Next by Date: ODE
  • Previous by thread: Triangle function
  • Next by thread: Re: Triangle function