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

📄 yagiuda.m

📁 天线设计方面的资料
💻 M
📖 第 1 页 / 共 3 页
字号:
% handles    structure with handles and user data (see GUIDATA)

% Link relevant axes 
linkaxes([handles.axes1,handles.axes2,handles.axes3,handles.axes4,handles.axes5],'x')
pan off
set(handles.Pan,'Value',0)
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 
linkaxes([handles.axes1,handles.axes2,handles.axes3,handles.axes4,handles.axes5],'x')
zoom off
set(handles.Zoom,'Value',0)
pan


% --- 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.axes2,'XLabel')); 
    mLabel(get(handles.axes3,'XLabel')); 
    mLabel(get(handles.axes3,'YLabel')); 
    mLabel(get(handles.axes4,'XLabel')); 
    mLabel(get(handles.axes4,'YLabel')); 
    mLabel(get(handles.axes5,'XLabel')); 
    mLabel(get(handles.axes5,'YLabel')); 
else
    set(hObject,'String','Wavelenghts')
    Wavelength = 1/(300/f);
    % Change axes' labels to reflect units
    reLabel(get(handles.axes1,'XLabel'));
    reLabel(get(handles.axes2,'XLabel')); 
    reLabel(get(handles.axes3,'XLabel')); 
    reLabel(get(handles.axes3,'YLabel')); 
    reLabel(get(handles.axes4,'XLabel')); 
    reLabel(get(handles.axes4,'YLabel')); 
    reLabel(get(handles.axes5,'XLabel')); 
    reLabel(get(handles.axes5,'YLabel')); 
end
% Scale axes' data
linkaxes([handles.axes1,handles.axes2,handles.axes3,...
    handles.axes4,handles.axes5],'off')
xScale(handles.axes1,Wavelength);
xScale(handles.axes2,Wavelength);
xScale(handles.axes3,Wavelength);
yScale(handles.axes3,Wavelength);
xScale(handles.axes4,Wavelength);
xScale(handles.axes5,Wavelength);
if (get(handles.Zoom,'Value') | get(handles.Pan,'Value') )
    linkaxes([handles.axes1,handles.axes2,handles.axes3,...
        handles.axes4,handles.axes5],'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 columns'},'Warning');
set(Warn,'WindowStyle','modal')
uiwait(Warn);
notValid = 1;
load YagiUdaParameters   % Load presaved variables
% Variable names
Properties = {'BL', 'N', 'Gain', 'RL', 'RDR', '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 = {'Boom Length','Number of Elements','Gain','Reflector Length',...
    'Reflector Director Ratio','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 'YagiUdaParameters' BL N Gain RL RDR BW % Save new parameters
        Msg = msgbox({'Restart to view changes'},'Saved')
        set(Msg,'WindowStyle','modal')
        uiwait(Msg);
    end
end

%%%%%%%%%% RELOAD YAGIUDA 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 Simon Mahlaba                  ',...
          '"Antenna Design Wizards: Design Curves for a Simple Yagi 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');






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


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


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -