How to plot sine waves in x and y-axes simultaneously?

조회 수: 5 (최근 30일)
Arash A.
Arash A. 2020년 8월 4일
댓글: Arash A. 2020년 8월 4일
I have a problem in plotting two sine waves through a single equation in both x and y-axes, simultaneously. The attached image below exhibits the targeted plot. Any suggestions are appreciated.

채택된 답변

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020년 8월 4일
편집: Abdolkarim Mohammadi 2020년 8월 4일
You should first create the horizontal sine and then rotate it for pi/2 using rotation matrix to get the vertical sine. You can play with coefficients of Sine1 to get exactly what you wish.
x = linspace (-5,5, 51)';
Sine1(:,1) = x;
Sine1(:,2) = 0.3 * sin(x);
theta = pi/2;
RotationMatrix = [cos(theta) -sin(theta); sin(theta) cos(theta)];
Sine2 = [Sine1(:,1),Sine1(:,2)] * RotationMatrix;
hold ('on');
plot (Sine1(:,1),Sine1(:,2));
plot (Sine2(:,1),Sine2(:,2));
hold ('off');
box ('on');
  댓글 수: 3
Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020년 8월 4일
편집: Abdolkarim Mohammadi 2020년 8월 4일
Sorry Arash. I can't help you with that :(
Arash A.
Arash A. 2020년 8월 4일
No problem. Thanks so much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by