xmax=10e-2; dx=xmax/10; [X,Y]=meshgrid(0:dx:xmax,0:dx:xmax) V=400.*(X.^2).*Y %V=200*sin(X).*cos(Y) contourf(X,Y,V) %surf(X,Y,V) [Ex,Ey]=gradient(-V,dx,dx) Eabs=sqrt(Ex.^2+Ey.^2) figure, surf(X,Y,Eabs)