function varargout = K_L_Simulation(varargin)
% K_L_SIMULATION M-file for K_L_Simulation.fig
% K_L_SIMULATION, by itself, creates a new K_L_SIMULATION or raises the existing
% singleton*.
%
% H = K_L_SIMULATION returns the handle to a new K_L_SIMULATION or the handle to
% the existing singleton*.
%
% K_L_SIMULATION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in K_L_SIMULATION.M with the given input arguments.
%
% K_L_SIMULATION('Property','Value',...) creates a new K_L_SIMULATION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before K_L_Simulation_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to K_L_Simulation_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
% Edit the above text to modify the response to help K_L_Simulation
% Last Modified by GUIDE v2.5 20-Mar-2011 10:01:19
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @K_L_Simulation_OpeningFcn, ...
'gui_OutputFcn', @K_L_Simulation_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 K_L_Simulation is made visible.
function K_L_Simulation_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 K_L_Simulation (see VARARGIN)
% Choose default command line output for K_L_Simulation
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes K_L_Simulation wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = K_L_Simulation_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 T_Callback(hObject, eventdata, handles)
% hObject handle to T (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 T as text
% str2double(get(hObject,'String')) returns contents of T as a double
% --- Executes during object creation, after setting all properties.
function T_CreateFcn(hObject, eventdata, handles)
% hObject handle to T (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function mont_Callback(hObject, eventdata, handles)
% hObject handle to mont (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 mont as text
% str2double(get(hObject,'String')) returns contents of mont as a double
% --- Executes during object creation, after setting all properties.
function mont_CreateFcn(hObject, eventdata, handles)
% hObject handle to mont (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function d_Callback(hObject, eventdata, handles)
% hObject handle to d (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 d as text
% str2double(get(hObject,'String')) returns contents of d as a double
% --- Executes during object creation, after setting all properties.
function d_CreateFcn(hObject, eventdata, handles)
% hObject handle to d (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in IKF.
function IKF_Callback(hObject, eventdata, handles)
% hObject handle to IKF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get user input from GUI
T = str2double(get(handles.T,'String'));
if T-floor(T)>0
errordlg('T must be integer!');
error('input T is not integer!');
end
mont = str2double(get(handles.mont,'String'));
if mont-floor(mont)>0
errordlg('mont must be integer!');
error('input mont is not integer!');
end
d = str2double(get(handles.d,'String'));
% Calculate data
[x,y,zx,zy,XXE,YYE,XERB,YERB,XSTD,YSTD]=IKF(T,mont,d);
% plot
axes(handles.plotTrack);
plot(zx,zy,'g',x,y,'r',XXE,YYE,'b');
grid;
%axis([0 10000 -500 2600]);
title('IKF算法仿真');
legend('观测数据','真实轨迹','滤波估计',0);
axes(handles.meanX);
plot(XERB);grid;
%axis([0 900 -200 60]);
xlabel('观测次数n');
title('X方向滤波误差均值');
axes(handles.meanY);
plot(YERB);grid;
%axis([0 900 -200 60]);
xlabel('观测次数n');
title('Y方向滤波误差均值');
axes(handles.stdX);
plot(XSTD);grid;
% axis([0 900 0 150]);
xlabel('观测次数n');
title('X方向滤波误差标准值');
axes(handles.stdY);
plot(YSTD);grid;
% axis([0 900 0 150]);
xlabel('观测次数n');
title('Y方向滤波误差标准值');
% --- Executes on button press in LS.
function LS_Callback(hObject, eventdata, handles)
% hObject handle to LS (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
T = str2double(get(handles.T,'String'));
if T-floor(T)>0
errordlg('T must be integer!');
error('input T is not integer!');
end
M = str2double(get(handles.mont,'String'));
if M-floor(M)>0
errordlg('mont must be integer!');
error('input mont is not integer!');
end
d = str2double(get(handles.d,'String'));
% Calculate data
[x,y,zx,zy,XXE,YYE,XERB,YERB,XSTD,YSTD]=LS(T,M,d);
% plot
axes(handles.plotTrack);
plot(zx,zy,'g',x,y,'r',XXE,YYE,'b');grid;
%axis([-100 10100 0 2600]);
title('最小二乘算法仿真');
legend('观测数据','真实轨迹','滤波估计',0);
axes(hand