MATLAB: Plot z = x^2 + y^2 over the interval -4 <= x <= +4, -4 <= y <= +4.

homeworkintervalplotting

I'm not sure how to plot above equation. Can anyone help me?

Best Answer

N = 100 ;
x = linspace(-4,4,N) ;
y = linspace(-4,4,N) ;
[X,Y] = meshgrid(x,y) ;
Z = X.^2+Y.^2 ;
surf(X,Y,Z)