pf_plot.m

来自「% % set some variables in the workspace」· M 代码 · 共 66 行

M
66 行
字号
function h = pf_plot(pf, flag)

	% plot the particles

	z = [pf.x.s]';

	if nargin == 1,
		flag = 0;
	end

	exists = findobj('Name', pf.name);
	usefig(pf.name);


	if isempty(exists) & ~isempty(pf.gpos),
		% window doesnt exist, and gpos is specified
		disp('** Window being created');
		set(gcf, 'Units', 'normalized');
		set(gcf, 'Position', pf.gpos);
	end

	if flag == 0,
		clf
		h1 = axes;
		plot(z(:,1), z(:,2), '.')
		axis([pf.xmin pf.xmax pf.ymin pf.ymax]);
		grid
	else
		cm = 0.3;
		wm = 0.65
		marg = 0.04;

		clf
		h1 = axes
		set(gca, 'Position', [cm cm wm wm])

		plot(z(:,1), z(:,2), '.')
		axis([pf.xmin pf.xmax pf.ymin pf.ymax]);
		grid on
		hold on
		plot(mean(z(:,1)), mean(z(:,2)), 'go');
		set(gca, 'XTickLabel', [])
		set(gca, 'YTickLabel', [])

		set(gcf,'nextplot', 'add') 
		h2 = axes
		set(gca, 'Position', [cm marg wm cm-marg])
		plot(z(:,1), [x.pi]', '.');
		set(h2, 'Xlim', [pf.xmin pf.xmax]);
		grid

		h3 = axes
		set(gca, 'Position', [marg cm cm-marg wm])

		plot([x.pi]', z(:,2), '.');
		set(h3, 'Ylim', [pf.ymin pf.ymax]);
		grid
	end

	drawnow

	% return the handle to main window
	if nargout > 0,
		h = h1;
	end

⌨️ 快捷键说明

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