Hot answers tagged

3

It has to do with the Bilinear Transform, as Hilmar already stated. The theoretical function is defined for the analog domain, so inherently there will be differences when you convert the response to the digital domain. However, you can still generate the "analog" frequency response and yield the expected result. I took your code and added/modified ...


2

Why is the amplitude changing throughout the signal Because you are sampling it at oh so slightly less than c_freq/2. Your linspace call generates x points that are evenly spaced between 0 and 3, with a spacing between them of 3 * c_freq * 2 / (3 * c_freq * 2 + 1). This means that the phase that gets calculated is $\begin{bmatrix}0, \pi-\epsilon, 2\pi - 2\...


2

OP seeks to randomize phase while keeping spectrum magnitude unchanged - and has achieved it. All that remains is to plot the spectrum. Just add this code: def plot(x0, x1, title): plt.plot(x0) plt.plot(x1) plt.title(title, weight='bold', fontsize=16, loc='left') plt.show() plot(amp, np.abs(nft), title="RFFT, original vs new | ...


1

Let's take a look at a simple example. Let's just say we have x = [1 1 1 1]. If we resample this by 1.25 we get y = [1 1 1 1 1] (assuming some perfect resampler that doesn't really exist). The signal amplitude is maintained. However since we have got one more sample, the signal energy is NOT maintained, i.e. $\sum x^2 = 4$ whereas $\sum y^2 = 5$. The ...


1

Upsampling is the process of inserting zeros between each sample, and that won't affect the magnitude as the total count will not have changed, but interpolation as the OP is doing which is the combination of upsampling and an interpolation filter will. In this case the zeros have grown through the interpolation filter to the expected values between the ...


1

FYI, if needed, it is possible to match magnitude or phase of digital filter to follow quite well the theory/analog model by using certain methods. I did this example plot using MIM (Magnitude Invariance Method) method: Here are some methods I've bumped to: MIM/PIM https://ieeexplore.ieee.org/document/4629708 , https://ieeexplore.ieee.org/document/7357808 , ...


1

I didn't know the convolution theorem for the DHT before, but it's pretty clear that if it exists, it must be about circular convolution, just like for the DFT. You're comparing that with acyclic convolution, so the results differing is no surprise.


1

I´m not sure if this really applies to your problem since it may be another issue, but I can tell from my experience with acoustic impulse response measurements (only there you want to estimate the response from the input signal, but the deconvolution should be the same): In case your transfer function E is somehow bandlimited and has zero (or very low) ...


1

If the goal is to get a metric for similarity, consider using direct correlation rather than mapping to the frequency domain to then perform a comparison (which I would then again recommend from that domain to also do as a subsequent direct correlation computation). Assuming no time-shift, the Pearson Correlation Coefficient is ideal for this application in ...


1

Your signal has a massive DC bias so your output is dominated by the step response of the band pass filter. It will eventually get there but it's going to take a really long time. Initialize your state with zi = -26040*sosfilt_zi(). See my answer to your other question today. EDIT On second thought: while you can fix some of this in software, you probably ...


1

But I don't understand what it does, and how it determines initial conditions from the sos argument and not from the actual signal to filter. From the documentation Compute an initial state zi for the sosfilt function that corresponds to the steady state of the step response. It assumes that the input signal is a unit step. That's useful if you input ...


1

scipy.signal.stft uses scale factor for the result stft source code To get the same values as for librosa.stft you need: _, _, stft_res = scipy.signal.stft(inputAudio, window='hamming', nperseg=640, noverlap=480, boundary=None, padded=False) hamm_win = scipy.signal.get_window('hamming', 640) scale = np.sqrt(1.0 / hamm_win.sum()**2) stft_res = stft_res / ...


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