📄 map_solver.m
字号:
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.ignv handles.agnv handles.annv handles.init handles.innv],'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 ignv_CreateFcn(hObject, eventdata, handles)
% hObject handle to ignv (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 innv_CreateFcn(hObject, eventdata, handles)
% hObject handle to innv (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 agnv_CreateFcn(hObject, eventdata, handles)
% hObject handle to agnv (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 annv_CreateFcn(hObject, eventdata, handles)
% hObject handle to annv (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}=['x' num2str(i)];
end
set(handles.x,'string',x);
prompt = {['Enter equation x' num2str(N+1) '(n+1)=...'],...
'Enter internal Gaussian noise variance:',...
'Enter internal white noise variance:',...
'Enter additive Gaussian noise variance:',...
'Enter additve white noise variance:',...
'Enter initial condition:'};
dlg_title = 'Add new equation';
num_lines= 1;
def = {'','0','0','0','0','0.5'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
if ~isempty(answer)
x=get(handles.x,'string');
f=get(handles.f,'string');
ignv=get(handles.ignv,'string');
innv=get(handles.innv,'string');
agnv=get(handles.agnv,'string');
annv=get(handles.annv,'string');
init=get(handles.init,'string');
x{N+1}=['x' num2str(N+1)];
f{N+1}=answer{1};
ignv{N+1}=answer{2};
innv{N+1}=answer{3};
agnv{N+1}=answer{4};
annv{N+1}=answer{5};
init{N+1}=answer{6};
set([handles.x, handles.f, handles.innv, handles.ignv, handles.agnv, handles.annv, handles.init],'value',N+1);
set(handles.x,'string',x);
set(handles.f,'string',f);
set(handles.innv,'string',innv);
set(handles.ignv,'string',ignv);
set(handles.agnv,'string',agnv);
set(handles.annv,'string',annv);
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');
ignv=get(handles.ignv,'string');
innv=get(handles.innv,'string');
agnv=get(handles.agnv,'string');
annv=get(handles.annv,'string');
init=get(handles.init,'string');
selection=get(handles.x,'value');
if isempty(x)
x{1}='x1'; f{1}=''; ignv{1}='0'; innv{1}='0'; agnv{1}='0'; annv{1}='0'; init{1}='0.7';
end
prompt = {['Enter equation ' x{selection} '(n+1)=...'],...
'Enter internal Gaussian noise variance:',...
'Enter internal white noise variance:',...
'Enter additive Gaussian noise variance:',...
'Enter additve white noise variance:',...
'Enter initial condition:'};
dlg_title = 'Modify equation';
num_lines= 1;
def = {f{selection},ignv{selection},innv{selection},agnv{selection},annv{selection},init{selection}};
answer = inputdlg(prompt,dlg_title,num_lines,def);
if ~isempty(answer)
f{selection}=answer{1};
ignv{selection}=answer{2};
innv{selection}=answer{3};
agnv{selection}=answer{4};
annv{selection}=answer{5};
init{selection}=answer{6};
set(handles.x,'string',x);
set(handles.f,'string',f);
set(handles.innv,'string',innv);
set(handles.ignv,'string',ignv);
set(handles.agnv,'string',agnv);
set(handles.annv,'string',annv);
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');
ignv=get(handles.ignv,'string');
innv=get(handles.innv,'string');
agnv=get(handles.agnv,'string');
annv=get(handles.annv,'string');
init=get(handles.init,'string');
selection=get(handles.x,'value');
if isempty(x)
return
end
n_f={}; n_ignv={}; n_innv={}; n_agnv={};n_annv={}; n_init={}; n_x={};
k=1;
for i=1:length(x)
if i~=selection
n_f{k}=f{i};
n_ignv{k}=ignv{i};
n_innv{k}=innv{i};
n_agnv{k}=agnv{i};
n_annv{k}=annv{i};
n_init{k}=init{i};
n_x{k}=x{i};
k=k+1;
end
end
set([handles.x, handles.f, handles.innv, handles.ignv, handles.agnv, handles.annv, handles.init],'value',max([1 selection-1]));
set(handles.x,'string',n_x);
set(handles.f,'string',n_f);
set(handles.innv,'string',n_innv);
set(handles.ignv,'string',n_ignv);
set(handles.agnv,'string',n_agnv);
set(handles.annv,'string',n_annv);
set(handles.init,'string',n_init);
% --- Executes during object creation, after setting all properties.
function trans_CreateFcn(hObject, eventdata, handles)
% hObject handle to trans (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 trans_Callback(hObject, eventdata, handles)
% hObject handle to trans (see GCBO)
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of trans as text
% str2double(get(hObject,'String')) returns contents of trans as a double
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -