% "Visualization" Sample commands clear all % % Set up the limits in x and y xORy=linspace(-10,10); % % The "meshgrid" command gives X and Y matrices that run over these values [X,Y]=meshgrid(xORy,xORy); % % Now calculate, element by element, the function of the two variables fBowl=X.^2+Y.^2; % % Make a contour plot, pretty much like what we did in Mathematica contour(X,Y,fBowl) pause % % Here is a "surface" plot of the same function surf(X,Y,fBowl) pause % % Use "quiver" to plot the vector field (y,-x), but use a more coarse grid xORy=-10:10; [X,Y]=meshgrid(xORy,xORy); quiver(X,Y,Y,-X)