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

5 次查看(过去 30 天)
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
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by