Solved it already, however if someone got a better way please let me know.
My solution is as follows:
signal[t_] :=
For[i = 0, i < 10, i++,
If[0 <= t <= 0.5/4 + i, Return[0],
If[0.5/4 + i < t <= 1.5/4 + i, Return[1],
If[1.5/4 + i < t <= 2.5/4 + i, Return[0],
If[2.5/4 + i < t <= 3.5/4 + i, Return[-1],
If[3.5/4 + i < t <= 4/4 + i, Return[0]
]]]]]]
My target is as follows:
I want to simulate the behavior of an optical switch, therefor it is important to get the function of my waveform generator. The “weird” zero lines in-between will give me additional information whether the switch behaves the same for e.g. +10V and -10V. The way i get the information out of it, is by comparing the amplitude of the optical output to the zero line output.