texts:
I am new to signal processing and am currently doing research into the subject. I am learning about Orthogonal Frequency Division Multiplexing and have a question. Most definitions of OFDM mention its modulation scheme can be adapted to suit channel conditions, an example being changing to a more robust scheme if heavy noise is present.

My question is if the adaptation is applied to every sub-carrier or can each scheme be applied on a per sub-carrier basis? Will every sub-carrier be forced to switch to QPSK for example or can ones that are not affected keep using a high data rate scheme?


texts: DFT - Removing window effect in spectral domain with convolution

texts:
I was thinking about the DFT windowing subject and a thought came to my mind. A DFT will yield the spectrum of a signal convoluted with spectrum of the window used, therefore having a main lobes and side lobes.

I figured it would be possible to remove the window effect on the spectrum of the signal by convoluting again both the signal and the window  spectrum magnitude, and it did indeed works as you can see on the following image.

Left is the original spectrum generated with a hanning window. Right is the spectrum convoluted by the DFT of a hanning window. Top is the Spectrum itself, bottom is MATLAB findpeaks result.

I never read anything regarding this technique, but I am pretty sure I haven't invented anything there. So I am wondering if there is a benefit of doing this processing on the spectrum or if there is a downside to it that I am not seeing.

From what I see, this could help peak detection as we can see on the previous image. Also, it looks like the spectrum is a little bit distorted as we can see on the 2 following images. :

Where the blue graph is the spectrum and the red graph the post-convoluted spectrum.

Any thought about this?
Is there a problem that could arise from this post-FFT convolution?
Any paper that treats the subject?

EDIT

You can find a script here that will generate the following graph:


texts: What mathematical function could be used to simulate this sound effect?

texts:
I have this sound effect which by the way if anyone could give me its name, I would really appreciate it. And after loading it into matlab/octave (don't worry this isn't a programming question) using the following commands:
[x, fs] = audioread("Path To File");
plot(length(x(:,1)),x)
sound(x,fs) % To hear the sound

I get the following:

Could anyone tell me what mathematical function I could use to simulate this?


texts: Alignment of 2 Set of Samples from Different Sensors

texts: If we measure the heart rate of a subject with two different devices, which have big different sampling rates then how we can compare their outcomes. For instance, one of the devices has the sampling rate of 1000 while the other one has sampling rate of 32.


texts: BIBO stability and input at system's pole

texts:
My understanding of BIBO stability is that if a bounded input is applied to a discrete-time, linear, time-invariant BIBO system, the output will also be bounded. A sufficient condition for this is that the poles of the transfer function are within the unit circle.

Suppose I have a system with the transfer function
$$
H(z)={(1−2z^{−1})(1−{\frac{1}{6}} z^{−1}) \over (1−\frac{1}{2}z^{−1})(1−\frac{1}{3}z^{−1})}
$$
The poles of this system are within the unit circle and so is a BIBO stable system.

If I apply an input of $x[n]=(\frac{1}{3})^n$, which is bounded, the output would involve $H(\frac{1}{3})=\infty$, which is unbounded - i.e. a bounded input produced an unbounded output.

Obviously, there is something amiss in my understanding here, but what?


texts: C-programming: How can I synthesize sounds through an ADSR envelope?

texts:
I want to write a C-program under Linux to synthesize sounds on a sound card by defining their ADSR envelopes (rather than playing previously sampled sounds. -- Background: Creating an electronic music instrument.)
I've come up pretty dry in a first search. In a pinch I'm also willing to try a different language than C, but even there the only results I've found were X-11 Basic.
Do you know of any C libraries which accept ADSR parameters?


texts:
While trying to determine the unit step and impulse response for a discrete LTI system I had several problems:

$$
\begin{aligned}
(Hx)[n]&=(Hx)[n-1]+\frac{1}{N}(x[n]-x[n-N]) \\x[n]&=(Hx)[n]=0\;\forall\;n\lt0
\end{aligned}
$$

Starting with the Impulse response:

$$h[n]=(H\delta)[n]=(H\delta)[n-1]+\frac{1}{N}(\delta[n]-\delta[n-N])$$

Can I argue that because of the condition $x[n]=(Hx)[n]=0\;\forall\;n\lt0$ the impulse response only exists where $n\gt 1\;\&\;n\gt N?$ But what about the other cases?

Concerning the Step response I am quite lost and am not even sure if this is how it is calculated:

$$a[n]=(H\sigma)[n]\sum_{k=-\infty}^{\infty}h[k]\sigma[n-k]$$

Help as to how to proceed and solutions are greatly appreciated


texts: Autoregressive Exogenous model on multiple datasets in MATLAB

texts:
I had trouble translating this exact question into search queries, which is why I am turning to you. Any sources you can provide on the topic would be greatly appreciated.

Say your data contains measurements for one output variable versus time and that experiment is repeated for different functions of an input variable. The specific case I am talking about is chicken's weight varying in time as a result of an input function (feed). The feed input function is a square wave of constant amplitude and frequency. Between different experiments, only the amplitude of the square wave changes (the daily amount of feed they get).

How could I build a model that can take a square wave input of feed of any amplitude and give a correct weight(t) response prediction? System can be considered time invariant for simplification.

I am currently using an Autoregressive (exogenous) approach in MATLAB: I analyze the data (input function of feed versus time, and a measured output of weight versus time). The exact approach is using rivid from the captain toolbox: this tool allows me to vary the number of coefficients in the model and compare each model according to certain criteria (YIC, AIC, ...). The result is a transfer function which I can use to make predictions for bird weight in time.

$$x(n)=\sum_{i=1}^Na_ix(n-i)+e(n)$$

However, I am modeling each feed amount input separately from the other ones. The models I am getting for each amplitude of feeding vary wildly, even having different numbers of coefficients. How can I take into account the data from all chicken feed experiments? My end goal is one model that can take any square wave input and will make a prediction for the chick's weight.

As a side question: the experiment is repeated a few times. Can I somehow have my model take into account all experiment iterations?


texts:
I have already understood partial fraction and here is link for my relevant DSP SE question

Finding inverse z transform for two sided ROC?

But now i want to know, is there any difference between partial fraction form and factored form in signal processing context?

For example I have a z transform $$Y(z)=\frac{(z^2−z)}{(z^2+1.3z+0.3)}$$

a)What will be its partial fraction form?

b)What will be its factored form?


texts: What type of filters can be used to remove Poisson noise in an image? I tried applying Gaussian filter to few points in the spectrum.


texts: Why do Savitzky-Golay filters of degrees 4 and 6 have roughly opposite ripples?

texts:
Savitzky-Golay smoothing filters of polynomial degrees 4 and 6
have frequency response with ripples of roughly opposite signs.
Thus averaging the coefficients of two filters of degrees d and d+2
is an easy way to attenuate the stopband:

Can anyone explain the roughly opposite ripples —
or are they just a lucky coincidence ?

(The coefficients were generated with this python:

def savgol_coef( N=33, d=4 ):
    """ Savitzky-Golay filter coefficients
        see e.g. Numerical Recipes http://apps.nrbook.com/empanel/index.html?pg=772
        d odd, e.g. 5 -> av 4, 6: cutoff between, stopband lower
    """
    assert N % 2 == 1, "filter width N must be odd, not %d" % N
    if d % 2 == 1:
        return (savgol_coef( N, d - 1 )
            +   savgol_coef( N, d + 1 )) / 2  # roughly opposite ripples ?
    x = np.arange( - (N//2), N//2 + 1. )
    A = np.array([ x**k for k in range( d+1 )]) .T  # Ajk = basisk( xj )
    # print A
    return np.linalg.pinv( A )[0]


texts: How do I interpolate between bins on an FFT in python?

texts:
I have four frequency peaks, which I have after applying FFT. Now I want to know precise values of these frequency peaks. there are different interpolation methods. How can I use this method of interpolation for four frequency peaks by using python

k=index of the max (possibly local) magnitude of an DFT
X[i]=bin "i" of an DFT
|X[i]|=magnitude of DFT at bin "i“
k'=the interpolated bin location

Quadradic Method
y1=|X[k - 1]|
y2=|X[k]|
y3=|X[k + 1]|
d=(y3 - y1) / (2 * (2 * y2 - y1 - y3))
k'=k + d

Thanks in advance


texts: Why does applying RRC to the signal increase bandwidth?

texts: Please see this question: Why samples per symbols $\geq 2$ in the GNURadio Constellation Modulator block?.  The first answer here says "filtering the signal, you have bandwidth expansion".  But look at the figure in this question: Relation between Bandwidth and Baud-Rate for 8-PSK - it looks like there is much less bandwidth required for the RRC filtered signal than the square wave / sinc.  So why does the first question have an answer that says that increased bandwidth is necessary and, taking it a step further, why does sps increase, as was the actual question there?


texts: A check on the definition of the continuous periodogram, and does it assume ergodicity somewhere?

texts:
Can someone verify my understanding of what the continuous periodogram is/means, and please tell me if I say something wrong:

As I've learned so far, the power spectral density of a wide-sense stationary stochastic process $x(t)$ is given by

$$S_{xx}(f) = \lim_{T\rightarrow\infty}\frac{1}{T}\mathbf{E}\Big\{|X_T(f)|^2\Big\} \tag{1}$$

where $X_T(f)$ is the Fourier transform of a single truncated sample path. The sample path itself is over $\{{-\infty<t<\infty}\}$, but the truncation is over time $T$. Finally, the expectation is over all sample paths in the ensemble.

1) Is it correct to write then that: if in practice we only have access to a single member of the ensemble which is over a finite observation time $T$, then the simplest possible estimator, $\hat{S}_{xx}(f)$, of the true power spectral density, $S_{xx}(f)$, is found by dropping both the $T\rightarrow\infty$ limit and the expectation (because we don't have any other members of the ensemble), and so

$$\hat{S}_{xx}(f) = \frac{1}{T}|X_T(f)|^2 \tag{2}$$

and that this is known as the continuous periodogram?

2) I have seen some resources which say that the periodogram assumes ergodicity - is this true? If so, where and how exactly does this assumption become necessary? As far as I can see, if we simply drop the expectation in (1) (because we only have access to a single realisation), then there should be no reason to need to invoke ergodicity (which would somehow involve replacing the ensemble expectation with a temporal average).

3) Finally, I would like to ask about the variance. I see that the main problem with the discrete periodogram is that it's variance does not decrease as the number of samples is increased. Is there an equivalent problem with the continuous periodogram, and what is the analogy in that case to be able to calculate the asymptotic variance (since we don't have any discrete points to take $N\rightarrow\infty$). Should it be the time window $T$, and one should be able to show that the variance becomes constant as $T\rightarrow\infty$?


texts:
I'm taking a multimedia systems class in my MSc Computer Science, and I'm having some trouble understanding the formula for the alias frequency - this could stem from my misunderstanding of the alias signal.

My understanding of an alias signal is that if you undersample your input signal (i.e. sample at a rate which is less than twice the maximum frequency) then we can get aliasing because we're not sampling frequently enough to capture the high frequency details.  The aliasing signal is the result of taking these sample values and joining them with a smooth curve.

Therefore, the resulting signal has a frequency of half the sampling frequency, since a pure sinusoid will need two samples per oscillation (1 for each turning point) - this would mean that the alias frequency should just be a function of the sampling frequency.

The formula for the alias frequency is the absolute difference of the signal frequency and the closest integer multiple of the sampling frequency - can someone explain this to me?  Thanks in advance!


