基于Matlab绘制偶极子和矩形孔径天线方向图

简介: 基于Matlab绘制偶极子和矩形孔径天线方向图

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

⛄ 内容介绍

研究了直线天线的两种简单分析模型:无穷小偶极子和有限长偶极子.建立了偶极子辐射强度和方向性系数数学模型.应用MATLAB对其性能进行了仿真分析.通过仿真分析比较,得出了和实际结果相符的结论,从而为天线的研究提供了有价值的基础理论.

⛄ 部分代码

function varargout = Dipole_Aperture_Aid(varargin)

% DIPOLE_APERTURE_AID M-file for Dipole_Aperture_Aid.fig

%      DIPOLE_APERTURE_AID, by itself, creates a new DIPOLE_APERTURE_AID or raises the existing

%      singleton*.

%

%      H = DIPOLE_APERTURE_AID returns the handle to a new DIPOLE_APERTURE_AID or the handle to

%      the existing singleton*.

%

%      DIPOLE_APERTURE_AID('CALLBACK',hObject,eventData,handles,...) calls the local

%      function named CALLBACK in DIPOLE_APERTURE_AID.M with the given input arguments.

%

%      DIPOLE_APERTURE_AID('Property','Value',...) creates a new DIPOLE_APERTURE_AID or raises the

%      existing singleton*.  Starting from the left, property value pairs are

%      applied to the GUI before Dipole_Aperture_Aid_OpeningFcn gets called.  An

%      unrecognized property name or invalid value makes property application

%      stop.  All inputs are passed to Dipole_Aperture_Aid_OpeningFcn via varargin.

%

%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one

%      instance to run (singleton)".

%

% See also: GUIDE, GUIDATA, GUIHANDLES


% Edit the above text to modify the response to help Dipole_Aperture_Aid


% Last Modified by GUIDE v2.5 30-Dec-2010 21:53:47


% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name',       mfilename, ...

                  'gui_Singleton',  gui_Singleton, ...

                  'gui_OpeningFcn', @Dipole_Aperture_Aid_OpeningFcn, ...

                  'gui_OutputFcn',  @Dipole_Aperture_Aid_OutputFcn, ...

                  'gui_LayoutFcn',  [] , ...

                  'gui_Callback',   []);

if nargin && ischar(varargin{1})

   gui_State.gui_Callback = str2func(varargin{1});

end


