Trouble plotting a surface from N^2 3D vectors
1 view (last 30 days)
Show older comments
I am in need of a bit of assistance with surface plotting. N^2 3D vectors in an 3xNxN array, M.
where M( 1 , : , : ) are my X coordinates
M( 2 , : , : ) are my Y coordinates
and M( 3 , : , : ) are my Z coordinate.
I thought I could simply say
surf(X,Y,Z)
But that returns the error Z must be a matrix, not a vector or a scalar
I don't understand this as Z is a matrix, yes?
0 Comments
Answers (1)
Walter Roberson
on 17 Nov 2015
X = squeeze(M(1,:,:));
Y = squeeze(M(2,:,:));
Z = squeeze(M(3,:,:));
surf(X,Y,Z)
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!