📄 helical.m
字号:
end
% Redraw GUI to reflect changes
HelicalInteractive(handles.Wizard,'draw');
% Scale curves' xdata
function xScale(Ax,Factor)
xaxis = get(Ax,'XLim');
Data = get(Ax,'UserData');
Data.xdata = Data.xdata.*Factor;
Data.xpoint = Data.xpoint.*Factor;
Data.x_rng = Data.x_rng.*Factor;
set(Ax,'UserData',Data);
set(Ax,'XLim',xaxis.*Factor);
Lines = get(Ax,'Children');
k = numel(Lines);
while k>2 % Top 2 are crosshairs
set(Lines(k),'XData',get(Lines(k),'XData').*Factor);
k = k - 1;
end
% Scale curves' ydata
function yScale(Ax,Factor)
yaxis = get(Ax,'YLim');
Data = get(Ax,'UserData');
Data.ydata = Data.ydata.*Factor;
Data.ypoint = Data.ypoint.*Factor;
Data.y_rng = Data.y_rng.*Factor;
set(Ax,'UserData',Data);
set(Ax,'YLim',yaxis.*Factor);
Lines = get(Ax,'Children');
k = numel(Lines);
while k>2 % Top 2 are crosshairs
set(Lines(k),'YData',get(Lines(k),'YData').*Factor);
k = k - 1;
end
% Search for (\lambda) in label and replace with (m)
function mLabel(LabelHandle)
% LabelHandle = get(Ax,'XLabel');
Label = get(LabelHandle,'String');
Pos = strfind(Label,'\lambda');
if ~isempty(Pos)
Label(Pos:Pos+2)='{m}';
Label(Pos+3:Pos+6)=[];
set(LabelHandle,'String',Label);
end
% Search for (m) in label and replace with (\lambda)
function reLabel(LabelHandle)
% LabelHandle = get(Ax,'XLabel');
Label = get(LabelHandle,'String');
Pos = strfind(Label,'{m}');
if ~isempty(Pos)
Label(Pos:numel(Label)) = [];
Label = strcat(Label,'\lambda\bf)');
set(LabelHandle,'String',Label);
end
% --------------------------------------------------------------------
function Help_Callback(hObject, eventdata, handles)
% hObject handle to Help (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function About_Callback(hObject, eventdata, handles)
% hObject handle to About (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
About = msgbox({'Antenna Design Wizards','by Rael Sinai and Moshe Aronowitz'},'About');
set(About,'WindowStyle','modal')
% --------------------------------------------------------------------
function EditGraphs_Callback(hObject, eventdata, handles)
% hObject handle to EditGraphs (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Warn = warndlg({'Changing these parameters will change the graphs. ',' ',...
'Parameter lengths are in wavelenghts.',' ',...
'Parameters must have the same number of columns'},'Warning');
set(Warn,'WindowStyle','modal')
uiwait(Warn);
Warn = warndlg({'These Graphs are defined by equations. ',' ',...
'The equations are used in the file.',' ',...
'Thus changing these parameters might result in incorrect operation'},'Warning');
set(Warn,'WindowStyle','modal')
uiwait(Warn);
notValid = 1;
load HelicalParameters % Load presaved variables
% Variable names
Properties = {'Axial', 'Gain', 'Pitch', 'BW'};
NVar = numel(Properties);
format = '%01g\t';
Lines = zeros(NVar,1);
Length = 0;
for i=1:NVar
Parameters{i} = deblank(num2str(eval(Properties{i}),format));
if (ceil(length(Parameters{i})) + (size(eval((Properties{i})),2)+1)*6) > Length
Length = ceil(length(Parameters{i})) + (size(eval((Properties{i})),2)+1)*6;
end
Lines(i) = eval(strcat('size(',Properties{i},',1)'));
end
if (Length > 150) Length = 150; end
if Lines(2) > 1
Warn = warndlg({'Each row vector corresponds to a curve. ',' ',...
'Each graph must have the same number of columns.'},'Warning');
set(Warn,'WindowStyle','modal');
uiwait(Warn);
end
Length = repmat(Length,NVar,1);
% Give Prompt meaningful names
prompt = {'Axial Length','Gain','Pitch','Bandwidth'};
while notValid
Parameters = inputdlg(prompt,'Edit Graphs',...
([Lines Length]),Parameters);
if ~isempty(Parameters)
for i = 1:NVar
eval(strcat(Properties{i},' = str2num(Parameters{i});'))
end
else
break;
end
% Check Parameters have the same number of columns
Numel = zeros(1,NVar);
for i = 1:NVar
Numel(i) = eval(strcat('size(',Properties{i},',2);'));
end
Numel = Numel ./ Numel(2);
if ~all(Numel == 1)
Warn = errordlg('All parameters must have the same number of elements');
set(Warn,'WindowStyle','modal')
uiwait(Warn);
else notValid = 0;
end
end
if ~notValid
Certain = questdlg('Are you sure you want to save parameters?','Save','Yes','No','Yes');
if strcmp(Certain,'Yes')
save 'HelicalParameters' Axial Gain Pitch BW % Save new parameters
Msg = msgbox({'Restart to view changes'},'Saved')
set(Msg,'WindowStyle','modal')
uiwait(Msg);
end
end
%%%%%%%%%% RELOAD Helical m-file %%%%%%%%%%%%%%%%%%%
% --- Executes on button press in FullScreen.
function FullScreen_Callback(hObject, eventdata, handles)
% hObject handle to FullScreen (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
FullScreenEdit(gca,handles);
% --- Executes on button press in InterpHelp.
function InterpHelp_Callback(hObject, eventdata, handles)
% hObject handle to InterpHelp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Msg = msgbox({strcat('Interpolation is the process of constructing new ',...
' data points from a discrete set of known data points. '),' ',...
strcat('The method of interpolation effects the ''accuracy'' of each new point. ',...
'Try selecting different interpolation methods to see the interpolated curve associated with each. '),' ',...
' Points are drawn connected with default linear interpolation.'},'Interpolation Help');
set(Msg,'WindowStyle','modal');
% --- Executes on slider movement.
function radslidecontrol_Callback(hObject, eventdata, handles)
% hObject handle to radslidecontrol (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,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
%set(handles.Parameter6,'Value',get(hObject,'Value'));
%set(handles.Parameter6,'String',num2str(get(hObject,'Value')));
% --- Executes during object creation, after setting all properties.
function radslidecontrol_CreateFcn(hObject, eventdata, handles)
% hObject handle to radslidecontrol (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
set(hObject,'BackgroundColor',[.9 .9 .9]);
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on slider movement.
function rdslidecontr_Callback(hObject, eventdata, handles)
% hObject handle to rdslidecontr (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,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
%set(handles.rdslidecontr,'Min', 0.1);
x = get(hObject,'Value');
y = (x*22.5)+2.5;
set(handles.Parameter6,'Value',y);
set(handles.Parameter6,'String',num2str(y));
% --- Executes during object creation, after setting all properties.
function rdslidecontr_CreateFcn(hObject, eventdata, handles)
% hObject handle to rdslidecontr (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
set(hObject,'BackgroundColor',[.9 .9 .9]);
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --------------------------------------------------------------------
function DesignCurves_Callback(hObject, eventdata, handles)
% hObject handle to DesignCurves (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
string = {' Design Curves by Wayne Jennings ',...
'"Design Curves for the Axial Mode Helical Antenna"',...
' Final Year Design Project, 2002 ',...
' School of Electrical and Information Engineering',...
' University of the Witwatersrand '};
Msg=msgbox(string,'About Design Curves');
set(Msg,'WindowStyle','modal');
% --- Executes on button press in Rotate.
function Rotate_Callback(hObject, eventdata, handles)
% hObject handle to Rotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pan off
set(handles.Pan,'Value',0)
zoom off
set(handles.Zoom,'Value',0)
if get(hObject,'Value')
rotate3d(handles.antenna,'on');
else
rotate3d(handles.antenna,'off');
end
% --------------------------------------------------------------------
function View_Callback(hObject, eventdata, handles)
% hObject handle to View (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ViewGraphs(handles)
function Parameter8_Callback(hObject, eventdata, handles)
% hObject handle to Parameter8 (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 Parameter8 as text
% str2double(get(hObject,'String')) returns contents of Parameter8 as a double
P = get(hObject,'Value');
set(hObject,'String',num2str(P));
% --- Executes during object creation, after setting all properties.
function Parameter8_CreateFcn(hObject, eventdata, handles)
% hObject handle to Parameter8 (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Edit_Callback(hObject, eventdata, handles)
% hObject handle to Edit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function ViewMenu_Callback(hObject, eventdata, handles)
% hObject handle to ViewMenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -