Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
9

"Is there a way to measure frequency (detect pitch) better than FFT, that is, with better resolution in less acquisition time?" yes there is. or are. there are multiple better ways to do musical pitch detection in real time that are far, far better than running an FFT. consider : Average Magnitude Difference Function (AMDF) $$ Q_x[k] = \sum_n |x[n] - ...


6

Slope from all samples obtained To summarize the question's problem, you want to calculate the slope based on all samples obtained thus far, and as new samples are obtained, update the slope without going through all the samples again. On the page you cite is the equation for calculation of the slope $m_n$ that together with $b_n$ minimizes the sum of ...


5

There are, a few discrepancies that might be making a difference here. My suggestion would be to edit the question for clarity. There are quite a few assumptions that lead to non-straightforward thinking about the problem which I have tried to address to an extent and I would be happy to modify the response in light of more information. In machine ...


5

*STOP! If you only want a hint and not the complete solution please see Stanley P.'s or Peter K.'s answers. * Since you do not specify if there is model for the temperature evolving over time $n$, I will derive an estimator which is a combination of $Y_1$ and $Y_2$ for each fixed $n$. Let $\alpha \in (0,1)$ and suppose the estimate of $X$ can be written as $...


4

So Least squares estimator is as it literally - the estimator which brings the mean square error to minimum. In the case of Gaussian white noise it has a simple and analytic solution. I recommend you develop it yourself, if your'e comfortable with matrices calculus it is not that hard. You can generate tons of estimators by defining different cost functions....


3

I already answered your question here: https://stackoverflow.com/questions/33667275/fast-frequency-measurement/33678202#33678202 But, in summary, in certain circumstances, you can interpolate an FFT result to finer resolution that FFT bin spacing, thus allowing you to use a shorter data window for better time resolution. But FFT frequency is not pitch ...


3

Given data $ { \left\{ {x}_{i} \right\} }_{i = 1}^{N} $ the Empirical STD of the data is well defined: $$ STD = \sqrt{ \frac{1}{N - 1} \sum_{i = 1}^{N} { \left( {x}_{i} - \bar{x} \right) }^{2} } $$ Where $ \bar{x} $ is the empirical mean of the data given by: $$ \bar{x} = \frac{1}{N} \sum_{i = 1}^{N} {x}_{i} $$ Now, if there's a model on the data (Such ...


3

There are really great answers. I will try to give the Sequential Least Squares approach which generalizes to any Linear Model. Sequential Least Squares Model We're after solving the Linear Least Squares model: $$ \arg \min_{\boldsymbol{\theta}} {\left\| H \boldsymbol{\theta} - \boldsymbol{x} \right\|}_{2}^{2} $$ Now imagine that we have new measurement ...


3

Since your signal isn't sampled uniformly some strange things might happen when you apply FFT and look at the results. What you should do is estimate the Uniform DFT of the Non Uniform Time Series. One easy way to do it is use the reference code and analysis I posted on the question - Frequency Analysis of a Signal Without a Constant Sampling Frequency (...


3

Basically I'd do something like: $$ \frac{ {\sigma}_{2}^{2} }{ {\sigma}_{1}^{2} + {\sigma}_{2}^{2}} {r}_{1} + \frac{ {\sigma}_{1}^{2} }{ {\sigma}_{1}^{2} + {\sigma}_{2}^{2}} {r}_{2} $$ This is the optimal weighing given knowledge of the Variance only (Well, linear). Basically it assumes the cross correlation is 0. Derivation There are many ways to derive ...


2

I am not entirely sure what matlab's LASSO routine does so I started with Ordinary Least Squares (OLS) and worked backwards. From an OLS perspective X1 as you have it won't work. You've got a regressor that is as all ones, but your parameter inputs for you example data (r) doesn't contain an offset. Essentially your model doesn't fit you're data well, ...


2

Very intuitively, the Generalized Cross-Correlation is a "standard" cross-correlation of the windowed signals (I'll restrict myself to window-GCC, I'm pretty certain there's others, too!). Windowing happens to increase the "peakiness" of the cross-correlation. It's basically down to the same trade-off between temporal and spectral precision that you ...


2

changing the notation to something better, i think the summations have to go in both the numerator and denominator: $$ \hat{m} = \frac{\sum_n b[n]a^*[n]}{\sum_n a[n]a^*[n] - \sum_n \sigma^2_{N_a} } $$ This is a plot showing: The variation in choosing different $\sigma_{N_a}^2$ values from the true value. The true value is shown by the red line. Upshot: ...


2

HINT: Since in your model $X[n]$ is independent of $X[n-1]$ or $X[n+1]$ or any other shifts greater than zero, the linear estimate will have form: $$ \hat{X}[n]= \alpha Y_1[n] + \beta Y_2[n] $$ One might consider how you would weight $\alpha$ and $\beta$ given $\sigma_v$ and $\sigma_w$. One might also make a connection for Gaussian models, linear ...


2

I think you are going to be stuck with an iterative approach. $$ y = a (1-e^{-bt + c}) + d $$ First rewrite your equation like this: $$ y = g + h e^{-bt} $$ Where: $$ g = a + d $$ $$ h = -a e^c $$ You have a set of values $(t_n, y_n)$. Consider the $y$ values as a single vector $\vec Y $. Then pick an initial value for $b$ and construct a vector $\...


2

I'm going to assume that we have no information about how $X[n]$ varies with time, so we can just do one-at-time estimation of $X[n]$ using $Y_1[n]$ and $Y_2[n]$. One way to get an estimate from $Y_1$ and $Y_2$ is to average the measurements: $$ \hat{X}[n] = \frac{Y_1[n] + Y_2[n]}{2} $$ Using the fact that the sum of two independent Gaussian variables, $A$...


2

I understand your question like this You have new points $(x_i,y_i)$ coming in constantly, and would like to update the estimate of your slope $m$, analogously as you would with a running average (ie without computing the whole sums again for all the values). Suggestion Why don't you simply take the formula that is given in your link and split the terms ...


2

A simple solution is to calculate the first coefficient of a DFT of appropriate length, using the summation formula instead of FFT. To get amplitude and phase, transform the result to polar coordinates.


2

A resistance isn’t a particularly dynamic state, should be an unknown constant, but you might have a bin of resistors where they might vary. Taking one “randomly” out the bin makes it a random variable. The bin of resistors will have a mean value, so perhaps that mean constitutes a state variable. Perhaps someone starts putting resistors in the bin from a ...


2

My guess would be that the DC peak is part of the transient response, thus it decreases to zero over time T as the oscillating parts of your signal continue. But I don't know what your signal is so that's a guess


1

I am joining the party, as fitting lines (and polynomials) remains a current topic when it come to huge numbers of points $N$. Indeed, in a recent work, I had to extrapolate data from cyber-physical systems, in a causal and real-time manner, with low-degree $D$ polynomials. With uniform sampling, numerical instabilities were observed with $N\gtrapprox 1.000....


1

i actually had this as a problem for my master's thesis 4 decades ago. it was before i was doing anything in audio. the application was predicting the equilibrium pressure of a very slow osmosis experiment (where the time constant was about a minute). this was for a process ostensibly obeying this physical equation: $$ \frac{d}{dt}P(t) = k\big(P_\text{eq}...


1

Hi: In order to estimate the variance, you need to have an underlying model for your signal. So, suppose that the model is $y_{t+1} = y_t + \epsilon_t$ $~\forall ~ t = 1,\ldots n $. assuming that $E(\epsilon_t) = 0$ and $var(\epsilon_t) = \sigma^2$. In this case, you would difference your data in order to get estimates of $\epsilon_{t}$ at each time $t$, ...


1

A very common approach is to consider $X(k) \;\text{and} \;\hat{X}(k)$ as elements vector space $C^R$, and consider the distance between the 2 vectors as a norm, which are real, positive or zero, and satisfy the triangle inequality. So using vector-matrix notation with the vectors as column vectors: $$ \text{error}^2 =(\mathbf{X}-\mathbf{\hat{X}})^H (\...


1

Remarks The MMSE is Bayesian Framework. Namely it should be employed between random variables which have joint distribution. In your case it seems $ x \left[ n \right] $ is a deterministic parameter hence Parameter Estimation framework should be employed. Parameter Estimation In the case above it seems the Maximum Likelihood Estimation fits. Since the data ...


1

Hi: I don't know about BJ or OE but, as far as the other three go, it REALLY MATTERS which one you choose because ARX has no MA or differencing terms, ARMAX has no differencing terms and ARIMAX has both. But, even within any of the three models, there are major choices to be made as far as A) the number of lags of y, the number of lags of X ( and, in the ...


1

Your true AR model is order 4. If an AR(16) model did a good job, then 12 of its parameters should be zero. Because of noise effects / overfitting, those 12 parameters are NOT zero and, more than likely, the other matching parameters will be more inaccurate because of this. Hence the error in an AR(16) will be larger than that for an AR(4) fit.


1

I don't have a really good answer for you, but I can see a possible problem with your second attempt: the value of $a_3$ has the potential to completely blow up the dynamics because it is multiplying $t^3$. In cases like this, you are better off defining an interval over which you wish to do the estimation, $[T_1,T_2]$ and then choosing well-behaved ...


1

Let's have a look on the following model: $$ y \left[ n \right] = \left( h \ast x \right) \left[ n \right] + \left( g \ast w \right) \left[ n \right] $$ Where $ x \left[ n \right] $ is the signal of interest and $ w \left[ n \right] $ is the AWGN with unit Variance. In Matrix form it is written by: $$ \boldsymbol{y} = H \boldsymbol{x} + G \boldsymbol{w}...


1

I'm inclined to think this is true, but so far I've only gotten a counterexample: Consider the channel: \begin{bmatrix}0.5 & 0.5 & 0 & 0\\ 0 & 0.5 & 0.5 & 0 \\ 0 & 0 & 0.5 & 0.5 \\ 0.5 & 0 & 0 & 0.5\end{bmatrix} This a typewriter channel. This matrix is not invertible (it has zero determinant, and rank 2). ...


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