⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pfgui_rmse.m

📁 MATLAB非线性滤波工具箱 在“中国国防科技论坛 ”找到的
💻 M
字号:
function pfgui_rmse(action,hObject,varargin)
% Sorry, I didn't have enough time to write nice and documented GUI code.

% Toolbox for nonlinear filtering.
% Copyright (C) 2005  Jakob Ros閚 <jakob.rosen@gmail.com>
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

myfont='default';

if strcmp(action,'init')
	parenthandles=guidata(hObject);

	if isempty(parenthandles.xhat)&&isempty(parenthandles.xpred)
		msgbox('No filtered data available!');
		return;
	end

	if isempty(parenthandles.xtrue)
		msgbox('No true x(t) data exists.');
		return;
	end;

	if ~(size(parenthandles.xtrue,3)==1||size(parenthandles.xtrue,3)==max(size(parenthandles.xhat,3),size(parenthandles.xpred,3)))
		msgbox('Wrong dimensions of the true x(t) data.');
		return;
	end

	xhat_length=length(parenthandles.xhat);
	xpred_length=length(parenthandles.xpred);

%	xvars=parenthandles.filtobj.model.xvars;
	xvars=get(get(parenthandles.filtobj,'model'),'xvars');

	if xhat_length&&xpred_length
		lnames=cell(1,2*length(xvars));
		for i=1:length(xvars);
			lnames{i}=[xvars{i},' [xhat]'];
		end;
		for i=1:length(xvars);
			lnames{i+length(xvars)}=[xvars{i},' [xpred]'];
		end;
		lindex=[1:length(xvars), 1:length(xvars)];
		larray=[repmat({'xhat'},1,length(xvars)), repmat({'xpred'},1,length(xvars))];
	elseif xhat_length
		lnames=cell(1,length(xvars));
		lnames=xvars;
		lindex=[1:length(xvars)];
		larray=repmat({'xhat'},1,length(xvars));
	else
		lnames=cell(1,length(xvars));
		lnames=xvars;
		lindex=[1:length(xvars)];
		larray=repmat({'xpred'},1,length(xvars));
	end

	hf=figure('Name','RMSE command window');
	uicontrol(hf,'Style','Text','String','Select the state(s) to be included in the calculations:','Units','normalized','Position',[0.05 0.91 0.9 0.05],'HorizontalAlign','Left','Min',1,'Max',3,'FontName',myfont);

	uicontrol(hf,'Style','Listbox','String',cell2str(lnames),'Units','normalized','Position',[0.05 0.5 0.9 0.4],'Tag','state_select','HorizontalAlign','Left','Min',1,'Max',3,'Value',1:length(xvars),'FontName','FixedWidth');

	uicontrol(hf,'Style','Pushbutton','String','RMSE!','Units','normalized','Position',[0.05 0.1 0.9 0.05],'callback',sprintf('pfgui_rmse(''rmse'',%g,%g)',hObject,hf),'HorizontalAlign','Left','FontName',myfont);

	handles=guihandles(hf);
	handles.lnames=lnames;
	handles.lindex=lindex;
	handles.larray=larray;
	guidata(hf,handles);


elseif strcmp(action,'rmse');
	hf=varargin{1};
	parenthandles=guidata(hObject);
	handles=guidata(hf);
	
	states=get(handles.state_select,'value');

	if isempty(states)
		msgbox('Please select at least one state');
		return;
	end;

	Ts=parenthandles.filtobj.Ts;


	xhat_states=[];
	xpred_states=[];
	for i=1:length(states);
		if strcmp(handles.larray{states(i)},'xhat')
			xhat_states(end+1)=handles.lindex(i);
		else
			xpred_states(end+1)=handles.lindex(i);
		end
	end
	

	plotstr='plot(';
	simnames={};


	figure;

	% Hej Gustaf. Jag antar att du vill verifiera RMSE-ber鋕ningarna :)
	% Det 鋜 inte s

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -