function plot_Xing(fname, levels, isTimeSeries, isIncremental) % plot sample path and crossings, and crossing tree % % fname: input file name without extension, x(t(n)) and t(n) in files fname.dat and fname.tim % isTimeSeries: if 1 then t(n) = n and fname.tim not used % isIncremental: if 1 then fname.dat contains x(n) - x(n-1) % levels: levels to be plotted % % Y.Shen 12.2002, O.D.Jones 7.2003 eval(['load ' fname '.dat;']); eval(['x = ' fname '(:,1);']); if isTimeSeries if isIncremental x = [0; cumsum(x)]; end lx = length(x); t = 0:lx-1; else lx = length(x); eval(['load ' fname '.tim;']); eval(['t = ' fname '(:,1);']); end clf subplot(2,1,1); hold on; plot(t, x, 'g'); title('sample path and crossings') subplot(2,1,2); hold on; title('crossing tree (points give start of crossing)') ylabel('crossing size') for n = levels if n < 10 file_name = sprintf('%s_0%d', fname, n); else file_name = sprintf('%s_%d', fname, n); end eval(['load ' file_name '.hit;']); eval(['data = ' file_name ';']); if ~isempty(data) subplot(2,1,1); plot(data(:,1), data(:,2), 'b'); plot(data(:,1), data(:,2), 'b.'); subplot(2,1,2); plot(data(1:end-1,1), 2^n, 'b.'); if n ~= levels(1) for i = 1:size(data,1)-1 jj = find((data0(:,1) >= data(i,1)) & (data0(:,1) < data(i+1,1))); for j = jj' plot([data(i,1), data0(j,1)], [2^n, 2^n0], 'b'); end end end data0 = data; n0 = n; end end subplot(2,1,1); hold off; subplot(2,1,2); hold off;