Reputation: 1304
I have 2 vectors and one matrix and I would like to make a surface plot.
How could I use the meshgrid and/or the surf function for getting a surface 3D plot?
Upvotes: 2
Views: 1487
Reputation: 112679
[AA, BB] = ndgrid(A,B);
surf(BB,AA,C)
Or use the version of surf
that allows two vectors as its two first inputs:
surf(B,A,C)
which for your particular vectors ([1 2 ...]
) could be simplified to the single-input version
surf(C)
Upvotes: 2