5 votes

Kalman Filter: Why $ Q $ Discrete Is Defined as $\int_0^Te^{\mathbf{A}\tau} Q e^{\mathbf{A}^T \tau} d\tau$?

The simple answer is that you discretize Differntial Equation. Actually a linear differential equation. The question is why the Matrix Exponential? Well, try to remember what are the solutions of ...
  • 42.4k
4 votes

Under what conditions is there a one-to-one mapping between continuous-time and discrete-time signals?

Apart from practical errors related to the truncation of the infinitely-long energy signal when discretized to digital, can we find a UNIQUE mapping between the two signal forms? Yes. Say you're ...
  • 9,161
4 votes
Accepted

First Order Hold discrete-time approximation to first order continuous-time linear system

The solution comes from assuming that $$ x(t) = x[k] + \frac{x[k+1]-x[k]}{T}(t-kT), \ \ t\in[kT,(k+1)T) $$ where $x[k]:=x(kT)$, this is, a first order hold or a linear interpolation of $x[k]$ and $x[k+...
3 votes

Implementing a Butterworth Filter Manually in C/C++ via Second Order Sections

My code is wrong Even without assuming that the code's behavior is wrong, for long-term maintainability it has its problems. You'd do much better to structure your code such that you have a data type ...
  • 9,161
3 votes
Accepted

Implementing a Butterworth Filter Manually in C/C++ via Second Order Sections

c) My code is wrong That one. You have your difference equations backwards. It should be $$y[n] = x[n] + 2x[n-1] + x[n-2] - a_1y[n-1] - a_2y[n-2]$$ You have your "a" and "b" ...
  • 34k
3 votes

Frequency warping when integrators are replaced with backward-euler and forward-euler integration

To the extent this helps, here are some interesting magnitude and phase plots of the backward Euler (here using the method of impulse invariance mapping which for 1/s has the same result as backward ...
  • 38.4k
3 votes
Accepted

Reduce the Number of Intensity Levels of a Grayscale Image in MATLAB

I think by number of levels you want the image full scale grey-scale to be divided piece-wise into given number of levels. For example: - If number of levels = 2, then you want only two grey-scales ...
  • 46
2 votes

s-Domin or z-Domain - What to Use for Mixed systems

First choice : Convert the Laplace transform of your process to the Z-domain using the ZOH method as it models your DAC. In your case, your DAC is a PWM. Second choice : Work in the Laplace domain ...
  • 3,670
2 votes

Proof of Forward Euler for discretizing a transfer function

Another way to see how the forward Euler method approximates a continuous-time system is by considering the "ideal" mapping of the $s$-plane to the $z$-plane (why?): $$z=e^{sT}\tag{1}$$ For ...
  • 80.9k
2 votes
Accepted

Forward Euler Discretization

Multiplication with $s$ in the Laplace transform domain equals differentiation in the time domain. In the discrete-time domain we can approximate differentiation by the equation $$y[n]=\frac{x[n+1]-x[...
  • 80.9k
2 votes
Accepted

Frequency warping when integrators are replaced with backward-euler and forward-euler integration

The important thing here is that there is no conventional frequency warping with the forward or backward Euler methods. Frequency warping would mean that the discrete-time (DT) and continuous-time (CT)...
  • 80.9k
2 votes
Accepted

Under what conditions is there a one-to-one mapping between continuous-time and discrete-time signals?

Apart from practical errors related to the truncation of the infinitely-long energy signal when discretized to digital, can we find a UNIQUE mapping between the two signal forms? No. I think about ...
  • 34k
2 votes
Accepted

How to check that the state observer works appropriately?

Try looking at the error term $$e(k) = \mathbf{y}(k) - \mathbf{C}_d\cdot\hat{\mathbf{x}}(k)$$ and testing it for whiteness. If the state estimate is good, then all the predictable component will be ...
  • 23.1k
2 votes

Discrete-time sampling of filtered white noise

Hmm. For standard deviation, I see https://dsp.stackexchange.com/a/8632/829 which states for uniform power spectral density $N_0/2$, the standard deviation is $$\sigma^2 = \int_{-\infty}^\infty \...
  • 979
2 votes
Accepted

Frequency prewarping of a bilinear transform (Tustin transform)

There might be some undocumented features for the c2d function. Namely, if I follow the documented way of specifying pre-warping (using ...
  • 944
1 vote
Accepted

Discretization method for a simple first order system

What you're doing is slightly different from the common mappings from the $s$-domain to the $z$-domain, but it's a peculiar mix of the well-known backward and forward Euler methods. Using $x$ and $y$ ...
  • 80.9k
1 vote

Discretization method for a simple first order system

The somewhat annoying answer this question is: there is no single correct answer. You can't do this correctly and you have to pick whatever discretization artifacts is least objectionable for your ...
  • 34k
1 vote
Accepted

Derive the Forward Euler substitution for transfer function

To the extent you can factor the transfer function into individual integrator sections of the general form $\frac{1}{s}$ you can make this substitution, which is an approximation of the Matched-$z$ ...
  • 38.4k
1 vote
Accepted

States transformation of the bilinear transform

The Tustin approximation is concerned with transfer functions, i.e. relations between inputs and outputs. In state space representation $$ \dot{\mathbb{x}}(t) = A \mathbb{x}(t) + B \mathbb{u}(t) $$ $$ ...
  • 1,611
1 vote
Accepted

Discrete implementation of the PI controller

Define "appropriate". Yes, the output of the controller will be limited to between your action_max and action_min -- ...
  • 9,161
1 vote

Under what conditions is there a one-to-one mapping between continuous-time and discrete-time signals?

IMHO the question has and obvious and boring answer. Given no additional constrains, no continuous signal can be equivalent to their information-destroying discretized representation. Let's introduce ...
  • 223
1 vote
Accepted

Impulse Invariant method for digital filter design

This is just as it turns out when you do the math. The discrete-time Fourier transform (DTFT) of the sampled continuous-time impulse response $h(t)$ is $$H_d(e^{j\omega T})=\sum_nh(nT)e^{-jn\omega T}\...
  • 80.9k
1 vote

Discrete-time sampling of filtered white noise

If you sample a finite-power continuous time WSS random process $x(t)$, the auto-correlation of the sampled process $y[k]=x(kT)$ equals the sampled auto-correlation of the continuous-time process: $$...
  • 80.9k
1 vote

Frequency warping when integrators are replaced with backward-euler and forward-euler integration

Here's my question, how can one characterize the frequency warping ? I believe that you'd just have to calculate the poles in the z domain as a function of the parameters. Frequency warping with ...
  • 9,161
1 vote

Discretizing a Controller with the Backward Difference Method

This is kind of hand-wavy, but you can look at this from two different perspectives: One, you can look at $z^{-1}$ as a "back-step" operator; i.e. if $X(z) = \mathcal{Z}\lbrace x_n \rbrace$, then (...
  • 9,161
1 vote

Matlab - Bode plot of Lag Filter + Integrator

You should see that figure(2) is the only process that avoids some errors. Note on figure (1) the magnitude overlaps; you can add a constant say bode(lag_daccu_d,lagaccu+.0001,pts); to split them bu ...
  • 405
1 vote

Matlab - Bode plot of Lag Filter + Integrator

I tried it in Octave, there's definitely a glitch like you said. I tried it with "Tustin" instead of "zoh", same result. However I was puzzled by your high sampling frequency. Your lag controller ...
  • 3,670
1 vote

Reduce the Number of Intensity Levels of a Grayscale Image in MATLAB

This is one way to do it ...
  • 205

Only top scored, non community-wiki answers of a minimum length are eligible