# Adding noise to the data

I am trying to write a Kalman Filter for airplane radar tracking, so I generated testing data and now I want to add some white noise to this data. I have tried doing this, but it didn't help. So far I was able to import the data from a spreadsheet and now I need to modify the data in the file.

The generated data consists of position (px, py) and velocity (vx, vy) in two dimensions. The model is very simplified, assuming that the airplane has constant acceleration only in the X direction and the acceleration in Y direction is so small that it can be neglected. Position and velocity is calculated for each the first 100 seconds of the motion.

Any tips, regarding how to implement the abovementioned?

• Could you show (a portion of) your testing data, so we can figure out how it’s formatted? Could you also include the specific code you used in your attempt with WhiteNoiseProcess? Jun 4, 2020 at 2:48

I have not used WhiteNoiseProcess before. But looking at help, what you can go is generate the noise (called noiseData below) and then add it, point by point, to your input?

p = WhiteNoiseProcess[.5]; (*mean 0 and standard deviation 0.5 say*)
noiseData = RandomFunction[p, {0, 10}];
ListPlot[noiseData]


myData = Transpose[{Range[0, 10], Range[0, 10]}];
ListLinePlot[myData]


ListLinePlot[myData + Normal[noiseData][[1]]]


It will depend a bit on exactly what the format of the data you imported is, but you can do something like this:

data = Sin[2 Pi 4 Subdivide[999]];
noisyData =
data + RandomVariate[NormalDistribution[0, 1], Length[data]];
ListLinePlot[{
noisyData,
data
}
]


I generate a pure sine wave with $$f = 4$$ (or $$\omega = 8 \pi$$). Then I add Gaussian noise to it using RandomVariate. I ask RandomVariate to produce 1000 random numbers since my data has a length of 1000. The 0 and 1 in NormalDistribution are the mean and standard deviation, respectively.