# Tag Info

Let's consider a discrete-time state space model (the derivation for a coninuous-time system is completely analogous): \begin{align}\mathbf{q}[n+1]&=\mathbf{Aq}[n]+\mathbf{b}x[n]\\ y[n]&=\mathbf{c}^T\mathbf{q}[n]+dx[n]\tag{1} \end{align} where $x[n]$ is the input, $y[n]$ is the output, and $\mathbf{q}[n]$ is the state vector. Taking the $\... 5 as the first answer (with the most votes) says, the kalman filter is better in Any case when signal is changing. Notice the problem statement These use the algorithm to estimate some constant voltage. How could using a Kalman filter for this be better than just keeping a running average? Are these examples just oversimplified use cases of the filter? using a ... 5 I've had the same question last week, but I've managed to find how to derive it (getting rid of those$z$terms is indeed tricky). I will give here detailed demonstration of how to arrive to the result given in 1 (with, in your notation,$\alpha = 2 \lambda$). So we define our new discrete-time function transfer as $$\begin{array}{rcl} H_d(z) &=& ... 5 I will ask you something that will give you intuition. How would you calculate the Gradient of an image? Image is a discretization of reality, so how would you estimate the gradient of the "Reality" if you're given only the image? In the case above we use Finite Differences to approximate the continuous derivative. So what actually is approximating \dot{... 5 As you pointed out, there are many state-space realizations of one particular transfer function. The reason is that a transfer function only represents the input-output behavior of a system (observable and controllable dynamics) and not the internal states. That being said, you can directly write state-space realizations from a transfer function with the so-... 4 Another take: The Kalman Filter lets you add more information about how the system you're filtering works. In other words, you can use a signal model to improve the output of the filter. Sure, a moving average filter can give very good results when you're expecting a close-to-constant output. But as soon as the signal you're modelling is dynamic (think ... 4 I won't add any equations, I will just add some intuition. I will also limit my self for Additive Gaussian White Noise. Now, in that case the Kalman filter can written as a Least Squares problem to solve. I'd say even more, the Kalman Filter is linear, if you have the samples up to certain time T , you can write the Kalman filter as weighted sum of all ... 4 The discrepancy between your derivation and matlab's computation results because of a convention mismatch you used during the partial fraction expansion: Given that the function to be expanded is H(s)$$ H(s) = \frac{K}{As^2 + Bs + C} $$then you should first convert it into the form$$ H(s) = \frac{K/A}{s^2 + (B/A)s + C/A} $$and then apply the expansion ... 4 You are right that a distributed system could be "something like a transmission line". Note that the system$$y(t)=x(t-T)\tag{1}$$is a simple model of a transmission line, where just a frequency-independent delay T is taken into account, and the attenuation is neglected. Note that lumped electrical systems, described by resistors, capacitors and ... 3 The equation you're trying to solve is$$ \mathbf{y}=\mathbf{X}\mathbf{h}, $$where \mathbf{h} is your unknown. The matrix \mathbf{X} is going to have a time-shifted structure that reflects the convolution operator. If we assume that the \mathbf{y} vector starts with y(3) i.e. ignores the first two zeroed out elements of y, then the corresponding \... 3 Unnecessary additional information that might help From a pragmatic point of view, there might be a problem when trying to control a given plant using only its transfer function G_p(s). In general, you test the plant putting a series of inputs and seeing how it reacts, measuring the respective outputs. From that, you can model the plant as a transfer ... 3 Yes sure they are LTI. Let A be the (L-1)\times (L-1) shift matrix$$ A := \begin{pmatrix}0 & 1 & 0 && \dots & 0\\0 & 0 & 1 & 0 &\dots &0\\\vdots &&& \ddots && 0\\0&&\dots&&1&0\\0 &&\dots&&0&1\\0&0&\dots&0&0&0\end{pmatrix} $$and$$ B ... 3 I think your E-step is correct(only one term missing in the last expression:$-N\ln\sigma_w$). To obtain the M-step you have to differentiate with respect to all your parameters. You don't have to include$u(n)$in$\theta$, since it's defined by$p$. So you compute$\frac{\partial Q}{\partial\theta}=0$. Solving for$\theta$, and this is your new$\theta$... 3 Short answer: Yes but no. Long answer: If a system matrix is rectangular then it means either; There are more number of states than the number of their derivatives which is not meaningful. If you have a system such as a jump linear system or something that couples to the initial system and extends the state space, you can still work with ... 3 Model your deterministic input as a$2 \times 1$matrix : $$\begin{bmatrix} u \\ T_a \\ \end{bmatrix}$$ Then your state space equations will be: $$\begin{bmatrix} \dot x_1 \\ \dot x_2 \\ \dot x_3 \end{bmatrix} = \begin{bmatrix} -\frac 13p & \frac 13p & 0 \\ p & -(p+ \frac{c}{10}) & \frac{c}{10} \\ 0 & \frac{c}{30} & -(\... 2 You're using a high order model so you might be running into numerical precision issues. Make sure the realization of model_state_space is minimal. You can do this with min_model_state_space = minreal(model_state_space) Also, not all state-space realizations are created equally. Some have better numerical properties, such as a balanced realization: [... 2 We don't know anything about your system, but general rule is:$$\begin{array} &y[n] &= \mathbf{C}x[n] + \mathbf{D}u[n]\\ x[n+1] &=\mathbf{A}x[n] + \mathbf{B}u[n] \\ \end{array}$$Where u[n] is the input signal value, x[n] is state vector value at a given point in time, and y[n] is obviously the output. What you need to do is to: ... 2 1) It depends on what you call the standard Kalman filter -- I will call the equations in the picture below to be the "standard Kalman filter". You can easily derive an expression for the Kalman filter where the covariance matrices of the noise processes are time varying in terms of the covariances of the noise processes (and cross-covariance of the noise ... 2 Your FIR state space representation seems to be doing too much. The way I would write it is to have the process noise is \epsilon(t) as your input, and your state as two time-delayed copies of it:$$x(t+1) = \left[ \begin{array}{c} \epsilon(t+1)\\ \epsilon(t) \\ \epsilon(t-1) \end{array} \right] = \left[ \begin{array}{ccc} 0 & 0 & 0\\ 1 & 0 &... 2 Let's rewrite your system as $$m \ddot{x}(t) + b \dot{x}(t) + k x(t) = f(t)$$ then you can see what you're saying: Everything I need to know is in$x(t)$! But is it really? State space systems are predicated on having a single, first order differential equation to solve. As you can see in the rewritten equation above, there is a double-derivative ... 2 The problem is numerical. You can in theory place the poles wherever you want. But as you have provided the examples are always academic. The polynomial methods are far far less accurate than matrix methods. The notorious Wilkinson polynomial is a prime example of such problems. In fact root finding of polynomials actually converts the polynomial ... 2 Rather than write $$x_t = Ax_{t-1} + f(u_{t-1},\mathbf{w})$$ as the state update equation, I'd write: $$\xi = \left[ \begin{array}{c} x_t\\ u_t \end{array} \right]$$ and then $$\xi_t = g(\xi_{t-1},A,\mathbf{w})$$ so that $$y_t = \left[ 1\ \ \ 0 \right] \xi_t + v_t$$ Then you could apply the non-additive noise formulation of the EKF to get ... 2 Well, any input-output representation obviously admits a state-sapce form. for your equation in$y[k]you can easily construct one as follows. Create a "shift" system (an integrator chain) as \begin{aligned} x_1[k+1] &= x_2[k],\\ x_2[k+1] &= x_3[k],\\ &\vdots\\ x_n[k+1] &= y[k] \end{aligned} In this way indeed you havex_n[k] = y[k-1]$... 2 If X is your design matrix then the matlab implementation of Ordinary Least Squares is: h_hat = X'*X\(X'*y); I attempted to answer your other question here: How to apply Least Squares estimation for sparse coefficient estimation? which explains how to create the design matrix. As mentioned this is a second order Moving Average model, lag of 2. https://... 2 I am most convinced you should try Hidden Markov Chains (which i am not explaining here), just justifying its use: Kalman Filter: continuous state space, discrete observations https://stats.stackexchange.com/questions/183118/difference-between-hidden-markov-models-and-particle-filter-and-kalman-filter 2 You could use a nonlinear Kalman filter, such as the extended Kalman filter (EKF), and track the phase and frequency as your state variables. In this case, your Kalman filter is essentially acting like a phase-locked loop (PLL). Example reference 2 Hi: I've been wondering about the same exact thing myself and the light bulb finally turned on a few days ago when I went back to Kalman's 1960 paper. ( I've read it many times but not recently ). The paper is at the link below and the short explanation is on the right hand side of page 6. The longer explanation is in the reference (18) which I have but ... 2 You can use pyvib to do frequency based subspace identification. Beware that there is no estimation of the initial state. It is possible to do optimization of the identified model, if the data is not perfectly linear. See the implemenentation, maybe you can use it, in case you want to do your own implementation. Somewhat incomplete example. Take a look at ... 2 You can split up the real and imaginary part of the state into their own seperate states. Namely by defining$x_r=\mathrm{Re}(x)$,$x_i=\mathrm{Im}(x)$,$A_r=\mathrm{Re}(A)$,$A_i=\mathrm{Im}(A)$,$u_r=\mathrm{Re}(u)$,$u_i=\mathrm{Im}(u)$,$B_r=\mathrm{Re}(B)$and$B_i=\mathrm{Im}(B)$then the differential equation can also be written as$\$ \dot{x}_r+i\,\...