matlab:在3d图中的x,y和z轴上绘制2d线

时间:2017-01-18 16:09:56

标签: matlab plot

鉴于信号复杂,我有3个维度:I-real part,Q-imaginary part,T-time。 我已经能够使用:

plot3(I,T,Q) 

在matlab中绘制信号。我现在想将Q虚部分线图添加到z平面,将I实部分线图添加到x,y平面。如何在图表中添加其他行?我列出了一张我希望它看起来像的照片:

enter image description here

到目前为止我所拥有的是:

enter image description here

1 个答案:

答案 0 :(得分:1)

以下评论代码:

% hold on for multiple plots
figure(1)
hold on

% Plot 3D Figure
plot3(I,T,Q) 

% Plot on XY plane - means function in Z = 0
plot3(I,T,Q.*0)

% Plot on YZ plane - means function in X = 0
plot(I.*0,T,Q)

hold off

在你的情况下,绘制的平面实际上不是轴'零。您可能希望将每个2D绘图中的零向量设置为任何单值向量,您可以通过以下方法设置正确的长度:

% vector of 2s the same size as Q
A = (Q./Q).*2;
% or
A = ones(size(Q)).*2;
% or 
A = A.*0 + 2;

例如,为您的图像绘制类似的功能:

x = linspace(0,20,1000);

hold on
plot3(sin(x),x,cos(x))
plot3(sin(x),x,cos(x).*0 - 1)
plot3(sin(x).*0 + 1,x,cos(x))
grid on
hold off

3D function with 2D plots

相关问题