📄 comparesemianalysis_discrete_fft.asv
字号:
%CompareSemiAnalysis_Discrete.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=6; %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
ebxn=rand(cwh); %One fourth of a cell
HN=cwh;
%Half number of Fourier coefficients
N=cw;
%Total number of Fourier coefficients
fx=(-HN:HN-1);
fy=fx;
FS=zeros(N,N,3);
for flag=1:3
for n=-HN:HN-1
for m=-HN:HN-1
FS(HN+n+1,HN+m+1,flag)=ebxn_2D_FS(ebxn,pw,cw,m,n,flag);
end
end
end
hN=0;
hN=hN+1;
figure(hN);
for m=1:3
subplot(2,3,m);
plot(fx,real(FS(HN,:,m)));
str=sprintf('Real %d',m);
title(str);
subplot(2,3,3+m);
plot(fx,imag(FS(HN,:,m)));
str=sprintf('Imagery %d',m);
title(str);
end
t=cat(2,ebxn,fliplr(ebxn));
ebxn_1=cat(1,t,flipud(t));
clear t;
tN=max(size(ebxn_1));
FS_1=zeros(tN,tN,3);
t=zeros(tN);
et=1./ebxn_1;
%Model 1 FFT
for m=1:tN
t(:,m)=fft(et(:,m));
end
t=1./t;
for m=1:tN
FS_1(m,:,1)=fft(t(m,:));
end
%Model 2 FFT
for m=1:tN
t(m,:)=fft(et(m,:));
end
t=1./t;
for m=1:tN
FS_1(:,m,2)=fft(t(:,m));
end
%Model 3 FFT
FS_1(:,:,3)=fft2(ebxn_1);
for m=1:3
FS_1(:,:,m)=fftshift(FS_1(:,:,m));
end
hN=hN+1;
figure(hN);
for m=1:3
subplot(2,3,m);
plot(fx,real(FS_1(HN,:,m)));
str=sprintf('Real %d',m);
title(str);
subplot(2,3,3+m);
plot(fx,imag(FS(HN,:,m)));
str=sprintf('Imagery %d',m);
title(str);
end
disp('CompareSemiAnalysis_Discrete ends');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -