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

📄 plot_chi2.m

📁 一个目标跟踪系统的MATLAB 源程序包
💻 M
字号:
function fig = plot_chi2(track)

% chi2 region vs. time
[nx, ny] = size(track(1).NEES);
fig = figure;
subplot(2,2,1);
hold on;
for i=1: ny
    index(i).ind = [];
    for j=1:nx
        if track(1).NEES(j,i)<13.3   % 99% uppper bound, 4df
            if i>1
                if ~isempty(find(~(index(i-1).ind-j)))
                    index(i).ind = [index(i).ind, j];
                end
            else
                index(i).ind = [index(i).ind, j];
            end
        end
    end
    n(i) = length(index(i).ind);
    lower = chi2inv(.025, n(i)*4)/n(i);
    upper = chi2inv(.975, n(i)*4)/n(i);
    plot(i, lower, 'r.');
    plot(i, upper, 'r.');
    plot(i, mean(track(1).NEES(index(i).ind, i)), 'k.-');
end
xlabel('scans');
ylabel('Test statistic (NEES) and the 95% \chi^2 region');
title('NEES, target 1, excluding lost tracks');
hold off;

subplot(2,2,2)
hold on;
for i=1:ny
    index(i).ind = [];
    for j=1:nx
        if track(2).NEES(j,i)<13.3   % 99% uppper bound, 4df
            if i>1
                if ~isempty(find(~(index(i-1).ind-j)))
                    index(i).ind = [index(i).ind, j];
                end
            else
                index(i).ind = [index(i).ind, j];
            end
        end
    end
    n(i) = length(index(i).ind);
    lower = chi2inv(.025, n(i)*4)/n(i);
    upper = chi2inv(.975, n(i)*4)/n(i);
    plot(i, lower, 'r.');
    plot(i, upper, 'r.');
    plot(i, mean(track(2).NEES(index(i).ind, i)), 'k.-');
end
xlabel('scans');
ylabel('Test statistic (NEES) and the 95% \chi^2 region');
title('NEES, target 2, excluding lost tracks');
hold off;

lower = chi2inv(.025, nx*4)/nx;
upper = chi2inv(.975, nx*4)/nx;
tl = linspace(lower, lower, ny);
tu = linspace(upper, upper, ny);
subplot(2,2,3)
hold on;
plot(tl, 'r.');
plot(tu, 'r.');
plot(mean(track(1).NEES), 'k.-');
xlabel('scans');
ylabel('Test statistic (NEES) and the 95% \chi^2 region');
title('NEES, target 1, including lost tracks');
hold off;

subplot(2,2,4)
hold on;
plot(tl, 'r.');
plot(tu, 'r.');
plot(mean(track(2).NEES), 'k.-');
xlabel('scans');
ylabel('Test statistic (NEES) and the 95% \chi^2 region');
title('NEES, target 2, including lost tracks');
hold off;

⌨️ 快捷键说明

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