0
votes

I have multiple vectors of varying lengths that I would like to plot next to each other in 3D space in Matlab.

As an example: Say I have three vectors: X is a 5x2 vector, Y is a 10x2 vector and Z is a 15x2 vector.

Each element of every vector has the format: x value, y value but the x values of the various vectors do not match.

I would like to plot these vectors in 3D space, next to each other. The reason why I don't want to plot them using "hold" is because most of the data have the same values, but I would like to see how many of the plots have the same value at a specific time.

I hope my questions makes sense. Please just ask if anyone is unsure.

1

1 Answers

0
votes

I think you are looking for the function ribbon.

Documentation: http://www.mathworks.fr/help/techdoc/ref/ribbon.html

enter image description here

EDIT:

if your x's do not have the same length, you can combine it with interp1 as follow:

x1=0:0.1:1;
x2=0:0.02:1.5;
y1=x1.^2;
y2=sqrt(x2);
y2=interp1(x2,y2,x1);
ribbon(x1',[y1;y2]')