if nargout

   [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

else

   gui_mainfcn(gui_State, varargin{:});

end

% End initialization code - DO NOT EDIT



% --- Executes just before Dipole_Aperture_Aid is made visible.

function Dipole_Aperture_Aid_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn.

% hObject    handle to figure

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% varargin   command line arguments to Dipole_Aperture_Aid (see VARARGIN)


%%__________________________________________________________________

%%____________________Start of the Program__________________________

%%__________________________________________________________________


%Variable Definition Specially Global and Preset ones

% Some values have default values so that it could be sketch by a single

% click

global PhiMax;

PhiMax = 2*pi;      % set default Phi


global ThetaMax;

ThetaMax = pi;      % set default Theta


global dimension;

dimension = 50;      %set default dimension


global Length

Length=1;            % set default Length

% Choose default command line output for Dipole_Aperture_Aid

handles.output = hObject;


% Update handles structure

guidata(hObject, handles);


% UIWAIT makes Dipole_Aperture_Aid wait for user response (see UIRESUME)

% uiwait(handles.figure1);



% --- Outputs from this function are returned to the command line.

function varargout = Dipole_Aperture_Aid_OutputFcn(hObject, eventdata, handles)

% varargout  cell array for returning output args (see VARARGOUT);

% hObject    handle to figure

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Get default command line output from handles structure

varargout{1} = handles.output;



% --- Executes on selection change in popupmenu1.

function popupmenu1_Callback(hObject, eventdata, handles)

% hObject    handle to popupmenu1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array

%        contents{get(hObject,'Value')} returns selected item from popupmenu1

%%____________________ Gather user information for Phi range

global PhiMax

content = get(hObject,'Value');

switch content

   case 1

     PhiMax=2*pi;

      PhiMax

     

   case 2

      PhiMax=1.5*pi;

       PhiMax


   case 3  

       PhiMax=pi;

       PhiMax

   

   case 4

       PhiMax=.5*pi;

       PhiMax

       

   otherwise

       disp('input wrong'); %% Otherwise condition will never happend

end



% --- Executes during object creation, after setting all properties.

function popupmenu1_CreateFcn(hObject, eventdata, handles)

% hObject    handle to popupmenu1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called


% Hint: popupmenu controls usually have a white background on Windows.

%       See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

   set(hObject,'BackgroundColor','white');

end



% --- Executes on selection change in popupmenu2.

function popupmenu2_Callback(hObject, eventdata, handles)

% hObject    handle to popupmenu2 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array

%        contents{get(hObject,'Value')} returns selected item from popupmenu2

%%____________ Gather user information for Theta ____________________

global ThetaMax

content = get(hObject,'Value'); % returned value is Theta angle , stored in content

switch content

   case 1

       ThetaMax=pi;

       ThetaMax

   case 2

       ThetaMax=.75*pi;

       ThetaMax

   case 3

       ThetaMax=.5*pi;

       ThetaMax

   otherwise

       disp('Non Above , actually this condition will never ever happen')

end



% --- Executes during object creation, after setting all properties.

function popupmenu2_CreateFcn(hObject, eventdata, handles)

% hObject    handle to popupmenu2 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called


% Hint: popupmenu controls usually have a white background on Windows.

%       See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

   set(hObject,'BackgroundColor','white');

end




function edit1_Callback(hObject, eventdata, handles)

% hObject    handle to edit1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Hints: get(hObject,'String') returns contents of edit1 as text

%        str2double(get(hObject,'String')) returns contents of edit1 as a double

%%____________ Returns the dimension of phi & theta matrix assigned by user

global dimension

dimension=str2double(get(hObject,'String'));

dimension=floor(dimension);    % as floats arent accepted dimension floored for example


%if dimension ( announced as Quality ) = 112.5 it's gonna turn into 112



zlabel('Axis Z');

title(['L =  ',num2str(Length),'Lambda'])


% --- Executes on button press in pushbutton3.

function pushbutton3_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton3 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

%%__________________ Sketch using Plot3 ___________________________

global phi

global theta

global Length

global R

global x

global y

global z

[THETA,PHI]=meshgrid(theta,phi);

R=abs((cos(Length.*pi.*cos(THETA))- cos(Length.*pi))./(sin(THETA)));

x=R.*sin(THETA).*cos(PHI);

y=R.*sin(THETA).*sin(PHI);

z=R.*cos(THETA);

%figure

plot3(x,y,z);

%clear all

set(gca,'PlotBoxAspectRatio',[1,1,1])

axis equal;

xlabel('Axis X');

ylabel('Axis Y');

zlabel('Axis Z');

title(['L =  ',num2str(Length),'Lambda'])


% --- Executes on button press in pushbutton4.

function pushbutton4_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton4 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

%______________________ Sketch Using Surf_________________________

global phi

global theta

global Length

global R

global x

global y

global z

[THETA,PHI]=meshgrid(theta,phi);

R=abs((cos(Length.*pi.*cos(THETA))- cos(Length.*pi))./(sin(THETA)));

x=R.*sin(THETA).*cos(PHI);

y=R.*sin(THETA).*sin(PHI);

z=R.*cos(THETA);

%Length

%figure

surf(x,y,z);

%clear all

set(gca,'PlotBoxAspectRatio',[1,1,1])

axis equal;

xlabel ('Axis X');

ylabel ('Axis Y');

zlabel ('Axis Z');

title(['L =  ',num2str(Length),'Lambda'])

% --- Executes on button press in pushbutton5.

function pushbutton5_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton5 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

%________________Sketch 2Dimension E Plane Using Polar____________________

global phi

global theta

global Length

global r


r=abs((cos(Length.*pi.*cos(phi))- cos(Length.*pi))./(sin(phi)));

%figure

polar(phi,r);

axis equal

title(['L =  ',num2str(Length),'Lambda'])

%clear all




function edit3_Callback(hObject, eventdata, handles)

% hObject    handle to edit3 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Hints: get(hObject,'String') returns contents of edit3 as text

global ap_a;

ap_a = str2double(get(hObject,'String')); % returns contents of edit3 as a double



% --- Executes during object creation, after setting all properties.

function edit3_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit3 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called


% Hint: edit controls usually have a white background on Windows.

%       See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'),...

       get(0,'defaultUicontrolBackgroundColor'))

   set(hObject,'BackgroundColor','white');