texts: Is there any fast algorithm to compute the most similar rectangular regions in two images?

texts:
I am working on a pattern recognition problem to find two most similar rectangular regions in two given images. Specifically, I have two 2D (gray) images of the same sizes $I_A$ and $I_B$. Denote an arbitrary rectangular region in an image $I$ as $R^I(x_0,y_0,w,h)$, where $(x_0,y_0)$ denotes the upper left pixel of the rectangular of width $w$ and height $h$ and
$\forall i\in[0,w-1] \,\textrm{and} j\in [0,h-1],$,we have $ R^I(x_0,y_0,w,h)[i,j] = I[x_0+i,y_0+j]$.

My question is to find two rectangular regions of the same size, one in each image, (say they are $R^{I_A}(x^A_0,y^A_0,w,h)$ and $R^{I_B}(x^B_0,y^B_0,w,h)$) such that they are most similar in terms of the mean square error of theses two rectangular regions. Note it is possible to have $(x^A_0,y^A_0)\neq(x^B_0,y^B_0)$.

Ideally, I want to answer this question for all possible $w,h$ combinations. It is very costly to compute even for a given pair of $w$ and $h$. So far, I adopt the integral image technique. However, it still requires shifting image pixels. I wonder whether there is some better technique. Can anyone help?


texts: Suppose we have the following data. How can we calculate the channel capacity and R?

texts:
A channel has a bandwith of 5MHz. If signal strength to spectral noise density S/N0 is 107 Hz, calculate the channel capacity C and R. The problem
is that I can use Shannon-Hartley theorem because instead of S/N or SNR I have
S/N0.


texts: Zero padding and 2D Fourier transforms: how does zero-padding affect phase?

texts:
It's pretty clear that zero-padding an image before performing Fourier transform simply enlarges the magnitude image (stretching it to the new, padded size).

What I can't understand is how it affects the phase... At least to me it does not look like simple enlargement of the phase image. Could somebody clarify?


texts: What is the difference between pulse shaping and equalizers when used to cancel Inter-symbol Interference (ISI)?

texts:
According to Nyquist, to transmit R symbols/sec without ISI, the minimum bandwidth required is R/2 Hz, and the sinc pulse shape satisfies this condition.

If we use equalizers instead of pulse shaping, do we need to keep this condition ( minimum R/2 Hz to transmit R symbols/sec)?
If we use equalizers, should the total system transfer function be of the sinc function shape, thus equivalently achieve the Nyquist condition?


texts: How to eliminate negative frequencies from IQ signal

texts:
I have a 192kHz IQ signal from an RF receiver, and i'm trying to remove signals in the negative (or positive) frequency spectrum.

I see that the negative frequency signals are -90 degrees phase shifted from I, where positive frequencies have the usual +90 degrees shift I vs Q.

Here's the problem:

If i set the center frequency to f, and i have two signals, one at f+1000, one at f-1000, they would both be audible on the same frequency, if i mix the whole thing into audio, either interfering with each other, or cancelling each other out.

I'm missing the step where i can decide whether i want to hear anything below or above center.

How is this usually being filtered?


texts:
Are there any mathematical transforms which can offset a select band of frequencies across the spectrum? (For sampled digital audio)

(crappy illustration)


texts: Discrete signals notation underlined value

texts:
In a book i have there's an exercise that want to find the output of a system for a given  signal

system: $ 2y(n)=2x(n)+x(n+1)+x(n-1) $

input : $ Χ=[\underline1, -1, 2, 0, -2, 0, 1 ]$

$Χ1=Χ[0] $

What represent's the underlined value?


texts:
My goal is to estimate the CFO and timing offset in GMSK modulated signal. I synthesize samples in Matlab and my goal is to add CFO and time offset to learn how to deal with mentioned distortions and successfully recover transmitted signal. I would like to use non-data-aided methods and rely only on the signal structure. To be honest, I read a lot and I have few methods in my mind, like: M&M (but I guess its for timing recovery), squaring method or FFT method (to calculate CFO), PLL/Costas Loop (for fine CFO estimation). I don't know if they really fits for GMSK so my question is, how to tackle this problem? What should be done first in the recovery algorithm to stay in the right order? My goal is to deep into signal recovery and to learn different approaches.
Thanks in advance


texts:
I'm currently performing matrix cross correlation in python using :

C = scipy.signal.correlate2d(A,A)

where A is a 2D matrix, typically a picture. As you can imagine, it gets very long for large array, such that I'm looking for something faster.

Any hint ?
I also heard about scipy.signal.fftconvolve. Despite that it's much more rapid, it rarely give me the same result at the end.


texts: Why are the frequencies associated with the STFT bins not representative of the energy?

texts:
I'm experimenting with a 30 Hz sine wave and I want to extract the frequencies of this, and have implemented the algorithm to do so. This gives a correct reading, well, gives 29 Hz.

I'm now wanting to compute the algorithm for an STFT. So, for this, I use NFFT = 256 with an overlap of 128, using the Hanning Window function.

This gives me a series of bins which I can then calculate the frequency formula on. However, when I graph this, the results do not seem right, for some reason:

I mean, it might just be me in thinking that the results do not look right, however, if they are, why would the results be this? I just don't get it.

For example, I was expecting when the energy is low, the result would be low and thus when the energy was high, the result would be high. Let me give you another example on a more structured sound file.

Sample rate = 12000
NFFT = 256
Overlap = 128

And the STFT output for this is below:

Am I doing something wrong here, or, do these results look ok?


texts: Can I square signal in the frequency domain to reduce noise?

texts:
Let's say this is the FFT of my measurements:

You can see that there is a clear peak and the rest is noise. I want to reduce noise, so I square the FFT and normalize it:

The peaks are now more clear, so the (relative) noise has been reduced, at the cost of changing the non-noise signal too. It's now easier to identify the frequency peaks, and of course we can use powers larger than 2 to increase this effect.

Is there a trickery? Is this commonly used? I guess the main problem is that the signal is affected.


texts: Finding Local mean value of pixels of window

texts: I want to solve the equation (2) in the attached picture which tells the local mean value. But i don't have any idea about how to evaluate this equation using matlab code. could only guess w indicates window size. What does g(m,n) means? Can anyone please help me to understand this concept?


texts: How to shift FFT spectrum by half a bin?

texts:
I am trying to find a way to shift the outputs of the FFT (any algorithm implementation, currently using radix-2) by half a bin with the same bandwidth.  To put it another way, say you have a 512pt FFT sampling data for a bandwidth of 100 kHz. The frequency bins are going to fall ~390 Hz apart (bandwidth) For example 195 to 585 is effectively the band pass range for bin 2 which happens to fall at the center frequency of 390 Hz. Bin 3 is from 585 to 975 with Fc being 790 Hz.  Say I want Fc to be 585 instead of 790. This represents a shift of all the FFT outputs by half a band.

I do not want to double the size of the FFT to get the result. I do not want to multiply the signal in time domain prior to FFT by an offset frequency as I don’t want to deal with extra products within bandwidth of the overall FFT.

Is there a way through modification of the twiddle factors to get the desired effect?


texts:
I read somewhere that the signal of speech has a bandwidth from 300 - 3400 Hz(Why), and audio files have a bandwidth from 50 Hz to 50000 HZ(Why).

Could someone help me , why are those constant sampling frequencies ?


texts: Camera calibration using checkerboard instead of 3D calibration object

texts:
What is the purpose and advantage of using a checkerboard than a 3D calibration object for camera calibration ?
With a 3D calibration object (e.g. a transparent cuboid like a table), I can take one image with a camera, then  find the corners of the cuboid, which gives me 8 2D-3D correspondences.
Since a projective camera matrix $P$ has 11 DoF, I have enough equations to obtain $P$.
Now with a checkboard given one image, I obtain the internal camera matrix and external kamera matrix.
However, the external camera matrix describes the change of basis from the checkerboard coordinate system to the camera coordinate system, and thus changes from image to image.
Thus is the idea of the checkerboard to take multiple images to obtain a more accurate estimation of the internal camera parameters, which should be same across all taken images ?
So for image i, we have 2D points $p_{i}$ with corresponding 3D points $P_{i}$ (on the checkerboard). Let $K_{i}$ be the internal camera matrix, $E_{i}$ be the external camera matrix and $M = \begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0  \\ 0 & 0 & 1 & 0\end{pmatrix}$  the  projective camera model.
So I am assuming that the optimization problem that is being solved is
$\min_{K,E_1,\ldots,E_m} \sum_{j=1}^{m}\sum_{i=1}^{n} || (K M E_{j}) P_{i}- p_{i,j}||^2$,
so that we obtain one internal camera matrix that fits to all images ?
Accordingly, am I right that it is necessary to do both, the calibration with the checkerboard to get an accurate estimate of $K$ and then the calibration with the 3D calibration object to obtain the extrinsic camera matrix, so that the 3D calibration object defines the world coordinate system ?


texts: Does a signal and its autocorrelation ever have the same Fourier spectra?

texts:
My understanding is that Fourier power spectra give the frequencies and corresponding intensities/amplitudes contained within a signal. In certain techniques, such as molecular dynamics, it is common to take the autocorrelation of a time-series before calculating the Fourier spectrum.

I have read that in molecular dynamics this practice can be due to the appearance of autocorrelations in quantum mechanics, and I have also read that taking the autocorrelation removes the dependence on the initial conditions.

a) Does the autocorrelation contain the same frequency components as the original signal?

b) Are there any conditions under which the Fourier power spectrum of the signal and it's autocorrelation become mathematically identical? eg. infinite signal length, perhaps.

c) What are the factors that cause these two spectra to differ?

d) Are there any other reasons to favor using the autocorrelation in place of the original signal when computing the power spectrum?

Thanks.


texts: Threshold both detail and analysis coefficients?

texts:
Suppose I perform a discrete wavelet transform on some noisy signal $x$ and obtain ${a_1, d_1, d_2, \ldots, d_n}$ where $a_1$ is the set of analysis coefficients and $\{d_j\}$ are the detail coefficients.

Suppose I wish to denoise the signal by thresholding of some sort. Many authors recommend only thresholding the detail coefficients $d_{j}$, and leaving the analysis coefficients alone. The reasoning is that the analysis coefficients are "low frequency", and that noise is "high frequency".

However, in the case of AWGN, noise is contained in every frequency, and since the DWT is orthogonal, noise is just as likely to end up in the analysis as the detail coefficients. In addition, I was under the impression that the thoughts one should have in the wavelet domain were about sparsity, not frequency. So I am confused as to whether I should threshold the whole vector or preserve the analysis coefficients.

Has a comparison of thresholding analysis coefficients vs leaving them alone been performed? Is there a consensus among experts on which way it should be done?


texts: Why does an ideal high pass filter on this image generate gray values

texts:
As seen from the image below, an ideal high pass filter was applied. Hence, stark changes in pixels from lighter to darker or vice versa show up on the filtered image. However, slower changes such as on the cheekbone appear to be this gray color.

What is this gray color? It seems to be quite prevalent in all my grayscale images.


texts: Obtaining a sine wave ECG from a matrix of short arrays

texts:
I am a software developer, so please forgive my limited knowledge in the DSP space.

I am given a task to plot an ECG graph and the data I receive from an ECG (BLE) device is provided in a matrix of short arrays.

E.g:

