Why does this code generate my Z value as a single row?
clear; clc; x = linspace(-4,4,40);y = linspace(-3,5,40);[X,Y] = meshgrid(x,y);Z = (2.*x.^2)+(3.*y.^2)-(4.*x.*y)-y-(3.*x);subplot(1,2,1);cs = contour(X,Y,Z);clabel(cs);xlabel('x');ylabel('y');title('(a) Contour plot');grid;subplot(1,2,2);cs = surfc(X,Y,Z);zmin = floor(min(Z));zmax = ceil(max(Z));xlabel('x');ylabel('y');zlabel('f(x,y)');title ('(b) Mesh plot');
Best Answer