0001
0002
0003 load('c/p5');
0004 nx=4*round(sqrt(p.np)); ny=nx; x=p.points(1,:)'; y=p.points(2,:)';
0005 xmin=min(x); xmax=max(x); ymin=min(y); ymax=max(y);
0006 xg=linspace(xmin,xmax,nx);yg=linspace(ymin,ymax,ny);
0007 kg=-nx/2:1:nx/2-1; lg=-ny/2:1:ny/2-1;
0008 cmp=1; u1=p.u(1+(cmp-1)*p.np:cmp*p.np);
0009 ugg=tri2grid(p.points,p.tria,u1,xg,yg);
0010 um=sum(sum(ugg))/nx/ny; ug=ugg-um;
0011 uf=fftshift(fft2(ug))/nx/ny;
0012 kf=2*pi/(xmax-xmin); lf=2*pi/(ymax-ymin);
0013
0014
0015 figure(6);clf; kc=5; lc=3;
0016 kvec=(kg(nx/2-kc+2:nx/2+kc+1)-0.5)*kf; lvec=(lg(ny/2-lc+2:ny/2+lc+1)-0.5)*lf;
0017 pcolor(kvec,lvec,(abs(uf(ny/2-lc+2:ny/2+lc+1,nx/2-kc+2:nx/2+kc+1))).^0.5);
0018 axis equal;axis tight;colorbar; grid off; colormap(hot); shading flat;
0019
0020
0021 fs=16;title(['Fourier coeff. at ',str],'Fontsize',16); set(gca,'fontsize',16)
0022