The ‘x’ vector is missing a ‘30’ value (supplied here).
I get a different result when I plot those data —
x = [0 10 20 30 0 10 20 30 0 10 20 30];
y = [0 0 0 0 15 15 15 15 30 30 30 30];
t = [20 22 25 23 22 27 30 25 19 20 18 22];
% Q = [size(x); size(y); size(t)]
xv = linspace(min(x), max(x), numel(x));
yv = linspace(min(y), max(y), numel(y));
[X,Y] = meshgrid(xv,yv);
F = scatteredInterpolant(x(:),y(:),t(:)); % Use 'scatteredInterpolant'
T = F(X,Y);
figure
surfc(X, Y, T)
colormap(turbo)
colorbar
xlabel('X')
ylabel('Y')
zlabel('T')
[Uy,yix] = unique(y);
Rows = mean(diff(yix));
X = reshape(x,Rows,[]); % Using 'reshape'
Y = reshape(y,Rows,[]);
T = reshape(t,Rows,[]);
figure
surfc(X, Y, T) % 'surfc'
colormap(turbo)
colorbar
xlabel('X')
ylabel('Y')
zlabel('T')
figure
meshc(X, Y, T) % 'meshc'
colormap(turbo)
colorbar
xlabel('X')
ylabel('Y')
zlabel('T')
Experiment to get different results.
.




