Reputation: 2596
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)
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:
Upvotes: 1
Views: 2209
Reputation: 30047
Commented code below:
% 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
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
Upvotes: 1