⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ifa.m

📁 天线设计方面的资料
💻 M
📖 第 1 页 / 共 3 页
字号:
zoom

% --- Executes on button press in pushbutton16.
function Pan_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton16 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Link relevant axes 
zoom off
set(handles.Zoom,'Value',0)
pan
linkaxes([handles.axes1,handles.axes2],'x')


% --- Executes on button press in Reset.
function Reset_Callback(hObject, eventdata, handles)
% hObject    handle to Reset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
zoom out
zoom off
pan off
set(handles.Zoom,'Value',0)
set(handles.Pan,'Value',0)
Ax = findobj(handles.Wizard,'Type','Axes');
Ax(find(Ax == handles.antenna)) = [];
for i=1:numel(Ax)
    Data = get(Ax(i),'UserData');
    set(Ax(i),'XLim',Data.x_rng);
    set(Ax(i),'YLim',Data.y_rng);
end


function Frequency_Callback(hObject, eventdata, handles)
% hObject    handle to Frequency (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 Frequency as text
%        str2double(get(hObject,'String')) returns contents of Frequency as a double
Val = str2double(get(hObject,'String'));
if isnan(Val)
    P = get(hObject,'Value');
    set(hObject,'String',num2str(P));
else
    if get(hObject,'Value')~= Val
        if get(handles.Units,'Value')
            PrevF = get(hObject,'Value');
            set(hObject,'Value',300*Val/PrevF);
            Units_Callback(handles.Units, eventdata, handles)
        end
       set(hObject,'Value',Val);
    end
end   


% --- 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


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');
Graphs = findobj('Type','Axes');

if get(hObject,'Value')
    set(hObject,'String','Meters')
    Wavelength = 300/f;
    % Change axes' labels to reflect units
    mLabel(get(handles.axes1,'XLabel'));
    mLabel(get(handles.axes1,'YLabel'));
    mLabel(get(handles.axes2,'XLabel'));
    mLabel(get(handles.axes2,'YLabel'));
   
else
    set(hObject,'String','Wavelenghts')
    Wavelength = 1/(300/f);
    % Change axes' labels to reflect units
    reLabel(get(handles.axes1,'XLabel'));
    reLabel(get(handles.axes1,'YLabel'));
    reLabel(get(handles.axes2,'XLabel'));
    reLabel(get(handles.axes2,'YLabel'));
   
end
% Scale axes' data
linkaxes([handles.axes1 handles.axes2],'off')
xScale(handles.axes1,Wavelength);
yScale(handles.axes1,Wavelength);
xScale(handles.axes2,Wavelength);
yScale(handles.axes2,Wavelength);
if (get(handles.Zoom,'Value') | get(handles.Pan,'Value') )
    linkaxes([handles.axes1 handles.axes2],'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)
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)
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 IFAParameters                   % Load presaved variables
Properties = {'Height', 'LF', 'LB'};  % Variable names
NVar = numel(Properties);
format =  '%01g\t';
Lines = size(Height,1);              % Number of curves
if Lines > 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 = 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
end
if (Length > 150) Length = 150; end
prompt = {'Height','Length LF','Length LB'};        % Give Prompt meaningful names
while notValid    
    Parameters = inputdlg(prompt,'Edit Graphs',...
        repmat([Lines Length],NVar,1),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 elements
    Numel = zeros(1,NVar);
    for i = 1:NVar
        Numel(i) = eval(strcat('numel(',Properties{i},');'));
    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 'IFAParameters' Height LF LB   % Save new parameters
    end
end

%%%%%%%%%% RELOAD IFA 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');



% --------------------------------------------------------------------
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 L.F.V. Neves Leal        ',...
          '      "Design Curves for an Inverted F Antenna"',...
          '               Final Year Design Project, 2003      ',...
          '  School of Electrical and Information Engineering',...
          '          University of the Witwatersrand           '};
Msg=msgbox(string,'About Design Curves');
set(Msg,'WindowStyle','modal');






% --- Executes on selection change in TraceSwitch.
function TraceSwitch_Callback(hObject, eventdata, handles)
% hObject    handle to TraceSwitch (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 TraceSwitch contents as cell array
%        contents{get(hObject,'Value')} returns selected item from TraceSwitch
% Interactive(handles.Wizard,'Draw')



% --- 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




% --------------------------------------------------------------------
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 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 + -