⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 semianalysis_discrete_fft_2d.asv

📁 通过计算晶体结构来确定其光谱分布
💻 ASV
字号:
%SemiAnalysis_Discrete_2D.m
%Ref:Linfang Shen, Sailing He, and Sanshui Xiao, Large absolute band gaps
%in two-dimensional photonic crystals formed by large dielectric pixels,
%Physical Review B 66, 165315-1->-6 (2002)
clear;
clear global;
close all;

cnh=50;                  %Half number of pixels in one cell
pw=1;                   %Width of pixel
cn=2*cnh;               %Number of pixles in one cell
cw=cn*pw;               %Width of cell
cwh=cnh*pw;             %Half width of cell

HN=cwh;              
%Half number of Fourier coefficients
N=cw;
%Total number of Fourier coefficients
fx=-HN:HN-1;
fy=fx;

x=1:HN;
y=x;
[X,Y]=meshgrid(x,y);
T=10;
%ebxn=1+cos(2*pi*(X+Y)/T);
ebxn=rand(cwh);
t=cat(2,ebxn,fliplr(ebxn));
ebxn_1=cat(1,t,flipud(t));
%ebxn_1=ebxn_1+rot90(ebxn_1);
%clear t X Y;

hN=0;
hN=hN+1;
figure(hN);
imshow(ebxn_1);
title('Original data');

%Standard FFT_0
fs00=fft2(ebxn_1)/cw^2;
fs00=fftshift(fs00);
hN=hN+1;
figure(hN);
surfl(fx,fy,real(fs00));
title('Real fs0');
hN=hN+1;
figure(hN);
surfl(fx,fy,imag(fs0));
title('Imagery fs0');

%Semianalysical FS_0
fs1=zeros(cw);
flag=3;
h=waitbar(0,'Calculating fs1...');
for m=1:cw
    waitbar(m/cw,h);
    for n=1:cw
        fs1(m,n)=ebxn_2D_FS(ebxn,pw,cw,fx(m),fy(n),flag);
    end
end
close(h);
hN=hN+1;
figure(hN);
surfl(fx,fy,real(fs1));
title('Real fs1');
hN=hN+1;
figure(hN);
surfl(fx,fy,imag(fs1));
title('Imagery fs1');

%Standard FFT_1
fd01=zeros(cw);
for m=1:cw
    fs01(:,m)=fft(1./ebxn_1(:,m))/cw;
end
fs01=1./fs01;
for m=1:cw
    fs01(m,:)=fft(fs01(m,:))/cw;
end
fs01=fftshift(fs01);
hN=hN+1;
figure(hN);
surfl(fx,fy,real(fs01));
title('Real fs01');
hN=hN+1;
figure(hN);
surfl(fx,fy,imag(fs01));
title('Imagery fs01');

%Semianalysical FS_1
fs11=zeros(cw);
flag=1;
h=waitbar(0,'Calculating fs11...');
for m=1:cw
    waitbar(m/cw,h);
    for n=1:cw
        fs11(m,n)=ebxn_2D_FS(ebxn,pw,cw,fx(m),fy(n),flag);
    end
end
close(h);
hN=hN+1;
figure(hN);
surfl(fx,fy,real(fs11));
title('Real fs11');
hN=hN+1;
figure(hN);
surfl(fx,fy,imag(fs11));
title('Imagery fs11');

%Standard FFT_2
fd02=zeros(cw);
for m=1:cw
    fs02(m,:)=fft(1./ebxn_1(m,:))/cw;
end
fs01=1./fs01;
for m=1:cw
    fs02(:,m)=fft(fs02(:,m))/cw;
end
fs02=fftshift(fs02);
hN=hN+1;
figure(hN);
surfl(fx,fy,real(fs02));
title('Real fs02');
hN=hN+1;
figure(hN);
surfl(fx,fy,imag(fs02));
title('Imagery fs02');

%Semianalysical FS_2
fs12=zeros(cw);
flag=2;
h=waitbar(0,'Calculating fs12...');
for m=1:cw
    waitbar(m/cw,h);
    for n=1:cw
        fs12(m,n)=ebxn_2D_FS(ebxn,pw,cw,fx(m),fy(n),flag);
    end
end
close(h);
hN=hN+1;
figure(hN);
surfl(fx,fy,real(fs12));
title('Real fs12');
hN=hN+1;
figure(hN);
surfl(fx,fy,imag(fs12));
title('Imagery fs11');

disp('SemiAnalysis_Discrete_2D ends');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -