# Building complex signals in Mathematica

How to build a particular signal in Mathematica such that we have a sine curve for half cycle, then have zeros for some time and this continues?

It is simple to have the zeros for the second half cycle using the function Max[Sin[t],0].

But what if the zeros extend for a time which is strictly not equal to half cycle?

Please show me the method to develop this.

• Perhaps read the documentation for the PieceWise function in Mathematica and see if you can use that to do what you want
– Bill
Apr 2 at 22:01
• Piecewise is probably the best option, but just to offer another way: you can multiply by an appropriately shifted and flipped UnitStep, e.g. Sin[t] UnitStep[Pi - t]. Note that the function Depress[x0_, x1_] := (UnitStep[x0 - #] + UnitStep[# - x1] &) /; x1 >= x0 will be zero between x0 and x1 and 1 otherwise, and so multiplying Sin[t] by Depress[x0, x1][t] will cause zeros in that range. Apr 2 at 22:15
Plot[Sin[2 Pi x] If[SawtoothWave[x] > 2/3 , 0, 1]
`