I am new to MATLAB. I have 2 functions,z=sin(x)
and y=cos(x)
. I want to plot them in a 3D (x,y,z) chart (but not with subplot), z=sin(x)
in plane X-Z and y=cos(x)
in plane X-Y. As I have seen, standard plot or plot3d functions are not obvious to use. May be needed some axis manipulation, etc, but I don't have it. I would like to know the solution if only I would or any guidance is appreciated.
我是MATLAB的新手。我有2个函数,z = sin(x)和y = cos(x)。我想将它们绘制在3D(x,y,z)图表中(但不包括子图),z = sin(x)在平面X-Z中,y = cos(x)在平面X-Y中。正如我所见,标准plot或plot3d函数使用起来并不明显。可能需要一些轴操作等,但我没有它。我想知道解决方案,只要我愿意或任何指导得到赞赏。
1 个解决方案
#1
2
Here you have a small example of what you want to do
这里有一个你想做的小例子
clear;clc; %clear variables from workspace and clean commadn line
x=-pi:0.1:pi; %define x
cero=zeros(size(x)); %create a vector of zeros
z=sin(x);
y=cos(x);
hold on %tell matlab to plot averything together
plot3(x,cero,z,'g');
plot3(x,y,cero,'r');
grid on; %pretty self-describing
view([1,1,1]) %set viewpoint to not se just a plane
hold off %stop ploting everything together
Ask if you don't get some of the lines
问你是否没有得到一些线路
#1
2
Here you have a small example of what you want to do
这里有一个你想做的小例子
clear;clc; %clear variables from workspace and clean commadn line
x=-pi:0.1:pi; %define x
cero=zeros(size(x)); %create a vector of zeros
z=sin(x);
y=cos(x);
hold on %tell matlab to plot averything together
plot3(x,cero,z,'g');
plot3(x,y,cero,'r');
grid on; %pretty self-describing
view([1,1,1]) %set viewpoint to not se just a plane
hold off %stop ploting everything together
Ask if you don't get some of the lines
问你是否没有得到一些线路