📄 lstrack.m
字号:
function varargout = LSTrack(varargin)
% LSTRACK Ment-file for LSTrack.fig
% LSTRACK, by itself, creates a new LSTRACK or raises the existing
% singleton*.
%
% H = LSTRACK returns the handle to a new LSTRACK or the handle to
% the existing singleton*.
%
% LSTRACK('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LSTRACK.Ment with the given input arguments.
%
% LSTRACK('Property','Value',...) creates a new LSTRACK or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before LSTrack_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to LSTrack_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 LSTrack
% Last Modified by GUIDE v2.5 25-Jun-2006 20:54:10
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @LSTrack_OpeningFcn, ...
'gui_OutputFcn', @LSTrack_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 LSTrack is made visible.
function LSTrack_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 LSTrack (see VARARGIN)
% Choose default command line output for LSTrack
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes LSTrack wait for user response (see UIRESUME)
% uiwait(handles.figure1);
set(handles.trace1,'value',1);%默认是非机动状态
% --- Outputs from this function are returned to the command line.
%====================================================================
function varargout = LSTrack_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;
%====================================================================% --- 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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));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 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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction 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 Ment_CreateFcn(hObject, eventdata, handles)% hObject handle to Ment (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 Ment_Callback(hObject, eventdata, handles)% hObject handle to Ment (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 Ment as text% str2double(get(hObject,'String')) returns contents of Ment as a double%====================================================================% --- Executes on button press in trace1.function trace1_Callback(hObject, eventdata, handles)% hObject handle to trace1 (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 trace1
set(handles.trace2,'value',0);%选项互斥
%====================================================================% --- Executes on button press in trace2.function trace2_Callback(hObject, eventdata, handles)% hObject handle to trace2 (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 trace2set(handles.trace1,'value',0);%选项互斥%====================================================================% --- 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)trace1=get(handles.trace1,'value');
trace2=get(handles.trace2,'value');
%扫描周期应该是正整数且不能太大
T = str2double(get(handles.T,'String'));
if T-floor(T)>0
errordlg('扫描周期应该是正整数!');
end
if T>100
errordlg('扫描周期不能太大!');
end
M = str2double(get(handles.Ment,'String'));
if M-floor(M)>0
errordlg('mont must be integer!');
end
d = str2double(get(handles.d,'String'));
if trace1==1 %非机动
%产生非机动真实轨迹[x,y]
[X_Real,Y_Real]=realTrack1(T);
%LS算法
% [x,y,zx,zy,XXE,YYE,XERB,YERB,XSTD,YSTD]=LS(T,M,d,X,Y);
[X_Obsv_M,Y_Obsv_M,X_Filt_M,Y_Filt_M,Error_X,Error_Y,Std_X,Std_Y] = LS_C(M,d,X_Real,Y_Real);
%结果
axes(handles.trace);
plot(X_Obsv_M,Y_Obsv_M,'g',X_Real,Y_Real,'r',X_Filt_M,Y_Filt_M,'b');
axis([500 3500 3000 11000]);
legend('观测轨迹','真实轨迹','滤波轨迹');
end
if trace2==1
%产生非机动真实轨迹[x,y]
[X_Real,Y_Real]=realTrack2(T);
%LS算法
% [x,y,zx,zy,XXE,YYE,XERB,YERB,XSTD,YSTD]=LS(T,M,d,X,Y);
[X_Obsv_M,Y_Obsv_M,X_Filt_M,Y_Filt_M,Error_X,Error_Y,Std_X,Std_Y] = LS_C(M,d,X_Real,Y_Real);
%结果
axes(handles.trace);
plot(X_Obsv_M,Y_Obsv_M,'g',X_Real,Y_Real,'r',X_Filt_M,Y_Filt_M,'b');
axis([1000 10000 -2000 11000]);
legend('观测轨迹','真实轨迹','滤波轨迹');
end
axes(handles.ErrorX);
n=1:length(Error_X);
plot(n,Error_X,'b',n,Error_Y,'r');
xlabel('观测点');
legend('X','Y');
title('X-Y方向误差的均值');
axes(handles.ErrorY);
n=1:length(Error_X);
plot(n,Std_X,'b',n,Std_Y,'r');
xlabel('观测点')
legend('X','Y');
title('X-Y方向误差的均方值');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -