# Tag Info

0

My late night brain made foolish mistakes, for the record, if anyone needs this, the working code is as follows: Header: float state1; float state2; float state3; Implementation: In Constructor: state1 = 0; state2 = 0; state3 = 0; Robert's function: // this processes one sample float first_order_filter(float input, float pole, float zero, float *state) { ...

0

For a signal that rides at VSS/2, goes down to 0V and up to VSS, just use a pair of GPIO pins, each with a $10\mathrm{k\Omega}$ resistor, with the far ends connected together. When both pins are high you'll get VSS, when both are low you'll get 0V, when one is high and the other low you'll get VSS/2. Then sequence the pins to get the pattern you want. If ...

1

// this processes one sample float first_order_filter(float input, float pole, float zero, float *state) { float new_state = input + pole*(*state); float output = new_state - zero*(*state); *state = new_state; return output; }

0

here is my quarter-century old MATLAB code for a pinking filter: % % pinking filter analysis program % % from robert bristow-johnson % % please give to your local right-wing fringe group % z = [0.98443604; 0.83392334; 0.07568359]; % the zeros as shown in http://www.firstpr.com.au/dsp/pink-noise/ p = [0.99572754; 0.94790649; 0.53567505]; % the poles % ...

0

You need to invert the filter, i.e. flip the poles and zeros. The implementation that you reference is fairly awkward and will require a decent amount of math work to invert: you need to write the Z-transform for each first order section, add all the fractions into a single fraction and calculate the zeros of numerator polynomial. An easier way would be to ...

0

Unsharp Mask is a sharpening filter. Intuitively, you apply high pass filter on an image and add the scaled result to the original image. So the equation you posted is accurate: $$o = f + \alpha (h \ast f)$$ Where $h$ is an High Pass Filter. If we implement our high pass filter by $e - g$ where $e$ is the unit impulse and $g$ is a low pass filter ...

0

Assuming that the number of the sinuses is less than $N$, this problem becomes solvable by the least mean squares. In the case of equality, should be solved by the usual matrix invention. The liner form is achieved by replacing the phase variable $\phi_i$ with a cosine. Once all the variables are estimated, the interpolation is done by simple substitution of ...

2

One natural way to do this is to use the the total $2N$ samples (two chunks of $N$ samples each) to estimate the parameters. Amplitude, frequency, and phase estimation are all textbook equations that you can look up so the problem here is the fact that they are all mixed together. If you are assuming that you don't know how many sinusoids are mixed, then you ...

1

