## 关于电磁波近远场变换 原

徐维

%function Near2far(pathstr1,pathstr2,n_beam,index_beam)
function Near2far(pathstr1,~,n_beam,index_beam)
pathstr1='G:\ISO\Horn\Horn-v-8.2-12.4-df0.1-Tx.nf_V-Pol..nf.txt'
n_beam=2048;
index_beam=1024
global fft_y;
global x_points;
global x_delta;
global y_points;
global y_delta;
global fre;
global coordtype;
global crosstick;
global pol;
global coord1_cent;
global coord2_cent;
global coord1_points;
global coord2_points;
global coord1_delta;
global coord2_delta;
global bias;
global CutStr;

bias=double(bias);
fre=double(fre)
x_delta=double(x_delta)
y_delta=double(y_delta)
coord1_delta=double(coord1_delta)
coord2_delta=double(coord2_delta)
rows=y_points;
columns=x_points;
x_points=int32(x_points);
y_points=int32(y_points);
coord1_points=int32(coord1_points);
coord2_points=int32(coord2_points);

coord1=(coord1_cent-(double(coord1_points)-1)*coord1_delta/2+coord1_delta*double(0:(coord1_points-1)));
coord1=double(ones(coord2_points,1))*double(coord1);
coord2=double((coord2_cent-(double(coord2_points)-1)*coord2_delta/2+coord2_delta*double(0:(coord2_points-1))));
coord2=double(ones(coord1_points,1))*double(coord2);
coord2=coord2';

coord1=reshape(coord1,1,coord1_points*coord2_points);
coord2=reshape(coord2,1,coord1_points*coord2_points);
c1=double(coord1).*double(cosd(bias))-double(coord2).*double(sind(bias));
c2=double(coord1).*double(sind(bias))+double(coord2).*double(cosd(bias));
coord1=c1;
coord2=c2;
% fid=fopen(pathstr1);
% fclose(fid);
% amp=reshape(amp,rows,columns,n_beam);
% fid=fopen(pathstr2);
% fclose(fid);
% pha=reshape(pha,rows,columns,n_beam);
amp=rawdata(:,1);
amp=reshape(amp,rows,columns,n_beam);
pha=rawdata(:,2);
pha=reshape(pha,rows,columns,n_beam);
ap=((10.^(amp(:,:,index_beam)/20)).*exp(1i*pha(:,:,index_beam)*pi/180));
if(crosstick==1)
amp=rawdata(:,1);
amp=reshape(amp,rows,columns,n_beam);
pha=rawdata(:,2);
pha=reshape(pha,rows,columns,n_beam);
apc=((10.^(amp(:,:,index_beam)/20)).*exp(1i*pha(:,:,index_beam)*pi/180));
else
apc=ap.*0+(10.^(-200/20));
end
delete amp;
delete pha;

%***********fill zeros*********
lzeros=fix((fft_x-size(ap,2))/2);
rzeros=fft_x-lzeros-size(ap,2);
uzeros=fix((fft_y-size(ap,1))/2);
dzeros=fft_y-uzeros-size(ap,1);
ap=[zeros(size(ap,1),lzeros),ap,zeros(size(ap,1),rzeros)];
ap=[zeros(uzeros,fft_x);ap;zeros(dzeros,fft_x)];

apc=[zeros(size(apc,1),lzeros),apc,zeros(size(apc,1),rzeros)];
apc=[zeros(uzeros,fft_x);apc;zeros(dzeros,fft_x)];
% figure
% plot(db(abs(ap(:,1))));
% colorbar
ap1=double(fft_x).*double(fft_y).*(ifft2(ap,fft_y,fft_x));
ap1=ifftshift(ap1);
% figure
% plot(db(abs(ap1(:,256))));
% colorbar
z=(linspace(1,fft_y,fft_x))'*double(ones(1,fft_x))+double(ones(fft_y,1))*double(linspace(1,fft_y,fft_x));
ap1=ap1.*(-1).^z;

