📄 lpda.m
字号:
function varargout = LPDA(varargin)
% LPDA M-file for LPDA.fig
% LPDA, by itself, creates a new LPDA or raises the existing
% singleton*.
%
% H = LPDA returns the handle to a new LPDA or the handle to
% the existing singleton*.
%
% LPDA('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LPDA.M with the given input arguments.
%
% LPDA('Property','Value',...) creates a new LPDA or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before LPDA_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to LPDA_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help LPDA
% Last Modified by GUIDE v2.5 06-Oct-2005 14:44:51
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @LPDA_OpeningFcn, ...
'gui_OutputFcn', @LPDA_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before LPDA is made visible.
function LPDA_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to LPDA (see VARARGIN)
% Choose default command line output for LPDA
handles.output = hObject;
if strcmp(get(hObject,'Visible'),'off')
% Set the Interval to zero
set(handles.Interval,'Value',0);
set(handles.Interval,'String','0');
set(handles.Frequency,'Value',300);
SetAntennas(handles,5);
% Plot Graphs, and set Parameter Names
LPDASetup(hObject,handles);
LPDASelection(handles);
% Determine if there are multiple traces
% MultipleTrace(hObject,handles);
[X,Y] = SetUp(handles,pi);
LPDASetParameters(handles,X,Y);
% Draw the Antenna
LPDADraw(handles)
% Prevent the Antenna axes from becoming the active object when clicked
set(handles.antenna,'HitTest','Off')
% Prevent the Antenna graph from becoming the active object when clicked
set(get(handles.antenna,'Children'),'HitTest','Off')
% Set Action for keypresses
set(gcf,'KeyPressFcn',{@KeyPressFcn,gcbf});
% Update handles structure
guidata(hObject, handles);
end
% UIWAIT makes LPDA wait for user response (see UIRESUME)
% uiwait(handles.figure1);
function [X Y] = SetUp(handles,Point)
NumberGraphs = numel(findobj(handles.Wizard,'Type','axes'))-1;
X = zeros(1,NumberGraphs);
Y = zeros(1,NumberGraphs);
for i=1:NumberGraphs
s = strcat('handles.axes',num2str(i));
set(gcf,'CurrentAxes',eval(s));
% Set Default values
[X(i),Y(i)] = crosshair('setx',Point);
% Set the callback for mouse click on each axes:
set(eval(s),'ButtonDownFcn',{@ButtonDownFcn,eval(s),handles.Wizard});
% Prevents the line data from becoming the active object when
% clicked:
set((get(gca,'Children')),'HitTest','Off');
end
function ButtonDownFcn(src,eventdata,Ax,FigHandle)
set(FigHandle,'CurrentAxes',Ax)
set(FigHandle,'BusyAction','queue')
set(FigHandle,'WindowButtonUpFcn',{@WindowButtonUpFcn,FigHandle})
Interactive(FigHandle,'move');
set(gcbf,'WindowButtonMotionFcn',{@WindowButtonMotionFcn,gcbf})
function WindowButtonMotionFcn(src,eventdata,FigHandle)
Interactive(FigHandle,'move');
function WindowButtonUpFcn(src,eventdata,FigHandle)
set(FigHandle,'WindowButtonMotionFcn','');
set(FigHandle,'WindowButtonUpFcn','');
set(FigHandle,'BusyAction','cancel')
function KeyPressFcn(varargin)
set(gcbf,'WindowButtonMotionFcn',' ');
CC = get(gcbf,'CurrentCharacter');
cc = double(CC);
if cc,
switch cc,
case 28, action = 'prevx'; % left
case 29, action = 'nextx'; % right
otherwise,
return;
end
Interactive(gcbf, action);
drawnow
else
return;
end
% --- Outputs from this function are returned to the command line.
function varargout = LPDA_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
% varargout{1} = handles.output;
function Parameter1_Callback(hObject, eventdata, handles)
% hObject handle to Parameter1 (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 Parameter1 as text
% str2double(get(hObject,'String')) returns contents of Parameter1 as a double
set(gcf,'CurrentAxes',handles.axes1);
Val = str2double(get(hObject,'String'));
if ~isnan(Val)
[X,Y] = crosshair('setx',Val);
Interactive(gcbf,'draw')
else
P = get(hObject,'Value');
set(hObject,'String',num2str(P));
end
% --- Executes during object creation, after setting all properties.
function Parameter1_CreateFcn(hObject, eventdata, handles)
% hObject handle to Parameter1 (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 Parameter2_Callback(hObject, eventdata, handles)
% hObject handle to Parameter2 (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 Parameter2 as text
% str2double(get(hObject,'String')) returns contents of Parameter2 as a double
set(gcf,'CurrentAxes',handles.axes1);
Val = str2double(get(hObject,'String'));
if ~isnan(Val)
[X,Y] = crosshair('sety',Val);
Interactive(gcbf,'draw')
else
P = get(hObject,'Value');
set(hObject,'String',num2str(P));
end
% --- Executes during object creation, after setting all properties.
function Parameter2_CreateFcn(hObject, eventdata, handles)
% hObject handle to Parameter2 (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 Parameter3_Callback(hObject, eventdata, handles)
% hObject handle to Parameter3 (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 Parameter3 as text
% str2double(get(hObject,'String')) returns contents of Parameter3 as a double
set(gcf,'CurrentAxes',handles.axes2);
Val = str2double(get(hObject,'String'));
if ~isnan(Val)
[X,Y] = crosshair('sety',Val);
Interactive(gcbf,'draw')
else
P = get(hObject,'Value');
set(hObject,'String',num2str(P));
end
% --- Executes during object creation, after setting all properties.
function Parameter3_CreateFcn(hObject, eventdata, handles)
% hObject handle to Parameter3 (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 Parameter4_Callback(hObject, eventdata, handles)
% hObject handle to Parameter4 (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 Parameter4 as text
% str2double(get(hObject,'String')) returns contents of Parameter4 as a double
set(gcf,'CurrentAxes',handles.axes3);
Val = str2double(get(hObject,'String'));
if ~isnan(Val)
[X,Y] = crosshair('sety',Val);
Interactive(gcbf,'draw')
else
P = get(hObject,'Value');
set(hObject,'String',num2str(P));
end
% --- Executes during object creation, after setting all properties.
function Parameter4_CreateFcn(hObject, eventdata, handles)
% hObject handle to Parameter4 (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 Parameter5_Callback(hObject, eventdata, handles)
% hObject handle to Parameter5 (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 Parameter5 as text
% str2double(get(hObject,'String')) returns contents of Parameter5 as a double
%Edditing of values is prohibited
P = get(hObject,'Value');
set(hObject,'String',num2str(P));
% --- Executes during object creation, after setting all properties.
function Parameter5_CreateFcn(hObject, eventdata, handles)
% hObject handle to Parameter5 (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 Parameter6_Callback(hObject, eventdata, handles)
% hObject handle to Parameter6 (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 Parameter6 as text
% str2double(get(hObject,'String')) returns contents of Parameter6 as a double
% %Edditing of values is prohibited
% P = get(hObject,'Value');
% P = num2str(P);
% set(hObject,'String',P);
Val = str2double(get(hObject,'String'));
if ~isnan(Val)
BWR = [1.5 3 5 10];
BWR = BWR(get(handles.BWRVal,'Value'));
FreqMin = Val;
FreqMax = FreqMin*BWR;
if get(handles.Units,'Value')
BL = get(handles.Parameter5,'Value');
f = get(handles.Frequency,'Value');
set(handles.Parameter5,'String',num2str(BL*f/FreqMax));
set(handles.Parameter5,'Value',(BL*f/FreqMax));
LPDADraw(handles)
end
set(handles.Frequency,'String',sprintf('%5g',FreqMax));
set(handles.Frequency,'Value',str2double(sprintf('%5g',FreqMax)));
else
set(hObject,'String',num2str(get(hObject,'Value')));
end
% --- Executes during object creation, after setting all properties.
function Parameter6_CreateFcn(hObject, eventdata, handles)
% hObject handle to Parameter6 (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 P1prev.
function P1prev_Callback(hObject, eventdata, handles)
% hObject handle to P1prev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(gcf,'CurrentAxes',handles.axes1)
Interactive(gcf,'prevx')
% --- Executes on button press in P2prev.
function P2prev_Callback(hObject, eventdata, handles)
% hObject handle to P2prev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(gcf,'CurrentAxes',handles.axes1)
Interactive(gcf,'prevx')
% --- Executes on button press in P3prev.
function P3prev_Callback(hObject, eventdata, handles)
% hObject handle to P3prev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(gcf,'CurrentAxes',handles.axes2)
Interactive(gcf,'prevx')
% --- Executes on button press in P4prev.
function P4prev_Callback(hObject, eventdata, handles)
% hObject handle to P4prev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(gcf,'CurrentAxes',handles.axes3)
Interactive(gcf,'prevx')
% --- Executes on button press in P5prev.
function P5prev_Callback(hObject, eventdata, handles)
% hObject handle to P5prev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(gcf,'CurrentAxes',handles.axes4)
Interactive(gcf,'prevx')
% --- Executes on button press in P6prev.
function P6prev_Callback(hObject, eventdata, handles)
% hObject handle to P6prev (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(gcf,'CurrentAxes',handles.axes5)
Interactive(gcf,'prevx')
% --- Executes on button press in P1next.
function P1next_Callback(hObject, eventdata, handles)
% hObject handle to P1next (see GCBO)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -