1
$\begingroup$

I would like to simulate a sensor that provides range and direction of a beacon. This is for EKF localization, so the noise must be Gaussian (i.e. $\mathcal{N}(0, \sigma^{2})$. Also, I would like to compute the measurement noise matrix $Q_{k}$ which is $$ Q_{k} = \begin{bmatrix} \sigma^{2}_{r} & 0 \\ 0 & \sigma^{2}_{\theta} \end{bmatrix} $$

This is what I've done

sigma_range = 1;
sigma_angle = degtorad(5);
Q = [sigma_range^2,               0;
                 0, sigma_angle^2];

In the sensor, this is I've done

% add Gaussian noise with zero mean and some variance
Z(1) = Z(1) + sigma_range*randn(); % Z(1) the distance btw robot and beacon
Z(2) = Z(2) + sigma_angle*randn(); % Z(2) the angle btw robot and beacon

Is this correct?

$\endgroup$
1
$\begingroup$

Few notes:

  1. First you should multiply the noise by the Standard Deviation (Root of the Variance for zero mean noise).
  2. You can do that by multiplying the Lower Cholesky Decomposition of matrix by a column vector of Gaussian noise. Yet since you assume no correlation, you can do that by independent multiplication.

Something like:

vZ = vZ + [sigma_range; sigma_angle] .* randn([2, 1]);
$\endgroup$
  • 1
    $\begingroup$ 1) I think I did. The standard deviation is sigma_range (i.e. $\sigma$) $\endgroup$ – CroCo Jun 16 '14 at 23:59
  • $\begingroup$ I missed it at first sight I guess. You did well under the independent assumption. Otherwise, you should do it as I noted in my 2nd part. $\endgroup$ – Royi Jun 17 '14 at 12:56
  • 1
    $\begingroup$ You can always check your answer by calculating a sample covariance matrix from you random observations. $\endgroup$ – David Jul 16 '14 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.