📄 lyap_exp_of_cont_sys.m
字号:
set(h, 'EdgeColor', 'Flat');
xlabel('t');
ylabel('x1');
end
if j==2
h = patch([Yplot(:,1)' fliplr(Yplot(:,1)')], [Yplot(:,2)' fliplr(Yplot(:,2)')], [max(locallecs.lle') fliplr(max(locallecs.lle'))]); grid on;
set(h, 'EdgeColor', 'Flat');
xlabel('x1');
ylabel('x2');
end
if j>2
h = patch([Yplot(:,1)' fliplr(Yplot(:,1)')], [Yplot(:,2)' fliplr(Yplot(:,2)')], [Yplot(:,3)' fliplr(Yplot(:,3)')], [max(locallecs.lle') fliplr(max(locallecs.lle'))]); grid on;
set(h, 'EdgeColor', 'Flat');
xlabel('x1');
ylabel('x2');
zlabel('x3');
view(45,45);
end
end
% --- Executes on button press in cancel.
function cancel_Callback(hObject, eventdata, handles)
% hObject handle to cancel (see GCBO)
% handles structure with handles and user data (see GUIDATA)
close(handles.figure);
% --- Executes during object creation, after setting all properties.
function edit_length_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_length (see GCBO)
% handles empty - handles not created until after all CreateFcns called
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function edit_length_Callback(hObject, eventdata, handles)
% hObject handle to edit_length (see GCBO)
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in load.
function load_Callback(hObject, eventdata, handles)
% hObject handle to load (see GCBO)
% handles structure with handles and user data (see GUIDATA)
[file,path] = uigetfile2('*.mat','Load System');
if file~=0
try
S=load([path file]);
set([handles.x handles.f handles.init],'value',1);
set(handles.x,'string',S.sys.dx);
set(handles.f,'string',S.sys.f);
set(handles.init,'string',S.sys.init);
set(handles.edit_info,'string',S.sys.info);
set(handles.edit_length,'string',S.sys.time);
set(handles.e_transient,'string',S.sys.tr_time);
str=get(handles.solver,'string');
for i=1:length(str)
if strcmp(str{i},S.sys.solver)
set(handles.solver,'value',i);
break
end
end
catch
errordlg('Wrong file format','File error');
end
end
% --- Executes on button press in save.
function save_Callback(hObject, eventdata, handles)
% hObject handle to save (see GCBO)
% handles structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.mat','Save System As');
if file~=0
sys.dx=get(handles.x,'string');
sys.f=get(handles.f,'string');
tmp=sys.dx;
for i=1:length(tmp)
tmp{i}='0';
end
sys.ignv=tmp;
sys.innv=tmp;
sys.agnv=tmp;
sys.annv=tmp;
sys.init=get(handles.init,'string');
sys.info=get(handles.edit_info,'string');
sys.tr_time=get(handles.e_transient,'string');
sys.time=get(handles.edit_length,'string');
str=get(handles.solver,'string');
sys.solver=str{get(handles.solver,'value')};
sys.addit_param='';
save([path file],'sys');
end
% --- Executes during object creation, after setting all properties.
function edit_info_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_info (see GCBO)
% handles empty - handles not created until after all CreateFcns called
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function edit_info_Callback(hObject, eventdata, handles)
% hObject handle to edit_info (see GCBO)
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function x_CreateFcn(hObject, eventdata, handles)
% hObject handle to x (see GCBO)
% handles empty - handles not created until after all CreateFcns called
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on selection change in x.
function x_Callback(hObject, eventdata, handles)
% hObject handle to x (see GCBO)
% handles structure with handles and user data (see GUIDATA)
set([handles.x handles.f handles.init],'value',get(hObject,'Value'));
% --- Executes during object creation, after setting all properties.
function f_CreateFcn(hObject, eventdata, handles)
% hObject handle to f (see GCBO)
% handles empty - handles not created until after all CreateFcns called
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes during object creation, after setting all properties.
function init_CreateFcn(hObject, eventdata, handles)
% hObject handle to init (see GCBO)
% handles empty - handles not created until after all CreateFcns called
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on button press in add.
function add_Callback(hObject, eventdata, handles)
% hObject handle to add (see GCBO)
% handles structure with handles and user data (see GUIDATA)
N=length(get(handles.x,'string'));
x={};
for i=1:N
x{i}=['dx' num2str(i) '/dt'];
end
set(handles.x,'string',x);
prompt = {['Enter equation dx' num2str(N+1) '/dt=...'],...
'Enter initial condition:'};
dlg_title = 'Add new equation';
num_lines= 1;
def = {'','0.5'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
if ~isempty(answer)
x=get(handles.x,'string');
f=get(handles.f,'string');
init=get(handles.init,'string');
x{N+1}=['dx' num2str(N+1) '/dt'];
f{N+1}=answer{1};
init{N+1}=answer{2};
set([handles.x, handles.f, handles.init],'value',N+1);
set(handles.x,'string',x);
set(handles.f,'string',f);
set(handles.init,'string',init);
end
% --- Executes on button press in modify.
function modify_Callback(hObject, eventdata, handles)
% hObject handle to modify (see GCBO)
% handles structure with handles and user data (see GUIDATA)
x=get(handles.x,'string');
f=get(handles.f,'string');
init=get(handles.init,'string');
selection=get(handles.x,'value');
if isempty(x)
x{1}='dx1/dt'; f{1}=''; init{1}='0.7';
end
prompt = {['Enter equation ' x{selection} '=...'],...
'Enter initial condition:'};
dlg_title = 'Modify equation';
num_lines= 1;
def = {f{selection},init{selection}};
answer = inputdlg(prompt,dlg_title,num_lines,def);
if ~isempty(answer)
f{selection}=answer{1};
init{selection}=answer{2};
set(handles.x,'string',x);
set(handles.f,'string',f);
set(handles.init,'string',init);
end
% --- Executes on button press in delete.
function delete_Callback(hObject, eventdata, handles)
% hObject handle to delete (see GCBO)
% handles structure with handles and user data (see GUIDATA)
x=get(handles.x,'string');
f=get(handles.f,'string');
init=get(handles.init,'string');
selection=get(handles.x,'value');
if isempty(x)
return
end
n_f={}; n_init={}; n_x={};
k=1;
for i=1:length(x)
if i~=selection
n_f{k}=f{i};
n_init{k}=init{i};
n_x{k}=x{i};
k=k+1;
end
end
set([handles.x, handles.f, handles.init],'value',max([1 selection-1]));
set(handles.x,'string',n_x);
set(handles.f,'string',n_f);
set(handles.init,'string',n_init);
% --- Executes during object creation, after setting all properties.
function solver_CreateFcn(hObject, eventdata, handles)
% hObject handle to solver (see GCBO)
% 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
set(hObject,'string',{'ode45' 'ode23' 'ode113' 'ode15s' 'ode23s' 'ode23t' 'ode23tb'});
% --- Executes on selection change in solver.
function solver_Callback(hObject, eventdata, handles)
% hObject handle to solver (see GCBO)
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns solver contents as cell array
% contents{get(hObject,'Value')} returns selected item from solver
% --- Executes during object creation, after setting all properties.
function e_transient_CreateFcn(hObject, eventdata, handles)
% hObject handle to e_transient (see GCBO)
% 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 e_transient_Callback(hObject, eventdata, handles)
% hObject handle to e_transient (see GCBO)
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of e_transient as text
% str2double(get(hObject,'String')) returns contents of e_transient as a double
% --- Executes on button press in isComputeLLE.
function isComputeLLE_Callback(hObject, eventdata, handles)
% hObject handle to isComputeLLE (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 isComputeLLE
% --- Executes on button press in isShowMLLE.
function isShowMLLE_Callback(hObject, eventdata, handles)
% hObject handle to isShowMLLE (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 isShowMLLE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -