0
$\begingroup$

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.

$\endgroup$
3
  • 2
    $\begingroup$ Perhaps read the documentation for the PieceWise function in Mathematica and see if you can use that to do what you want $\endgroup$
    – Bill
    Apr 2 at 22:01
  • $\begingroup$ Thanks @Bill. Forgot about piecewise functions. I will positively look into it. Meanwhile if you find anything readymade, please do answer. $\endgroup$
    – User6292
    Apr 2 at 22:07
  • 1
    $\begingroup$ 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. $\endgroup$
    – thorimur
    Apr 2 at 22:15
1
$\begingroup$

One possible approach :

Plot[Sin[2 Pi x] If[SawtoothWave[x] > 2/3 , 0, 1]
   , {x, -2, 2}
   , Exclusions -> None
   , PlotStyle -> Thick]   

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.