Kalman filter and simulating Gaussian noise

In summary, we have discussed using Kalman filtering to solve a problem with a constant water level, a static state model with a variance of \(P_0 = 1000\), system noise of \(Q = 0.0001\), and measurement noise of \(R = 0.1\). To generate 10 y values based on Gaussian random noise, we can use the formula \(\mathbf{y} = y\) with a mean of 1 and a variance of 1/10. This can be achieved in Matlab by using the command randn(1,10)/sqrt(10).
  • #1
Dustinsfl
2,281
5
Water level assumed constant. Static state model \(P_0 = 1000\), system noise \(Q = 0.0001\), measurement noise \(R = 0.1\).

I want to use Kalman filtering to solve this problem. I know how to do this but I need to generate \(\mathbf{y} = y\) using Gaussian random noise. \(P_0\) is also call the variance which is high do to uncertanity in \(x_0\).

How do I generate 10 y values based on Gaussian random noise with these conditions?

These values come from here.

Then I have a copy the same presentation but page 7-9 are additionally hand written pages with more info and everything before and after these pages are identical to the first link.
 
Last edited:
Physics news on Phys.org
  • #2
I found a presentation on the topic by Stanford; unfortunately, I don't see how to apply it to the problem. If someone can help with this, that would be great.

On page 14, they go over linear measurements of the form \(y = Ax + v\).

Stanford lecture

This is just a beamer style presentation so it isn't dense.
 
  • #3
dwsmith said:
Water level assumed constant. Static state model \(P_0 = 1000\), system noise \(Q = 0.0001\), measurement noise \(R = 0.1\).

I want to use Kalman filtering to solve this problem. I know how to do this but I need to generate \(\mathbf{y} = y\) using Gaussian random noise. \(P_0\) is also call the variance which is high do to uncertanity in \(x_0\).

How do I generate 10 y values based on Gaussian random noise with these conditions?

These values come from here.

Then I have a copy the same presentation but page 7-9 are additionally hand written pages with more info and everything before and after these pages are identical to the first link.

The \(\displaystyle y\)'s are \(\displaystyle \sim N(y_{true},R)\) with \(\displaystyle y_{true}=1\) and \(\displaystyle R=1/10\), so in Matlab code a sample of 10 \(\displaystyle y\)'s would be generated thusly:

Code:
--> ysamp=1+randn(1,10)/sqrt(10)

ysamp =

 Columns 1 to 6
    1.0032    1.0506    0.5366    0.9875    1.3739    0.7645
 Columns 7 to 10
    1.2047    0.8725    0.6744    1.2186

.
 
  • #4
zzephod said:
The \(\displaystyle y\)'s are \(\displaystyle \sim N(y,R)\) with \(\displaystyle y=1\) and \(\displaystyle R=1/10\), so in Matlab code a sample of 10 \(\displaystyle y\)'s would be generated thusly:

Code:
--> ysamp=1+randn(1,10)/sqrt(10)

ysamp =

 Columns 1 to 6
    1.0032    1.0506    0.5366    0.9875    1.3739    0.7645
 Columns 7 to 10
    1.2047    0.8725    0.6744    1.2186

.

Can you explain the plus one and divided by sqrt(10). I understand the randn.
 
  • #5
If y was represented as \(y = 0.1k + \) noise, \(r = 0.1\), and we want 6 values, would it be
Code:
for i = (1:1:6)
     sampley = 1 + 0.1*i + randn(1,6)/sqrt(10)
end

I just realized this doesn't make sense because we will have 6 1x6 column vectors. I am not sure how to use this definition of \(y\).

Or would it be
Code:
for i = (1:1:6)
     sampley = randn(1,6)/sqrt(10)
end
and then where I use my sample ys (which is in a loop), I can augment them as
Code:
for i = (2:1:8)
     some stuff
     x(i) = ax(i) + K(i)*((y(i - 1) + (i - 1)*.1) - ax(i))
     some stuff
end
 
Last edited:
  • #6
dwsmith said:
Can you explain the plus one and divided by sqrt(10). I understand the randn.

randn(nrows,ncols) generates a matrix of nrows rows and ncols columns of samples from a zero mean unit variance normal distribution.

Code:
-->Sample_Mean=1.0;

-->Sample_Variance=1/10.0;

-->ysamp=Sample_Mean+randn(1,10)*sqrt(Sample_Variance)

ysamp = 

Columns 1 to 6    1.0032    1.0506    0.5366    0.9875    1.3739    0.7645
 
Columns 7 to 10    1.2047    0.8725    0.6744    1.2186
 

FAQ: Kalman filter and simulating Gaussian noise

What is a Kalman filter and how does it work?

A Kalman filter is a mathematical algorithm used to estimate the state of a system based on noisy measurements. It works by combining a prediction of the system's state with a measurement of the system, taking into account the uncertainty or noise in both the prediction and the measurement. It then provides an optimal estimate of the system's state.

How is a Kalman filter used in real-world applications?

Kalman filters are commonly used in a wide range of applications, including navigation systems, control systems, signal processing, and computer vision. They are particularly useful in situations where measurements are noisy and need to be combined with predictions to obtain an accurate estimate of the system's state.

What is Gaussian noise and why is it important to simulate it?

Gaussian noise is a type of random noise that can be described by a normal distribution. It is important to simulate Gaussian noise because it is a common type of noise encountered in real-world systems and can have a significant impact on the performance of a Kalman filter. By simulating Gaussian noise, we can test and evaluate the robustness of the filter under different noise conditions.

How do you simulate Gaussian noise in a Kalman filter?

Gaussian noise can be simulated by generating a random number from a normal distribution with a mean of 0 and a standard deviation that represents the level of noise in the system. This noise can then be added to the system's measurements or predictions before being passed through the Kalman filter.

What are the advantages of using a Kalman filter over other filtering techniques?

Kalman filters are optimal in the sense that they minimize the error between the estimated state and the true state of a system. They also have the ability to handle non-linear systems and can adapt to changes in the system over time. Additionally, Kalman filters are computationally efficient and can handle large amounts of data, making them a popular choice in many real-world applications.

Similar threads

Replies
4
Views
1K
Replies
1
Views
2K
Replies
1
Views
974
Replies
6
Views
3K
Replies
2
Views
8K
Replies
5
Views
1K
Replies
2
Views
2K
Replies
2
Views
3K
Back
Top