36

There's a flaw in Jason R's answer, which is discussed in Knuth's "Art of Computer Programming" vol. 2. The problem comes if you have a standard deviation which is a small fraction of the mean: the calculation of E(x^2) - (E(x)^2) suffers from severe sensitivity to floating point rounding errors. You can even try this yourself in a Python script: ofs = 1e9 ...


15

Many years ago I wrote this tutorial on the Kalman filter. It derives the filter using both the conventional matrix approach as well as showing it's statistical assumptions as an 'optimal' least squares filter.


13

What would be the ideal way to find the mean and standard deviation of a signal for a real time application. I'd like to be able to trigger a controller when a signal was more than 3 standard deviation off of the mean for a certain amount of time. The right approach in situations like this is typically to compute an exponentially weighted running ...


13

Transfer function estimation is usually implemented slightly differently than the method you describe. Your method computes $$\left\langle \frac{\mathcal{F}[y]}{\mathcal{F}[x]} \right\rangle$$ where $\langle$angle brackets$\rangle$ represent averages taken over data segments, and a windowing function is applied to each data segment before taking the ...


13

Noise is random, but like most random phenomena, it follows a certain pattern. Different patterns are given different names. Consider rolling a die. This is clearly random. Roll the die 1000 times, keeping track of each result. Then, calculate the histogram of the result; you'll find that you got each of 1, 2, 3, 4, 5 and 6 approximately the same number of ...


12

Welcome to Signal Processing! You're absolutely right. You cannot simply average DFT magnitudes and phases separately, especially phases. Here's a simple demonstration: Let $z = a+bi$. By definition, magnitude $|z|$ and phase $\angle z$ of $z$ are: $$|z| = \sqrt{a^2 + b^2}$$ $$\angle z = \tan ^{-1} \left( \frac{b}{a} \right)$$ Average $z$ of two complex ...


11

A signal having a mean-value or DC component of zero is commonly referred to as mean-free or as having no DC component. It does not mean that it cannot be averaged, just that the average comes out as zero. Might be a little inexact but it is very common.


8

Signals 3 and 5 appear to be quite correlated -- they share their first harmonic. If I were given two mixtures of those, I wouldn't be able to separate those, I'd be tempted to put the common harmonic as one signal and the higher harmonics as a second signal. And I would be wrong! This might explain the missing eigenvalue. Signals 1 and 2 do not look ...


8

