# Piecewise function to include SawtoothWave function

I am trying to write a Piecewise function that includes the SawtoothWave function. Can someone indicate how to do this, or if it is possible within mathematica?

The piecewise code is here:

G = -1/50; (*G gradient*)
P = 6; (*pulse period in seconds*)

L = 3.08/2; (*pulse width in dimensionless units*)
tform = 1; (*time allowed for soliton to form independently,e.g.100*)

bell[s_, x_] := Exp[-(x/s)^2/2]

Astep[x_, t_] := -bell[1, x] bell[10, t - 10] + Piecewise[{{G SawtoothWave[{-1, 1}, x/L + t/P]}, t > tform}, 0]

Animate[Plot[Astep[x, t], {x, -10, 10}, PlotRange -> {{-10, 10}, {-0.05, 0.05}}], {t, 0, 50}, AnimationRunning -> False]


The error message I receive is as follows:

• you should have Piecewise[{{G SawtoothWave[{-1, 1}, x/L + t/P], t > tform}}, 0] instead of Piecewise[{{G SawtoothWave[{-1, 1}, x/L + t/P]}, t > tform}, 0] (misplaced '}'). – kglr Jun 16 '19 at 17:35
• Thanks! That has solved it. – Brendan Darrer Jun 16 '19 at 17:41