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

📄 yagipoynting.m

📁 天线设计方面的资料
💻 M
📖 第 1 页 / 共 4 页
字号:
    y = findobj(Sibs,'Tag','XHR_YLINE');
    Temp = Sibs;
    Sibs = zeros(2,1);
    Sibs(1) = x;
    Sibs(2) = y;
    Temp(find(Temp == x)) = [];
    Temp(find(Temp == y)) = [];
    Sibs = [Sibs;Temp];
    set(Hand(i),'Children',Sibs)
    hold off
    axis(limits)
end
set(handles.Wizard,'CurrentAxes',CurrentAxes);


% --- Executes during object creation, after setting all properties.
function InterpSelect_CreateFcn(hObject, eventdata, handles)
% hObject    handle to InterpSelect (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 Interval_Callback(hObject, eventdata, handles)
% hObject    handle to Interval (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 Interval as text
%        str2double(get(hObject,'String')) returns contents of Interval as
%        a double
Val = str2double(get(hObject,'String'));
if Val ~= NaN
    set(hObject,'Value',Val)
end


% --- Executes during object creation, after setting all properties.
function Interval_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Interval (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 Zoom.
function Zoom_Callback(hObject, eventdata, handles)
% hObject    handle to Zoom (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')
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)
Status = get(hObject,'Value');
% 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



% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


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);
yScale(handles.axes4,Wavelength);
xScale(handles.axes5,Wavelength);
yScale(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
%Parameter7_Callback(handles.Parameter7, eventdata, handles)
%Parameter8_Callback(handles.Parameter8, eventdata, handles)
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 YagiPoyntingParameters  % Load presaved variables
% Variable names
Properties = {'BL', 'RL', 'N', 'Gain', 'DL', 'Driven',...
    'DirectorSpacing','ReflectorSpacing'};
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','Reflector Length','Number of Elements','Gain',...
    'Director Length','Driven Length','Director Spacing','Reflector Spacing'};
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')

⌨️ 快捷键说明

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