% 2D Finite Difference Method % Purpose: class use only % (c) Zhengqing Yun, 2005 % % Usage: fdc % clear all; % read geometry and boundary conditions fn = input('Enter the input file name: ','s'); [imax jmax bc nbn K] = geobc(fn); % build FD equations Ax = B. A = bldA(K,nbn,jmax,bc); B = bldB(K,nbn,bc); % solve for x x = A\B; % result visualization Phi = reshape(x,jmax,imax); figure;image(Phi'); axis image; set(gcf,'color','w'); figure;contour(flipud(Phi'),20); axis image; grid off; set(gcf,'color','w'); %figure;surf(Phi'); set(gcf,'color','w');