MATLAB: How to create a waterfall plot with two matrices and a vector

matricesvectorswaterfall

Hi,
Not sure if this is possible, but:
I want to create a waterfall plot from a set of data in the following format
X = [m x n]
Y = [m]
Z = [m x n]
So what i want is for the mth value in Y, i want to take the corresponding n row from X and plot it against the n row from Z. Then move onto the next value of m from Y, and plot X against Z etc.
So I end up with many plots of X vs Z along a Y-axis to form a waterfall.
How might i do this? The waterfall function only allows X to be a vector.

Best Answer

OK so i did it in the end. It wasn't that hard, but i had to do it in a loop. Couldn't work out a way to do it in one step.
for g = 1:length(Y)
hold on
waterfall(X(g,:),Y(g),Z(g,:))
end
Related Question