% try plot 3D clear clc x=1:10; y=1:10; [X,Y] = meshgrid(x,y); Z=zeros(10); for i = 1 : 10 for j = 1 : 10 Z(i,j) = i^2 + j^2; end end mesh(X,Y,Z)