T = table2array(MeshProblem);x = T(:,1);y = T(:,2);z = T(:,3);X = [ones(size(x)) x y x.*y];b = regress(z,X)scatter3(x,y,z,'filled')hold onxfit = min(x):100:max(x);yfit = min(y):10:max(y);[xFIT,yFIT] = meshgrid(xfit,yfit);YFIT = b(1) + b(2)*xFIT + b(3)*xFIT + b(4)*xFIT.*yFIT;mesh(xFIT,yFIT,YFIT)xlabel('dX1/dt')ylabel('dX2/dt')zlabel('dP/dt')view(50,10)hold off
Error message generated:
Error using mesh (line 71)
Z must be a matrix, not a scalar or vector.
Error in EBITREGRESS (line 22)
mesh(xFIT,yFIT,YFIT)
Best Answer