testofmeshgrid.m |
L=3; H=2; a=-L; b=L; c=-H; d=H; nx=30; ny=20; X=linspace(a,b,nx+1); Y=linspace(c,d,ny+1); [x,y]=meshgrid(X,Y); % f(x,y)=sin(x)sin(2y) F=sin(x).*sin(2*y); figure('Name','graph of F') meshc(x,y,F) fig1=gcf; figure(fig1) % g(x,y)=x^2-y^2 G=x.^2-y.^2; figure('Name','graph of G') meshc(x,y,G) fig2=gcf; figure(fig2) |