[4114, 4130, 4134, 4139, 4133, 4121, 4120, 4136, 4127, 4129]
[4144, 4163, 4152, 4156, 4142, 4135, 4135, 4144, 4147, 4146]
[4131, 4127, 4141, 4131, 4147, 4144, 4141, 4154, 4181, 4168]
[4153, 4167, 4161, 4159, 4147, 4153, 4158, 4156, 4165, 4154]

I think I can find the sampling frequency of the device as well.

Can you guys point me to a formula I can use to get a Waveform (e.g: a graph-library I might use has this example)

Update 1: I also have the followings: ADC Zero:128 & ADC Gain:500

Thank you in advance!


texts: Image Gradient - Flipping Effect of the Convolution Matrix (Kernel) for Edge Detection

texts:
Prewitt operator is a common operator to compute image gradient in edge detection, and I knew that to apply this Prewitt operator to an image is just to convolve them together, say, the image is represent as $A$, and as the wikipedia page lays out, the Prewitt operator for *x-gradient is $$G_x=\pmatrix{ -1 & 0 & 1\\\ -1 & 0 & 1\\\ -1 & 0 & 1}$$, for y-gradient is $$G_y=\pmatrix{1 & 1 & 1\\\ 0 & 0 & 0\\\ -1 & -1 & -1}$$
So if I want to compute the x-gradient of image $A$, convolve them like this,$$A_x=A*G_x$$, but here comes my problem. $G_x$ is the kernel, when convolve it with $A$, $G_x$ should be flipped which turn it into this, $$G_x=\pmatrix{1 &0 &-1\\\ 1 &0 &-1\\\ 1 &0 &-1}$$
right? If so, the x-gradient will be something like this, $$\nabla A_x=A(x-1,y)-A(x+1,y)$$
, BUT I think it should be $$\nabla A_x=A(x+1,y) - A(x-1,y)$$.
So I presume that either $G_x$ and $G_y$ should not be flipped when convolve them with $A$, or $G_x$ doesn't look like the above, and it should be this,$$G_x=\pmatrix{1& 0& -1\\\ 1& 0& -1\\\ 1& 0& -1}$$
Anyone can help me with this?


texts: Generating 3-dimension $1/f^\alpha$ noise

texts:
I'm stumped trying to find a way to generate a 3-dimensional $1/f^\alpha$ noise time series. Basically I want simulate a forcing that is $1/f^\alpha$ in the 2 space dimensions and $1/f^\beta$ in time, $0<\alpha<2$ and $0<\beta<1$.

It believe I should be able to 3D fourier filter a giant random matrix, but the matrix sizes needed are around $512\times512\times2048$.

Does anyone know of a clever way to do this? Is fourier filtering my only option or is there some way to draw from a distribution so as to to generate these surfaces at each time step in a model, rather than creating and saving these giant matrices?

Any insight is appreciated!


texts: Effect of Adding the cyclic prefix on the toeplitz matrix in OFDM

texts:
Assuming we have $N$ symbols to transmit encoded in block $k$,

Performing $N$−iFFT at the transmitter, we now have

The resulted signal $x(k)$ has length of $N$.  inserting  a cyclic prefix $CP$ of size $D$, the length of signal will be $N+D$ instead of $N$.

Assuming we have channel $h$ of length $L$, the convolution of signal with channel can be written as:

$y = h*x_{CP}(k)$ = $Hx_{CP}(k)$ ,

where * is the convolution operation and $H$ is toeplitz matrix of size $(N+D+L),(N+D)$ built in matlab as below :

