필터 지우기
필터 지우기

Surface plot using surf() and mesh grid

조회 수: 6 (최근 30일)
federico nutarelli
federico nutarelli 2021년 8월 20일
댓글: federico nutarelli 2021년 8월 20일
Hi all,
I have two vectors and a matrix that I would like to plot in 3D (as surfaces). I have seen that there is a command called surf() to do so. Now, my variables are two vectors, say k1 and k2 of length (1x741) and a matrix, say omega, of dimension (12x741). When I perform:
[X,Y]=meshgrid(k1,k2)
my new vectors X and Y, are, of course 741x741. My problem is: is there a way to transform the 12x741 matrix in, say, a matrix Z so that I can perform
surf(X,Y,Z)
without dimensionality errors?
Thank you

채택된 답변

KSSV
KSSV 2021년 8월 20일
You can use interp2, imresize to resize your desired matrices into required dimensions.
Let Omega be your matrix of size 12*741.
Z = imresize(Omega,[741 741]) ;
Now you can use surf.
  댓글 수: 1
federico nutarelli
federico nutarelli 2021년 8월 20일
@KSSV thank you for your reply. However, I might have posed the question in the wrong way. In particular I would like 12 surfaces to appear. The matrix Omega is a 12x741 since it contains 12 curves. With imresize the surface plot is just one

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by