MHB Kalman filter and simulating Gaussian noise

AI Thread Summary
The discussion focuses on using Kalman filtering to generate values based on Gaussian random noise, specifically under the conditions of a static state model with a high initial variance \(P_0 = 1000\), system noise \(Q = 0.0001\), and measurement noise \(R = 0.1\). Participants seek to generate 10 values of \(y\) that follow a normal distribution with a true mean of 1 and a variance of \(R\). The MATLAB code provided illustrates how to sample these values using the function `randn`, with explanations on the significance of adding one and dividing by the square root of ten. Clarifications on the generation of \(y\) values and their integration into the Kalman filter process are also discussed, emphasizing the need for correct implementation in the context of the filtering algorithm. The conversation highlights the importance of understanding the statistical properties of the generated noise in the Kalman filtering framework.
Dustinsfl
Messages
2,217
Reaction score
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
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.
 
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 $$y$$'s are $$\sim N(y_{true},R)$$ with $$y_{true}=1$$ and $$R=1/10$$, so in Matlab code a sample of 10 $$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

.
 
zzephod said:
The $$y$$'s are $$\sim N(y,R)$$ with $$y=1$$ and $$R=1/10$$, so in Matlab code a sample of 10 $$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.
 
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:
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
 

Similar threads

Back
Top