📄 lpda.m
字号:
% --- Executes during object creation, after setting all properties.
function Frequency_CreateFcn(hObject, eventdata, handles)
% hObject handle to Frequency (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
% --- Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox3
function Units_Callback(hObject, eventdata, handles)
% hObject handle to Units (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of Units
CurrentAxes = gca;
f = get(handles.Frequency,'Value');
BL = get(handles.Parameter5,'Value');
if get(hObject,'Value')
set(hObject,'String','Meters')
Wavelength = 300/f;
else
set(hObject,'String','Wavelenghts')
Wavelength = 1/(300/f);
end
BL = BL*Wavelength;
set(handles.Parameter5,'Value',BL)
set(handles.Parameter5,'String',num2str(BL))
LPDADraw(handles)
% % Scale axes' data
% linkaxes([handles.axes1,handles.axes2,handles.axes3],'off')
% if (get(handles.Zoom,'Value') | get(handles.Pan,'Value') )
% linkaxes([handles.axes1,handles.axes2,handles.axes3],'x')
% end
if CurrentAxes ~= handles.antenna
set(gcf,'CurrentAxes',gca)
else
set(gcf,'CurrentAxes',handles.axes1);
end
% % Redraw GUI to reflect changes
% Interactive(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 elements'},'Warning');
set(Warn,'WindowStyle','modal')
uiwait(Warn);
notValid = 1;
load LPDAParameters % Load presaved variables
% Variable names
Properties = {'FF', 'N', 'Z', 'Gain'};
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
% Give Prompt meaningful names
Length = repmat(Length,NVar,1);
prompt = {'Form Factor','Number of Elements',...
'Ratio of the Geometric Mean of Input Resistance to Boom Impedance','Gain'};
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 columns');
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 'LPDAParameters' FF N Z Gain % Save new parameters
Msg = msgbox({'Restart to view changes'},'Saved')
set(Msg,'WindowStyle','modal')
uiwait(Msg);
end
end
%%%%%%%%%% RELOAD LPDA 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 selection change in BWRVal.
function BWRVal_Callback(hObject, eventdata, handles)
% hObject handle to BWRVal (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 BWRVal contents as cell array
% contents{get(hObject,'Value')} returns selected item from BWRVal
LPDASelection(handles);
[X,Y] = SetUp(handles,get(handles.Parameter1,'Value'));
LPDASetParameters(handles,X,Y);
LPDADraw(handles)
InterpSelect_Callback(handles.InterpSelect,eventdata,handles)
BWR = [1.5 3 5 10];
BWR = BWR(get(handles.BWRVal,'Value'));
FreqMax = (get(handles.Frequency,'Value'));
FreqMin = FreqMax/BWR;
set(handles.Parameter6,'String',sprintf('%5g',FreqMin));
set(handles.Parameter6,'Value',str2double(sprintf('%5g',FreqMin)));
% --- Executes on selection change in TFVal.
function TFVal_Callback(hObject, eventdata, handles)
% hObject handle to TFVal (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 TFVal contents as cell array
% contents{get(hObject,'Value')} returns selected item from TFVal
LPDASelection(handles);
[X,Y] = SetUp(handles,get(handles.Parameter1,'Value'));
LPDASetParameters(handles,X,Y);
LPDADraw(handles)
InterpSelect_Callback(handles.InterpSelect,eventdata,handles)
% --- Executes on selection change in BoomImpVal.
function BoomImpVal_Callback(hObject, eventdata, handles)
% hObject handle to BoomImpVal (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 BoomImpVal contents as cell array
% contents{get(hObject,'Value')} returns selected item from BoomImpVal
LPDASelection(handles);
[X,Y] = SetUp(handles,get(handles.Parameter1,'Value'));
LPDASetParameters(handles,X,Y);
LPDADraw(handles)
InterpSelect_Callback(handles.InterpSelect,eventdata,handles)
% --- Executes during object creation, after setting all properties.
function TraceSwitch_CreateFcn(hObject, eventdata, handles)
% hObject handle to TraceSwitch (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes during object creation, after setting all properties.
function BWRVal_CreateFcn(hObject, eventdata, handles)
% hObject handle to BWRVal (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes during object creation, after setting all properties.
function TFVal_CreateFcn(hObject, eventdata, handles)
% hObject handle to TFVal (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes during object creation, after setting all properties.
function BoomImpVal_CreateFcn(hObject, eventdata, handles)
% hObject handle to BoomImpVal (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
set(hObject,'BackgroundColor','white');
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 Dale Wright ',...
' "Antenna Design Wizards: LPDA" ',...
' 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');
% --------------------------------------------------------------------
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)
% --- Executes during object deletion, before destroying properties.
function Wizard_DeleteFcn(hObject, eventdata, handles)
% hObject handle to Wizard (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
FullScreenEdit = findobj('Tag','FullScreenEdit');
if ~isempty(FullScreenEdit)
delete(FullScreenEdit)
end
% --- Executes during object creation, after setting all properties.
function Wizard_CreateFcn(hObject, eventdata, handles)
% hObject handle to Wizard (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --------------------------------------------------------------------
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 + -