Yeah, it can mess you up pretty badly if you don't get the fundamentals right off the get-go. This is how I interpret correlation, and it has worked for me for what I do for a living. Let's start off with a relatively simple example. Take a look at the following figure (pulled from dspguide... this is actually a great online book for knowing the basics of ...


8

Because each step in the processing chain is linear we consider a case with only noise and no coherent signal. Denote the noise $\xi(t)$. The $I$ and $Q$ signals are \begin{align}\ I(t) &= \xi(t) \cos(\Omega t) \\ Q(t) &= - \xi(t) \sin(\Omega t) \, . \end{align} We express the effect of the filter as a convolution with the time response function $h$, ...


7

I'm not an expert on ICA, but I can tell you a little bit about independence. As some of the comments have mentioned, statistical independence between two random variables can be roughly interpreted as "the amount of information that observing one variable gives about another". However, because we're talking about statistical independence, all of this is ...


6

A binary symmetric channel (BSC) can be characterized by its complemented probability $p$. Its well-known capacity is $$C = 1 - H(p) = 1 - (-p\log(p) - (1-p)\log(1-p))$$ where $H(p)$ is binary entropy function: A $L-$concatenated BSC, which is also a BSC characterized by $p_L$, can be visualized as in the figure below The complemented probability $p_L$ ...


5

A method I've used before in an embedded processing application is to maintain accumulators of the sum and sum-of-squares of the signal of interest: $$ A_{x,i} = \sum_{k=0}^{i}x[k] = A_{x,i-1} + x[i], A_{x,-1} = 0 $$ $$ A_{x^2,i} = \sum_{k=0}^{i}x^2[k] = A_{x^2,i-1} + x^2[i], A_{x^2,-1} = 0 $$ Also, keep track of the current time instant $i$ in the ...


5

Try something like this: $\begin{eqnarray} \mu(n) &=& (1 - \alpha_1) \mu(n) + \alpha_1 x(n) \\ \bar{x}(n) &=& x(n) - \mu(n) \\ s(n) &=& (1 - \alpha_2) s(n) + \alpha_2 \bar{x}(n)^2 \\ \sigma(n) &=& \sqrt{s(n)} \\ \end{eqnarray}$ This is equivalent to sending your input signal to a 1-pole DC blocking high-pass filter with a ...


5

It depends on what you mean by a "randomly moving object". If you are trying to track something that truly moves around in a totally uncorrelated manner from sample to sample (like, say, a laser pointer that flickers on and off and randomly changes position in your camera images) then a linear tracker will not give you insight into the object's state. ...


5

For any single chunk (window) of data the coherence will, as you observed, be 1. In order to properly estimate coherence you must average the spectra and cross-spectra for multiple windows, and THEN calculate coherence. The auto-spectra XX and YY can be averaged the conventional way. For the cross-spectrum XY you must average the real and imaginary ...


5

You need to do it numerically, as a related toy problem $2^a + 3^a = 4$ appears to have no symbolic solution. Bisection method (binary search) is probably the easiest solver to implement: minexponent = 0; maxexponent = 2; targetsum = 10; precision = 32; loop precision times { exponent = (minexponent + maxexponent)*0.5; if (sum(s.^exponent) < ...


5

I suppose you mean the cross-correlation at lag zero. Well take an Hilbert space $H$ (i.e. a metric space in which you can define a scalar product $\langle\cdot ,\cdot\rangle$). Then $x,y\in H$ are orthogonal if $\langle x,y\rangle=0$, by definition. If your Hilbert Space is $L_2(\mathbb{R})$ (the space of real square integrable functions) then the scalar ...


5

What are reasons to choose for cross-correlation or cross-covariance when comparing signals with non-zero mean? Well, part of the issue is that cross-correlation as defined in your equation: $$(f \star g)[n]\ \stackrel{\mathrm{def}}{=} \sum_{m=-\infty}^{\infty} f^*[m]\ g[m+n].$$ will not exist (or be infinite) if $f$ and $g$ have non-zero mean. So, in ...


5

The answer to the question (a counterexample) Properties of random processes will in general be time-dependent. They are not only when talking about stationary processes. Another related concept (not relevant here but that you might find interesting) is ergodicity. Most of us find it difficult to understand the difference between both concepts, but then you ...


4

You should define a linear $F$ to use Kalman filtering recursions. However, I think, random movements can not be described very well with linear models (an object which is tied to certain and linear physical rules can be tracked by the Kalman filter). Therefore, your state space model will not be linear. Then, your question about $F$ is critical. Because, ...


4

Is this crazy? Good? Done before and has a name? I wouldn't say that it is "Good" because clipping is not noise that can be modeled as an additive component with some distribution. fit a curve over the top 3 or 5 highest bins, and the position of the peak is the signal median The position of that peak would be the modal mean, not the median The ...


4

Note that in general the Fourier transform of a stationary process $x(t)$ does not exist. The Wiener-Khinchin theorem only states that under certain conditions the power spectral density of $x(t)$ exists, and it can be computed as the Fourier transform of the autocorrelation function of $x(t)$. Having said that, if for some reason one assumes that the ...


4

The output signal will still be normally distributed, but its power spectrum, i.e. its frequency content, will obviously be different from the input signal. If $S_X(\omega)$ is the power spectrum of the input signal, which is approximately flat, then the power spectrum of the output signal is $$S_Y(\omega)=|H(\omega)|^2S_X(\omega)$$ where $H(\omega)$ is ...


4

OK, let's have a look at one of the problematic terms: $$ \frac{\delta}{\delta x} \bigg[ \bigg(\frac{\tilde{d}[n]}{x}-\mu_A\bigg)^2 \bigg ] = - \frac{2 \tilde{d}[n] \bigg (\tilde{d}[n] - \mu_A x\bigg) }{x^3} $$ which can be verified by Wolfram Alpha. The full derivative of the summation term is then just this summed over $n$.


4

Even though your calculation yields the correct result (in this case), the steps are not completely correct. First of all, the covariance matrix of a random variable $n$ is given by $$ C = E[nn^H]. $$ The nomenclature of variance is more suitable for scalar random variables, in my opinion (or it refers to the diagonal of the covariance matrix, i.e. the ...


4

edit: to be clear this answer describes why Lab can be described as a decorrelated color space. This does not imply that decorrelation is the main benefit of using Lab (see many answers on why Lab is useful) If you plot all the RGB colors of a standard RGB image of the natural world you will notice something (see below), the values tend to fall on a ...


3

As a fellow astrophysicist, I suggest you use the standard 3 sigma above noise for detection, and 5 sigma above noise if you want to do analysis on what you find. If your noise does not have a flat background, you need to subtract a "Flat", an estimation of that the background might be. If you know what the noise should look like, such as exponential, ...


3

This is a difference between coherent and incoherent averaging of FFT spectra. Coherent averaging is more likely to reject random noise in the analysis. Incoherent is more likely to accentuate random noise magnitudes. Which of these is more important to your result report?


3

This seems to be a nice write-up of the Kalman filter.


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