MATLAB: How to remove the line in 3D plot

3d plots mesh plot surface plotMATLAB

I am very new to MatLab, I am trying to do 3D plotting as a surface but I think I am doing something wrong since my image does not look right. Also when I try to do a Mesh or surf it complains that "z must be a matrix, not a scalar or vector." To resolve this I let Z=meshgrid(z); in order to change z to a Vector. I am not sure if this is right.
Thank you in advance.
Below is my code:
slow = [21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24];
fast = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
z = [130987 72144 63869 60094 61169 52175 50125 43487 47181 38644 21694 34581 42581 38725 37137 28512 30225 56275 57875 64706 132044 74850 69681 66281 63337 56937 51250 45706 40056 29337 18175 28444 37894 41156 31331 29444 33150 45438 44225 33444 132994 75606 71137 69362 57494 50775 46606 42562 30319 27894 26875 33337 39144 35725 29087 29619 42656 45481 38550 34581 133925 78169 65931 75050 60944 59769 49944 38762 35025 36681 32944 37550 44319 41294 41237 34506 47269 51850 42394 39487];
figure
plot3(slow,fast,z)
xlabel('slow')
ylabel('fast')
grid on
% This is what I use to plot Mesh graph but it does not look right I am not sure if using Z=meshgrid(z); is correct?
% [X1, X2] = meshgrid(slow,fast);
%
% Z=meshgrid(z);
% %Z=X1.*X2;
%
% figure
% mesh(X1,X2,Z)
% shading interp

Best Answer

clc; clear all ;
slow = [21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24];
fast = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
z = [130987 72144 63869 60094 61169 52175 50125 43487 47181 38644 21694 34581 42581 38725 37137 28512 30225 56275 57875 64706 132044 74850 69681 66281 63337 56937 51250 45706 40056 29337 18175 28444 37894 41156 31331 29444 33150 45438 44225 33444 132994 75606 71137 69362 57494 50775 46606 42562 30319 27894 26875 33337 39144 35725 29087 29619 42656 45481 38550 34581 133925 78169 65931 75050 60944 59769 49944 38762 35025 36681 32944 37550 44319 41294 41237 34506 47269 51850 42394 39487];
x = unique(slow) ;
y = unique(fast) ;
nx = length(x) ;
ny = length(y) ;
X = reshape(slow,ny,nx) ;
Y = reshape(fast,ny,nx) ;
Z = reshape(z,ny,nx) ;
surf(X,Y,Z)