Question

Context

I have a matrix comprising of a sequence of column vectors. Each column vector contains a series of angles defined in degrees within the range -180 to 180. I wish to add white Gaussian noise to each angle across the sequence to test a system in relation to its robustness against noise.

Given that some angles do not change much and others change significantly over the sequence, I wish to add noise at a level that is proportional to the amount of activity/change. Therefore, I have chosen to sample from a Gaussian with zero mean with the amplitude defined relative to the individual angles' standard deviation (as a ratio).

My Matlab code for doing so is given below:

function Y2 = addnoise2angles(Y1, ratio)

%# Random numbers sampled from Gaussian
N = randn(size(Y1));

%# Noise level is defined per angle as a ratio of their respective standard deviations
sigma = std(Y1, 0, 2);
N = N.*repmat(sigma, 1, size(N, 2));
N = N*ratio;

%# Apply noise to angles
Y2 = Y1+N;
Y2 = wrapTo180(Y2);

end

Questions

Is this the right approach to test the robustness to noise?

If so, what range of ratios would be sensible for testing?

If not, what is wrong about it, and what is the right approach?

Was it helpful?

Solution

If I understand correctly, each row is the measurement of the same angle, and each column is a single measurement of all the angles. What you would like to do is add some noise to the entire set of measurements, so as to then check the effect on some subsequent process. How you should add the noise is completely dependent on what sort of question you want to answer. If you believe that each column looks something like a measurement of all the angles, then your idea of estimating the noise in each angle measurement independently, and then adding additional white noise, would allow you to say something about how per-angle noise effects a subsequent process. In this sense I think your measurement works.

One thing I would point out is that measuring the standard deviation of angles around a circle is not the same as measuring samples on the real line. For instance, if you have a measurement whos value is 180 + randn(0.1), i.e, right at the boundary between +180 and -180, then your measurement of the std deviation is going to be much larger than .1 degree, since most samples are very close to +180 or -180. One very easy way to solve this is to estimate the std deviation twice, with different wrapping points, and take the minimum estimate. E.g.

sigma1 = std(Y1, 0, 2);
sigma2 = std(wrapTo180(Y1+90),0,2);
sigma = min(sigma1,sigma2);

More complicated estimates for variance around a ring exist, for instance looking looking at the median angle difference between all estimate pairs within a sample. This additional complexity might not be necessary for your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top