calcmeascov2.m

来自「一个目标跟踪系统的MATLAB 源程序包」· M 代码 · 共 26 行

M
26 行
字号
% function [x, y, R] = CalcMeasCov2(r, theta, x1, y1, sigma_r, sigma_theta)
%
% Convert polar to Cartesian measurements with Covariance Matrix 
%
% r   ----- measured range
% theta --- measured bearing
% x1  ----- sensor's x-position
% y1  ----- sensor's y-position
% sigma_r   ---- standard deviation of range measurement
% sigma_theta -- standard deviation of bearing measurement
% x   ----- measured target's x-position
% y   ----- measured target's y-position
% R   ----- covariance of the measurement vector [x; y]
function [x, y, R] = CalcMeasCov2(r, theta, x1, y1, sigma_r, sigma_theta)
R=zeros(2,2);
sigma_rsq=sigma_r^2;
sigma_thetasq=sigma_theta^2;

x = r*cos(theta) + x1;
y = r*sin(theta) + y1;

b=(sigma_rsq + r^2*sigma_thetasq)/(sigma_rsq - r^2*sigma_thetasq);
const=(sigma_rsq - r^2*sigma_thetasq)/2;
R = const*[b + cos(2*theta), sin(2*theta);
	   sin(2*theta), b - cos(2*theta)];

⌨️ 快捷键说明

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