MATLAB: How to plot 3d graphs using just matrices Values

3d plotsmeshgrid

A = {1;2;5;7;10;20};
B = {1;2;5;7;10;20}';
[X Y] = meshgrid(A,B);
Z = { 1 8 18 21 25 26; 1 8 18 21 25 26; 1 8 18 21 25 26; 1 8 18 21 25 26; 1 8 18 21 25 26; 1 8 18 21 25 26};
surf(X,Y,Z);

Best Answer

The curly braces are used to create cell arrays. You want numerical arrays and need square brackets:
A = [1;2;5;7;10;20];
B = [1;2;5;7;10;20]';
[X Y] = meshgrid(A,B);
Z = [1 8 18 21 25 26; 1 8 18 21 25 26; 1 8 18 21 25 26; ...
1 8 18 21 25 26; 1 8 18 21 25 26; 1 8 18 21 25 26];
surf(X,Y,Z);
And suddenly it works :-)