How to create a piecewise sine function?

11 views (last 30 days)
Wes
Wes on 23 Sep 2011
Hey all,
I am a trying to create an alternating sine wave of two seperate frequencies over a specified length of time. I have specified my 1 column of points in time and want to calculate the y(x) function/position.
I have my y(x)=sin(w*t)and y2(x)=sin(w2*t)functions, but am not sure how to create this piecewise wave? I am trying to use a for loop with if statements to do this , but I am finding this diffcult. How would you try to accomplish this?

Answers (1)

Walter Roberson
Walter Roberson on 23 Sep 2011
Are the sine wave segments to be pieced together only on full-cycle boundaries, or is it necessary to match phase because one just leaves off and the other begins at the same point? Or if the boundary is not a full cycle, is it allowed for there to be a "glitch" in switching from the one to the other?

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!