function AOARBL3D_PlotFig(NsePwrVecdB,Qcrlb,mseQ1,mseQ2,tcrlb,mset1,mset2,M,N,Loc)
% AOARBL3D_PlotFig(NsePwrVecdB,Qcrlb,mseQ1,mseQ2,tcrlb,mset1,mset2,M,N,Loc)
%
% Generate the plots for Figs. 3-10 in the reference paper below
%
% Input:
%   NsePwrVecdB:    20 log10(NoisePower)
%   Qcrlb:          CRLB for rotation matrix
%   mseQ1:          mse of Q for the proposed method
%   mseQ2:          mse of Q for the comparison method
%   tcrlb:          CRLB for translation vector
%   mset1:          mse of t for the proposed method
%   mset2:          mse of t for the comparison method
%   M:              number of anchors
%   N:              number of sensors
%   Loc:    scalar, Self-Localization (Loc=0), Localization(Loc=1)
%
% Reference:
% Y. Wang, G. Wang, S. Chen, K. C. Ho and L. Huang, "An investigation and
% solution of angle based rigid body localization," IEEE Trans. Signal
% Process., vol. 68, pp. 5457-5472, 2020.
%
% Yue Wang, K. C. Ho   07-18-2021
%
%       Copyright (C) 2020
%       Computational Intelligence Signal Processing Laboratory
%       University of Missouri
%       Columbia, MO 65211, USA
%       hod@missouri.edu
%

nsePwr=10.^(NsePwrVecdB./10);

% -- mse for Q --
figure;
loglog(sqrt(nsePwr),sqrt(Qcrlb),'k'); hold on;
loglog(sqrt(nsePwr),sqrt(mseQ1),'*k'); hold on;
xlabel('\sigma_m (degree)');
ylabel('RMSE($\tilde{\mathbf{Q}}$)','interpreter','latex');

if (M==1 | N==1)
    hold off; grid on;
    legend('CRLB','RMSE','Location','southeast')
    if (M==1)
        axis([sqrt(nsePwr(1)) sqrt(nsePwr(end)) 1e-4 1e1]);
    else
        axis([sqrt(nsePwr(1)) sqrt(nsePwr(end)) 1e-5 1e0]);
    end;
else
    loglog(sqrt(nsePwr),sqrt(mseQ2),'ok'); hold on;
    hold off; grid on;
    legend('CRLB','RMSE','RMSE-BRPLE','Location','northwest');
    if (Loc)
        axis([sqrt(nsePwr(1)) sqrt(nsePwr(end)) 1e-3 1e1]);
    else
        axis([sqrt(nsePwr(1)) sqrt(nsePwr(end)) 1e-4 1e1]);
    end;
end;

% -- mse for t --
figure;
loglog(sqrt(nsePwr),sqrt(tcrlb),'k'); hold on;
loglog(sqrt(nsePwr),sqrt(mset1),'*k'); hold on;
xlabel('\sigma_m (degree)');
ylabel('RMSE($\tilde{\mathbf{t}}$(m))','interpreter','latex');

if (M==1 | N==1)
    hold off; grid on;
    legend('CRLB','RMSE','Location','southeast')
    axis([sqrt(nsePwr(1)) sqrt(nsePwr(end)) 1e-3 1e2]);
else
    loglog(sqrt(nsePwr),sqrt(mset2),'ok'); hold on;
    hold off; grid on;
    legend('CRLB','RMSE','RMSE-BRPLE','Location','northwest');
    if (Loc)
        axis([sqrt(nsePwr(1)) sqrt(nsePwr(end)) 1e-3 1e2]);
    else
        axis([sqrt(nsePwr(1)) sqrt(nsePwr(end)) 1e-2 1e4]);
    end;
end;

% -------------------------------------------------------------------
