Generate sine wave with varying phase

조회 수: 6 (최근 30일)
A VP
A VP 2018년 9월 26일
댓글: A VP 2018년 9월 26일
Hello, I would like to have 2 sinewaves, the second sine wave should be in phase with the first for half of its total time and must be out of phase by 30° for the rest of the time. Is there a method to generate this?
Thanks in advance.

채택된 답변

Star Strider
Star Strider 2018년 9월 26일
One approach:
t = linspace(0, 2, 500);
f = 10;
s(1,:) = sin(2*pi*f*t/t(end));
s(2,:) = [sin(2*pi*f*t(1:numel(t)/2)/t(end)) sin(2*pi*f*t((numel(t)/2+1):end)/t(end) + 30*pi/180)];
figure
plot(t, s)
grid
Experiment to get the result you want.
And I hope this is not homework.
  댓글 수: 3
Star Strider
Star Strider 2018년 9월 26일
As always, my pleasure!
Good luck with your research!
A VP
A VP 2018년 9월 26일
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by