H = toeplitz([h(1) zeros(1,length(x_cp)-1) ], [h.' zeros(1,length(x_cp)-1) ]).';

As known, the signal $y$ has now the length of of $D+N+L$. However, the useful signal has the length of $N$ which is equivalent to $s(k)$

What I am asking about is the toeplitz matrix $H$ equivalent into $y$ after removing the delays $L$ and cyclic prefix $D$?  In other words, If I can write the $y$ in matlab as y = y(D+1:end-L+1); whose length becomes $N$ now, how can I write $H$ equivalent into this part ?


texts: Negative values from High Pass filtering

texts:
I come from Fluid Mechanics domain so pardon me for asking a naive and fundamental question.

I am trying to perform high pass filtering on a set of positive real numbers (~Energy) using FFT. However, the result I obtain has a lot of negative values. I tried to quantify how many of them are negative and it seems $\sim50\%$ of these values are negative.

I tried looking up for an answer and I saw a general approach used in Image processing domain, where people offset these negative values or use some threshold. But in my case, I can't use either of these techniques because I need to look at some statistical quantities after the filtering process.

So I want to ask why do these negative numbers appear for a purely positive input and if so, are there any solutions for it?


texts: Behaviour of microphone with high volume input

texts:
I have a microphone which produces unexpected results when exposed to very loud input. The mic is a cheap electret headset mic and I am recording into a DAW. For very loud, noisy signals (eg. blowing on the mic) I get an unexpected waveform. In the MATLAB plot below, you can see a snippet of about 0.5 seconds of audio which demonstrate what I'm talking about. The signal is clearly clipping at -1.0, but is not getting near the other end of its range at 1.0.

In the same signal, the clipping behaviour can then reverse and start clipping almost constantly at 1.0 and not reaching -1.0. It's as though there has been some sort of wandering, fluctuating DC offset introduced. Can anyone shed some light on what is happening?


texts: Normalizing audio waveforms code implementation (Peak, RMS)

texts:
I have some audio data (array of floats) which I use to plot a simple
waveform.
When plotted, the waveform doesn't max out at the edges.
No problem - the data just needs to be normalized. I iterate once to find the max, and then iterate again dividing each by the max. Plot again and everything looks great!
But wait videos which have a loud intro, or loud explosion, causes the rest of the waveform to still be tiny.
After some research, I come across RMS that is supposed to address this. I iterate through the samples and calculate the RMS, and again divide each sample by the RMS value. This results in considerable "clipping":

What is the best method to solve this?
Intuitively, it seems I might need to calculate a local max or average based on a moving window (rather than the entire set) but I'm not entirely sure. Help?
Note: The waveform is purely for visual purposes (the audio will not be played back to the user).


texts: Nyquist Frequency on semi-unevenly sampled data

texts:
I have a data set that has 'kind of' constant sampling rate - it switches between 1 min and 2 min. About 70% of the times, samples are taken every 1 minute, and about 30%, samples are taken every 2 minutes.

I tried using FFT, but it didn't work because samples aren't evenly spaced. Instead I applied Lomb-Scargle transformation, and obtained a good looking plot. Upper plot is a Lomb-Scargle periodogram, and lower plot is the original sample data with varying sampling rate (1 min or 2 min).

What should I use for Nyquist Frequency in this case?


texts: Do we need a transmit and a receive filter in a OFDM transceiver system?

texts: can anyone specify in brief what are the filters that can be used as a transmit and receive filter in OFDM. Any material to start with will be very much appreciated. Thank you!


texts: Where can I get an open source implementation of the Parks-McClellan optimal FIR filter design algorithm?

texts:
Background: Often times I am doing some sort of signal processing task that requires a unique filter. Usually at this point I go to MATLAB and generate a new unique filter using $\tt firpm()$. The MATLAB firpm() function implements that Parks-McClellan algorithm. Now I have a filter and I put the filter into a hardcoded array. But here's the problem I now have a hardcoded filter that only works for one scenario.

The problem: I can now solve my signal processing problem du-jour... but only for a very SPECIFIC single sample rate or SPECIFIC scenario.

The goal: I want to be able to call $\tt firpm()$ from C code or some other language and make my signal processing code more generic. I can't find an open source implementation of firpm() !

Where can I get an open source implementation of the Parks-McClellan optimal FIR filter design algorithm (aka $\tt firpm()$ in MATLAB)?

P.S. I am aware that I can design filters differently using windowing or something else... feel free to mention those in the comments. But the point of this question is not to ask "what are other filter design techniques?" the point is to find an open source implementation of the VERY VERY useful $\tt firpm()$... or something similar.
P.P.S. One of the goals of this question is to learn how the Parks-McClellan algorithm works by looking at the code first and then I plan on reading some background theory.


texts: Doubling of the scipy.signal's bandpass filter order during the design

texts:
I am trying to extract filter coefficients for a bandpass, using the "scipy.signal.iirfilter" function:
b, a = filt = iirfilter(
        N=2,
        btype='bandpass',
        ftype='cheby2',
        Wn=np.array([3000, 4850]) / (12400 / 2),
        rs=30,
        output='ba'
            )

b, a
Out[10]:
(array([0.04008421, 0.04822953, 0.04776774, 0.04822953, 0.04008421]),
 array([1.        , 1.66028928, 2.34267679, 1.39001415, 0.70301997]))

Seems like the filter order is twice larger than expected. A similar task using Matlab's "designfilt" performs with the expected number of coefficients. What I am missing? is the filter order a fluid definition?
For lowpass, the number of the coefficients is as expected...


texts:
I am using OpenCV(4.5.1) and trying to extract a smooth contour of an object on my image.
Firstly I got the contour by:
contours, hierarchy = cv2.findContours(mask2, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

I got the following contour:

Then I tried to remove the redundant element on the image by:
for i,cnt in enumerate(contours):
    # if the contour has no other contours inside of it
    if hierarchy[0][i][2] == -1 :
        # if the size of the contour is greater than a threshold

            if  cv2.contourArea(cnt) >  500:
                    print(cv2.moments(cnt))
                    epsilon = 0.0001*cv2.arcLength(cnt,True)
                    approx = cv2.approxPolyDP(cnt,epsilon,True)
                    cv2.drawContours(mask3,[approx], 0, (255), 1)

And I got the following contour:

How can I go further and remove more rough edges and redundant details of my contour?
In other words, I just want straight lines and smooth curves on my image, what can I do?
Thanks for any help.


texts: Removing frequencies and reconstructing signal

texts:
I am trying to implement this section of this paper:
https://arxiv.org/abs/2012.15846

The rPPG signal is the spatial average of green value per frame over a video. Head orientation signals are a timeseries of the x,y,z pose estimation of a head per frame. I am trying to implement as follows:
from scipy.fft import rfft, rfftfreq

### get original green signal frequency
# normalize
d = np.array(df.green)/df.green.max()
plt.plot(d)
plt.show()
N = len(d)
yf = rfft(d)
xf = rfftfreq(N, 1 / 29)
plt.plot(xf, np.abs(yf))
plt.show()

### get movement frequencies
# normalize
# normalize
d = np.array(df.ang1)/df.ang1.max()
plt.plot(d)
plt.show()
N = len(d)
yf_1 = rfft(d)
xf_1 = rfftfreq(N, 1 / 29)
plt.plot(xf_1, np.abs(yf_1))
plt.show()

ang2 = abs(np.array(df.ang2))
# normalize
# normalize
d = np.array(ang2)/ang2.max()
plt.plot(d)
plt.show()
N = len(d)
yf_2 = rfft(d)
xf_2 = rfftfreq(N, 1 / 29)
plt.plot(xf_2, np.abs(yf_2))
plt.show()

# compute avg movement frequency
avg_headpose_freq = (abs(yf_1) + abs(yf_2))/2

# remove movement frequency from green
yf_headpose_rm = abs(yf - avg_headpose_freq)
plt.plot(xf, yf_headpose_rm)
plt.show()

# convert from freq to timeseries
new_signal = irfft(yf_headpose_rm)
plt.figure(figsize=(20,10))
plt.plot(new_signal)
plt.show()

Which results in the following:

Original green signal and frequency:

Headpose angle 1 signal and frequency:

Headpose angle 2 signal and frequency:

Original green frequency with averaged headpose frequency removed, then converted to timeseries

This really doesn't look like I was expecting. The paper makes it sound as though the final plot, the green signal with the headpose frequencies removed, would be a less noisy signal. However, it now looks like a totally different thing.
What have I done wrong?


texts: Adding two audio files at a predefined SNR level

texts:
I have two speech audio wav files. file1 is primary speech, file2 is supposed to be interference.

I want to add them so that the SIR (signal to interference ratio) is 10 dB.

How do I proceed?
Do I do sample by sample addition like below?

Assuming $N$ is the data-length of both the files (single channel).

for i = 1:N
   x = 0.1 * file1(i)^2 / file2(i)^2
   file3(i) = file1(i) + x*file2(i)
end

file3 is the output file.
Are there any better ways to do this?

Note: $\textrm{SIR(in dB) = 10 log (Power(signal) / Power(interference))}$


texts: Convolution reverb using a frequently updated frequency dependant impulse response

texts:
I am implementing a software to auralize a virtual scene but am kind of a newbie to DSP. The focus should be the calculation of the IR which is frequency dependant. But this means that the renderer of the sound should be able to convolute reverb in a frequency dependant way (in realtime possibly). A IR has a set of Reflections. A reflection is a tuple of delay (double) and decay for each frequency band to a decay in dB (hash_map from freqband to double).

Now I want to convolute this IR with my input signal in the most efficient manner. What I intend to do is using the FFT to get the frequency spectrum and then apply a reverb function to this signal. The two main conceptual problems for me here are:

How do I apply delay in the frequency spectrum? (Is it even necessary to do this in the frequency spectrum?)
Is there a common method to apply such a reverb function to a signal? And if there is, do I need to have phase information modelled?

What I was thinking about was splitting the IR into several frequency responses dependant on the frequency band and then apply it to the frequency spectrum of the input signal. But then again this involves problem 1 and somehow includes phases because I would not know otherwise if I need to add or subtract.


texts: Visualize visual words in bag of words model

texts:
I am implementing visual bag of words through these steps:

Find interest points using SIFT
Calculate SIFT descriptor
Build codebook through kmeans clustering of SIFT descriptors.

How can I visualize these visual words? For example in the following lecture, how do they get those patches?


texts:
I hope to design 1st order highpass filter from transfer function. In the example of 1st order lowpass filter, I first get the coefficients of numerator and denominator in the variable 'b' and 'a'. In case of first order filer,

b = 1/tau;
a = [1, 1/tau];
h = freqs(b, a, w) % LPF
[digital_b, digial_a] = bilinear(b, a, fs) % Analog to Digital transformation.

The order is like above. First, we obtain the coefficients of the transfer function and then make LPF by the 'freq' function in MATLAB. After that, I can convert the analog filter to a digital filter by using the 'bilinear' function.

However, in case of HPF, I cannot transform it using the 'bilinear' function. When I run the 'bilinear' function in MATLAB for 1st order HPF, it gives the following error

Numerator cannot be higher order than denominator.

I used the code below to make digital HPF.

b = [1, 1/tau];
a = 1;
h = freqs(b, a, w) % LPF
[digital_b, digial_a] = bilinear(b, a, fs) % Analog to Digital transformation.

What is the problem? and how should I design HPF on MATLAB?


texts: Fourier transform of $\sum_{n=-\infty}^\infty(-1)^n\delta(t-nT_0)$

texts: Given $x(t)$ and $h(t)=\sum_{n=-\infty}^\infty(-1)^n\delta(t-nT_0)$, I have to compute $Y(f)$, where $y(t)=x(t)h(t)$. I have thought about using that, in this case, $Y(f)=X(f)*H(f)$. I know that $\mathscr{F}(\sum_{n=-\infty}^\infty\delta(t-nT_0))=T_0^{-1}\sum_{n=-\infty}^\infty\delta(t-nf_0)$, but how can I deal with that $(-1)^n?$


texts: Discrete signals in spectrum to Analog : DFT

texts:
An analog signal $x(t)$ was sampled for a period $T$ of $1 \text{ms}$. The resulting, discrete signal is denoted as $x[n]$. Now you are given the spectrum $X[k]$ of the sampled signal $x[n]$.

Doubts regarding the attached images 1 & 2.

Please explain how this coefficients and signs for sin and cos term are considered??


texts:
I know that time shifting property of discrete-time Fourier Transform states that
$x[n]\leftrightarrow X(e^{j\omega})\implies x[n-n_0]\leftrightarrow e^{-j\omega n_0}X(e^{j\omega})$
So given a signal $\;y[n]=u[n]-u[n-5]\;,\;$What is $\;\mathfrak{F}\{ y_{(2)}[n-1]\}\:?$
$ y_{(2)}[n]\;$ denotes the slowed-down version of $\:y[n].\;$And $\:y[n] \leftrightarrow e^{-j2\omega}\frac{\sin(5\omega/2)}{\sin(\omega/2)}$
From time expansion property $\:y_{(2)}[n]\leftrightarrow e^{-j4\omega}\frac{\sin(5\omega)}{sin(\omega)}\:$then follows the time shifting property
$\mathfrak{F}\{ y_{(2)}[n-1]\}=e^{-j6w}\frac{\sin(5\omega)}{\sin(\omega)}$
But the answer should be $\:e^{-j5\omega}\frac{\sin(5w)}{\sin(\omega)}$
What is wrong with my understanding?


texts: How to compute magnitude and phase response from transfer function in Z-domain?

texts:
I have a transfer function $$H(z)=\frac{1+1.2z^{-1}+0.8z^{z^-2}}{1-0.9z^{-1}}$$ from which I'm supposed to sketch the magnitude and phase response. I know that you can transform $z=e^{j\omega}$ to get the frequency response, but I don't really understand what it means. The magnitude response is then $$\left|H(e^{j\omega})\right|=\left|\frac{1+1.2e^{-j\omega}+0.8e^{-j2\omega}}{1-0.9e^{-j\omega}}\right|,$$ but how do I calculate the values from here?

For example, if we set $\omega=0$, then the result is $30$. But if we set $\omega=\pi/4$, then the result is $$\left|\frac{1+1.2e^{-j\pi/4}+0.8e^{-j\pi/2}}{1-0.9e^{-j\pi/4}}\right|.$$ How does one solve this?

I also know that the formula for phase response is $$\arg(H(e^{j\omega}))=\frac{\Im(H(e^{j\omega}))}{\Re(H(e^{j\omega}))}$$ but I'm having a hard time to understand how to use it and what phase response actually is. Can you give me an example of how to calculate the phase response of a certain angle?


texts: How to get a depth map from a Kinect 360 depth sensor?

texts:
I'm trying to understand how Kinect 360 depth sensor works. At the moment, I know that this sensor is composed by an infrared pattern generator and a infrared camera. IR camera gets the pattern generated from the IR emitter, and using math it calculates a depth value for each pixel. The process of emitting a light in a pattern is called Structured Light. So the question is, I don't really understand how an IR image is transformed into a depth map.
I read some documents, like this one, but I don't really understand how it works. I would appreciate any help. I have a Kinect 360, so I could generate some images if it helps.


texts:
I'm trying to find the integral of the following signal:
$x(t)=A, 0 \le t \le T$
$x(t)=0, otherwise$
The integral is defined as
$y(t)=\int_0^t{x(\tau)d\tau}$
For $y(t)$, I'm getting $AT$ when $t \gt T$, but the answer mentions that it is 0 everywhere else apart from $0 \le t \le T$. Why is this so? Any help is appreciated.


texts:
I've come across the below. Can you please help me understand the proof for this?

$$\int_{-\infty}^{\infty}x(t)\delta'(t-2.5)dt=-\frac{dx(t)}{dt}{\Big |}_{t=2.5}$$


texts: How to use 'randi' in MATLAB to generate equally probable samples which are either 0 or 1?

texts: How can I use ‘randi’ function in MATLAB to generate a signal sequence s(t) which contains 1e6 samples which are either 0 or 1 and are equally probable. Any suggestions? Thanks!


texts: Why DFT-SPREAD OFDM has lower PAPR than OFDM?

texts:
I just read 4G LTE/LTE-Advanced
for Mobile Broadband, and found the content as below,

  If the DFT size M equals the IDFT size N, the cascaded DFT/IDFT
  processing would obviously completely cancel each other out. However,
  if M is smaller than N and the remaining inputs to the IDFT are set to
  zero, the output of the IDFT will be a signal with “single-carrier”
  properties – that is, a signal with low power variations, and with a
  bandwidth that depends on M.

My question is that why DFT-SPREAD OFDM has lower variations in comparison with OFDM? The picture is DFT-SPREAD OFDM modulation scheme.

Thank you.


texts: Clarification on the application of window pre-FFT

texts:
Good morning, I have a simple question about the application of a Hanning window before performing an FFT.  My application is pretty textbook, i'm decoding a 4-FSK signal.

Question: why does the spectral width increase when I apply a Hanning window to a perfect sin?

Many thanks!
A


texts:
I have a search coil magnetometer with two coils, one at each end of a ferromagnetic core of high magnetic permeability:

Figure 1. Double search coil magnetometer. (Modified from a drawing CC BY-SA 3.0 Christophe coillot.)

Each coil converts change in the magnetic field into a voltage signal. The two signals are digitized. I'm only interested in local anomalies in the magnetic field as they appear in the difference signal between the two coils when the magnetometer is moved through the anomalies. The anomalies are in Earth's magnetic field, created by ferromagnetic objects buried in the ground. So this is a kind of metal detector.

The problem is that the coils are not aligned perfectly symmetrically and are not built perfectly identically. The difference signal is therefore polluted by imperfectly cancelled noise. The noise originates primarily from accidental shaking of the magnetometer that changes its orientation with respect to Earth's magnetic field.

I can do calibration by going to nature and lifting up the magnetometer in the air, away from stray magnetic fields and magnetic anomalies, and shaking it, producing pure noise that ideally would be identical at both coils, but is not, as described above. During such calibration, I have tried adaptively changing the gain of one of the coil signals to match that of the other, which works, but only to an extent. I think I would get better results by matching the frequency responses as well. How can I do this?

Figure 2. Possible signal flow diagrams with equalization of A) just one of the channels to match the other, B) both channels to match a common target response.

I don't need to flatten the frequency responses, as long as they are equal, because I'm not trying to properly quantify the anomalies, just detect them. As far as I understand, the equivalent circuit of each search coil is:

Figure 3. LTspice equivalent circuit of a search coil. Voltage from the voltage source is proportional to magnetic flux time derivative. The component values are very approximate, but probably close enough to reveal the general shape of the frequency response.

Figure 4. LTspice simulated frequency response of the search coil.

Gain must remain as one of the variables to equalize, because some of the gain difference comes from the digitization. I can set the sampling frequency as high as needed. I'd rather not do the calibration in a test bench with a generated artificial magnetic field, but adaptively in the field.


texts: What are some alternatives to Spectrogram charts?

texts:
Spectrogram renders of audio are limited in their representation of audio. For example, one could not use a Spectrogram to re-render the original audio.

What are some alternatives to Spectrogram charts for rendering representations of audio?

Preferably this would be methods which are more accurate (in every possible way/in every possible audio dimension) for representing audio in graphical format (an image)?

A good measure of accuracy would be for example;

Could the image be used to (at least to some extent) re-create the audio file?
Could the image be used to match the similarity between two songs in some or all dimensions?

And, are there any scripts/tools/software's that can be used for converting audio into an image format?


texts: Remove multiplied white noise from periodic signal

texts:
I need to remove noise that is multiplied to a periodic signal using a maximum of 7 periods having no information about the noise.
I have tried to use auto-correlation:

 abs(ifft(fft(signal.*noise).*conj(fft(signal.*noise)))),

But I'm losing too much information from the original signal.
Any suggestion to recover the original signal keeping maximum points index information?

If it helps, the data set I'm using is here (Matlab mat file)


texts: The Parameter Devil — How to set them when no validation against groundtruth is possible

texts:
Question:

I want to kick up a discussion on how people set algorithmic parameters when no validation against groundtruth is possible (maybe because groundtruth just cannot be obtained or is very hard/tedious to obtain).

I have read numerous papers and implemented the underlying algorithms wherein --- a set of parameters are said to have been set "empirically" --- and often i found that these are the ones that affect the generality of the algorithm (even though the theory underlying the method is elegant, enticing and sound).

I would appreciate it if you could share your thoughts. And, there is no right or wrong answer for this question. I just want to know, how everybody else deals with this.

Background/Source-of-question:

I am a computer scientist working in the areas of image analysis, computer vision, and machine learning and this question has been on the back of my mind for a while as i have faced this dilemma time and again whenever i design a new algorithm and i found myself spending a considerable amount of time tuning the parameters.

Also, I think, my question here is more general to any area where in computational algorithms are heavily involved, and i want to invite the thoughts of people from all concerned areas.

I wanted to give you some concrete example, just so it helps you think:

--- Take the case of feature detection (lets say circular blobs or salient points). You run some filters (needs parameters) at different scales (scale parameters) and probably threshold the response (threshold parameter). Its usually not possible to get a groundtruth to validate against and thereby automatically tune your parameters in such scenarios.

--- Take any computational framework which involves a lot of signal processing components. There are always parameters to tune and usually there is no groundtruth and when you tune them subjectively on a small random subset of your dataset you will someday encounter the case to which it doesnt generalize.

This parameter devil is more troublesome when you are setting parameters for some intermediate steps in your algorithm.

And I often found, it is not possible to cast the problem of finding good values for these parameters as an optimization problem with an objective function of which you can take a derivative and thereby use standard optimization algorithms to find good values.

Also, in many scenarios exposing these parameters to an end-user is not an option, as we often develop applications/software for non-computational end-users (lets say biologists, doctors) and they usually go clueless when you ask them to tune it unless its very intuitive (like approx object size).

Please share your thoughts.


texts: Problem with 1st order PLL update equation

texts:
The output of a communication channel is given by:

$x(t) = \sum_n{a_n}h(t-nT)$,

where $\{a_n\}$ are BPSK symbols, $h(t)$ is the channel response, and $T$ is the symbol period. If there is an inherent unknown timing offset $\tau$ inside the channel response we will instead have:

$x(t) = \sum_n{a_n}h(t-nT-\tau)$.

Say we need to sample $x(t)$ at times $\{kT\}$ and we can detect the symbols using the shifted channel response $h(t-nT-\tau)$. In other words we do not wish to resample $x(t)$ to compensate for the timing offset but we can estimate $\tau$. An estimate of $\tau$ is given by $z_k = x_k \hat{a}_{k-1} - x_{k-1}\hat{a}_k$ such that $E\{z_k\} = \tau$, where $x_k = x(kT)$, and $\{\hat{a}_k\}$ are the decisions of a (Viterbi) detector. This is the $M \& M$ estimate.

The question is how to use this estimate to recursively update the estimates of $\tau$ in a 1-st order PLL sense since the following equation will diverge.

$\tau_{k+1} = \tau_k + stepsize \times z_k$


texts:
In the process of trying to learn dialup, I've managed to learn/figure out everything except how to convert a demodulated/filtered signal back into the original data.

Here I have a random two-bit signal (red) sampled at 16000Hz at 2400 symbols/s (gray lines separate symbols), as well as the filtered signal (blue). The filter is a raised-cosine filter with α=1200Hz, β=0.5, and a length of 27 samples.

Given the filtered signal, it's clear that a simple A/D converter is insufficient; for example, at about 7 symbols in (about a third from the left), the original signal crosses zero four times, whereas the filtered signal only crosses twice. I imagine this is due to higher frequencies being attenuated more than lower frequencies.

I realize that because the signal is being filtered at half the symbol rate, there shouldn't be any loss of information. How do I go about reconstructing the original signal from the filtered version?

In case it helps any: because the dialup training signal consists of known, pseudo-random data, should I use that to construct an adaptive filter/equalizer? Is it as "simple" as "un-attenuating" the higher frequencies?


texts:
I am not sure if I understand meaning of “bit depth” in audio.

As I see in many audio applications the audio sample values (when not distorted) are between minValue = -1.0f; and maxValue = 1.0f;.

I need to know the smallest possible value next to 0.0f of one sample.

As I suppose “x bit depth” means that one sample can be expressed by 2^16 various values. Am I right?

So does it mean that the smallest possible sample value change is (maxValue - minValue) / (pow(2.0f, x)) ??? So for 16 bit depth is it 2.0f / pow(2.0f, 16.0f) ?? Which is 4.6566128742e-10 ?

I have mess in mind, couse I have even problem with simple float variable. As I know it has 32 bits. So the biggest value should be 2^31 (and one bit for sign) which is 2147483647. And for int it works, but how is it possible that float max value can be 3.40282e+38 ? Which is much more than 2147483647.

So let’s imagine I have audio with 32 bit depth. So then the smallest possible sample value change is 2.0f / 2147483647.0f, or maybe 2.0f / 3.40282e+38 ???

And other issue is: should I realy devide (maxValue - minValue) / (pow(2.0f, x)) - which means bit depth concern to amplitude. Or it concern to gain - which means I should calculete it by 1.0f / (pow(2.0f, x)) ?

Please help me to understand it because my math calculations (a lot of logarithms and powers) gives me a lot of “NaN” and “inf”. So I need to narrow the possible inputs and outputs to avoid such errors. But first I need to understand how to do that.

For any help great thanks in advance.
Best Regards


texts: How to implement compressed sensing reconstruction?

texts:
I am new to the field of Compressive Sensing. I'm trying to implement an example in this link. This example have described and implemented a sample tone reconstruction carefully, but unfortunately, there is no use of l1-magic toolbox to reconstruct the signal using compressive sensing minimization.

I know that l1eq_pd function in l1-magic calculates x in Ax=b for compressed sensing but when I use this function it returns an error Error using linsolve: Matrix must be positive definite.

Have anyone solved this minimization before?

Does anyone know any substitute for this toolbox?

How can I format my code in stack exchange (below code) for Matlab using <!-- language: lang-or-tag-here --> ?

Appendix 1:

My Matlab code:

%% signal initialization

n = 1/40000:1/40000:1/8;
f = sin(1394*pi*n) + sin(3266*pi*n);

%% Random Sampling

% b = Phi * f    (random sampling)
% c = Psi * f    where Psi = IDCT (sparsifying)

m = floor(rand(1,500)*length(f));
b = f(m);       % random samples of (f)
c = idct(f);    % sparsed (f)
plot(f,'b');hold
plot(m,b,'k.');title('Original Signal(f) and random sampless(b)');
axis([1,1000,-3,3])
legend('Original Signal','Randomly Sampled Signal')
figure, plot(c), axis([0,650,-10,10]);title('Sparse samples (c = IDCT(f))');

% f = Psi * c
% Psi = DCT
% f = DCT(c)
% c = IDCT(f)

%% solution 1 (x)

% Ax = b
% x = A\b

D = dct(eye(length(n),length(n)));
A = D(m,:);
% sound(f)
x = (A\b')';
b_hat = dct(x);
% sound(b_hat)

%% solution 2 (y)

% Ay = b
% y = pinv(A) * b

y = (pinv(A)*b')';
figure,plot(y),axis([0,650,-10,10])
figure,plot(dct(y)),axis([1,1000,-1.5,1.5])

%% solution 3 (s1)

s1 = l1eq_pd(y',A,A',b',5e-3,20); % L1-magic toolbox

This piece of code is a good example to understand compressed sensing and works correctly except the last line I am questioning.


texts: Definition of MIMO (Multi-input Multi-output ),does this output mean antenna or transmitter?

texts:
I want to ask the definition of MIMO(Multi-input Multi-output )

If there are one transmitter and one receiver,each of them has $N$ antennas,$N >1$.
So i can say it is a MIMO system.

But if now i have one transmitter with $N$ antennas,$N >1$.And $5$ receivers with single antennas for each,can this still be called MIMO?

I think it should be called MISO,because each receiver just has only one antenna.However,in this paper,it called this system "MIMO" system .

Paper:https://arxiv.org/pdf/1903.05758.pdf


texts: How to chose a kernel function for a FIR low pass filter in audio processing?

texts:
As the answer of a previous question, I was suggested to use a FIR filter to act as a low-pass filter to reconstruct the envelope of a sound wave (edited, emphasis mine):

  As I said in a comment, you can get the envelope of a signal by
  running it through a lowpass filter

  [...]

  Implement a lowpass filter (FIR) by creating a filter kernel of appropriate length M (h(M) ). Note that your FIR filter
  (sin(x)/x) should normally be multiplied by a window function (e.g
  Hamming, Blackman, etc).
  Convolve your signal with the filter kernel.

  [...]

I'm having a hard time choosing/finding a proper filter kernel function. The quote above suggests sin(x)/x. Is this a standard kernel function? Does it have some magic properties that make it particularly suitable? What should I check if I consider another kernel function?


texts: Fourier descriptors: trying to classify objects

texts:
Describing my background: I have around 33 items labeled. For example, 3 pictures of the contour of a basil plant, 4 pictures of the contour of earphones, 7 of a mug, etcetera.

I'm trying to calculate N Fourier descriptors of a random picture in order to compare them with the other items, making the average of the distances between classes and saying: "This is a mug!" or "this is a basil plant!".

In my experience, I take a random picture of a MUG:

it looks to my MUGS that I've classified (because it gives me a distance close to 0):

but if I take a picture of the MUG without the handle:

the closest averages of the norm of distances to this MUG are of BASIL plants or EARPHONES (instead MUG, which is boundary closer):

indeed I have been realising that for every random picture I use to get a low value for earphones and basil. It seems that I have to normalize somewhere... but... what should I do ??

Do anybody could give me a clue?

Thank you very much in advance.
Regards.

UPDATED
In response to @tbirdal , I have to say that that's what I do:

vector<double> vector;
if (dft_z.size() < 2)
    return vector; // handling errors
dft_z.at(0) = complex<double>(0,0); // First DC to 0 (invariance on translation)
double si1 = abs(dft_z.at(1)); // Module of the a(1)
for(int i = 0; i < dft_z.size(); i++) {
    dft_z.at(i) = complex<double>(dft_z.at(i).real() / si1, dft_z.at(i).imag() / si1); // dividing by the module
    vector.push_back(abs(dft_z.at(i))); // and putting into my vector the absolute value (to eliminate any phase)
}

HOW I'M GOING TO CONTINUE

I've seen that making the absolute value of every FD to remove its phase makes confusion on my shapes.
In addiction, I realised that only simple forms and contours are well matched. For example basil was too complicated, but the mug is not.

Thanks to @tbirdal who gives me an idea.


texts:
I am trying to identify a system based on input/output response and thereby estimate a transfer function.
I generated a frequency sweep function in Mathematica which gives me the discrete values of a frequency sweep.

g[t_] := 0.799760*Sin[2 Pi (3 t/333.3 + 1) t];
Plot[g[t], {t, 0, 1000000000000000000000000000000}]
g[#] & /@ Range[0, 5, 0.001]

So now I have a bunch of data but at what rate should I input it into the system, and at what rate should I read it?

How should I apply Nyquist frequency rule here?


texts:
I have idea of creating Content based Music recommendation system based on Music signals, Now I am asking how I can extract signal features from Music and how to represent them. There after I may find similarity between them to make recommendation?

Your ideas will help me, Thanks!


texts:
Before anyone yells at me I fully realize that this question has been asked numerous times. I assure you that I've read through the existing questions and answers but I am still confused about part of the problem.

I have a sound source that plays music (A) in a closed environment. I have a mic  that I'm using to record  A. I am left with two wav files which share the same characteristics and length (number of samples).

My goal is calculate the time it took for A to reach the mic.

I am trying to perform the calculation using cross-correlation (numpy):

# Delay estimation
corr = numpy.convolve(original_audio, recorded_audio, 'full')
delay = int(len(corr)/2) - numpy.argmax(corr)
distance = delay / sample_rate * 343 # sample_rate == 22050, m/s = speed of sound
print("Distance full: %.2f cm" % (distance * 100))

I consistently obtain values in the 300,000 cm range. The distance between the speaker and mic is approximately 2 feet.

This is all pretty new to me so I'm sure I'm missing something obvious.

Thanks in advance.


texts:
I have a curve which the asymptotic behavior is the one of a cosinus. I look at this curve on all integers.

I know that the asymptotic curve has this behavior : $$ cos(a*x+b) $$

My question is : how can I determine $a$ and $b$ ?

Indeed I only have samples of the curve, and the samples that I have are not exactly of the form of the cosinus as the cosinus is the asymptotic behavior of my curve.

I did the following : I took samples between $[N; N+P]$ with $N$ large enough to be sure that I'm ""in"" the asymptotic zone.

I did a FFT on this zone and noted the frequencies where a Dirac seemed to appear. I . (I chose P large enough to have enough sample to have a good frequency resolution).

Then I made a function which fft is just 2 pure dirac.

But when I plot my curve and the supposed asymptote, I have this (in blue the initial curve that I evaluate only on integers and in red the function I made with the two diracs).

We can see that we have a slow drift between the two curves (I'm almost sure that if I look to samples far away the two curves will be in opposite of phase at a moment).

My question is : is it possible to determine an asymptotic behavior of samples in my case ? And how to do it ?


texts: Strong (0,0) pixel among an otherwise normal cross correlation peak

texts:
I am working on an imagery registration problem via cross-correlation and am seeing a weird phenomena sometimes. First, I am pre-processing each image by subtracting the mean image brightness from every pixel and then applying a cosine window to deal with the fact that my images are not periodic across the edges.

Then I am doing a simple cross correlation in Fourier space and creating the correlation surface. I work in Python so here is some scratch code showing what I am doing:

import numpy as np
from scipy.signal.windows import cosine as wind

im1 = np.load(file1)
im2 = np.load(file2)

rows, cols = im1.shape
hr = np.reshape(wind(rows, sym = False), (rows, 1))
hc = np.reshape(wind(cols, sym = False), (cols, 1))

h2d = np.dot(hr, hc.T)

im1 = im1 - im1.mean()
im2 = im2 - im2.mean()

im1 = im1 * h2d
im2 = im2 * h2d

fft1 = np.fft.fft2(im1)
fft2 = np.fft.fft2(im2)

prod = fft1 * fft2.conj()
surface = np.abs(np.fft.ifft2(prod))

When the relative shifts between the two images are largish, the (0,0) pixel seems to be drowned out by the overall correlation surface peak structure. However, when the relative shift becomes smaller, the (0,0) pixel starts to dominate and is no longer a smooth part of the overall surface. This causes a simple peak finding algorithm like numpys argmax to latch onto a shift of (0,0) even though a faint correlation peak surface still exists.

I am curious what can cause something like this to happen? In general, what about a set of two shifted images can cause the (0,0) pixel to dominate?

Edit 4: I discovered a scipy function called match_template that incorporates a normalization to the correlation surface proposed by JP Lewis. This method requires that template dimensions be smaller than the reference image. I accomplished this by zero padding the reference image to 2x the original image size so that upon convolution of the template, the entirety of the image dimensions contain valid correlation results. I found that there is basically no difference between my code above and this match_template method and the (0,0) peak is still the strongest component when it shouldn't be in the some cases. I think a band-aide solution is to interpolate the (0,0) pixel so that it becomes part of the overall surface. I'm jotting all this down hoping this helps someone in the future since this question hasn't gained much traction.

Edit 3: After some intensive literature review, it has become clear that this method of cross correlation is at best an approximation of normalized cross correlation. It seems like the denominator in NCC has no easily computable equivalent in Fourier space. Additionally, doing cross-correlation for images of the same size, inevitably results in inaccuracies anywhere besides the (0,0) shift component. This is due to pixels in the two images that no longer overlap once they have been shifted relative to each other. Spatially, this can/has to be accounted for by padding the images so that the correlation is defined everywhere. This padding results in inaccuracies but is necessary to search all possible translations between the two. I have another question related to this point. When doing a cross correlation like in the code above, what "padding" is applied? How are the non-overlapping parts spatially handled in Fourier space? I never define a padding, yet the surface I get is the same size as the input images...so what is going on behind the scenes for every pixel except the (0,0) one?

Edit 2: I accidentally stumbled on the realization that the (0,0) pixel of the correlation surface is always equal to the mean of the fft product. That makes me feel like its sort of deterministic and that the (0,0) pixel in the surface doesn't really encode any information about what the actual shift?

Edit to add an example image, notice the underlying structure isn't centered on that central (0,0) pixel yet it is the largest component of the surface. Also this surface has been shifted with np.fft.fftshift() to make visualization easier.


texts:
i want to create a Saliency Map based on itti model via OpenCV(Python). what i'm doing is that:
1- first i change image color space from RGB to LAB color space
2- for each color channel, i create a Pyramid with 6 level
3- from bigger image to smaller, first i make them a fixed size, then differ them via cv2.subtract command.

What i expect is that, in each step of differencing, i should lose details and focus on salient regions but what a get is a black screen. in fact, subtracting removes all image data.

this is my code:

import cv2
import numpy as np

sign =  cv2.imread("sign.jpg")

#size of image
height = np.size(sign, 0)
width = np.size(sign, 1)

#converting LAB color space
lab = cv2.cvtColor(sign, cv2.COLOR_BGR2LAB)

#extracting color channels
l= lab[:,:,0]
a= lab[:,:,1]
b= lab[:,:,2]

a_channel = a.copy()
b_channel = b.copy()

a_prm = [a_channel]
b_prm = [b_channel]

for i in xrange(6):
    a_channel = cv2.pyrDown(a_channel)
    b_channel = cv2.pyrDown(b_channel)

    a_prm.append(cv2.resize(a_channel, dsize=(width,height)))
    b_prm.append(cv2.resize(b_channel, dsize=(width,height)))

a_map = a_prm[0]
for i in range(1,6):
        print(i)
        a_map = cv2.subtract(a_map,a_prm[i])

cv2.imshow('a_map',a_map)


texts: 2D Multi Scale Dot Enhancement Filter based on Gaussian Filter and Hessian Matrix

texts:
I'm trying to implement an algorithm that enhance dot and line like structures based on Hessian matrix, the algorithm uses Gaussian filter with different scales before calculating the hessian matrix for every pixel and later the Eigen values.

I want to use the algorithm to enhance pulmonary nodules (dot like structures) to extract them for later classification.

The Gaussian filter is used to reduce noise and preserve objects with specific scales (diameters in my case).

Here is the algorithm that I'm trying to implement:

A = imread('sliceX.png');

scales = [3, 5, 7, 11, 17]; % the scales in number of pixels
% correspond to diameter of nodules in mm [1, 1.6, 2.4, 3.8, 6]
Ecircle = zeros(512, 512, length(scales)); % Ecircle will store the
% results of each enhancement scale.

for sn=1:length(scales) % sn for scale number
% Smooth the original 2D image with a 2D Gaussian function of scale
% Sigma_s.
    B = imgaussfilt(A, scales(sn));

    [gx, gy] = gradient(double(B));
    [gxx, gxy] = gradient(gx);
    [gxy, gyy] = gradient(gy); % it's normaly [gyx, gyy] but since
    % gyx = gxy it's ok

    % loop through the image to calculte the eigen values for every
    % pixel and based on that we choose the value of each scale
    %enhancement filter
    for x = 1:512
        for y = 1:512
            % construct 2*2 hessian matrix for every pixel
            h = [gxx(x, y), gxy(x, y); gxy(x, y), gyy(x, y)];

            e = eig(h); % returns a vector with the two eigen values
            % lambda1 and lambda2 in which lambda1 = e(1) and
            % lambda2 = e(2)
            lambda1 = e(1); lambda2 = e(2);

            if abs(lambda1) < abs(lambda2)
                temp = lambda1;
                lambda1 = lambda2;
                lambda2 = temp;
            end

            if lambda1 < 0 && lambda2 < 0
                Ecircle(x, y, sn) = (abs(lambda2)^2)/abs(lambda1);
            end
        end
    end
    % multiply each enhancement scale by (sigma^2) as mentioned in the
    % article
    Ecircle(:, :, sn) = Ecircle(:, :, sn) * (scales(sn)^2);
end

I = max(Ecircle, [], 3);

This implementation for enhancing dot like structures (nodules), and can enhance line structures (vessels in my case) with just changing the if condition.

The problem is I'm not getting the supposed results that I should get:

The result of the developer of the method in the paper:

And this is my result:

abvisioly the nodule in the image is greatly enhanced by there are great noise in the output image plus all the vessels joints are enhanced too (small and big)

I think the problem is with the Gaussian smoothing filter imgaussfilt(), and precisely with sigma or scales(sn) in this example.
I've read that sigma should be in the same units of x and y i.e. number of pixels so I've transformed the diameters (that I got from the experimental results of the original article) to the number of pixels using PixelSpacing attribute form the original Dicom file metadata.

The diameters are [1, 1.6, 2.4, 3.8, 6] to cover approximately all the diameters of possible nodules.

Where I did get wrong and If the problem is with the value of Sigma,How can I specify sigma? and how can I use the imgaussfilt() function correctly?

Note: here is the image used in the example:
input image


texts:
I have some 64 channel EEG data sampled at 256Hz and I'm trying to conduct a time frequency analysis for each channel and plot a spectrogram.

The data is stored in a numpy 3d array, where one of the dimensions has length 256, each element containing a microvolt reading over all sampled time points (total length is 1 second for each channel of data)

To be clear: my 3D array is 64*256*913 (electrode * voltages * trial). Trial is just a single trial of an experiment. So what I want to do is take a single electrode, from a single trial, and the entire 1D voltage vector and creating a time-frequency spectrogram. So I want to create a spectrogram plot from data[0,:,0] for example.

For each electrode, I want a plot where the y axis is frequency, x axis is time, and colour/intensity is power

I have tried using this in python:

from matplotlib.pyplot import specgram
#data = np.random.rand(256)
specgram(data, NFFT=256, Fs=256)

This gives me something that looks like this:

Right off the bat this looks incorrect to me because the axis ranges are incorrect

Furthermore, when I run the same code for all EEG channels, over all of my data, I end up with the exact same plot (even though I have verified that the data is different for each)

I'm pretty new to signal processing, is there somewhere that I went wrong in either how my data is laid out or how I used my function?


texts: Removal of blocking artifacts in images due to compression

texts: Having compressed an image,how can the compression noise or blocking artifacts be suppressed to improve the quality of the image before further processing. Thanks


texts:
I will explain the system:

i am trying to transfer data from tx node to rx at UHF band on 400 MHz. I am trying first only wired
transfer then i will try wireless.i am assuming only gaussian noise. My bandwidth is 1 Mhz. I am using gardner timing recovery with 2 samples/symbol. I am using 2nd order loop filter.
please let me know any other information is required?.

What kind of interpolation filter should be used in timing recovery block of the receiver? I have seen some papers where linear, cubic, quadratic farrow filter is used.

Is there any particular criteria for this?
Do i need a farrow filter or any other filter?
Does this has any affect of the convergence of the timing recovery?
If my input and output samples/symbol are same can i use any simpler filter?


texts: MR tools are used in many sectors such as medicine and mining. MR stands for magnetic resonance and MRI for magnetic resonance imaging. What are characteristics of different MR images? What are typical noise to signal ratios and other important decision factors?


texts: What do we mean by Total Factor Space in Audio Processing?

texts:
I am referring to the article for understanding Ivectors which says:

  Over recent years, i-vector-based framework has been proven to provide state-of-the-art performance in speaker verification. Each utterance is projected onto a total factor space and is represented by a low-dimensional feature vector.

I tried understanding on my own, but could not get anywhere.
Can someone please help me understand what does 'Total Factor Space' mean?


texts:
Following shows the discrete time Fourier transform of an ideal low pass filter with cutoff frequency $\omega_c$:
$$H\left(e^{j\omega}\right) =
\begin{cases}
1,  & \text{if $|\omega| \le \omega_c$} \\
0, & \text{otherwise}
\end{cases}
$$
Taking inverse discrete time Fourier transform would result in following infinite support impulse response:
$$h[n] = \frac{\omega_c}{\pi} \operatorname{sinc}\left(\frac{\omega_c n}{\pi}\right)$$
If we want to filter out high frequency components of a finite support sequence $x[n]$ in time domain, we have to compute the convolution product of $x[n]$ and $h[n]$. Since $h[n]$ is of infinite length, it is not possible to implement it for example in a computer program and we must use a truncated version of it. But in frequency domain, we can simply multiply $X(e^{j\omega})$ (i.e. discrete time Fourier transform of $x[n]$) with $H(e^{j\omega})$ and then take inverse discrete time Fourier transform to evaluate filtered version of sequence $x[n]$. In brief, my question is why don't researchers and engineers employ frequency response of ideal low pass filters and instead, they have developed a vast body of literature on filter design?
In other words, $h[n]$ is ideal but its frequency response $H(e^{j\omega})$ is practical and realistic.


texts: Determine a sequence whose N point DFT is given without computing inverse

texts: For example, I'm given a sequence x(n) = { 3, 5, 1, 4, -3, 5, -2, -2, 4 } whose 9 point DFT is X[k]. Without computing IDFT, i need to find the sequence y(n) whose 9 point DFT is given by $Y[k] = (-1)^k ~ e^{j \frac{\pi}{3} k}$ . How do I approach this question?


texts: Optimizing FFT code for 12 bit processing on microcontroller

texts:
I want to port the following FFT code on a microcontoller having a very little floating point capability. I want to perform FFT of the output from 12 bit ADC. Since my values are all 12 bit numbers it is wasteful of storage and processing power (I do not need very accurate FFT output) if I do every thing in double as the following code does.

How do I modify this C code so that it works only for 12 bit numbers and do not do any floating point arithmatic. This way I can save lots of storage space and  do very litlle arithmatics.

#define PI  M_PI    /* pi to machine precision, defined in math.h */
#define TWOPI   (2.0*PI)

void four1(double data[], int nn, int isign)
{
    int n, mmax, m, j, istep, i;
    double wtemp, wr, wpr, wpi, wi, theta;
    double tempr, tempi;

    n = nn << 1;
    j = 1;
    for (i = 1; i < n; i += 2) {
    if (j > i) {
        tempr = data[j];     data[j] = data[i];     data[i] = tempr;
        tempr = data[j+1]; data[j+1] = data[i+1]; data[i+1] = tempr;
    }
    m = n >> 1;
    while (m >= 2 && j > m) {
        j -= m;
        m >>= 1;
    }
    j += m;
    }
    mmax = 2;
    while (n > mmax) {
    istep = 2*mmax;
    theta = TWOPI/(isign*mmax);
    wtemp = sin(0.5*theta);
    wpr = -2.0*wtemp*wtemp;
    wpi = sin(theta);
    wr = 1.0;
    wi = 0.0;
    for (m = 1; m < mmax; m += 2) {
        for (i = m; i <= n; i += istep) {
        j =i + mmax;
        tempr = wr*data[j]   - wi*data[j+1];
        tempi = wr*data[j+1] + wi*data[j];
        data[j]   = data[i]   - tempr;
        data[j+1] = data[i+1] - tempi;
        data[i] += tempr;
        data[i+1] += tempi;
        }
        wr = (wtemp = wr)*wpr - wi*wpi + wr;
        wi = wi*wpr + wtemp*wpi + wi;
    }
    mmax = istep;
    }
}


texts:
By reading some books about wavelets, it seems that Discretized CWT is not the same thing as DWT.

Can we give a classification of Discretized CWT vs DWT vs FWT etc. ?

A few remarks :

All I read about DWT or MRA (multi-resolution analysis) involves a dyadic factor (2)  for $a$ in $\frac{1}{\sqrt{a}} \Psi(\frac{t-b}{a})$, ie $a=2^m$. Is it always true ?
Remark : This is good in order to have a non-redondant transform (see B Z's answer here Scalogram (and related nomenclatures) for DWT?), but the graphical representation of such a transform isn't very satisfying for visual analysis of a signal.
The fact that there is $ a=2^m$ involved implies that the frequency bands studied [in the case where the mother-wavelet has a narrow-band fourier transform, e.g. Morlet wavelet http://ieeexplore.ieee.org/ieee_pilot/articles/06/ttg2009061375/assets/img/article_1/fig_3/large.gif] are things like [20hz,40hz], [40hz,80hz], [80hz, 160hz], etc.
Thus we cannot hope a good graphical representation with precise frequency resolution. It seems that this kind of transform is more suited for "approximation + details" than for visual frequency analysis (scalogram, etc.)
On the other hand, a discretization of Continuous wavelet transform allows to take $a=1.0004^m$ for example, and thus have a more precise frequency resolution, for one who wants to do a graphical representation (scalogram).


texts: Capturing images on fast moving conveyor belt

texts:
This may or may not be an image processing problem.
I am developing a simple system that captures images of a part as they are being manufactured and sent out along the conveyor belt.

I've solved the alignment problems, and background subtraction problem that this application requires. Everything is working in my prototype setup where I manually place parts with and without defect under the camera in different lighting conditions, position and other realistic variables. My setup uses Logitech C920 web cam, the software is able to process each frame in less than 1 second on average.

The problem arises when I start simulating the parts on the moving conveyor belt, it is unable to capture frame fast enough resulting in motion blur.

How is the issue approached in this industry?
If I switch to use a DSLR and use the correct f-stop (etc.) will that solve the blur problem? If so, wouldn't DSLR overheat since it has to capture so many frames for hours and hours and hours?

PS: speed of conveyor belt is fast but slow enough to easily track with human eyes. I don't have the information about the exact speed at this time.


texts:
Lets say i have a LPF response that has some kind of droop (some attenaution in the passband, usually could be due to cic filter how to make CIC compensation filter,,,, or can also be due to large ripple in passband).

Nevertheless, let say i have some droop in the passband , like the below figure,

So now what i need is this passsband droop compnesation using a IIR-2nd order filter ( direct-ii- transposed or is lattice-ladder better , with regard to memory, quantization etc ?).

Can someone guide me what are the steps that i need, assuming i already have the pole-zeros of the lpf either in s-domain --> impinvar--> z-domain.

So how to proceed-...

Something like a pole-zero compensation with RMS error calibration.

Any help would be appreciated. Newbie in DSP.


texts:
In radix-2 FFT, why is the bit growth equal to $1+\sqrt{2}$ per stage?

I want to know the logic as to how that value has been obtained. Is it just empirical or has it been derived?


texts: Find the error in phase angle and dB gain Function Transfer

texts:
This is a question paper that I've tried to solved but seems I am missing something.

My attempt:

$$ |G|_{w=0} = K$$

So,

$\require{cancel}|G|_{w=0.5a} = \dfrac{K}{\left|1+\dfrac{j0.5\cdot \cancel{a}}{\cancel{a}}\right|} = \dfrac{K}{\underbrace{|1+j0.5|}_{Gain}}$

$Gain = 20 \log(\sqrt{1,25}) = 0.96910013008$ [OK]

But about the phase error?

$\angle(1+j0.5) = \tan^{-1}(0.5/1) = 26.56º$

EDIT: Sorry picture this question:

What I did wrong?


texts: Blind deconvolution implementation, Python, Shalvi-Weinstein

texts:
I'd like a 1D blind deconvolution implementation in Python. I read Shalvi and Weinstein 1990 (on the recommendation of Yair Weiss) and it appears relatively simple.

However I can't find an existing implementation online, and I'd rather trust an established library rather than apply it directly - there may be implementation gotchas. Also, if there are no implementations online, does this mean it is not a recommended method currently?

Thus I'd like to know if this kurtosis-based algorithm is recommended by current practitioners for blind deconvolution, and if so whether there is any existing implementation I can rely on.


texts: Fourier transform and energy of a convolution

texts:
Hi guys i have to find the fourier transform of the convolution:
$$ sinc(t/2T)*\sum\limits_{n-\infty}^{+\infty} (-1)^{n}\delta(t - nT) $$
i was thinking of express the summatory as : $$\sum\limits_{n-\infty}^{+\infty} (-1)^{n}\delta(t - nT) = \mathrm{III}_{2T}(t) -\mathrm{III}_{T}(t-1)$$
so we have:
$$ sinc(t/2T)*[\mathrm{III}_{2T}(t) -\mathrm{III}_{T}(t-1)]$$
So the convolution in the fourier domain became a product:
$$ rect(f2T)\mathrm{III}_{1/2T}(t)-2rect(f2T)\mathrm{III}_{1/T}(t)e^{ipif} $$
Well is this a good result and how i can find the energy from this formula  ?


texts: What is the DFT of $[x_1 -x_2 x_3 -x_4....x_n]$

texts:
If DFT of $[x_1 x_2 x_3... x_N]$ is $Y(k)$, what is the DFT of $[x_1 -x_2 x_3 -x_4,....x_N]$ in terms of $Y(k)$?
I have tried to formulate it but I cannot get a simplified expression for DFT of modified sequence in terms of $Y(k)$.


texts:
I have been implementing a control software where one of its core functionalities is the ability to synchronize with the three phase grid. Basically I need to implement some form of the phase locked loop (PLL) suitable for three phases. I have found that there are several posibilies how to do that. One of the simplest I have found is basically based on calculation of the time integral of the phase voltages. My first idea how to do that was to use the trapezoidal integration rule in recurent form
$$I(k) = I(k-1) + \frac{T}{2}\cdot\left[x(k-1) + x(k)\right].$$
I have implemented the above written difference equation in C and I have tried to pass a sinewave into it
    #define PI 3.14
    #define N 64

    float x, y;
    for(int k = 0; k < N; k++){
        x = sin(k*2*PI/N);
        y = integrate(1.0, x);
    }

    float integrate(float T, float xk)
    {
        static float intk_1 = 0; // I(k-1)
        static float xk_1 = 0; // x(k-1)

        float intk = intk_1 + T/2*(xk_1 + xk);
        intk_1 = intk;
        xk_1 = xk;

        return intk;
    }

Based on the outcomes of my experiment I have realized that in case the integration process starts from the point where the sinewave has zero value the resulted integral has large offset

In case the integration process starts from point where the sinewave has its positive maximum the integral has zero offset.
I need to have the integral with zero offset to be able to estimate the phase and frequency of the three phase grid. The obvious solution could be to somehow detect the positive maximum of the sinewaves and then start integration process. The problem is that the frequency of the three phase grid fluctuates in some tolerance band. Can anybody give me an advice how to do the integration process so that the resulted integrals have zero offsets?


texts:
I have floating point data signal. I apply lossy control to it and I need some kind of metric to determine its quality.

In image processing, there is PSNR (or MSE). I tried to use the same for it, It gives me some kind of result. But is there anything better (or any standard used for this kind or problem) ?


texts: Discrete-time Biquad filter: Relation between peak frequency and pole frequency

texts:
This question arose from a discussion in the comments to this question and its answer. The author of that question discussed a discrete-time second order filter described by the following difference equation:

$$y[n]=b_0x[n]+b_1x[n-1]+b_2x[n-2]-a_1y[n-1]-a_2y[n-2]\tag{1}$$

with $b_0=b_2=(1-r^2)/2$, $b_1=0$, $a_1=-2r\cos(2\pi f_0 T)$, and $a_2=r^2$.

The transfer function corresponding to the difference equation $(1)$ is

$$H(z)=\frac{1-r^2}{2}\frac{1-z^{-2}}{1-2r\cos(\omega_p)z^{-1}+r^2z^{-2}}\tag{2}$$

where I use the abbreviation $\omega_p=2\pi f_0 T$.

In the original question quoted above, $f_0$ was called "resonant frequency", and the discussion inspired by that question was about whether or not $f_0$ equals the peak frequency of the filter's frequency response.

So the questions I pose are:

What is the meaning of $r$ and $f_0$ as used in the coefficients of Eqs. $(1)$ and $(2)$?
Does $f_0$ equal the filter's peak frequency (i.e., the frequency where the magnitude of the filter's frequency response attains its maximum)?


texts: Direction of arrival and distance to source

texts:
Suppose we have $3$ receivers $a,b,c$ and one wave source which are all located on the same $XY$ plane and we do not know the position of only $c$ on the plane.

Assume a plane wave is transmitted $s(t)$ from an aribitrary point source in far field.

Using the received signal $s_a(t)$ and $s_b(t)$ by pattern matching would it be possible to infer the direction of arrival at $a$ and $b$ and time delay of signal to reach $a$ and $b$?
Suppose the received signal at $c$ is $s_c(t)$ would it be possible to guess the distance and direction of source to $c$ and also $(x,y)$ coordinates of $c$ with $s_a(t),s_b(t)$ and $s_c(t)$? If not what other minimal information do we need to find these?
Is there a reference for these kind of problems for multiple sources and $XYZ$ coordinates?


texts: Continuum Fitting with Python using specutils

texts:
it's my first time processing spectra from a black body radiation experiment, I'm using Python and having some troubles...
I have this spectra with 2 peaks and uneven background noise which I want to normalize, I tried using specutils 1.1 "continuum-fitting" (documentation here: https://specutils.readthedocs.io/en/stable/fitting.html#continuum-fitting )
My implementation is this:
import matplotlib.pyplot as plt import numpy as np
from astropy.modeling import models
from astropy import units as u
from specutils.spectra import Spectrum1D, SpectralRegion
from specutils.fitting import fit_generic_continuum

...

x = data[:, 0]
y = data[:, 1]
plt.plot(x, y, label = 'My Data', c='C0')

spectrum = Spectrum1D(flux=y*u.Jy, spectral_axis=x*u.um)
g1_fit = fit_generic_continuum(spectrum)
y_fit = g1_fit(x*u.um)

plt.plot(x, y_fit, label = ' Specutils Continuum Fit', c='C1')

plt.legend()

But the result is somewhat disappointing

Am I doing something wrong? Do you have any other way to normalize the background noise in python? any suggestion at all?


texts: General Questions MIMO Communication theory

texts:
The following are questions regarding MIMO communication theory. I have come across a MATLAB implementation of MIMO channel. My questions are not regarding the implementation, but rather regarding the theory itself.
In MATLAB there is comm.MIMOChannel that creates a MIMO channel. The following are the properties which one can play with

 MIMOChannel properties:
%
%   SampleRate                  - Input signal sample rate (Hz)
%   PathDelays                  - Discrete path delay vector (s)
%   AveragePathGains            - Average path gain vector (dB)
%   NormalizePathGains          - Normalize path gains (logical)
%   FadingDistribution          - Rayleigh or Rician fading
%   KFactor                     - Rician K-factor scalar or vector (linear scale)
%   DirectPathDopplerShift      - Doppler shift(s) of line-of-sight component(s) (Hz)
%   DirectPathInitialPhase      - Initial phase(s) of line-of-sight component(s) (rad)
%   MaximumDopplerShift         - Maximum Doppler shift (Hz)
%   DopplerSpectrum             - Doppler spectrum
%   SpatialCorrelation          - Spatially correlated
%   NumTransmitAntennas         - Number of transmit antennas
%   NumReceiveAntennas          - Number of receive antennas
%   TransmitCorrelationMatrix   - Transmit correlation matrix (or 3-D array)
%   ReceiveCorrelationMatrix    - Receive correlation matrix (or 3-D array)
%   AntennaSelection            - Optional transmit and/or receive antenna selection
%   NormalizeChannelOutputs     - Normalize channel outputs (logical)
%   RandomStream                - Source of random number stream
%   Seed                        - Initial seed of mt19937ar random number stream
%   PathGainsOutputPort         - Enable path gain output (logical)

I have the following questions: ( I really hope I can get some help)

Does the sample rate mean the actual symbol rate of the input? Is it related to the modulation we use?
Do path delays dictate whether we have a frequency selective or frequency flat fading channel?
The channel above gives the option of having either Rayleigh or Ricean fading channel gains, I know that Rayleigh is good approximation because of the central limit theorem (i.e large number of random paths), if one specifies that the distribution is Rayleigh, does that mean that the Path Delays should be infinite? Or does this distribution mean a distribution of the path itself.
Why would a Direct PATH (LOS) have a doppler shift different that the maximum doppler shift? Then which one dictates the coherence time?

Thank you for any advice or answers on any of the above questions


texts: How to applly Hanning window on S parameter results?

texts:
I am working on Time domain computation. I have S parameter results simulated, using these results I do the Inverse FFT to get results in time domain.
I want to filter/window results using Hanning window.
In frequency domain, I need to do the multiplication of the function of this filter in frequency and the S parameter results. So, I will loop on N:number of frequencies and multiply each results by the Hann window. How can I compute the length of the filter L??


texts: i want to mute a particular frequency in real time audio

texts: i want to mute a particular frequency range in real time audio for eg: in audio signal frequency above 3 kHz should be muted for specific interval of time.


texts:
I am working on a soft iterative receiver for an M-ary modulation.
Since my constellations, M=2⁷ — M=2¹², are rather big, the log likelihood ratios also become large.
Is there a way to compress these values to a smaller range, e.g. from [-100, 100] to [-10,10]?
Momentarily, I am rescaling the values to fit them in my desired range. However, the actual confidence levels don't make sense then anymore.
== Edit ==
To calculate the soft-outputs of my decoder, I first convert the soft-inputs into probabilities by,
$$
P = \frac{e^{LLR_{in}}}{1 + e^{LLR_{in}}}
$$
As can be seen from this equation, large LLRs will be approximately 1. However if this happens, my decoder takes wrong decisions and calculates wrong soft-outputs. Therefore I am searching for a way to deacrease the magnitudes of the input LLRs.
The MATLAB rescale() function isn't the optimal solution, since it does introduce errors with the iterations.


texts: Usefulness of Matched $z$ transform Method

texts:
I'm aware that the matched $z$ transform method maps between the continuous $s$ plane and the discrete/digital $z$ plane but my question is - when would this be necessary? Why would we need to convert between the two?
Thanks


texts: Finding the frequency response $H(\omega)$ of a shifted sinc function

texts:
Given
  $$h[n]=\frac{\sin\left(\frac{\pi}{3}n-\frac{\pi}{3}\right)}{\pi n-\pi}\text,$$ use the table to find the frequency response $H(\omega)$.

I don't have any clue that how to deal with the denominator, could anyone help me please?


texts: Hello World Example of a Digital Waveguide in JavaScript

texts:
I am just learning about sound so might be jumping the gun a bit. But it helps me stay motivated and get into an interesting problem to solve to ask these more complicated questions.
I am looking at Digital Waveguides, and would like to know how to implement them practically in JavaScript. I am new to all these concepts so have done some basic stuff with oscillators and played with Tone.js, but I am not familiar yet with how and where "digital waveguides" would be implemented in the Browser API situation.
I saw the Sound Synthesis Toolkit in C++, and they have a class in there called Mesh2D. I'm not sure if that means Digital Waveguide 2D Mesh or what, but it looks like it's getting close to a hello world example with code snippets like this:
StkFloat Mesh2D :: energy( void )
{
  // Return total energy contained in wave variables Note that some
  // energy is also contained in any filter delay elements.

  int x, y;
  StkFloat t;
  StkFloat e = 0;
  if ( counter_ & 1 ) { // Ready for Mesh2D::tick1() to be called.
    for ( x=0; x<NX_; x++ ) {
      for ( y=0; y<NY_; y++ ) {
        t = vxp1_[x][y];
        e += t*t;
        t = vxm1_[x][y];
        e += t*t;
        t = vyp1_[x][y];
        e += t*t;
        t = vym1_[x][y];
        e += t*t;
      }
    }
  }
  else { // Ready for Mesh2D::tick0() to be called.
    for ( x=0; x<NX_; x++ ) {
      for ( y=0; y<NY_; y++ ) {
        t = vxp_[x][y];
        e += t*t;
        t = vxm_[x][y];
        e += t*t;
        t = vyp_[x][y];
        e += t*t;
        t = vym_[x][y];
        e += t*t;
      }
    }
  }

  return e;
}

My question is, how do I implement this "Discrete simulation of the ideal, lossy waveguide" in JavaScript?

They say "sampling these exponentially traveling waves, etc.", and provide this sampling equation:

How do I connect these "dots" into a function that produces a sound on click, using this digital waveguide system? This would help introduce me into the world of implementation of the theoretical sound stuff, as well as the more advanced sound generation concepts. I am mainly confused what the data is supposed to be and how to map it to an actual sound in JavaScript.
Some related links:

https://www.dsprelated.com/freebooks/pasp/Digital_Waveguide_Oscillator.html
https://ccrma.stanford.edu/~jos/pmudw/