apc=double(fft_x).*double(fft_y).*(ifft2(apc,fft_y,fft_x));
apc=ifftshift(apc);
apc=apc.*(-1).^z;
%*****************AZ/EL坐标**************
%************全部整理成一维数组***********
dkx=2*pi/(x_delta*fft_x);
dky=2*pi/(y_delta*fft_y);
kx=(dkx*linspace(-fft_x/2,fft_x/2-1,fft_x));
ky=(dky*linspace(-fft_y/2,fft_y/2-1,fft_y))';
k=2*pi/(300/fre);

switch coordtype
case 'AZ/EL'
cost=cosd(coord2).*cosd(coord1);
sint=sqrt(1-cost.^2);
sinp=(sind(coord2))./(sint);
cosp=(cosd(coord2).*sind(coord1))./(sint);
case 'EL/AZ'
cost=cosd(coord2).*cosd(coord1);
sint=sqrt(1-cost.^2);
cosp=(sind(coord1))./(sint);
sinp=sind(coord2).*cosd(coord1)./(sint);

case 'THETA/PHI'
cost=cosd(coord1);
sint=sind(coord1);
cosp=cosd(coord2);
sinp=sind(coord2);
end

id1=find(coord1==0);
id2=find(coord2==0);
id=find(coord2(id1)==0);
kxi=k.*sint.*cosp;
kyi=k.*sint.*sinp;
kxi(id1)=0;
kyi(id2)=0;

n_angle=length(coord1);
kxi=reshape(kxi,n_angle,1);
kyi=reshape(kyi,n_angle,1);
ap3=interp2(kx,ky,ap1,kxi,kyi);
apc3=interp2(kx,ky,apc,kxi,kyi);
delete ap1
delete apc
[proe,proh]=probedata(fre*1000,cost,pol);
ap3=reshape(ap3,1,n_angle);
apc3=reshape(apc3,1,n_angle);
ftheta=(cost./proe).*(cosp.*ap3+sinp.*apc3);
fphi=(cost./proh).*(cosp.*apc3-sinp.*ap3);
switch (coordtype)
case {'AZ/EL'}
sat=sqrt(1-(cosd(coord2).*cosd(coord1)).^2);
faz=(sind(coord1).*ftheta-sind(coord2).*cosd(coord1).*fphi)./(sat);
fel=(sind(coord2).*cosd(coord1).*ftheta+sind(coord1).*fphi)./(sat);
faz(id1(id))=ap3(id1(id));
amp2=db(abs(faz));
pha2=180*(angle(faz)/pi);
amp2c=db(abs(fel));
pha2c=180*(angle(fel)/pi);
fip=fopen('E:\NFMS2017\prin.bin','wb');
fwrite(fip,[amp2,pha2],'single');
fclose(fip);
fip=fopen('E:\NFMS2017\cross.bin','wb');
fwrite(fip,[amp2c;pha2c],'single');
fclose(fip);
case {'EL/AZ'}
sat=sqrt(1-(cosd(coord1).*cosd(coord2)).^2);
faz=(sind(coord1).*ftheta-sind(coord2).*cosd(coord1).*fphi)./(sat);
fel=(sind(coord2).*cosd(coord1).*ftheta+sind(coord1).*fphi)./(sat);
faz(id1(id))=ap3(id1(id));
amp2=db(abs(faz));
pha2=180*(angle(faz)/pi);
amp2c=db(abs(fel));
pha2c=180*(angle(fel)/pi);
fip=fopen('E:\NFMS2017\prin.bin','wb');
fwrite(fip,[amp2,pha2],'single');
fclose(fip);
fip=fopen('E:\NFMS2017\cross.bin','wb');
fwrite(fip,[amp2c;pha2c],'single');
fclose(fip);
case {'THETA/PHI'}
amp2=db(abs(ftheta));
pha2=180*(angle(ftheta)/pi);
amp2c=db(abs(fphi));
pha2c=180*(angle(fphi)/pi);
fip=fopen('E:\NFMS2017\prin.bin','wb');
fwrite(fip,[amp2,pha2],'single');
fclose(fip);
fip=fopen('E:\NFMS2017\cross.bin','wb');
fwrite(fip,[amp2c,pha2c],'single');
fclose(fip);
end

% AMP=(10.^((faz)/20)).^2+(10.^((fel)/20)).^2;
% samp=(sum(AMP'))';
% sua=sum(samp.*cos(coord2));
% Dir=10*log10(4*180*180/(sua*pi*del*del));

function [proe,proh]=probedata(fre,cossit,pola)
[wa2,wb1,kkk]=wgsize(fre);
% if(pola==1)
switch pola
case 'H-Pol'
[proe,proh]=probepattern(fre,wa2,wb1,cossit,kkk);
case 'V-Pol'
[proh,proe]=probepattern(fre,wa2,wb1,cossit,kkk);
end
% probe size
function [wa2,wb1,kkk]=wgsize(fre)
kkk=1;
if  fre<700  kkk=0;
elseif  fre<1000
wa2=2*250;
wb1=126;
elseif fre<1730
wa2=2*165.1;
wb1=82.55;
elseif fre<2610
wa2=2*109.2;
wb1=54.6;
elseif fre<3950
wa2=2*72.14;
wb1=34.04;
elseif fre<5990
wa2=2*47.55;
wb1=22.15;
elseif fre<8170
wa2=2*34.85;
wb1=15.8;
elseif fre<12500
wa2=2*22.86;
wb1=10.16;
elseif fre<18000
wa2=2*15.8;
wb1=7.9;
elseif fre<24000
wa2=2*10.67;
wb1=4.32;
elseif 26300<fre<40000
wa2=2*7.12;
wb1=3.556;
else
kkk=0;
end

%probe pattern

function [proe,proh]=probepattern(fre,a2,b,cossit,kkk)
if kkk==0
proe=cossit;
proh=1;
else
wl=3e5/fre;
rat=sqrt(1-(wl/a2)^2);
sinsit=(sqrt(1-cossit.^2));
u=(pi*b/wl*sinsit);
msmall=find(abs(u)<1e-7);
u(msmall)=1e-7;
sic=((sin(u))./u);
proe=(sic.*(1+rat*cossit)/(1+rat));
u=(a2/wl*sinsit);
u1=(1-u.*u);
msmall=find(abs(u1)<1e-7);
u1(msmall)=1e-7;
u(msmall)=sqrt(1-1e-7);
cc=((cos(pi*u/2))./u1);
%     proh=(cc.*cossit);

su1=(1.0/rat-1)*8/(pi*pi*sqrt(2));
dec=cossit+1;
nu=(pi/2)^2-(pi*a2/(2*wl)*sinsit).^2;
su2=dec./nu;
u=cos(pi*a2/(2*wl)*sinsit);
proh1=(su1+su2).*u;
proh=proh1/(max(max(proh1)));
end

### 评论(1)

2017/12/20
0
0
WebGL简易教程(六)：第一个三维示例(使用模型视图投影变换)

charlee44
10/05
0
0
Metal入门教程（七）天空盒全景

2018/08/04
0
0

2017/11/22
0
0

（点击上方蓝字，快速关注我们） 中国科学院物理所的不少井盖最近换了“新装”，每个卡通图案对应着一个物理学公式，科学与艺术在 24 个井盖上碰撞出有趣的火花。 　　 一只恐龙站在木块上在...

p5deyt322jacs
2018/05/26
0
0

popgis

5
0

code-ortaerc

4
0

43
0
Mybatis Plus service

/** * @author beth * @data 2019-10-20 23:34 */@RunWith(SpringRunner.class)@SpringBootTestpublic class ServiceTest { @Autowired private IUserInfoService iUserInfoS......

5
0
php7-internal 7 zval的操作

## 7.7 zval的操作 扩展中经常会用到各种类型的zval，PHP提供了很多宏用于不同类型zval的操作，尽管我们也可以自己操作zval，但这并不是一个好习惯，因为zval有很多其它用途的标识，如果自己...

6
0