end




function edit6_Callback(hObject, eventdata, handles)

% hObject    handle to edit6 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Hints: get(hObject,'String') returns contents of edit6 as text

global ap_b;

ap_b = str2double(get(hObject,'String'));% returns contents of edit6 as a double



% --- Executes during object creation, after setting all properties.

function edit6_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit6 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called


% Hint: edit controls usually have a white background on Windows.

%       See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), ...

       get(0,'defaultUicontrolBackgroundColor'))

   set(hObject,'BackgroundColor','white');

end



% --- Executes on button press in pushbutton6.

function pushbutton6_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton6 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% ploting aperture antenna 3D

global ap_a;

global ap_b;

global phi;

global theta;

[Phi,Theta]=meshgrid(phi,theta);

% ap_a & ap_b are dimensions of the notch

% U = sin(theta).cos(phi)   v = sin(theta).sin(phi) for 3D plot

U = sin(Theta).*cos(Phi);

V = sin(Theta).*sin(Phi);

B=2*pi;

% u & v both in lowercase for 2D plot

u = sin(theta).*cos(0);

v = sin(theta).*sin(0);

% rho is 2D polar pattern

rho = abs (sinc(B*ap_a/2.*u).*sinc(B*ap_b/2.*v));

% E for 3D pattern

E = abs( sinc(B*ap_a/2.*U).*sinc(B*ap_b/2.*V));

x = E.*cos(Phi).*sin(Theta);

y = E.*sin(Phi).*sin(Theta);

z = E.*cos(Theta);

% polar plot

plot(rho.*sin(phi),rho.*cos(phi));

set(gca,'PlotBoxAspectRatio',[1,3,1])

xlabel('Axis X');

ylabel('Axis Y');

title(['Rectangular Aperture Antenna Cross Section for '...

   ,num2str(ap_a),',',num2str(ap_b),' Lambda'])


figure('Name','3D Aperture Plot');

mesh(x,y,z)

set(gca,'PlotBoxAspectRatio',[.5,.5,2])

xlabel('Axis X');

ylabel('Axis Y');

zlabel('Axis Z');

title(['Rectangular Aperture Antenna '...

   ,num2str(ap_a),',',num2str(ap_b),'Lambda'])


⛄ 运行结果

⛄ 参考文献

[1]张清泉, 吉安平, 行小帅,等. 基于MATLAB的偶极子辐射性能仿真分析[J]. 仪器仪表与分析监测, 2011(3):3.

⛄ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


相关文章
|
2月前
|
编解码
MATLAB | 科研绘图第十一期动态趋势图
MATLAB | 科研绘图第十一期动态趋势图
27 0
|
2月前
|
存储 编解码
MATLAB | 科研绘图第十八期散点密度图
MATLAB | 科研绘图第十八期散点密度图
60 0
|
2月前
|
存储 编解码
MATLAB | 科研绘图第十九期散点密度图强化版
MATLAB | 科研绘图第十九期散点密度图强化版
37 0
|
2月前
|
编解码
MATLAB | 科研绘图第二十三期箭头图
MATLAB | 科研绘图第二十三期箭头图
33 0
|
10天前
|
Shell
MATLAB 求解特征方程的根轨迹图稳定性分析
MATLAB 求解特征方程的根轨迹图稳定性分析
12 0
|
2月前
|
编解码
MATLAB | 科研绘图第十期四象限的正弦图
MATLAB | 科研绘图第十期四象限的正弦图
28 0
|
2月前
|
编解码
MATLAB | 科研绘图第二十二期信号分解中用于展示效果的三维瀑布图
MATLAB | 科研绘图第二十二期信号分解中用于展示效果的三维瀑布图
28 0
|
3月前
|
Perl
【MFAC】基于全格式动态线性化的无模型自适应控制(Matlab代码)
【MFAC】基于全格式动态线性化的无模型自适应控制(Matlab代码)
|
3月前
【数值分析】迭代法求方程的根(附matlab代码)
【数值分析】迭代法求方程的根(附matlab代码)
|
3月前
【数值分析】Jacobi、Seidel和Sor迭代法求解线性方程组(附matlab代码)
【数值分析】Jacobi、Seidel和Sor迭代法求解线性方程组(附matlab代码)

热门文章

最新文章