You seem to do a few things wrong Start with just transcribing each fraction, ignore the factors in front of the fraction and "1" in front Make sure you sort by powers of $z$ Normalize all coefficients to $a_0$ Multiply all $b$ coefficients with the factor for the fraction. The "1" is a third filter Example $$a0_1 = 1+2Kc_m+K^2 \\ a1_1 =... 1 The trick is to properly compensate for the fact that Frequency Domain multiplication applies a convolution with the circular boundary conditions in the spatial domain. You may use the following code: clear('all'); close('all'); gaussianKernelStd = 2; gaussianKernelRadius = ceil(5 * gaussianKernelStd); mI = im2double(imread('cameraman.tif')); mI = ... 0 I'll here give another reason (perhaps the most important one) why implementing filters by manually changing frequency bins is usually a bad idea. Note first that time domain convolution (simple FIR filter design) can also be implemented in the frequency domain and this procedure is known as FFT convolution ( despite its name the math operation here is ... 0 What you want is basically a delay$$x(t-\tau) \Rightarrow e^{-j\omega \tau}If you can live with k being quantized you can simply use a single tap delay FIR filter. If you need more granularity you need to implement a fractional dealy. I would cascade a shot fractional FIR filter with a long single tab bulk delay filter. If k is positive the filter ... 1 You can have all the taps be zero except for the last tap and the filter will delay the signal by that number of taps (as an all-pass). This doesn't do any filtering, and it is the actual filtering requirement that would drive the number of taps needed in the filter. For that requirement alone a dual port memory is a good solution for very long delays. The ... 2 This depends a lot on whether your constraints on the number of taps is computation or memory. If you have a enough memory, you can simply use an FIR with all taps zero except for the last one (Which is 1). That's equivalent to using a ring buffer and no filter at all. If you don't have enough memeory, things are more tricky. YOu can get delays that are ... 1 Solution: So, I got it working I am not sure if it was due to poorly documentation of I2S or me not understanding the left/ right aligness of a bit, but after reading this on a forum from one the of users, it stated this "The one you show is Left-justified or as TI calls it "Standard format"" I saw the standard format from here the ADC ... 4 I2S audio samples are signed two's complement. Just add 2^{N-1}, where N is the number of bits, to the result, and binary and by 2^N-1, to get the range to 0\ldots2^{N}-1, which I think you used to get from the built-in analog-to-digital converter (ADC). Do this both to the data you receive and the data you transmit using I2S. You can optimize the ... 2 The Japanese link actually implies how to derive Eq.5, and ironically they also refer to an existing dsp.se answer at the bottom. Derivation of Eq.5 is as follows: Consider a moving average filter of length N, with the impulse response h[n]:h[n] = \begin{cases} ~~~1/N~~~,~~~n=0,1,...,N-1 \\ ~~~0~~~,~~~ \text{otherwise} \end{cases} \tag{1}$$Magnitude ... 2 is it ok to showcase this diagram ? Sorry, we can't tell you this. This is really a function of your specific application, the physics behind your signal, and how you exactly define "peak". DSP can offer you methods to suppress "near by" peaks or to de-noise multiple peaks but whether that's the right thing to do or not depends largely ... 1 As far as I know and I have experienced, filtering in Fourier space has the advantages of modifying the frequencies directly on the frequency domain. Let's say that you have a frequency component at 50 Hz and you can manually remove then even better than a Butterworth filter. That being said, you might modify the phase response of your filter introducing ... 4 We actually do implement long FIR filters doing that. If it's running real-time or on an input that is indefinitely long, then the method for doing that is called "fast convolution". Remember that the "Fourier Transform" that you are multiplying is the Discrete Fourier Transform and that has issues regarding circularity in the resulting ... 1 An IIR filter is a recursive one. It means, current value of output y[n] is computed based on its previous value(s). Consider a simple 1st order IIR filter definition:$$y[n] = a \cdot y[n-1]+ b \cdot x[n]a and b are the filter coefficients. Now assume you have a long block of N samples input data. If you want to process that block of input data ... 0 Actually, in theory and error performance there is no difference. But in practice, OQPSK decrases the maximum phase alteriation from 180 to 90 degrees which is better for RF power amplifiers. 1 I haven't looked at the reference yet , but just to answer the question, yes filtering is performed prior to down sampling to avoid aliasing back in the out of band signals. However if your signal is already appropriately bandlimited you could forego the filter entirely. There's various reasons you might want to do other, unrelated, filtering after the ... 0 If you are post processing you can instead use a "zero-phase" filter which passes the signal through the filter twice in the forward and reverse direction, resulting in an output that is completely aligned with the input as would be expected with a filter with no delay, and with a significant reduction in start-up deviations (this is a non-causal ... 0 Signals exist in both time- and frequency domain, the only difference is what domain is more important for a specific application. This is also true for non-periodic events (signals) - they too can be shown in frequency domain (see the difference between Fourier Series and Fourier Transform). Consider two simple examples: You want to design a current ... 0 Creating a smooth looking spectrogram is not so much a DSP problem as it is a computer graphics thing. Of course, the choice of certain spectrogram parameters such as the frame/window length, the overlapping, the window function (Hann, Blackman etc) do play a role but they're not overly important. By far , the 2 most important things when it comes to ... 2 The answer to this question could be tricky. For a simple answer you may take the bandwidth of a bandpass signal as \omega_2 - \omega_1 (highest minus the lowest frequencies), and don't care about what happens in between the two. Hence your bandwidth allocation is not fully efficient, and a sampling based on this bandwidth will include redundant ... 0 Try increasing the overlap in the spectrogram calculation, and using an interpolated array-to-image renderer (shading interp in matlabesque). -k 1 The bilinear transform compresses the analog frequency in the s-domain associated with f=\infty to the point z=-1 in the z-domain (which is where the frequency is f_s/2 where f_s is the sampling rate. Consider what the magnitude of your notch filter is at f=\infty: It has no effect on the magnitude or phase of your signal; there is no filtering ... 0 That's the polynomial you are talking about. Note that it should have only negative powers of z, not positive. No. Let A(z)=1 - \sum_{i=1}^{p} a_i z^{-i}. thenz^pA(z)=z^p- \sum_{i=1}^{p} a_i z^{p-i}= z^p - a_1z^{p-1} - a_2z^{p-2} - \ldots - a_p = \prod_{i=1}^{p}(z - b_i)$$for some b_i. Therefore we can refactor A(z) to$$A(z)=\prod_{i=1}^{p} (1-...

1

Regarding the prewarping, it gets significantly challenging to match the analog shape as we approach the Nyquist boundary since the bilinear transform warps infinity in s to z=-1 in z (Nyquist). Prewarping implies the filter design is being mapped from s to z which wouldn't be my first choice for filter design unless I specifically needed to "copy the ...

1

is it possible to have a digital filter with a sampling frequency of 44.410kHz and a Fc = 20kHz? Yes it is possible... . I use MIM (Magnitude Invariance Method) for this. Here's plot showing 2nd order LPF responses for fc=20kHz-25kHz (1kHz step) @ 44.kHz sampling: MIM method works well for even lower sample rate implementations but, there are also issues ...

0

Two techniques are useful to increase robustness of your model: Normalization and Data Augmentation. Normalizing the inputs to the models can be used to remove the difference in audio level between classes, samples, distance from-source, or device the data comes from. A common method with spectrogram as feature representation is to either mean/std normalize, ...

1

It is trivial to separate the signals in a noise-free purely mathematical case: unless you have more information to bound it further, such a question boils down to "How many independent equations do you need, and therefore how many independent samples do you need, to solve for $n$ unknowns?" For noise free cases @Cedron has blog articles (https://...

2

but the padding distorts the spectrum. No, it doesn't. Zero padding just increases spectral resolution. Consider a minimalistic problem of a sum of perfect f=1,5 signals. I assume you mean ideal sine waves at 1Hz and 5 Hz ? $N=128$ samples. And here is where your problem is. Once you constrain the numnber of samples you don't have sine wave anymore, but ...

1

What could the cause of this trend be? System bias or something else? Most mechanical systems are low-pass, i.e. they let through less energy at higher frequencies. That would be perfectly plausible, but I don't know what you're observing. Of course, your accelerometer is inherently frequency-selective, too, and you might need to calibrate it, together with ...

5

Yes Virginia, There is a perfect digital filter. I assume the OP means by "perfect filter" what we would typically call an "ideal filter": which is a filter that passes a finite block of frequencies with no alteration and completely removes all other frequencies, which is referred to as a "brick wall filter". Otherwise if the OP ...

Top 50 recent answers are included