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

📄 helical.m

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

% Hints: contents = get(hObject,'String') returns TraceSelect contents as cell array
%        contents{get(hObject,'Value')} returns selected item from TraceSelect

% --- Executes during object creation, after setting all properties.
function TraceSelect_CreateFcn(hObject, eventdata, handles)
% hObject    handle to TraceSelect (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 on button press in NearestTrace.
function NearestTrace_Callback(hObject, eventdata, handles)
% hObject    handle to NearestTrace (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 NearestTrace


% --- Executes on selection change in InterpSelect.
function InterpSelect_Callback(hObject, eventdata, handles)
% hObject    handle to InterpSelect (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 InterpSelect contents as cell array
%        contents{get(hObject,'Value')} returns selected item from InterpSelect
VP = findobj('Tag','Interpolated');
if ~isempty(P)
    delete(P)
    P = [];
end
CurrentAxes = gca;
Hand = findobj(handles.Wizard,'Type','axes');
Hand(find(Hand==handles.antenna))=[]; % Don't want handle to antenna
LineStyle = {'b','g','c','m','y','k',':b','-.b','--b'}; % Set LineStyles
for i=1:numel(Hand)
    Style = 1;
    set(handles.Wizard,'CurrentAxes',Hand(i))
    limits = axis;
    Sibs = get(Hand(i),'Children');
    k = numel(Sibs);
    XData = get(Sibs,'XData');
    YData = get(Sibs,'YData');
    Vis = get(Hand(i),'Visible');
    while (k > 2)
        x = XData{k};
        y = YData{k};
        t = x(1):(x(numel(x))-x(1))/1000:x(numel(x));
        hold on
        switch get(hObject,'Value')
            case 1,
                set(Sibs(k),'LineStyle',':')
            case 2, 
                set(Sibs(k),'LineStyle','none')
                plot(t,interp1(x,y,t,'nearest'),LineStyle{Style},...
                    'Tag','Interpolated','HitTest','off','Visible',Vis);
            case 3, 
                set(Sibs(k),'LineStyle','none')
                plot(t,interp1(x,y,t,'linear'),LineStyle{Style},...
                    'Tag','Interpolated','HitTest','off','Visible',Vis);
            case 4, 
                set(Sibs(k),'LineStyle','none')
                plot(t,interp1(x,y,t,'spline'),LineStyle{Style},...
                    'Tag','Interpolated','HitTest','off','Visible',Vis);
            case 5, 
                set(Sibs(k),'LineStyle','none')
                plot(t,interp1(x,y,t,'cubic'),LineStyle{Style},...
                    'Tag','Interpolated','HitTest','off','Visible',Vis);
        end
        k = k - 1;
        Style = Style + 1;
    end
    % Make sure Crosshairs are on top! 
    Sibs = get(Hand(i),'Children');
    x = findobj(Sibs,'Tag','XHR_XLINE');
    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],'x');
pan off
set(handles.Pan,'Value',0)
rotate3d off
set(handles.Rotate,'Value',0)
% set(gcf,'deletefcn',{@checklims,'stop'});
% checklims(gca);
zoom

% function checklims(varargin)
% tmp = timerfindall('tag','mytimer');
% if ~isempty(tmp)
%     stop(tmp);
%     delete(tmp);
%     if nargin > 3 & strcmp(varargin{3},'stop')
%         return
%     end
% end
% mytimer = timer('executionmode','fixedrate',...
%     'timerfcn',{@tcb,varargin{1}},...
%     'startdelay',5,...
%     'period',1,...
%     'tag','mytimer');
% start(mytimer);
% 
% 
% function tcb(varargin)
%     handles = guidata(gcbf);
%     Ax(1) = handles.axes1;
%     Ax(2) = handles.axes2;
%     Ax(3) = handles.axes3;
%     if ( gca == Ax(1)) | (gca == Ax(2))
%         set(Ax(3),'XLim',get(Ax(2),'YLim'));
%     elseif (gca == Ax(3))
%         set(Ax(2),'YLim',get(Ax(3),'XLim'));
%     end


% --- 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],'x');
zoom off
rotate3d off
set(handles.Rotate,'Value',0)
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)
rotate3d off
set(handles.Rotate,'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

% tmp = timerfindall('tag','mytimer');
% if ~isempty(tmp)
%     stop(tmp);
%     delete(tmp);
% end
% Ax(1) = handles.axes1;
% Ax(2) = handles.axes2;
% Ax(3) = handles.axes3;
% if ( gca == Ax(1)) | (gca == Ax(2))
%     set(Ax(3),'XLim',get(Ax(2),'YLim'));
% elseif (gca == Ax(3))
%     set(Ax(2),'YLim',get(Ax(3),'XLim'));
% 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 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) | Val == 0)
    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


% --- 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
rotate3d off
set(handles.Rotate,'Value',0)

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')); 
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')); 
end
% Scale axes' data
linkaxes([handles.axes1 handles.axes2],'off')
xScale(handles.axes1,Wavelength);
xScale(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',CurrentAxes)
else 
    set(gcf,'CurrentAxes',handles.axes1);

⌨️ 快捷键说明

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