Message Boards Message Boards

[✓] Plot a sawtooth pulse wave?

GROUPS:

Hello, I am familiar with plotting a regular sawtooth function, but I can seem to figure out how to plot a sawtooth pulse with periods of zero amplitude just like a pulse wave/step response function. I do not see any paameters in the sawtooth function for this. Id greatly appreciate the help. Thanks

POSTED BY: Nathan Olszewski
Answer
3 months ago

Like this?

Show[Plot[SawtoothWave[x], {x, #[[1]], #[[2]]},
    (*Plot options.*)
    PlotRange -> {{-12, 12}, All},
    ExclusionsStyle -> Dashed(*Plot*)] & /@ {{-2,0.1(*to get the dashes*)}, {1, 5.1}, {9, 10.1}}(*Show*)]
POSTED BY: Isaac Abraham
Answer
3 months ago

Roll your own?:

sw[x_, a_: 0] := Max[0, Mod[x - a, 1 + a, -a]];
Plot[sw[x, 1], {x, -5, 5}]
POSTED BY: Michael Rogers
Answer
3 months ago

Group Abstract Group Abstract