How to create a piecewise sine function?

5 次查看(过去 30 天)
Wes
Wes 2011-9-23
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?

回答(1 个)

Walter Roberson
Walter Roberson 2011-9-23
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?

Community Treasure Hunt

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

Start Hunting!

Translated by