I want to plot the surface Z of arbitrary given values for each X,Y-pair.
I usually IMPORT the tables with the X,Y,Z data, so I they are not a matrix.
An example is displayed below:
1 1 0.171121066356432
1 2 0.0326008205305280
1 3 0.561199792709660
2 1 0.881866500451810
2 2 0.669175304534394
2 3 0.190433267179954
3 1 0.368916546063895
3 2 0.460725937260412
3 3 0.981637950970750
I tried the following lines to plot the surface
[X,Y] = meshgrid(1:1:3, 1:1:3);
Z=rand(9,1);
surf(X,Y,Z)
But I get the following error:
??? Error using ==> surf at 78
Z must be a matrix, not a scalar or vector.
Error in ==> Untitled2 at 5
surf(X,Y,Z)
Question: I replaced the x,y coordinate with the function meshgrid but what do I make wih the Z values?
I'm aware that Z is not a matrix, but this is exactly the problem!!!
I hope someone knows how to correct these commands
Thanks,
Emerson
Best Answer