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개)

KSSV
KSSV 2021년 2월 5일
편집: KSSV 2021년 2월 5일

0 개 추천

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

I plugged this in and I am getting an error "Size arguments must be integer scalars" for the "X = reshape(x,nx,ny) ;" line. Do you know what is the problem?
KSSV
KSSV 2021년 2월 5일
Share your data.
From the code you gave, I see that nx and ny are both 100x1 double, which I think is where the issue might be coming from.
KSSV
KSSV 2021년 2월 5일
Yes you are right.....I have edited the code, try now. If not working share the data.

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

카테고리

제품

릴리스

R2020a

질문:

2021년 2월 5일

댓글:

2021년 2월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by