Surface plot using surf() and mesh grid
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
federico nutarelli
el 20 de Ag. de 2021
Comentada: federico nutarelli
el 20 de Ag. de 2021
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
0 comentarios
Respuesta aceptada
KSSV
el 20 de Ag. de 2021
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!