📄 sonnet.m
字号:
function varargout = Sonnet(varargin)% SONNET Application M-file for Sonnet.fig% FIG = SONNET launch Sonnet GUI.% SONNET('callback_name', ...) invoke the named callback.% Last Modified by GUIDE v2.0 29-Jul-2004 13:36:09if 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.% --------------------------------------------------------------------function varargout = length_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.length=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = width_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.width=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = Leff_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.Leff=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = yo_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.yo=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = Rin_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.Rin=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = res_Callback(h, eventdata, handles, varargin)NewStrVal = get (h, 'String');NewVal = str2double(NewStrVal);handles.res=NewVal;guidata(h, handles);% --------------------------------------------------------------------function varargout = ref_close_Callback(h, eventdata, handles, varargin)delete Sonnet;close Sonnet;sonnet% --------------------------------------------------------------------function varargout = refresh_Callback(h, eventdata, handles, varargin)delete Sonnet;refresh(Sonnet);global d;% % --------------------------------------------------------------------% global length Leff width width_res Zc yo; data=load ('sonnet_file.dat');length1 =data(1);Leff1= data(2);width1=data(3);width_res1=data(4);Zc1=data(5);yo1=data(6);d=data(7);year=data(8);month=data(9);day=data(10);hour=data(11);min=data(12);% set(handles.length_disp, 'String', length1);% set(handles.width_disp, 'String', width1);% set(handles.Leff_disp, 'String', Leff1);% set(handles.Zc_disp, 'String', Zc1);% set(handles.width_res_disp, 'String', width_res1);% set(handles.feedpoint, 'String', yo1);set(handles.length, 'String', length1);set(handles.width, 'String', width1);set(handles.Leff, 'String', Leff1);set(handles.Rin, 'String', Zc1);set(handles.res, 'String', width_res1);set(handles.yo, 'String', yo1);%displaying clockset(handles.year, 'String', year);set(handles.day, 'String', day);set(handles.min, 'String', min);set(handles.mm, 'String', month);set(handles.hour, 'String', hour);set(handles.info, 'String', 'The Loaded data was Created by the Antenna GUI on:');set(handles.colon, 'String', ':');set(handles.semi, 'String', ';');set(handles.bi1, 'String', '/');set(handles.bi2, 'String', '/');if (d==0.02)set(handles.warn, 'String', 'These data are from the Antenna GUI. Rogers 1 was used with it' );set(handles.material, 'String', 'Rogers 1' );endif (d==0.03)set(handles.warn, 'String', 'These data are from the Antenna GUI. Rogers 2 was used with it' );set(handles.material, 'String', 'Rogers 2' );endif (d==0.06)set(handles.warn, 'String', 'These data are from the Antenna GUI. Rogers 3 was used with it' );set(handles.material, 'String', 'Rogers 3' );endhandles.length=length1;guidata(h, handles);handles.width=width1;guidata(h, handles);handles.yo=yo1;guidata(h, handles);handles.Leff=Leff1;guidata(h, handles);handles.Rin=Zc1;guidata(h, handles);handles.res=width_res1;guidata(h, handles);% --------------------------------------------------------------------function varargout = Inset_Callback(h, eventdata, handles, varargin) global length width yo Leff Zc width_res d;length=(handles.length);width=(handles.width);yo=(handles.yo);Leff=(handles.Leff);Zc=(handles.Rin);width_res=(handles.res);Er=3;if ((length > 20) | (isnan(length))) set(handles.warn, 'String', 'Check your length parameter'); error('Check your length parameter');endif ((width > 20) | (isnan(width))) set(handles.warn, 'String', 'Check your width parameter'); error('Check your width parameter');endif ((Leff > 20) | (isnan(Leff))) set(handles.warn, 'String', 'Check your Effective length parameter'); error('Check your Effective length parameter');endif ((width_res > 5) | (isnan(width_res))) set(handles.warn, 'String', 'Check your width of feedline parameter'); error('Check your width of feedline parameter');end[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 .geo extension .dat' ); endendinset_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'); endset(handles.save, 'String', inset_file );%creating sonnet geo file for Inset feed% yo= inset_feed(length, width, fr, Zc);set(handles.length_disp, 'String', length);set(handles.width_disp, 'String', width);set(handles.Leff_disp, 'String', Leff);set(handles.Zc_disp, 'String', Zc);set(handles.width_res_disp, 'String', width_res);set(handles.feedpoint, 'String', yo);set(handles.h, 'String', d);set(handles.Er, 'String', Er);sonnet_inset_patch(Er, length, width, width_res, d, Zc, inset_file, Leff, yo);set(handles.warn, 'String', 'Sonnet geometry file has been created.');% --------------------------------------------------------------------function varargout = non_inset_Callback(h, eventdata, handles, varargin)global length width yo Leff Zc width_res d;length=(handles.length);width=(handles.width);Leff=(handles.Leff);Zc=(handles.Rin);width_res=(handles.res);Er=3;if ((length > 20) | (isnan(length))) set(handles.warn, 'String', 'Check your length parameter'); error('Check your length parameter');endif ((width > 20) | (isnan(width))) set(handles.warn, 'String', 'Check your width parameter'); error('Check your width parameter');endif ((Leff > 20) | (isnan(Leff))) set(handles.warn, 'String', 'Check your Effective length parameter'); error('Check your Effective length parameter');endif ((width_res > 5) | (isnan(width_res))) set(handles.warn, 'String', 'Check your width of feedline parameter'); error('Check your width of feedline parameter');end [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 fileset(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 .geo extension .dat' ); endendsonnet_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 fileset(handles.length_disp, 'String', length);set(handles.width_disp, 'String', width);set(handles.Leff_disp, 'String', Leff);set(handles.Zc_disp, 'String', Zc);set(handles.width_res_disp, 'String', width_res);set(handles.feedpoint, 'String', '-');set(handles.h, 'String', d);set(handles.Er, 'String', Er);sonnet_boxes_patch(Er, length, width, width_res, d, Zc, sonnet_file, Leff); % creating sonnet geo fileset(handles.warn, 'String', 'Sonnet geometry file has been created.');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -