Re: Square wave form
- To: mathgroup at smc.vnet.net
- Subject: [mg29293] Re: [mg29288] Square wave form
- From: BobHanlon at aol.com
- Date: Tue, 12 Jun 2001 04:18:15 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/6/11 4:55:24 AM, daldosch at ccc.at writes:
>How would I go about plotting a sqare
>wave form ,or one of rectangular shape
>?
>I did find the sawline function (
>math.book 2.9.2 ) , but I don`t know how
>to get mathematica to plot a square ,
>rectangular ,or trapezoid like graph.
>
f[x_] := 10*Sum[(-1)^(n/2) * UnitStep[x-n], {n, 0, 9, 2}]-5;
g[x_] := Sum[(-1)^(n/2) * 6((x-n)*UnitStep[x-n]-(x-n-1)*UnitStep[x-n-1]), {n,
0, 9, 2}]-3;
Plot[{f[x], g[x]}, {x, -1, 10},
PlotStyle ->
{{RGBColor[0, 0, 1], AbsoluteThickness[2]}, {RGBColor[1, 0, 1],
AbsoluteThickness[2]}}];
Bob Hanlon
Chantilly, VA USA