📄 antenna.m
字号:
function varargout = antenna(varargin)% This GUI was created by Gazi K Asadullah% ANTENNA Application M-file for antenna.fig% FIG = ANTENNA launch antenna GUI.% ANTENNA('callback_name', ...) invoke the named callback.% Last Modified by GUIDE v2.0 29-Jul-2004 10:58:35if nargin == 0 % LAUNCH GUI fig = openfig(mfilename,'reuse'); % Generate a structure of handles to pass to callbacks, and store it. handles = guihandles(fig); guidata(fig, handles); if nargout > 0 varargout{1} = fig; endelseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try if (nargout) [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard else feval(varargin{:}); % FEVAL switchyard end catch disp(lasterr); endend%| ABOUT CALLBACKS:%| GUIDE automatically appends subfunction prototypes to this file, and %| sets objects' callback properties to call them through the FEVAL %| switchyard above. This comment describes that mechanism.%|%| Each callback subfunction declaration has the following form:%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)%|%| The subfunction name is composed using the object's Tag and the %| callback type separated by '_', e.g. 'slider2_Callback',%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.%|%| H is the callback object's handle (obtained using GCBO).%|%| EVENTDATA is empty, but reserved for future use.%|%| HANDLES is a structure containing handles of components in GUI using%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This%| structure is created at GUI startup using GUIHANDLES and stored in%| the figure's application data using GUIDATA. A copy of the structure%| is passed to each callback. You can store additional information in%| this structure at GUI startup, and you can change the structure%| during callbacks. Call guidata(h, handles) after changing your%| copy to replace the stored original so that subsequent callbacks see%| the updates. Type "help guihandles" and "help guidata" for more%| information.%|%| VARARGIN contains any extra arguments you have passed to the%| callback. Specify the extra arguments by editing the callback%| property in the inspector. By default, GUIDE sets the property to:%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))%| Add any extra arguments after the last argument, before the final%| closing parenthesis.global sonnet_file;% --------------------------------------------------------------------function varargout = shape_Callback(h, eventdata, handles, varargin)% --------------------------------------------------------------------function varargout = fr_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.fr=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = Zc_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.Zc=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = material_Callback(h, eventdata, handles, varargin)% --------------------------------------------------------------------function varargout = calculate_Callback(h, eventdata, handles, varargin)% global Er length width width_res h Leff;global fr Zc;fr=(handles.fr);Zc=(handles.Zc);% Initializing output fieldsmaterial_value= get(handles.material, 'Value');shape_value= get(handles.shape, 'Value');set(handles.len, 'String', '-');set(handles.width, 'String', '-');set(handles.warn, 'String', '-');set(handles.power, 'String', '-' );set(handles.direct, 'String', '-' );set(handles.Yo, 'String', '-' );set(handles.feed_Zc, 'String', '-' );set(handles.width_feed, 'String', '-' );set(handles.Er, 'String', '-' );set(handles.h, 'String', '-' );set(handles.Leff, 'String', '-' );%Checking if the input fields are emptyfr_empty=isnan(fr);Zc_empty=isnan(Zc);if shape_value == 1 set(handles.warn, 'String', 'You must choose a shape for the Antenna' ); error('You must choose a shape');endif shape_value==2 %DIsplaying picture of microstrip axes(handles.picture); [pic, map]=imread('microstrip.bmp'); image(pic); colormap(map); set(handles.pic_title, 'String', 'Microstrip Antenna' ); if fr_empty == 1 set(handles.warn, 'String', 'You must specify the resonant frequency' ); error('You must specify the resonant frequency'); end if Zc_empty == 1 set(handles.warn, 'String', 'You must specify the resonant Impedance' ); error('You must specify the resonant frequency'); end if material_value == 1 set(handles.warn, 'String', 'You must choose a circuit material' ); error('You must choose a circuit material'); end% Setting up the thickness and dielectric constant for different materials if material_value == 2 global d d=0.02 global Er; Er=3; copper_thickness=0.017; set(handles.warn, 'String', 'You must choose a different material as Rogers 1 is unavailable' ); error('You must choose a different material, Rogers one is not available right now'); end if material_value == 3 global d d=0.03; copper_thickness=0.018; global Er Er=3; end if material_value == 4 global d d=0.025; copper_thickness=0.019; global Er Er=9.6; end%Displaying out the Dielectric constant and Thickness set(handles.Er, 'String', Er ); set(handles.h, 'String', d );%calculating width of Patch Antenna global width width=calc_width_patch(fr, Er, d);%calculating the Length and effective length of PAtch antenna global length Leff [length, delta_length, Leff]=cal_len_patch(Er, width, d, fr); %calculating the width of feedline global width_res [ratio, width_res]=width_feedline(Zc, Er, d);% set(handles.len, 'String', length );% set(handles.width, 'String', width ); yo= inset_feed(length, width, fr, Zc); %calculating Inset feed point for Patch Antenna sonnet_file=0; [direct, directdB, Prad]=directivity(-90, 90, 0.1, 180, fr, width, Leff, d);%Calculating directivity, and radiated power Prad=(Prad*1000); Prad=num2str(Prad); %Displaying all the output parameters on the GUI set(handles.len, 'String', length ); set(handles.width, 'String', width ); set(handles.power, 'String', Prad ); set(handles.direct, 'String', directdB ); set(handles.Yo, 'String', yo ); set(handles.feed_Zc, 'String', Zc ); %set(handles.feed_Zc, 'String', Zc ); set(handles.width_feed, 'String', width_res ); set(handles.warn, 'String', 'parameters calculated' ); set(handles.Leff, 'String', Leff ); %PLotting Radiation Pattern: axes(handles.eplane); [E_plane, phi]= e_plane1(fr, width, Leff, d, directdB); %plotting H-plane axes(handles.hplane); [h_plane, theta]= h_plane1(fr, width, Leff, d, directdB); time=clock; year=time(1); month=time(2); day=time(3); hour=time(4); min=time(5); save ('sonnet_file.dat', 'length', 'Leff', 'width', 'width_res', 'Zc', 'yo', 'd', 'year', 'month', 'day', 'hour', 'min', '-ASCII');end% % --------------------------------------------------------------------% function varargout = browse_Callback(h, eventdata, handles, varargin)% global sonnet_file;% global Er length width width_res d Leff Zc fr;% % axes(handles.picture);% [pic, map]=imread('non_inset_feed.bmp');% image(pic);% set(handles.pic_title, 'String', 'Radiating Patch' );% % %asking to select a file name to save the geo file% set(handles.save, 'String', 'Select a geo file' );% % %Checking if the file name has correct extension. (.geo)% check=0;% while check==0% [sonnet_file1,sonnet_path] = uiputfile('*.geo','choose sonnet geo file name');% check=check_extension_patch(sonnet_file1);% if check==0% set(handles.warn, 'String', 'You must choose file with .dat extension .dat' );% end% end% sonnet_file=strcat(sonnet_path, sonnet_file1);% % % set(handles.save, 'String', sonnet_file );% file_empty=isstr(sonnet_file);% file_empty1=isempty(sonnet_file);% % % if (file_empty == 0) | (file_empty1 == 1) % set(handles.warn, 'String', 'You must specify a filename' );% error('You must specify the file name');% end% %Creating sonnet geo file% sonnet_boxes_patch(Er, length, width, width_res, d, Zc, sonnet_file, Leff); % creating sonnet geo file% % --------------------------------------------------------------------% function varargout = inset_Callback(h, eventdata, handles, varargin)% global fr;% global inset_file;% global Er length width width_res d Leff Zc;% % axes(handles.picture);% [pic, map]=imread('inset_feed.bmp');% image(pic);% set(handles.pic_title, 'String', 'Inset fed Patch' );% %colormap(map);% %Cheking for right extension (.geo)% check=0;% while check==0% [inset_file1,inset_path] = uiputfile('*.geo','choose sonnet geo file name');% check=check_extension_patch(inset_file1);% if check==0% set(handles.warn, 'String', 'You must choose file with .dat extension .dat' );% end% end% inset_file=strcat(inset_path, inset_file1);% % % inset_empty=isstr(inset_file);% inset_empty1=isempty(inset_file);% % if (inset_empty == 0) | (inset_empty1 == 1) % set(handles.warn, 'String', 'You must specify a filename' );% error('You must specify the file name');% end% % set(handles.save, 'String', inset_file );% %creating sonnet geo file for Inset feed% global yo% yo= inset_feed(length, width, fr, Zc);% sonnet_inset_patch(Er, length, width, width_res, d, Zc, inset_file, Leff, yo);% --------------------------------------------------------------------function varargout = sonnetgeo_Callback(h, eventdata, handles, varargin)sonnet
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -