4

Apart from the formulae, let us go back to their actual meaning, and how they are derived. Talking about convolution: this operation is inherent to Linear-Time-Invariant (LTI) systems. In other words: if you want to analyse a system that is linear, and time-invariant, or you want to apply a processing or a filter that does not vary in time or space then ...


3

Let's assume you have 2 signals: vX and vY. So: clear(); numSamplesX = length(vX); numSamplesY = length(vY); numSamplesConv = numSamplesX + numSamplesY - 1; vTimeDomainConv = conv(vX, vY); vFrequencyDomainConv = ifft(fft(vX, numSamplesConv) .* fft(vY, numSamplesConv), 'symmetric'); max(abs(vTimeDomainConv - vFrequencyDomainConv)) %<! Should be < ...


3

and how to avoid it? Address the NaN in your input data. Don't "fix", "paper over it" or "replace by 0". Find the root cause for the NaN, understand what's happening and take meaningful corrective action. NaN means your input data is bad. Doing anything with bad data is pointless since your output will be bad. Doing cosmetic adjustment just so the code ...


2

I would recommend three approaches: Try your own implementations first, especially if you haven’t written image processing code in a while. Google “Python image processing library.” There are a number of choices, and you know enough to pick what’s right for you. Opt for simplicity and usability first. Install OpenCV on a Pi. Don’t worry about performance; ...


2

Python has a lot of import libraries for image processing, and they are running on platforms that support Linux, such as Raspberry Pi. Pi runs with ARM based processors, and every limitation of that CPU (especially on SIMD floating point ops) is also a limitation for image processing. Pi also comes with a dedicated hardware GPU which can be used to ...


2

After playing with the notebook for a while, I figured out the following: The result from scipy is shifted by one pixel in each axis (probably due to its definition of the "same" mode). Or, alternatively, both the analytic result and pyfftw results are shifted the opposite way. After working around that, the result is exactly (within error) the same as the ...


2

A convolution integral is an overlap integral, i.e., for any given shift of the two functions being convolved, the convolution integral is simply the overlap area. From [1, p. 58], the convolution integral of $x_1$ and $x_2$ is $$\mathrm {x_3 =x_1*x_2 =\int_{-\infty}^{\infty}x_1(\lambda)x_2(t-\lambda)\,\mathrm d\lambda }$$ If $x_1$ and $x_2$ are ...


1

If you understand that the input and output of an LTI (linear time-invariant) system are related by convolution, then you should also be able to understand that a rectangular input and a rectangular impulse response result in a triangular signal, if you know what convolution means, namely: $$y(t)=\int_{-\infty}^{\infty}x(\tau)h(t-\tau)d\tau\tag{1}$$ where $...


1

The problem with your code is that you need to get the indexing and time gating right. Matlab represents the frequencies in the FFT vector somewhat out of order , i.e. from $[0,N-1]$ instead of $[-N/2+1,N/2]. Once you rotate them so that DC is in the center and grab the correct frequencies after convolution, this does indeed work. %% Create two signals n = ...


1

My answer is not from speech processing angle but from a generic signal processing involving Linear and Circular Convolution. Is zero-padding necessary for speech processing to satisfy linear convolution property? If the FFT size is $N$, and the length of result of linear convolution size is $\gt N$, then you need to do zero-padding. Otherwise it will ...


1

Circular convolution is basically linear convolution with aliasing. The circular convolution calculated at a sample number that does not involve wrap around values of the signal and are calculated within the one period of both signals might have the same value as the linear convolution.


1

For the 1-d case, I think that conv() is implemented in the direct domain while xcorr is implemented in the frequency domain. This indicates that conv will be faster for small kernels, while xcorr will be faster when inputs are equal size. I dont know if this still is the case, and if it extends to the 2-d case. Operations that allows for native single-...


1

One of the most important classes of systems are Linear Time Invariant (or LTI) systems. These can fully described by either their transfer function or their impulse response (which are Fourier transforms of each other). If you apply an input signal to an LTI system and you want calculate the output signal, you can simply convolve the input with the ...


1

For a convolution resulting in N+M-1 elements, with N>=M, best result might be to discard M-1 elements from both sides of the result. All the other convolutional result elements are "contaminated" by your assumptions about padding (zero, circular, random, etc.), and how closely that assumption corresponds to something useful or actual.


1

In this particular example best practice would be zero pad both signals to 2048 samples, FFT, multiply, and inverse FFT. This will result in 2048 time samples. The first 1999 are your convolution result and the last 49 are zero. Whether you want to discard the last 49 samples or just leave them as zeros, depends on what you want to do with them. If you ...


1

Lot of good comments and a nice answer but still I felt OP's question may have gone unanswered. A is length 100 sequence, B is length 80 sequence. So conv(A,B) linear convolution operation results in a 179 length sequence. The important thing to keep in mind is that the resulting sequence is 179 length. Now, coming to DFT of these sequences (remember FFT ...


1

the following matlab/octave code gives the linear convolution result using frequency domain : A = ((-1).^[0:79]').*hamming(80); % input one B = blackman(100); % input two C1 = conv(A,B); % A * B (convolution) in time domain C2 = real( ifft( fft(A,179).*fft(B,179) ) ); % convolution using freq domain The output will be identical of length 179 ...


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