matlab:在3d图中在x,y和z轴上绘制2d线图 [英] matlab: Graph 2d lines on x,y and z axis in a 3d plot

查看:92
本文介绍了matlab:在3d图中在x,y和z轴上绘制2d线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定一个复杂的信号,我有3个维度:I实部,Q虚部,T时间. 我已经可以使用:

Given a complex signal I have 3 dimensions: I-real part, Q-imaginary part, T-time. I have been able to use the:

plot3(I,T,Q) 

在matlab中绘制信号.我现在想将Q虚部线图​​添加到z平面,将I实部线图添加到x,y平面.如何在图表中添加其他线条?我附了一张我想要的样子的照片:

to plot the signal in matlab. I would now like to add the Q-imaginary part line graph to the z-plane and the I-real part line graph to the x,y plane. How can I add the additional lines to the graph? I included a picture of what I want it to look like:

到目前为止,我是这样的:

What I have so far is this:

推荐答案

下面的注释代码:

% 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图中的零向量设置为任何单值向量,您可以通过以下方法来设置正确的长度:

In your case the planes being plotted on aren't actually the axes' zeros. You may want to set the zero vector in each 2D plot to be any single-valued vector, which you can make the correct length by methods like this:

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

例如,绘制与图像相似的功能:

For instance, plotting a similar function to your image:

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

这篇关于matlab:在3d图中在x,y和z轴上绘制2d线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