New answers tagged

1

Your impulse response is symmetric. Why do you think it's not? Symmetry here means $$h[n] = h[-n]$$ and since a DFT of length $N$ is inherently periodic in both domains with $N$ we can extend this to $$h[n+kN] = h[-n+mN] \qquad m,n \in \mathbb{Z}$$ Matlab uses unfortunately an array offset of 1, i.e. $h[0]$ is coded as h(1) and $h[N-1]$ is h(N) or h(end). ...


0

I'm sorry to ask the question in this form as I can't comment under your answer. @Dan Boschen After reading the above answer, I understand that the reason for the left picture is that the frequency domain multiplication of the recorded data leads to the appearance of delay. But after reading your explanation about non-causal emergence, I have a question ...


0

It depends on how you define the phase. For a linear phase FIR filter you could write the frequency response as $$H(e^{j\omega})=A(\omega)e^{j\phi(\omega)}\tag{1}$$ where $A(\omega)$ is a real-valued (or purely imaginary) function that can become positive and negative such that the phase $\phi(\omega)$ is a linear function without jumps. This is the case for ...


2

left is ifft of frequency response and right is time shifted fir filter to be causal filter in noise cancellation problem, delay is very annoying things. You are misinterpreting the results of the IFFT in your picture on the left side. This comes from using the IFFT where you should, properly, use the inverse DTFT. The DFT (from whence the FFT comes), has ...


1

Update: I realize now the OP is asking why we have to have any of that "annoying" delay in filter implementations given we can just multiply by a zero-phase filter in frequency. Tim answered that question while below with my prior answer, I provide the details as to why the OP's left plot is non-causal (and requires fftshift to correct), as well as ...


1

i think that is just multiply process Multiplying in the frequency domain implements circular convolution, not linear convolution. That's why you need to use algorithms like overlap-add or overlap-save for frequency domain filtering. Frequency domain processing also isn't a great fit for most active noise cancellation problems since the latency is too large....


-1

filter() implements an IIR-filter. You mention FIR filter. While IIR is a generalization of FIR, it makes some sense to think of them as two different things wrgt optimization. Generally, MATLAB may use libraries or point optimizations implemented in FORTRAN, C or Assembly using algorithmic optimizations, as well as SIMD, multi threading or any other clever ...


0

I was also looking for a function like cfirpm in Python libraries, couldn't find one. This is the difference between solid-supported Matlab toolboxes and community-supported Python libraries. The difference between the cfirpm generated filter and the LMS trained filter; the first one minimizes the response error while the second one minimizes the criteria (...


4

Like @MattL. and @aconcernedcitizen say, the issue is numerical. Python's scipy.signal.firls uses internally the solver scipy.linalg.solve. For your input, the solver throws a "matrix singular" error, but firls suppresses the error and falls back to another solver scipy.linalg.lstsq which doesn't throw an error but also doesn't get the problem ...


6

The problem lies in the formulation of the desired response, and especially in the "don't care" region, which is extremely wide for the chosen filter length. Even though I can't give any exact relation between transition band width and filter length, I know that in the case of a least squares design, the matrix of the system of linear equations ...


2

Because of the comment, I obviously must have seen this question nearly 5 years ago, but I don't remember it really. But one advantage that windowed-sinc has over P-McC or LS for a brick-wall interpolating filter is that the windowed-sinc can be guaranteed to pass through zero at all integer values except 0. That means the interpolated signal always goes ...


0

You are off by a factor of two since you are averaging amplitudes. You should average the power instead (i.e. the square of the amplitude). Off course, this only works if the input signal is white, i.e. equal energy at all freqeuncies.


0

From the OP's original question and the subsequent comments I suspect that he is interested in creating an FIR filter from a truncated impulse response (for example the impulse response of a Butterworth filter by using only the first 200 samples). The compensation used is commonly done with "windowing" and this refers to the windowing process for ...


Top 50 recent answers are included