the function is z(x,y) = cos(2y-x)sin(2x)
with the range of x and y values mentioned in the code.
my code:clcclearfunction [z]= contour(x,y)x=[-pi:0.1:pi./2]y=[-pi:0.1:pi]z = cos(2y-x).*sin(2x)end [xx,yy]=meshgrid(x,y)zz = cos(2y-x).*sin(2x)figuresurf(xx,yy,zz)xlabel('X')ylabel('Y')zlable('Z')shading interpcolorbar
when i run it in the command window it says:
Error: File: contour.m Line: 6 Column: 10Invalid expression. Check for missing multiplication operator, missing orunbalanced delimiters, or other syntax error. To construct matrices, usebrackets instead of parentheses.
-this refers to this line of code:
z = cos(2y-x).*sin(2x)
Best Answer