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

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.

댓글 수: 2

Can you give an example of Y
Joseph Harris
Joseph Harris 2013년 3월 6일
편집: Joseph Harris 2013년 3월 6일
This is basically what i want to do, so my Y-axis is a simple [1 x 21] vector, but my X and Z axis are [21 x 1001] matrices.
I managed to get the above image by creating waterfall plot with only the first row of my X matrix, but obviously i would like to plot each row of Z against the corresponding row of X.

댓글을 달려면 로그인하십시오.

 채택된 답변

Joseph Harris
Joseph Harris 2013년 3월 7일

0 개 추천

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

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 6일
Example
m=10;
n=40;
z= sort(rand(m , n),2)
y = randi(m,m,1)
x = rand(m, n)
xx=x(y,:)
zz=z(y,:)
plot(zz',xx')

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by