How to make a surface plot given an NxMxK matrix?
显示 更早的评论
I have a matrix that is 100x2x10 double, which represents 10 timesteps each with two columns of 100 data points each (the first column is repeated data that just marks the location where the second piece of data is from). I want to make a surface plot using this data to show the change over time. What would be the best way to go about this?
回答(1 个)
Let A be your 100*2*10 data matrix.
[m,n,p] = size(A) ;
for i = 1:p
x = A(:,1,i) ; y = A(:,2,i) ;
nx = length(unique(x)) ; ny = length(unique(y)) ;
X = reshape(x,nx,ny) ;
Y = reshape(y,nx,ny) ;
mesh(X,Y) ;
drawnow
end
4 个评论
Paul Hurley
2021-2-5
KSSV
2021-2-5
Share your data.
Paul Hurley
2021-2-5
KSSV
2021-2-5
Yes you are right.....I have edited the code, try now. If not working share the data.
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!