📄 comparesemianalysis_discrete_fft_1d.m
字号:
%CompareSemiAnalysis_Discrete_1D.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=100; %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);
fxh=1:HN;
%ebxn=rand(1,cwh); %One fourth of a cell
T=cw/20
ebxn=1+cos(2*pi*fxh/T)
ebxn_1=cat(2,ebxn,fliplr(ebxn))
tN=max(size(ebxn_1))
hN=0;
hN=hN+1;
figure(hN);
plot(fx,ebxn_1);
title('Original data');
FS=zeros(1,N);
for n=-HN:HN-1
FS(HN+n+1)=SquarePixel_ebxn_1D_FC(ebxn,pw,n);
end
hN=hN+1;
figure(hN);
subplot(2,2,1);
plot(fx,real(FS));
title('Real A');
subplot(2,2,2);
plot(fx,imag(FS));
title('Imagery A');
ebxn_1=cat(2,ebxn,fliplr(ebxn));
tN=max(size(ebxn_1));
FS_1=fft(ebxn_1)/cn;
FS_2=FS_1;
z_cn=find(abs(FS_2)<1.0e-10);
FS_2(z_cn)=zeros(1,length(z_cn));
FS_1=fftshift(FS_2);
subplot(2,2,3);
plot(fx,real(FS_1));
title('Real B');
subplot(2,2,4);
plot(fx,imag(FS_1));
title('Imagery B');
disp('CompareSemiAnalysis_Discrete_1D ends');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -