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

📄 dipole.m

📁 用MATLAB语言编程计算半波对称振子场图
💻 M
字号:
n=2*pi;
 
d=n/50+0.001;
 
[x,y] = meshgrid(-n:d:n,-n:d:n);
 
         nn=30
         j=0;
 
          M = moviein(nn);
          for j=1:nn
 
z=(x./sqrt(x.^2+y.^2)).^2.*(...
 -sin(sqrt(x.^2+y.^2)-j*2*pi/nn)...
 -cos(sqrt(x.^2+y.^2)-j*2*pi/nn)./sqrt(x.^2+y.^2)...
 );
 
v=[-1 -0.9 -0.8 -0.75 -0.5 -0.25 -0.1 -0.05 0 0.05 0.1 0.25 0.5 ...
0.75 0.8 0.9 1];

%v=[ -0.75 -0.5 -0.25 0 0.25 0.5 0.75 ];
 
contour(z,v);
%contour(z,30);
%colorbar
axis equal
%grid on
 
         M(:,j) = getframe;
         end
         movie(M,100,10)    
         
         
         clear all
N     = 10;
d     = 0.5;
alpha = 2*pi;
dip=[1:N];
kd=2*pi*d;
phi=[0:2*pi/800.1:2*pi];
framemax = 48;
M = moviein(framemax);
set(gcf,'Position',[100 100 640 480])
for n=1:framemax
u=kd*cos(phi)-alpha/framemax*(n-1);
F=abs(sin(N.*u./2+N*1e-15)./sin(u./2+1e-15));
plot(F.*cos(phi),F.*sin(phi),'r','LineWidth',3);
%polar(phi,abs(F));
title([  num2str(N),' elements, '...
        ,num2str(d),' \lambda apart'],'fontsize', 18)
xlabel(['\alpha=' ,num2str(alpha/framemax*(n-1))],'Color','k','fontsize', 18)
hold on
plot(N.*cos(phi),N.*sin(phi),'b','LineWidth',2);
plot(dip-N/2-0.5,dip*0,'o','linewidth',3)
hold off
axis equal
M(:,n) = getframe(gcf);
end
clf reset
set(gcf,'Position',[100 100 800 600])
axis off
movie(M,1,6)


clear all
N     = 10;
d     = 0.5;
alpha = 2*pi;
dip=[1:N];
kd=2*pi*d;
phi=[0:2*pi/800.1:2*pi];
framemax = 48;
M = moviein(framemax);
set(gcf,'Position',[100 100 640 480])
for n=1:framemax
u=kd*cos(phi)-alpha/framemax*(n-1);
F=abs(sin(N.*u./2+N*1e-15)./sin(u./2+1e-15));
plot(F.*cos(phi),F.*sin(phi),'r','LineWidth',3);
%polar(phi,abs(F));
title([  num2str(N),' elements, '...
        ,num2str(d),' \lambda apart'],'fontsize', 18)
xlabel(['\alpha=' ,num2str(alpha/framemax*(n-1))],'Color','k','fontsize', 18)
hold on
plot(N.*cos(phi),N.*sin(phi),'b','LineWidth',2);
plot(dip-N/2-0.5,dip*0,'o','linewidth',3)
hold off
axis equal
M(:,n) = getframe(gcf);
end
clf reset
set(gcf,'Position',[100 100 800 600])
axis off
movie(M,1,6)







clear;clc;
range=1/4;
point=6;
wave_length_value=1;
measurement=7.022*(10)^(-3);
v0=1;
k=(2*pi)/wave_length_value;
a=measurement*wave_length_value;
l=range*wave_length_value;
step=l/(point-1);
i_point=1:point; % 测试点赋值
matrix_wavelength(i_point)=step*(i_point-1); 
z=linspace(-l,l,100); % 积分离散

for i_point=1:point;    % 求解A向量
r=((matrix_wavelength(i_point)-z).^2 + a^2).^(1/2); % 场源距离离散
g=exp(-j*k*r)./r; % 格林函数离散
A(i_point)=trapz(z,sin(k*(1/4-abs(z))).*g); % A元素确定
end
for i_point=1:point; % 求解B向量
r=((matrix_wavelength(i_point)-z).^2 + a^2).^(1/2); % 场源距离离散
g=exp(-j*k*r)./r; % 格林函数离散
B(i_point)=trapz(z,sin(2*k*(1/4-abs(z))).*g); % B元素确定
end
for i_point=1:point;   % 求解C向量
r=((matrix_wavelength(i_point)-z).^2 + a^2).^(1/2); % 场源距离离散
g=exp(-j*k*r)./r; % 格林函数离散
C(i_point)=trapz(z,sin(3*k*(1/4-abs(z))).*g); % B元素确定
end
for i_point=1:point;   % 求解D向量
r=((matrix_wavelength(i_point)-z).^2 + a^2).^(1/2); % 场源距离离散
g=exp(-j*k*r)./r; % 格林函数离散
D(i_point)=trapz(z,sin(4*k*(1/4-abs(z))).*g); % B元素确定
end
for i_point=1:point; % 求解E向量
r=((matrix_wavelength(i_point)-z).^2 + a^2).^(1/2); % 场源距离离散
g=exp(-j*k*r)./r; % 格林函数离散
E(i_point)=trapz(z,sin(5*k*(1/4-abs(z))).*g); % B元素确定
end
for i_point=1:point; % 求解F向量
F(i_point)=cos(k*matrix_wavelength(i_point)); % B元素确定
end

impedance_matrix=[A.',B.',C.',D.',E.',F.']; % 阻抗矩阵确定
for i_point=1:point; % 电压矩阵确定
voltage_matrix(i_point)=(-j*v0/60)*sin(k*abs(matrix_wavelength(i_point))); % B元素确定
end
% 求解a1,a2,a3,a4,a5,C_contant;
current=impedance_matrix\voltage_matrix';
z_distribute=linspace(0,l,100); % 图形表示
current_function=current(1,1)*sin(k*(l-abs(z_distribute))) +current(2,1)*sin(2*k*(l-abs(z_distribute)))+current(3,1)*sin (3*k*(l-abs(z_distribute)))+current(4,1)*sin(4*k*(l-abs(z_distribute)))+current(5,1)*sin(5*k*(l-abs(z_distribute))); 
current_re=real(current_function); % 电流实虚部
current_im=imag(current_function);
plot(current_re,z_distribute,'r'); % 绘图
hold on;
plot(current_im,z_distribute,'g');
xlabel('current distribution');
ylabel('unitary distance')
title('antenna current distribution plot');
legend('real current','imag current',2);

⌨️ 快捷键说明

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