MATLAB: I get error saying that z should be a matrix and not a scalar multivariable x = linspace (-1,1); y = linspace (-1,1); [X, Y] = meshgrid(x,y); Z=7*sin(pi.*x).*cos(3*pi.*x); surf(X,Y,Z ) hold on contour(X,Y,Z) hold off rotate3d on Best Answer Z=7*sin(pi.*X).*cos(3*pi.*X); Related SolutionsMATLAB: Error using contour z must be at least a 2×2 matrix Use meshgrid.x = (pi/2):0.1:(2*pi);y = (pi/2):0.1:(2*pi);[X,Y]=meshgrid(x,y);z = sin(X) + cos(Y);contour3(X,Y,z) MATLAB: How to plot cos(x) + cos(y) + cos(z) = 0 Try fimplicit3()fimplicit3(@(x,y,z) cos(x) + cos(y) + cos(z)) Related QuestionScalar MultiplicationHelp plotting with simple linespace and surfHow to use meshgrid and contourZ must be a matrix, not scalar or vectorError when Plotting sin(x)*sin(y) mesh… Please point me in the right direction. ‘Error: Unbalanced or unexpected parenthesis or bracket.’
Best Answer