What is wrong with this piece of code?
plot3(X,Y,Z,'r');
hold on
plot3(Xs,Ys,Zs,'g');
Why do I only get one plot? If I try to draw them separately, both draw just fine.
Your question is quite vague. It's not clear if you want to plot 2 sets of data on the same axes (for that your code is fine), or you want to plot to different axes on the same figure.
Assuming your data looks like this:
X = 0:0.1:100;
Y = sin(X);
Z = cos(X);
Xs = 0:0.1:100;
Ys = cos(X);
Zs = sin(X);
For the first option you would write:
plot3(X,Y,Z,'r');
hold on
plot3(Xs,Ys,Zs,'g');
hold off
and get:
and for the second option you would write:
subplot 211
plot3(X,Y,Z,'r');
subplot 212
plot3(Xs,Ys,Zs,'g');
and get:
X = [1 2 3]; Y = [1 2 3]; Z = [1 2 3]; Xs = 4+[1 2 3]; Ys = 4+[1 2 3]; Zs = 4+[1 2 3];
- Jørgen[min(X(:)) max(X(:))]
before plotting, and see what is the range of your values with respect toXs
. do so forY
andZ
as well, and see if their range is from the same order, or one is very small compared to the other so you can't see him - EBH