Kalman filter on linear accleration for distance - matlab

I'm calculating displacement from the motion of an accelerometer and using a Kalman filter to improve the displacement accuracy. Please note that I am aware of ineffectiveness of using acceleration to obtain displacement in real scenarios, but in my case displacement is pretty small (like 10 cm over 2–3 seconds).
I am following this paper (PDF). In the paper there are two matrices, Q and R, for noise modeling and they are set such that displacement error is minimized. The authors tested the above with synthetic acceleration data of a known covariance to use the same in matrices Q and R.
I decided to vary the particular covariance and find its corresponding minimum error in displacement. But in my case there is no change in displacement at any value of covariance. Any help?

Related

Stability of pose estimation using n points

I am using chessboard to estimate translation vector between it and the camera. Firstly, the intrinsic camera parameters are calculated, then translation vector are estimated using n points detected from the chessboard.
I found a very strange phenomenon: the translation vector is accurate and stable when using more points in the chessboard, and such phenomenon is more obvious when the distance is farer. For instance, the square in the chessboard is 1cm*1cm, when the distance is 3m, translation vector is accurately estimated when using 25 points, while it is inaccurate and unstable using the minimal 4 points. However, when the distance is 0.6m, estimation results of translation vector using 4 points and 25 points are similar, which are all accurate.
How to explain this phenomenon (in theory)? what's the relationship between stable estimation result and distance, and number of points?
Thanks.
When you are using a smaller number of points, the calculation of the translation vector is more sensitive to the noise in coordinates of those points. Point coordinates are noisy due to a finite resolution of the camera (among other things). A that noise only increases with distance. So using a larger number of points should provide for a better estimation.

Confidence intervals on the derivative of a polynomial surface

My problem is the following:
I have fit a surface to some xyz coordinate data to obtain a polynomial surface. That's a polynomial in the variables x and y giving a surface of z-values. I know how to compute 95 percent condidence intervals on the mean response and also new predicition intervals (the standard stuff). Having obtained the surface function it's also easy to determine the derivative at a certain point on the the surface however, what I'm looking for is:
How do I compute confidence levels on the derivative value dS/dx, the (partial) derivative in the x direction at a certain point?
Are there expressions for calculating such intervals similar to the intervals for the 95 percent confidence intervals on the mean response?
(Please don't bother to post an answer on the confidence interval for the slope of a simple regression line. That's not the answer to this question. Anyway, I think it isn't.)

Confusion between prediction matrix and measurement covariance matrix in Kalman filter

I am trying to implement Kalman filter for vehicle tracking in MATLAB. A Vehicle is moving in X direction with constant velocity. Initial state for vehicle =[x(t) v(t)].
I have to find position of vehicle after t=2 sec. Position of vehicle from GPS is corrupted by noise.
My question is: if I consider that there is no process noise, then will initial prediction matrix be equal to measurement noise matrix? I don't know how to initialise prediction matrix.
Any part of your state that is initialized from a measurement can have the corresponding variance initialized from the measurement variance. If your state has other variables (e.g. velocity) which aren't directly measured, then you'll have to put in educated guesses about how far wrong you could be. Variance has units of "state unit squared" (because variance is the square of standard deviation). So if your velocity estimate has a 68% chance (see: normal distribution) of being within +/-7mph, then the initial variance would be 49 miles^2/hour^2.

How does this logic produce high and low pass filters?

I was studying for a signals & systems project and I have come across this code on high and low pass filters for an audio signal on the internet. Now I have tested this code and it works but I really don't understand how it is doing the low/high pass action.
The logic is that a sound is read into MATLAB by using the audioread or wavread function and the audio is stored as an nx2 matrix. The n depends on the sampling rate and the 2 columns are due to the 2 sterio channels.
Now here is the code for the low pass;
[hootie,fs]=wavread('hootie.wav'); % loads Hootie
out=hootie;
for n=2:length(hootie)
out(n,1)=.9*out(n-1,1)+hootie(n,1); % left
out(n,2)=.9*out(n-1,2)+hootie(n,2); % right
end
And this is for the high pass;
out=hootie;
for n=2:length(hootie)
out(n,1)=hootie(n,1)-hootie(n-1,1); % left
out(n,2)=hootie(n,2)-hootie(n-1,2); % right
end
I would really like to know how this produces the filtering effect since this is making no sense to me yet it works. Also shouldn't there be any cutoff points in these filters ?
The frequency response for a filter can be roughly estimated using a pole-zero plot. How this works can be found on the internet, for example in this link. The filter can be for example be a so called Finite Impulse Response (FIR) filter, or an Infinite Impulse Response (IIR) filter. The FIR-filters properties is determined only from the input signal (no feedback, open loop), while the IIR-filter uses the previous signal output to control the current signal output (feedback loop or closed loop). The general equation can be written like,
a_0*y(n)+a_1*y(n-1)+... = b_0*x(n)+ b_1*x(n-1)+...
Applying the discrete fourier transform you may define a filter H(z) = X(z)/Y(Z) using the fact that it is possible to define a filter H(z) so that Y(Z)=H(Z)*X(Z). Note that I skip a lot of steps here to cut down this text to proper length.
The point of the discussion is that these discrete poles can be mapped in a pole-zero plot. The pole-zero plot for digital filters plots the poles and zeros in a diagram where the normalized frequencies, relative to the sampling frequencies are illustrated by the unit circle, where fs/2 is located at 180 degrees( eg. a frequency fs/8 will be defined as the polar coordinate (r, phi)=(1,pi/4) ). The "zeros" are then the nominator polynom A(z) and the poles are defined by the denominator polynom B(z). A frequency close to a zero will have an attenuation at that frequency. A frequency close to a pole will instead have a high amplifictation at that frequency instead. Further, frequencies far from a pole is attenuated and frequencies far from a zero is amplified.
For your highpass filter you have a polynom,
y(n)=x(n)-x(n-1),
for each channel. This is transformed and it is possble to create a filter,
H(z) = 1 - z^(-1)
For your lowpass filter the equation instead looks like this,
y(n) - y(n-1) = x(n),
which becomes the filter
H(z) = 1/( 1-0.9*z^(-1) ).
Placing these filters in the pole-zero plot you will have the zero in the highpass filter on the positive x-axis. This means that you will have high attenuation for low frequencies and high amplification for high frequencies. The pole in the lowpass filter will also be loccated on the positive x-axis and will thus amplify low frequencies and attenuate high frequencies.
This description is best illustrated with images, which is why I recommend you to follow my links. Good luck and please comment ask if anything is unclear.

convert normalized frequency to real frequency in AR model

let us suppose that we have modeled signal using AR model, and suppose we have following model
i used spectral estimation function from matlab
pyulear
now frequencies are given in normalized frequencies and i would like to know how to convert it into real frequencies?from there it is clear that we have four deterministic model and also plus some white noise,actual i want to know approximate frequencies in each deterministic model,i can of course determine this frequencies uisng FFT,periodogram and so on,but i am studying application of AR/ARMA model,so in case of i have such frequencies and pictures,how can i determine actual frequencies?thanks in advance
The frequency is normalized in radians/second where pi is the normalized Nyquist frequency in radians/second. To be able to get the real frequency in radians/s, then scale the f axis with 1/T where T is the sampling time. To then get the frequency in Hz, divide the now scaled frequency with pi.