📄 let.m
字号:
%"Setting", "Exit" and "New Plot" buttons, and %enable the "Stop" button. set(MainHandles([2,4,13,15]),'Enable','Off'); set(MainHandles(3),'Enable','On'); set(gca,'UserData',0); %Reset the state of "Stop" button to zero (i.e. not pressed) set(MainHandles(3),'UserData', 0); msg='Errors in "findlyap".'; Warn=['errordlg(msg,''ERROR'',''replace'');',... 'set(MainHandles([2,4,13,15]),''Enable'',''On'');',... 'set(MainHandles(3),''Enable'',''Off'');',... 'findlyap(MainHandles)']; %eval('findlyap(MainHandles)',Warn); LineHandles=findlyap(MainHandles); %Store the line handles in the 'Userdata' of the "New Plot" button. set(MainHandles(13),'UserData',LineHandles);otherwise error('Incorrect input argument!');end%--------------------------Subroutines---------------------------function MainHandles=maingui(AxisRange,FontSize)%MAINGUI Function accompanied with LET% MAINGUI creates a graphical user interface (GUI)window.% by Steve Wai Kam SIU, Feb. 19, 1998.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Default parameters for main window%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%--Grid Lines--gOn=0; %Grid on: initial set 0 (i.e. off)gOff=1; %Grid off: initial set 1 (i.e. on)%--Plot Range--%1st element is the min. value, 2nd is the max. valuexRange=AxisRange(1:2); %Plot range of X-AxisyRange=AxisRange(3:4); %Plot range of Y-Axis%--Draw line at--y=[]; %No value is displayed initially%--Current Time--ct=0; %Current time (initial displayed value)%--Final Time--ft=0; %Final time (initial displayed value)%--Time Used--ut=0; %Time counted from starting calculation%--Bottom text--bttmText=''; %Nothing is displayed initially%X-Axis LabelxLabel='Time';%Y-Axis LabelyLabel='Lyapunov Exponents';%TitleTitle=''; %No default title%%%%%%%%%%%%%%%%%%%%%%%%%% GUI window setup%%%%%%%%%%%%%%%%%%%%%%%%%WinWidth=0.95; %Window widthWinHeight=0.78; %Window heightBtnWidth=0.12; %Button widthBtnHeight=0.05; %Button heightxPos=0.865; %X-position of buttons%Windowa=figure('Units','Normalized','Color',[1 1 1],'BackingStore','Off',... 'Name','LET Main Program','NumberTitle','off', ... 'Position',[0.02 0.1 WinWidth WinHeight],'Visible','Off','Tag','Fig1');%Right frameuicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'Position',[0.85 0 0.15 1],'Style','frame','Tag','Frame2');%Bottom frameuicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'Position',[0 0 0.85 0.0676],'Style','frame','Tag','Frame1');%Bottom text display for showing the calculated%Lyapunov exponents at each iteration.btmDisplay=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[1 1 1], ... 'ForegroundColor',[0 0 1],'Position',[0.0057 0.01 0.835 0.045], ... 'String',bttmText,'FontSize', FontSize,'Style','text','Tag','StaticText9');%"Start" buttonstartBtn=uicontrol('Parent',a,'Units','normalized','Callback','let(''start'')', ... 'FontSize', FontSize,'FontWeight','bold','Position',[xPos 0.94 BtnWidth BtnHeight], ... 'String','Start','Interruptible','on','Tag','Pushbutton1');%"Stop" button : initial set disablestopBtn=uicontrol('Parent',a,'Units','normalized','Callback','let(''stop'')', ... 'FontSize', FontSize,'FontWeight','bold','Position',[xPos 0.88 BtnWidth BtnHeight], ... 'String','Stop','UserData',0,'Enable','off','Tag','Pushbutton2');%"Setting" buttonsettingBtn=uicontrol('Parent',a,'Units','normalized','Callback','let(''setting'')', ... 'FontSize', FontSize,'FontWeight','bold','Position',[xPos 0.82 BtnWidth BtnHeight], ... 'String','Setting','Tag','Pushbutton3');%Label: "Grid Lines"uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'FontWeight','bold','Position',[0.86 0.72 0.07 0.08], ... 'String','Grid Lines','Style','text','Tag','StaticText1');%Grid Lines "On" radio buttongOnRadio=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'Position',[0.925 0.765 0.07 0.043],'Callback','let(''OnPressed'')','FontSize',FontSize, ... 'String','On','Value',gOn,'Style','radiobutton','Tag','Radiobutton1');%Grid Lines "Off" Radio ButtongOffRadio=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'Position',[0.925 0.723 0.07 0.043],'Callback','let(''OffPressed'')','FontSize',FontSize,... 'String','Off','Style','radiobutton','Tag','Radiobutton2','Value',gOff);%Label: "Plot Range"uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'FontWeight','bold','Position',[0.86 0.68 0.135 0.035], ... 'String','Plot Range','Style','text','Tag','StaticText10');%Label: "X :" (X-Axis)uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'Position',[0.855 0.625 0.0365 0.037], ... 'String','X :','Style','text','Tag','StaticText11');%Edit text box for "X :"xRangeEdt=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[1 1 1], ... 'ForegroundColor',[0 0 1],'Position',[0.89 0.62 0.1 0.045], ... 'String',[num2str(xRange(1)) ', ' num2str(xRange(2))],'FontSize', FontSize, ... 'Callback','let(''changeAxis'')','UserData', xRange,'Style','edit','Tag','EditText2');%Label: "Y :" (Y-Axis)uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'Position',[0.855 0.56 0.0365 0.037],'String','Y :','Style','text','Tag','StaticText12');%Edit text box for "Y :"yRangeEdt=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[1 1 1], ... 'ForegroundColor',[0 0 1],'Position',[0.89 0.555 0.1 0.045],'FontSize', FontSize,... 'String',[num2str(yRange(1)) ', ' num2str(yRange(2))],'UserData',yRange, ... 'Callback','let(''changeAxis'')','Style','edit','Tag','EditText3');%Label: "Draw line at"uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'Position',[0.865 0.51 0.12 0.035],'String','Draw line at', ... 'Style','text','Tag','StaticText2');%Edit box for "Draw Line at"drawEdt=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[1 1 1], ... 'ForegroundColor',[0 0 1],'Position',[0.86 0.46 0.13 0.045],'FontSize', FontSize,... 'String',num2str(y),'Callback','let(''drawLine'')','Style','edit','Tag','EditText1');%Label: "Current Time"uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'Position',[0.865 0.415 0.12 0.035], ... 'String','Current Time','Style','text','Tag','StaticText3');%Display of "Current Time"ctDisplay=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[1 1 1], ... 'ForegroundColor',[0 0 1],'Position',[0.86 0.38 0.13 0.035],'FontSize', FontSize,... 'String',num2str(ct),'Style','text','Tag','StaticText4');%Label: "Final Time"uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'Position',[0.865 0.33 0.12 0.035],... 'String','Final Time','Style','text','Tag','StaticText5');%Display of "Final Time"ftDisplay=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[1 1 1], ... 'ForegroundColor',[0 0 1],'Position',[0.86 0.295 0.13 0.035], ... 'String',num2str(ft),'Style','text','FontSize', FontSize,'Tag','StaticText6');%Label: "Time Used" uicontrol('Parent',a,'Units','normalized','BackgroundColor',[0.513725 0.6 0.694118], ... 'FontSize', FontSize,'Position',[0.865 0.245 0.12 0.035], ... 'String','Time Used','Style','text','Tag','StaticText7');%Display text of "Time Used"utDisplay=uicontrol('Parent',a,'Units','normalized','BackgroundColor',[1 1 1], ... 'ForegroundColor',[0 0 1],'Position',[0.86 0.21 0.13 0.035], ... 'String',num2str(ut),'FontSize', FontSize,'Style','text','Tag','StaticText8');%"New Plot" buttonplotBtn=uicontrol('Parent',a,'Units','normalized','Callback','let(''plot'')', ... 'FontSize', FontSize,'FontWeight','bold','Position',[xPos 0.14 BtnWidth BtnHeight], ... 'String','New Plot','Enable','Off','Tag','Pushbutton4');%"Help" buttonhelpBtn=uicontrol('Parent',a,'Units','normalized','Callback','let(''help'')', ... 'FontSize', FontSize,'FontWeight','bold','Position',[xPos 0.08 BtnWidth BtnHeight], ... 'String','Help','Tag','Pushbutton5');%"Exit" buttonexitBtn=uicontrol('Parent',a,'Units','normalized','Callback','close(gcf)', ... 'FontSize', FontSize,'FontWeight','bold','Position',[xPos 0.02 BtnWidth BtnHeight], ... 'String','Exit','Tag','Pushbutton6');%Define the active region on the figure for plottingset(gca,'Position',[0.1 0.1776 0.7024 0.7474]);%Setup Axes using default rangesaxis(AxisRange);%Create axis boxbox;%Add X-axis label, Y-axis label and titlexlabel(xLabel); ylabel(yLabel); title(Title);%Freeze axesaxis('manual');%Output the handles (or addresses) of the GUI elements%which will be used laterMainHandles=[btmDisplay, startBtn, stopBtn, settingBtn, ... gOnRadio, gOffRadio, xRangeEdt, yRangeEdt, ... drawEdt, ctDisplay, ftDisplay, utDisplay, ... plotBtn, helpBtn, exitBtn];%Uncover the figure when setup is finishedset(a,'Visible','On');%------------------------------------------------------------function check(checkList,uncheckList)%CHECK Check function for check box or radio button% % CHECK(CHECKLIST) checks the radio buttons or % check boxes with handles in CHECKLIST.%% CHECK(CHECKLIST,UNCHECKLIST) checks the radio % buttons or check boxes with handles in CHECKLIST% and unchecks the ones with handles in UNCHECKLIST.%% CHECK([],UNCHECKLIST) unchecks the radio buttons% or check boxes with handles in CHECKLIST.% by Steve Wai Kam SIU, Feb. 19, 1998.if nargin<2 uncheckList=[];endif ~isempty(checkList) set(checkList,'Value',1);endif ~isempty(uncheckList) set(uncheckList,'Value',0);end%------------------------------------------------------------------------function outStr=rmspace(inStr)%RMSPACE Function for removing the beginning and ending% spaces of a string%Remove spaces at the end of the stringoutStr=strcat(inStr);%Delete spaces at the beginning of the stringif ~isempty(outStr) while isspace(outStr(1)) outStr=outStr(2:length(outStr)); endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -