Hot answers tagged

10

The sequence is exactly what you should expect: $$x[-n]=x[N-n]\tag{1}$$ Clearly, for $n=0$ $x[n]$ and $x[-n]$ have the same value. It seems like you were expecting to see the sequence $x[N-1-n]$ instead of $x[N-n]$. If you wanted that sequence you would need to modulate the result of the first DFT: N = 16; x = 1:N; c = exp(-1i*2*pi/N*(0:N-1)); x2 = real( ...


7

Using the duality property of the Fourier transform, you have that $$x[n] \overset{\mathcal F}{\longleftrightarrow}X[k]\implies X[n] \overset{\mathcal F}{\longleftrightarrow} \begin{cases}Nx[N - k] & \text{for} & k = 1, \ldots, N -1 \\Nx\left[(k)_N\right]&\text{for}&k = 0\end{cases}$$ You have then: \begin{align} X[0] & = Nx[0]\\ X[1] &...


7

Yes reversed (!) but not in the programming sense ! The sequence $N \cdot x[-n]$ which results after applying DFT twice to the N-point sequence $x[n]$ is a time-reversed (and amplitude scaled by $N$) sequence indicated by the minus sign in its argument. Remembering from your math courses, a function with a negated argument such as $f(-t)$ means the function $...


4

You don't want np.ones_like(num) in the denominator. That's making a denominator of all ones, with lots of possibly unstable poles. Your denominator in Python needs to be [1,0,0,0,0,0,...]. Or just [1] if possible.


3

One problem with your design is that the quantized numerator coefficients don't add up to zero anymore, so you lose the desired notch at DC. That can be done differently, because even with quantized coefficients you can have a (double) zero at DC. Just make sure that $b[0]=b[2]$ and $b[1]=-2b[0]$. The real problem is the denominator polynomial. It is well ...


2

When dealing with applying a 2D convolution in frequency domain we have to take into account 2 things: Extending the kernel to the dimension of the input data. Dealing with the implicit periodic extension of the frequency domain element wise multiplication. As you wrote in the comments, one way to do it is simple zero padding and fftshift(). Yet this might ...


2

Cross correlation can be implemented in the frequency domain using FFT by multiplying signals. For a cyclic cross correlation you can use: cc = ifft(fft(x).*conj(fft(y))); You can also calculate the linear cross correlation using FFT by zero-padding the signals before the FFT. Related: Cross correlation with FFT and fftshift Edit: In order to calculate the ...


2

This filter amounts to a cutoff frequency of 24 Hz @ 44.1 kHz. That means your poles are extremely close to the unit circle so you require way more numerical precision than you can get with 16 bits. You need more resolution: even 24 bits are iffy for that low a cutoff frequency, but 32-bit should do nicely. This also depends on your requirements: how much ...


2

Assuming continuous-time, for all periodic signals with a period of $T$ , for any $m$ , we have : $$ x( t + mT) = x(t) \tag{1}$$ So, for example with $T=7$ , and $m=2$ , you can see that $x(15) = x(2\cdot 7 + 1) = x(1)$. The operator that is used to find base argument for a given $t$ value is the modulus : $$ x(t) = x( \text{mod}(t,T) ) \tag{2}$$ where $\...


2

The discrete-time Fourier transform (DTFT) is always periodic. This is also the case for the frequency response of the discrete-time Hilbert transformer. For this reason, the ideal frequency response is not only zero at DC but also at Nyquist, which corresponds to index $2$ for a signal of length $4$. Consequently, the correct way to do what you're trying to ...


1

The function firls() is meant to design filters with piecewise constant magnitude responses. So in practice you use only a few frequency points and the corresponding desired magnitude values, and the function computes a linear interpolation between the given frequency points. Of course, in theory your call to firls is correct, but I guess that the resulting ...


1

MATLAB assumes that the transfer function has a form like this: $$ H(z) = \frac{b_0 + b_1z^{-1} + \ ... \ + b_{M}z^{-M}}{1+a_1z^{-1}+ \ ... \ + a_{N}z^{-N}} $$ So then you can read off the coefficients from your equation as $b_0=1$, $a_0=1$ (always assumed), $a_1 = -0.2$, and $a_2 = -0.1$. In MATLAB world, you define the coefficients as: b = 1; a = [1; -0.2; ...


1

You have to define numerator and denominator polynomials. In your case you have b = 1; a = [1,-0.2, -0.1];


1

The scale values should be all $1$ except for the first Unless that's $1$ too. Multiply your output signal with that first scale value OR multiply the first three numbers in the first three row of you SOS matrix with that number before filtering. EDIT Turns out the filter designer makes this more convoluted than it needs to be. Just multiply all the scale ...


1

When trying to measure similarity between signals we're basically building a metric. When doing so we need to ask what we want to be sensitive about. For instance, if you don't remove the DC Component (The Mean) and use something like an integral to measure similarity (Correlation / Convolution based) then you are sensitive the added DC component. For ...


1

According to your filter equations, your polynomials for $b1$, $b2$ and $a$ should only contain 1, zeros and -1. Your don't need to evaluate the last coefficient (num_exp, and others) at the complex exponential - That is done inside the freqz() Take a look at this example here So you should have: a=[1, -1] b1 = [1, 0, 0, ..., 0, -1] b2 = [1, 0, 0, ..., 0, -1]...


1

The spectrum is periodic so you need circular convoluioint, not linear convolution You are smoothing the complex linear spectrum. Due to the phase of the complex ammplitude you will get significant interference in your smoothing window. Smoothing is typically in the energy domain and the phase is discarded. Complex smoothing is fairly difficult to do.


1

Hi I am confused about the implementation of AGC in Simulink example. I am unable to relate the given implementation to the algorithm given by MATLAB. Kindly help me in understanding the reason behind the difference in algorithm and implementation. Best Regards Sunny


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