texts: Is it possible to apply a fractional delay to even-length signals using the frequency-domain phase shift method?

texts:
Suppose I have the following Python function to apply any real-valued circular delay to a signal by multiplying by a phase factor in the frequency domain:
import numpy as np

def rfd_shift(sig, delay):
    ft = np.fft.rfft(sig)
    ft *= np.exp(2j * np.pi * delay * np.arange(len(ft)) / len(sig))
    return np.fft.irfft(ft)

Let's use this to apply a delay of 0.5 samples (twice) to an odd-length signal:
>>> sig = np.arange(5)
>>> rfd_shift(sig, 0.5)
array([-0.23606798,  2.        ,  2.        ,  4.23606798,  2.        ])
>>> rfd_shift(_, 0.5)
array([1.00000000e+00, 2.00000000e+00, 3.00000000e+00, 4.00000000e+00,
       3.55271368e-16])

The intermediate result may look a bit unintuitive, but the fact that the second application resulted in a shift of exactly 1 sample suggests to me that this is working.
But if I try the same thing with an even-length signal:
>>> sig = np.arange(6)
>>> rfd_shift(sig, 0.5)
array([-0.23205081,  1.76794919,  2.5       ,  3.23205081,  5.23205081,
        2.5       ])
>>> rfd_shift(_, 0.5)
array([0.5, 2.5, 2.5, 4.5, 4.5, 0.5])

The intermediate result looks similarly plausible, but now the 1-sample delay is not recovered after the second application.
I have tracked down this discrepancy to the fact that in the even case the final frequency bin is shared by the positive and negative Nyquist frequency and so must be real-valued. This leads to the phase factor not being applied fully as this bin is projected onto the real axis when the inverse Fourier transform is performed.
To attempt to work around this, I tried the same with NumPy's FFT functions for complex-valued signals, but I was unable to retrieve a real-valued signal for any fractional delay. There were always significant imaginary components.
My questions: Am I doing something wrong? Is this simply not possible? Do I have to resort to FIR filters to achieve fractional delays for arbitrary signals?


texts: Decimation of signal. How to plot frequency spectrum

texts:
I have an FDM signal from 0 to 70 MHz. The total signal contains 4 FDM signals from (0-fs/4), (fs/4-fs/2), (fs/2-3fs/4) & (3fs/4-fs).
I used fvtool command in matlab to plot these signals.
Then i downsampled the total signal by 4. Downsampling is time is expansion in freq spectrum.
Thus on paper my new signal should occupy freq (0-fs), (fs-2fs), (2fs-3fs) & (3fs-4fs)
When i plot this downsampled signal using fvtool again, i am just able to see my 1st FDM signal ie b/w (0-fs/4) appearing in the plot.
How to view the entire spectrum from (0-4fs) in fvtool.


texts:
So I understand that a type 3 filter is not suitable for a highpass filter design, but is there any reason why it isnt suitable for a lowpass filter?

So ultimately, can a type 3 linear-phase FIR filter be used to design a lowpass filter? Why or why not?


texts:
I'm considering the following simple system model:

$$\mathbf{y}=\mathbf{Hx}+\mathbf{n}\quad\textrm{with}\quad \mathbf{n} \sim \mathcal{CN}(\mathbf{0},\mathbf{I})$$

The resulting MIMO channel capacity for known and constant $\mathbf{H}$ should be:

$$C = \log_2\det\left(\mathbf{I}+\mathbf{HQH}^H\right)$$

where $\mathbf{Q}$ denotes the covariance matrix of $\mathbf{x}$.

In my opinion the channel capacity should be real valued. But if I simulate it in MATLAB and compute the capacity I obtain a complex capacity. I generate a random complex $\mathbf{H}$ since $\mathbf{H} \in \mathbb{C}^{n \times n}$ and chose a random covariance matrix $\mathbf{Q} \in \mathbb{C}^{n \times n}$ which is symmetric and positive semi-definite.

Am I doing something wrong in MATLAB or do I violate and conditions, constraints or rules?

My Matlab code is:

%% Init
N = 2;
% Generate complex random channel H
H = sqrt(1) * (randn(N,N)+1i*randn(N,N));
% Generate complex, symmetric positive semidefinite Q
Q = [1,complex(3,-7);complex(3,-7),13];
%% Check if Q is a valid covariance matrix
% Check if Q is symmetric
sym = issymmetric(Q)
% Check if Q is positive definite
psd = all(eig(0.5*(Q+Q'))>=0)
%% Compute capacity
C = log2( det(eye(N,N) + H\*Q\*H' ) )


texts: What is going on with convolution at the output of a circuit?

texts:
Signal analysis newbie here. I was doing a project which analyzed the noise quality of a signal (it was a white noise generating circuit), and I found that the noise was more random for lower sample rates. I had a ton of capacitors in my circuit so I attributed it to parasitic capacitance on the Zener diode, but my supervisor suggested that another reason could be the fact that with a really high sample rate, my data will look less random -- in that the voltage signal would have varied less due to the fact that the output is a convolution of ... past voltage outputs? So, with a sufficiently slow sample rate this apparently won't happen.

In my head, I'm imagining a nominal output voltage and a few "past" measured voltages being convolved, forming some kind of a band, and this band moves as the signal varies randomly. With a slow enough sample rate, this "band" will have moved sufficiently far away from the previous sample to vary satisfactorily far enough so the voltage input I'm measuring is unaffected by the convolution of a past measured voltage. I know my language here is terrible, but I'm confused.

Can anyone elaborate more about what my lecturer was saying?


texts: What happens if an harmonic in a band-limited signal at Nyquist frequency is added to a 90 degrees out-of-phase replica of it?

texts:
I'm interested about aliasing in digital audio and I wonder if aliasing can be produced by simple mixing of band-limited signals.
As I know a band limited signal can contain frequencies up to sample rate/2 frequency, the so-called Nyquist frequency. Is this right?
If that is so, what will happen if an harmonic in a band-limited signal at Nyquist frequency is added to a 90 degrees out-of-phase replica of it?
Will this create an harmonic with double frequency and could such an addition create aliasing?


texts: generating white gaussian noise in matlab using two different functions

texts:
I want to know the difference between the two Gaussian noises generated below? Which one is white and how can i make the other one white?

y=wgn(1,10000,0)

and

y=randn(1,10000);


texts: Intensity change after filtering this image?

texts:
I need to filter the image raster below with the following mask:

 0 1
-1 0

and the Image Raster:

0 0 0 0 0 1
0 0 0 0 1 1
0 0 0 1 1 1
0 0 1 1 1 1
1 1 1 1 1 1

My results are:

 0 0 0 0 0
 0 0 0 0 0
 0 0 0 0 0
-1 0 0 0 0

In what direction does this mask detect intensity change? What does the sign of the output signal mean?


texts: I am measuring voltages and currents of a 3-phase electrical machine and I need to calculate the power. Every interrupt (frequency between 30-70kHz) I get values (voltages, currents) from analogue-digital converter and I need to do a simple calculation to determine power. However, I was told to use averaging with a first order filter with a time constant of approximate 1s for the power calculation. This, I believe, means low pass filter with a frequency of approximately 1Hz? What is the simplest solution to this? Moving average?


texts: Unique signal extraction from a cumulated signal

texts:
I'd like to start off by saying that I am not very experienced at signal processing, so I apologise in advance if I do not explain everything properly the first time.

I would like to analyse the following

Signal A:

Signal A is a simplified simulation of an air compressor, with the compressor operating between 140 and 160 PSI (YELLOW SIGNAL). The blue and orange lines indicate that a component that draws air from the compressor is active, which you can notice causes dips in the PSI level.

The following signal represents the amount of PSI drawn by the components, causing the noticed drops in PSI:

Signal B:

Signal B is generated by adding two separate pulse generators, and fed through an integrator. I would like to analyse Signal A to obtain each individual signal that makes up signal B.

The two pulses that make up signal B are:

Off for 14 seconds, on for 1 second, amplitude = 1 PSI
Off for 900 seconds, on for 40 seconds, amplitude = 0.5 PSI

I would like some recommendations for what processes to use to achieve this. I have tried wavelets and FFT to no avail so far. I hope to use my findings here to allow me to train a machine learning model to expect drops in air pressure  by X PSI every Y seconds.

NOTE: This signal normally has a slight bit of noise, however I removed it for this post. The components turning on are also not exactly periodic in my actual data (reiterating that this is a simulation), however the times are only ever out by 1% at most.


texts: Signal spectrum when carrier width changes

texts:
If I have spectrum $X_k$ of the signal evaluated at frequencies $k \delta f$ and I want to know what is the value of that same signal at some other frequencies , i.e., $k' \delta f'$.I know that $\delta f$ and $\delta f'$ are somehow reelated (e.g. $\delta f = 12 \delta f'$) how can I express spectrum of the signal with this new carrier spacing ($k' \delta f'$) having only info about $X_k$ or in other words what is the coefficient, $X_k' = coefficient \cdot X_k$.
Thanks in advance for any help.


texts: Is it valid to calculate the magnitude, power, and phase of a real time-domain signal without converting it to the frequency-domain?

texts:
I would assume you perform the calculations the same way, but since there would be no imaginary component because the signal is not complex it would be simpler:

magnitude = |x(n)|

power = |x(n)|^2

phase = 0 (for all values of n) - since there's no imaginary portion the phase equation would always result in a 0 value.

I'm trying to fully grasp and internalize some of the basic concepts of signal processing, and while I haven't ever really seen anyone try to use the equation for phase on a time-domain signal I don't see why it wouldn't be valid even if the results don't have much meaning.


texts:
I have the following difference equation:
$y[n]=y[n-2]-0.25y[n-4]+x[n]-x[n-2]$
I need to find the first 6 values of the impulse response of the system characterized by that equation. When I do that, the values I get are:
$[1,0,0,0,-0.25,0]$, starting from index zero. I have the answer, which states that the right response is $[1,0,0,0,-0.25,1]$. I really cannot find my mistake; any help will be appreciated.


texts: Waveform pattern detection in time series

texts:
I have some IMU data which I am using to detect activity patterns - walking, running etc.
In order to differentiate one activity from another I need to do pattern matching in time series. Different walks will have similar accelerometer patterns but will be either longer or shorter.
I initially thought about using simple cross correlation but I realized cross correlation doesn't work well for signals that are not repeated exactly in time domain. This led me to wavelets which I believe can provide basis functions that can be expanded or squeezed in time scale. Am I on the right path or should I look at other techniques like machine learning or conventional methods like STFT
Ex: Triangular sine wave type patterns with varying period.


texts: Which type of fliter should be designed to remove 50 Hz

texts:
Actually I am using DSP kit TMS320C6711 through which I want to remove 50Hz component out of the signal. I am unable to interface Code Composer studio (v2) with matlab. Therefore, I have designed FIR notch filter using Code composer Studio in which coefficients are taken from fdatool of matlab. Kaiser window has been used for filtering. The problem I am facing here is when lower and upper cutoff frequencies are 35Hz and 65Hz respectively only I am able to manage significant attenuation. When I am trying to get the cutoff frequencies closer, attenuation level is reducing to unsatisfactory levels.
So, please help me to decide the window to be used and order to be selected so that I could achieve significant attenuation of 50Hz component with sharp cutoff frequencies.


texts:
First of all, I am very new to signal processing.
I use FFT to get various characteristics (SNR, THD, etc.) of a sinusoidal wave, represented as a series of double numbers. However, this works only if the wave is "coherent", i.e. the last sample completes the wave. In other words, the number of periods is an integer number. If I just remove a few samples from the wave, I get a complete different FFT result, and the characteristics also look totally different.
Is this a known issue in FFT? If yes, how should such waves be analysed?
Thank you in advance.


texts:
I have a basic question about the formulas represented for discrete sinusoids. In some textbooks we see this form

$$x[n]= A\cos (2\pi f nT + \phi ) $$

and in others we have

$$x[n]= A\cos (2\pi k/N n + \phi ) $$

What $N$ and $T$ stands for? And what is the differences between these two formulas?


texts:
I am just unable to find the correct Fourier transform of these signals (unit step, sine and cosine functions) which are containing delta functions in their Fourier transform.
For unit step function,
I proceeded as -->
$$ U(ω)=\int_{-\infty}^{\infty}u(t)e^{-jωt}dt $$
$$=\int_{0}^{\infty}e^{-jωt}dt$$
$$=\frac {e^{-jωt}}{-jω}\Big|_0^{\infty} $$
$$=\frac {1} {jω}$$
But as I checked this is just a part of the answer as the Fourier transform also includes $\pi δ(ω) $.Now how do I get this? Same is the case for sine and cosine signals. Can anybody derive the answer in simple terms?


texts: how to add two images in one, next to each other

texts:
I have two splited images from diference matlab files. Now i need to merge them, near to each other. I tried supblot, imadd,cat methods, but nothing works. Please help me.

rezult after sublot experiment.


texts:
I am looking for an algorithm that adds borders to a bitmap image(very much like the photoshop stroke effect) but one that will also have antialiasing to the borders(or one that copies alpha from the original bitmap to make the border look antialiased).

If you can't answer with an algorithm a direction of creating one myself would be great.

*****Update***

The part coloured black is the original ellipse and the part coloured green is the stroke.

The stroke is basically adding a contour to the bitmap or edges.


texts: Computer Vision - Does implementation of Hough Transform for lines require a loop for angle parameter?

texts:
I am trying to understand how Hough Transform is implemented in real world applications. Consider a line with equation:

$y = mx + b$

In parametric form, this line can be represented using (d, $\theta$):

$d = xcos(\theta) + ysin(\theta)$

This is the Hough Transform algorithm in simple form, using the parametric form (ref: link) :

Initialize parameter space H[d, theta]=0

for each edge point I[x,y] in the image,

   for theta = [theta_min to theta_max ],

      set H[d, theta] += 1

Find the value(s) of (d, theta) where H[d, theta] is maximum

1) In real world implementations, is the line: for theta = [theta_min to theta_max ] required? Since we apply Canny edge detector to an image, prior to Hough Transform, we can obtain angle of gradient($\theta$) for a point (x, y) from Sobel operators. This can be noted down against (x, y) and later used in Hough Transform algorithm, eliminating one for loop. Isn't this the better, real world approach? Or do we actually implement the extra for loop?


texts: Spectral location of individual OFDM symbols

texts:
The generic IFFT OFDM transmitter takes $N$ serial input data symbols, parallelizes them, maps them to their signal constellation points, and processes all $N$ resultant complex values using the IFFT to produce $N$ subcarriers (assuming no virtual carriers).

The IFFT takes $N$ input values and produces $N$ output values, such that changing a single input value will change all output values. Therefore each input symbol contributes to each of the $N$ subcarriers; each symbol is "shredded" across all subcarriers.

However, several sources state that in OFDM "each modulation symbol is mainly confined to a relatively narrow bandwidth" (Communications Engineering Desk Reference, Elsevier, 2009, 1st ed, p.287).

Are these two different OFDM implementations, or is the IFFT implemented in a different way to achieve this?


texts: Is there any way of retrieving phase information with only access to real part of successive FFT frames?

texts: Due to a limitation of the WebAudio specification the FFT available in JavaScript only makes available the real part (1st half) of the calculated frequency data. Is there any way of recreating the phase information (and subsequently improving interpolation of peak frequencies) using the fluctuations in bin amplitude between frames?


texts: sound source localization - calculation of sound intensity vector angles

texts:
I'm working on an acoustic source separation problem where I want to separate the voices of a choir based on intensity vector statistics.
I'm currently implementing a paper by Günel called “Acoustic Source Separation of Convolutive Mixtures Based on Intensity Vector Statistics” In this paper, the acoustic source separation is achieved in a couple of steps:

the signals from the microphone-array are converted to a time-frequency representation (using the modified discrete cosine transform, MDCT)
The intensity vector direction is calculated and rounded to the nearest degree. All of the obtained directions are then plotted in a histogram to find the mixture probability density. On this histogram, a von Mises distribution is fitted for every source position. (my question is related to this step)
As I understand it, this distribution is then used to define a directivity function for each sound source and a time-frequency bin and beamforming is applied to separate each source.
Finally, the inverse MDCT is calculated for each separate signal, obtaining the separate signals in the time-domain.

So this brings me to my question. After calculating the vector intensity directions for a single source in a simulated anechoic room (pyroom acoustics) and real-life measurements with a GRASS 50VI-1 Intensity probe, all obtained directions are plotted on a histogram and here, something I can’t explain happens. For a source that should be positioned at 45 degrees relative to the microphone array, the histogram shows two peaks. One peak at 45 degrees, but also one peak at 225 degrees (so, 180 degrees shifted).

This is simulated in a 3D space, but for now we are only using 4 microphones to find the source directions, so only finding the azimuth directions. These directions are found using the following formula (in python, we use the arctan2 operator):

where Pw, Py and Px are found by using our microhpone measurements as in the picture below:

I have read countless papers about DAO/separation using sound intensity, but not a single one I found shows any sign of this behaviour or talks about certain assumptions that should be made. It seems they only have a peak in the direction that the sound is actually coming from.
Finally, here is the code I used:


texts: Solve for Transfer Function Coefficients Embedded in a Non Linear System

texts:
Given a complex input signal $x$ and real input signal $v$, a 4th order (for simplicity) transfer function $H(z)$ is first applied to $v$ to obtain $w$, which in the time domain is represented by the linear difference equation:

$$ w[n] = b_0v[n]+...+b_4v[n-4] - a_1w[n-1]-...-a_4w[n-4]$$

Output $y$ is then a function of $w$ and $x$:
$$  y = F(x,w) = c_1x + c_2x|x| + c_3xw +c_4xw^2 $$

In the physical system being modeled, the inputs $x,v$ and output $y$ are known and observable, $w$ is not observable, however.

The coefficients of $H(z)$ are known to a fair degree of accuracy a priori, the question is how to adapt them in order to improve the model accuracy given only the input and output signals?

In reality there are many more higher order terms in $F$, but the representation here should be sufficient to understand the problem.

So far, I am able to solve for the coefficients of $F$ with an ordinary least squares approach.  I can get some improvement by then using a non-linear least squares (Levenberg-Marquardt) approach to improve the estimate of the coefficients of $H$. Intuition tells me I should try to move the zeros and poles of $H$ to improve convergence, but so far I have not been able to connect the dots.  Solutions and ideas are much appreciated!


texts:
Following this link:
http://software.intel.com/sites/products/documentation/doclib/ipp_sa/80/ipp_manual/GUID-5457048E-3C59-43E4-8A99-FB3873DCB769.htm
I have produced the following code:

        const int len = 512;
        Ipp64f pInputSignal[len];

        int tapslen = 27;
        int numIters = len;

        IppsFIRState_64f* pState;
        IppStatus status;

        Ipp64f* pOutputSignal = ippsMalloc_64f(len*sizeof(Ipp64f));
        Ipp64f* taps = ippsMalloc_64f(tapslen*sizeof(Ipp64f));
        Ipp64f* pDL = ippsMalloc_64f(tapslen*sizeof(Ipp64f));

        ippsZero_64f(pDL,tapslen);
        float sample_rate = 48000.0;//Hz //TODO DEFAULT_SAMPLE_RATE
        float frequency = 400.0;//Hz
        float amplitude = 2000.0;

        //Fill pInputSignal[t] = 2*pi*frequency*t, where t is time from t[i] = i/sample_rate
        fillBufferWithSinusoidData_64f(pInputSignal,len,sample_rate,frequency,amplitude);

        //computes tapsLen coefficients for bandstop  FIR filter
        float rFreqLow  = (frequency-52.0)/(sample_rate);
        float rFreqHigh = (frequency+51.0)/(sample_rate);

        status = ippsFIRGenBandstop_64f(
            rFreqLow,
            rFreqHigh,
            taps,
            tapslen,
            ippWinHamming,
            ippTrue);
        Assert::AreEqual((int)IppStatus::ippStsNoErr,(int)status);

        ////filter an input vector
        status = ippsFIRInitAlloc_64f(&pState, taps,tapslen, pDL);
        status = ippsFIR_64f(pInputSignal, pOutputSignal, numIters, pState);

In other words:
Input is a sinusoid at frequency 400Hz
Band stop between 348.0Hz to 451Hz

Expected output : something flat (as I would expect the sine signal would get filtered out).

Actual output : Sine wave moves 1/2 phase, magnitude is lowered a bit.

Any ideas about what went wrong here?


texts: Getting started with wavelet-based real-time anomaly detection for temporal signals using Python

texts:
I have an anomaly detection problem I wanted to consider addressing in software (python) with wavelets.   I’m new to wavelets as well as the python’s spicy.signal wavelet package, let alone with the numerous additional packages floating around out there (e.g., PyWavelets).

Here’s the problem formulation:  Consider a desired low-pass signal subject to various anomalies and a small amount of additive white Gaussian noise (AWGN):

$$
r(t) = d(t)x(t) + n(t) + a(t)
$$

where $x(t)$ is the desired low-pass signal, $n(t)$ is the AWGN, and $a(t)$ are the additive anomalies and $d(t)$ are the multiplicative anomalies.  The anomalies are roughly modeled as a linear combination of scaled and shifted versions of two types of effects: impulsive spikes, exponentially decaying transients.  Multiplicative square pulse-type signal drop-outs directly affect the desired signal:

$$
a(t) = s(t) + e(t).
$$

The spikes can be written as:
$$
s(t) = \sum^{N_s-1}_{k=0} s_k (t)\\
s_k(t)  =  S_k \delta(t-t_k)
$$
where $N_s$ is the number of spikes, $\delta(t)$  is the Dirac delta function, and $S_k$ and $t_k$ are the amplitude and delay associated with the $k$th spike

The exponential transients are written as:
$$
 \begin{align*}
 e(t) & = \sum^{N_e-1}_{k=0}e_k(t)\qquad
 e_k(t)  = \left \{  \begin{array}{lll}
         E_k \cdot \exp({-[t-t_k]/\tau_k} )&& t\ge t_k\\
         0 && t< t_k
        \end{array}
       \right .
 \end{align*}
$$
where it is assumed that the transients are well-separated in time and $\tau_k$ are known not to exceed some maximum.

Dropouts are crudely modeled as product of scaled and shifted square pulses:
    \begin{align*}
 d(t) & =\prod^{N_d-1}_{k=0}d_k(t)\\
 d_k(t) & = \left \{  \begin{array}{lll}
               \epsilon_k && t\in[t_k, t_k+T_{d_k}]\\
               1 &&  t\notin[t_k, t_k+T_{d_k}]
        \end{array}
    \right . \qquad \epsilon_k\in[0,1)
 \end{align*}
where it is assumed that the drop-outs do not overlap in time and that $T_{d_k}$ are less than some maximum.

The goal is to flag the time intervals affected by the anomalies which are further assumed to arise one at a time (e.g., a spike will not occur in the middle of a dropout).  The exponential transients are considered to be non-negligible for a limited period of time (say up to 90% attenuation from the start of the transient).

I don’t want to rely heavily on a precise parametric model for detecting the anomalies since the above anomaly modeling is only a crude approximation.  It seems like wavelets may be a good method for localizing these effects in the received signal.  The desired signal’s bandwidth is far lower than that of the anomalies which overlap and extend beyond the desired signal bandwidth.  It is necessary for the detection procedure to be at least near real-time.

I don’t know much about wavelets aside from a few very basic tutorials and I haven’t played with any python-based wavelet packages.

My questions are as follows:

1) Are wavelets indeed well-suited to this type of detection problem?  If not, what other approaches would make sense to try?

2) If wavelets do make sense here, what type of wavelet transform should be considered (e.g., continuous or discrete)?

3) What type of mother wavelets should be tried here?

4) Are the wavelet routines in scipy.signal adequate for a preliminary, meaningful study?  If so, which are the relevant functions?  If not, which package would be preferable?  PyWavelets?

5) Can anyone point me to resources that have addressed directly similar problems?


texts:
I am new to signal processing. I am trying to use the output of a sliding DFT to analyse frequency peaks. Take for instance this implementation:

https://github.com/bronsonp/SlidingDFT/blob/master/sliding_dft.hpp

How do I find the normalised magnitudes for each SDFT bin?

Thanks.


texts:
If I am looking to do a PSD plot on a signal $x(t)$ with units $m$ then the units I am expecting in the PSD would be $\frac{m^2}{Hz}$ but I can't seem to get this result from the following reasoning:

If we consider the fourier transform
$$ F(k) = \int^{\infty}_{-\infty} x(t) e^{-2\pi i k t} dt  $$
I think this should have units $ms$ then the PSD should be
$$|F(k)|^2. $$
Which should have units $m^2s^2$ or $m^2Hz^{-2}$ which is not $\frac{m^2}{Hz}$. There is probably an obvious mistake here but I can't see it, can anyone help?


texts: Filtering noise and identifying phones boundary in speech recongition

texts:
I am planning to do a self project on speech recognition for a vocabulary detection system using arduino. I know CMUsphinx or bitvoicer is probably the way to go. But I would like to code the project from the ground up as the purpose of the project is learning.

I have been reading different papers like

http://revistaie.ase.ro/content/46/s%20-%20furtuna.pdf (dynamic time warping)

http://citeseer.ist.psu.edu/viewdoc/download;jsessionid=DEC7F40E5AE89F1508A3B6D0625CC1DA?doi=10.1.1.131.2084&rep=rep1&type=pdf
(HMM)

But I have encountered the following difficulties

I have a hard time reconciling the entire process with higher level algorithm. From what I have read so far the entire process is the following

i. input signal

ii. filter all noise, getting all signals that is high energy volume and low frequency. (How do I know what to compare against? What is consider high energy volume, and low freqency?)

iii. divide the signal into phones using FFT (where do I get dataset for phones, what constitutes a boundary between two phones, and how similar does the detected phones have to match the dataset?)

iv. matching the list of phones to each word using HMM or DTW

For beginners like me I feel that steps 2-3 is the hardest part due to the difficulties I listed.

Can someone point me a direction?

Thanks


texts: Need help with detecting onset of audio in wav file

texts:
I'm new to DSP and I'm learning as I go. I have an audio file with a chirp signal(2kHz). I played and recorded this chirp signal and the recording has a lot of environmental sounds.

Here is my code:


texts: What should be considered when selecting a windowing function when smoothing a time series?

texts: If one wants to smooth a time series using a window function such as Hanning, Hamming, Blackman etc., what are the considerations for favouring any one window over another?


texts:
I've been googling for a while and came across the audio cookbook and Bjorn's blog explaining it further Link Here.

Background info: I've modified the rtl-sdr open source code to tune to a VOR station (transmits heading, typically used for aircraft). I tune to 113.1 MHz which is the the frequency the nearby VOR station transmist data. Inside that 113.1 MHz frequency, there are 3 signals;

Morse Code at 1020Hz
Reference Signal (9960Hz +- 480Hz) (FM this signal, inside this there is another 30Hz signal)
Variable Signal (30Hz)

I'm trying to isolate these signals. Now when I tune to the station (113.1MHz) and perform amplitude modulation, I can hear the Morse code signal from the speaker with lots of noise in the background. I followed the audio cookbook guide along with Bjorn's implementation to write a BPF function (pasted below) to isolate the Morse code signal (1020Hz) to hear only the morse code with very little to no noise in the background. However, I just about hear nothing, it's like someone just really lowered the volume almost to mute. I'm starting with this because if I can actually hear the morse code signal, then that proves that the BPF works and now I can use that function to isolate the other two signals.

The values I used to compute a0 to b2: I also did normalize the a0 to b2 values.

Sample Rate: 24KHz
Center Freq: 1020Hz
BW (in octaves): 1 (don't really understand this)
gain: 1 (assuming 1 should be ok but again not really sure)

BPF Function in C Language:

int band_pass_fir(struct morse *_m, int16_t *_signal, int _len)
{
  // _m->signal (int16 array) is my desired output
  // _signal (int16 array) contains the actual amplitude modulated data received from the signal
  // _len is the length of _signal

  int i = 2;

  const float b0 = 0.1205498139,
              b1 = 0,
              b2 = -0.1205498139,
              a1 = -1.7626236142,
              a2 = 0.8273910712;

  while (i < _len)
  {
    _m->signal[i] = (int16_t)(b0 * _signal[i]) +
                    (int16_t)(b1 * _signal[i-1]) +
                    (int16_t)(b2 * _signal[i-2]) -
                    (int16_t)(a1 * _m->signal[i-1]) -
                    (int16_t)(a2 * _m->signal[i-2]);

    _m->signal[i-2] = _m->signal[i-1];
    _m->signal[i-1] = _m->signal[i];

    i++;
  }
}

Questions:

To isolate this 1020Hz signal, is it safe to assume I need a BPF? or do I need some other type of filter?
Assuming whatever type of filter I need to isolate the 1020Hz would be the same type of filter I would need to isolate the 30Hz signal (variable signal) ? Is that correct?
Do you see if I'm doing anything wrong with my above method?


texts: Tracking unknown number of signals/coordinates

texts:
I have a time series data. Where for every time step I have a varying number of object coordinates. I want to track these over time. There might also be some missing coordinates for a few frames. Ideally, given the time series input and I am looking to find out a list of tracks and their respective start and end time.

What kind of algorithms am I supposed to use? Are there any implementations available.


texts: Signal vs. noise at a particular frequency

texts:
I collect samples (time series) at a frequency.  The sample rate is arbitrary (I can change it to whatever I want.)  I want to determine if what's at this frequency is a signal, or (normally distributed) noise.

I've tried using a normality test (from scipy); that didn't seem to work - there were no big differences in the results when what was at the frequency was a man-made signal (center frequency of an FM broadcast station, for example) vs. noise.  I tried using auto-correlation using Pandas - Pandas always thought it was noise.

Are my techniques off?  Perhaps the techniques are good, but I need to sample different (I've been sampling about every two seconds, for, say, 100 samples)?  Something else?


texts: How Is the MATLAB `filter()` Function So Fast?

texts:
How is the filter() implemented in MATLAB? How is it so fast?
What's the fastest implementation of a FIR filter?


texts: Simulation of wireless communication system

texts: In monte carlo simulation of the wireless communications system why we multiply noise by SNRlin( Signal to Noise Ratio in linear). What is the logic behind doing this. Any help in this basic doubt is highly appreciated.


texts: Modeling spring oscilliations with electric noise (50 hz)

texts:
I have Analog to Digital converter from which I get data of measurements of 1kg load.
The aim is to model the simple spring-damper system, so that after entering correct initial data (x[0] = a, x'[0] = b) the model will give almost the same data as the original data from converter.

It is my first modeling attempt of a such real system. The problem is that the data from converter contains the 50Hz noise (electricity frequency) and if I use FIR filter I am afraid that the initial values needed for modeling the same wave data will be corrupted. How this process is done usually? As for modeling equation I use mx'' = -kx - c x'. And I have made numerical solution for this equation.

Edit 1: How about not filtering but modeling the system with taking into account the electrical noise?


texts:
I am building a variometer as a hobbie, this could be a duplicate from an existing question: How to use Kalman filter for altitude prediction based on barometer data? .

Details follow:

I have a https://es.wikipedia.org/wiki/NodeMCU running http://www.micropython.org/ , it works nice and I have attached a BMP180 barometric pressure sensor, so I can retrieve: temperature, pressure and altitude, however, while the sensor is fixed in my desk and if I read from three seconds I can get values that range from (982.409 to 983.956 ) in terms of altitude, see the log:  https://pastebin.com/C3RbuyDn . So there is an error margin of more than 1 meter .

I would like to use it as a variometer for paragliding, and I only have the pressure sensor, I read it is better to combile with a magnetic sensor, however I want to keep it simple, so it is possible to have an accurate variometer with just the pressure sensor and some algorithms behind and off course with no lag ( no more than 1 second ) ?

Is there any existent algorithm for getting the variation (m/s) with just one variable (altitute) and also considering this chip report the altitude ?

Please look at the data referenced in pastebin .

Thanks for your time.


texts: Why duplicating the signal length alters magnitude in FFT spectrum?

texts:
I have a signal vector x=[a b c..] having 10 data values. I replicated this signal and created another vector y=[a b c.. a b c..] totaling to 20 data values.

But the Magnitude FFT spectrum results of signal x and y are different i.e. abs(fft(x)) and abs(fft(y)) are different. Any reasons what is happening.


texts: Identifiability for Time Invariant State Space Models

texts:
Kevin Murphy's Kalman Filter toolbox (for Matlab) contains an example where it's the fact that the state space system in not identifiable causes problems. I include the example in it's entirety but you won't actually be able to run the code without installing the toolbox first. See the comments between the code blocks where he notes the systems lack of identifiability.

Q1.) Can someone please explain why the system below is not identifiable.

Q2.) Can someone please given general rules for determining whether a time invariant state space system is identifiable or not.

% X(t+1) = F X(t) + noise(Q)
% Y(t) = H X(t) + noise(R)

ss = 4; % state size
os = 2; % observation size
F = [1 0 1 0; 0 1 0 1; 0 0 1 0; 0 0 0 1];
H = [1 0 0 0; 0 1 0 0];
Q = 0.1*eye(ss);
R = 1*eye(os);
initx = [10 10 1 0]';
initV = 10*eye(ss);

seed = 1;
rand('state', seed);
randn('state', seed);
T = 10000;
[x,y] = sample_lds(F, H, Q, R, initx, T);

% Initializing the params to sensible values is crucial.
% Here, we use the true values for everything except F and H,
% which we initialize randomly (bad idea!)
% Lack of identifiability means the learned params. are often far from the true ones.
% All that EM guarantees is that the likelihood will increase.
F1 = randn(ss,ss);
H1 = randn(os,ss);
Q1 = Q;
R1 = R;
initx1 = initx;
initV1 = initV;
max_iter = 100;
[F2, H2, Q2, R2, initx2, initV2, LL] =  learn_kalman(y, F1, H1, Q1, R1, initx1, initV1, max_iter,1,1);

Thanks

Baz


texts: Inconsistant Variation in BLE Beacon RSSI Values for Distance Measurement

texts: I am developing an application to estimate the distance to a BLE Beacon using its RSSi values measured from a Mobile Phone. But when I started to collect data I could see that they varied so much that I cannot possibly estimate the distance using the values. Even though I implemented mean and median filters with various window sizes, the RSSI values are highly varying. Is this a common problem with RSSI values ? Is there a way to eliminate/filter out these variations so that I can input them to a distance modal ? Help is greatly appriciated.


texts: Total Variation of a Signal - Is It Proportional to Signal Energy?

texts:
In an audio application, I found it very useful to measure the total variation of a signal $y[n]$
$$\sum_{n=n_0}^{n_0+N} |y[n]-y[n-1]|$$
over a window of time length $N$ (discrete analogous to total variation of a function).
I've noticed that:

during "background noise only" parts of the signal, this total variation is low

during "background noise + musical sound" parts of the signal, the total variation is strictly higher.

Thus, it worked well in my application for envelope detection, etc. After doing my application, I heard about total variation denoising, and it seems to confirm why it works:

It is based on the principle that signals with excessive and possibly spurious detail have high total variation, that is, the integral of the absolute gradient of the signal is high.
This noise removal technique has advantages [...] total variation denoising is remarkably effective at simultaneously preserving edges whilst smoothing away noise in flat regions, even at low signal-to-noise ratios

The total variation of the signal over a time-window is in fact the distance traveled on the y-axis by the 1D-curve $n \mapsto y[n]$, so we understand why it works:

when the signal is noise only, the waveform of the signal "travels" at a nearly-constant rate (see left of the following image)

when the signal is noise + musical sound, the waveform of the signal "travels" more! (see right of the image)

Now the question:
Question: It seems that the total variation of the signal over a time-window is more or less proportional to the energy present in the signal during this window. Is this true? At least for signals with a zero mean?


texts: Simultaneously minimize and maximize two cost functions

texts:
I want to solve the following optimization problem, in which I have two cost functions $J_1 = \mathbf{w}^T R_1 \mathbf{w}$ and $J_2 = \mathbf{w}^T R_2 \mathbf{w}$, where $R_1$ and $R_2$ are covariance matrices (symmetric PSD).

The problem is to find $\mathbf{w}$ such that $J_1$ is minimized and $J_2$ s maximized constrained on $\mathbf{w}^T \mathbf{w} = 1$.

NB:- This problem arises in signal processing algorithm development and hence posted in this forum.

Thanks for any help.

Purna.


texts: How to concatenate IIR filter (Butterworth) with a Matlab function and evaluate the integral

texts:
I have a function of $j\Omega$ and $v$ (velocity), i.e.:

$$A(j\Omega,v)=\frac{(j\Omega)^2}{p + \frac{j\Omega}{v}}$$

where $p$ is the pole.

I want know how $A(j\Omega,v)$ modify its behavior, when I insert another cascade filter $F(j\Omega)$.

In this case I would like study the power of this system via Parseval's theorem:

$$P(v) = \frac{1}{2 \pi} \int_{-\infty}^{+\infty} \big|A(j \Omega,v) F(j\Omega)\big|^2 \text{d} \Omega$$

Until yesterday, I have used always the same $F(j\Omega)$, so the Matlab code was long, but simple:

acc = @(w,v) ...
    abs( ...
    ((1i.*w).^2).* ...
    (1./(.1+1i.*w./v)) .*...
          ((0.0612.*(1i.*w)+1)./ ...
          (3.375e-06.*(1i.*w).^4+0.0001057.*(1i.*w).^3+0.0167.* ...
          (1i.*w).^2+0.0612.*(1i.*w)+1)) ...
    ).^2;

q = zeros(v_min, v_max);

for v = v_min:v_max;
    q(v) = integral(@(w)acc(w,v), 0, Inf)./pi;
end

Where the second part of acc is the filter.

This code works and everything is OK.

Now, I do not want put that filter, but several kind of IIR Butterworth low-pass filters.

A series, with $F_c = constant$, but with order N = 1:10.
A second series, with $N = constant$, and Fc = [1 2 4 8 16 32 64 128]Hz.

I know that the code for generate these filters is:

h  = fdesign.lowpass('N,F3dB', N, Fc, Fs);
Hd = design(h, 'butter');

but my questions is: how concatenate this filter with a Matlab function, i.e.:

A = @(w,v)(((1i.*w).^2).*(1./(.1+1i.*w./v)));

for evaluate the integral?


texts: What is the impulse response of SIMO channel and its equivalent in oversampling?

texts:
1- According to the below paragraph :

Could someone explain, What mean M here? I mean when saying with Order M ?

2- On the other hand,  When performing Fractional sampling, for example sampling with rate Ts/G (Ts is the sampling rate used at transmitter, and G the oversampling facto), we are expecting to get a discrete-time CIR with GxL channel taps at Ts/G spacing. (exactly as explained in answer below by Zeyad_Zeyad),

So the question, is it right that channel response in above equation is similar to SIMO channel response?  how ?

Thank you


texts: find time domain sequences using DTFT definition (NOT IDTFT)

texts:
The sequence is X(e^jw) = 3 + 2cos(w) + 4cos(2w), and the problem asks to use the definition of the DTFT to find the corresponding sequence.
I have tried using the IDTFT and integrating, but I could only find the first term which is a 3*delta function.
The book specifically wants you to use the DTFT definition, so I thought maybe I could just divide each term by e^-jwn?
could anyone please give some guidance? I am also trying to check my answer with MATLAB. thanks.
MATLAB code:
k = -500:500;
w = k*pi/max(k);

xn0 = 3;
xn1 = 2*cos(w)/exp(-j*w);
xn2 = 4*cos(2*w)/exp(-j*w*2);

n = 0:9;
x = [xn0 xn1 xn2 0 0 0 0 0 0 0];

stem(n,x);

X = dtft(n,x,k);
figure; plot(w/pi,abs(X));

X_check = 3 + 2*cos(w) + 4*cos(2*w);
figure; plot(w/pi,abs(X_check));

DTFT function:
function X = dtft(n,x,k)
% DESCRIPTION
%  Performs an approximate Discrete Time Fourier Transform
%  the approximation is due to the fact that the output is
%  not continous. ex. X = dtft(n,x,k);
%
% NOTE : Only for finite duration signals.
%
% INPUT VARIABLES
%  n = number of samples
%  x = array containing time domain signal samples
%  k = evenly spaced divisions of omega (frequency)
%
% OUTPUT VARIABLES
%  X = the transformed output
%  Various graphs of signal aspects
%
% REFERENCES
%  Adapted from "Digital Signal Processing Using MATLAB 3rd ed." - Ingle, V.,
%  Proakis, J. (pg. 65).
%
% DOCUMENTATION
%  ver 1.0 by Dominic Meads  5/8/2020
%  filename: dtft.m
%
% ENGINEER'S COMMENTS
%  The authors reccommend to use this more as an
%  excersize rather than a full function. As stated above, use the DFT for
%  better results.
%

kmax = length(k)-1;

w = (pi/kmax)*k;  % calculates the evenly spaced frequencies
X = x * (exp(-j*pi/kmax)) .^(n'*k); % calculates the DTFT
end


texts:
I have created a Common Lisp Library to receive samples of an FM signal from BladeRF1 SDR. I want to write a subroutine to implement FM demodulation. The input should be in the format of IQ data.

What is the algorithm for demodulating an FM signal?


texts: Matched filter for "amplitude SNR" vs power SNR

texts:
I am working on an application for which a matched filter seems like the right concept.  In the derivation for the matched filter which I went through (here), they define the SNR as the ratio of signal power to noise power as the basis for the derivation of the expression for the matched filter.  I think that for my application, the "amplitude" SNR would be a better target for optimization.  However, it looks like I reach a mathematical dead-end that is avoided by the use of the power SNR.  Below is my work which roughly follows the derivation from wiki:

Is there a manipulation I am missing that could get me past this obstacle or does someone know if this result has been solved for already?  I have not found it anywhere.


texts:
This question is about 1-d signals.

I have an array of size X with the signal on which I preform Fourier transformation using FFTW.

Is there a way to use the frequency domain data from this transformation to get an array of size X * 2 that contains the time-domain signal resampled to twice the original sampling frequency?

Would that be the same as doing linear interpolation on the original array?


texts: Is there any problem with my FFT method?

texts:
I am trying to analysis a system by Fourier Transform. my system has 3 dominant modes. (1,0.05) (0.51,0.01),(0.46,0.01) the pairs are defined as (freq,damping_ratio)
I've got those result with eigenvalue analysis.the system contains 3 signal.so these frequency[1,0.51,0.46] must be find in these three signals too. so I've run FFT but I didn't see these frequency in the plot. what is the problem in your mind? why these frequencies do not exist in FFT plots?
 Here you can get the signal this txt file contain 3 signal in it. I put last signal FFT(PSD) here.  Tnx

as you see those frequencies don't exist in the 3rd-signal. its same for other 2 signals too. Also I will put my codes here.

t=linspace(0,30,3012);
fS=ceil(inv(t(2)-t(1)));
x=data(:,3);
 Nfft = 10 * 2^nextpow2(length(t));
    psd = 20.*log10(fftshift(abs(fft(x,Nfft))));
    freqs=[0:Nfft - 1].*(fS/Nfft);
    freqs(freqs >= fS/2) = freqs(freqs >= fS/2) - fS;
    freqs=fftshift(freqs);
    figure(1);
    plot(freqs, psd);
    xlim([-1.5  1.5]);
    xlabel('Frequency / Hz');
    title (sprintf('PSD'));


texts: How to measure/estimate symbol rate of a signal with unknown ( but probably QAM ) modulation?

texts:
Is it possible to estimate the symbol rate of a signal whose modulation is not know exactly but it can only be guessed that it is probably some kind of QAM (probably 64 or 256).

What is the best way to get an estimate for the  symbol rate of a signal of unknown modulation?

For example by feeding the signal through some non-linearity and then looking at it's spectra, should that reveal something about the symbol rate ?

More precisely, I have a 10 MHz wide signal recorded with an SDR at 2.45GHz. It is emitted by a wireless camera.


texts:
If the homography matrix of Image 1 to Image 2 is given, and another homography matrix for image 2 to image 3 is given, how do I calculate the homography matrix for image 1 to image 3?
PS : I need the homorgraphy matrices to be 3x3 only because I would be working on a large dataset.


texts:
Let $a$ and $b$ $\in \mathbb C^N$ and $a[k] = a[k \mod N]$ (same with b). Then the circular convolution of $a$ and $b$ is defined by

$$ (a * b)[n] = \sum_{p=0}^{N-1} a[p] b[n-p].$$

I have a problem understanding the flip operation on the convolution. Let $(Ja)[n] = a[-n]$, then

$$ J(a*b)[n] = \sum_{p=0}^{N-1} a[p]b[-n-p].$$

so we first apply the convolution and then we flip the n - is this correct? Or do we flip the whole index of $b$, meaning that

$$ J(a*b)[n] = \sum_{p=0}^{N-1} a[p]b[-n+p].$$
 On the other hand we have

$$((Ja)*(Jb))[n] = \sum_{p=0}^{N-1}a[-p]b[n+p].$$
so we first flip $a$ and $b$ and then apply the convolution. However, my book says $J(a*b)[n] = ((Ja)*(Jb))[n]$, which is not the case with my calculation, so I'm sure did something wrong. Can you help me finding the logical mistake here?


texts: Finding horizontal count of items in an image

texts:
I'm trying to find the count of horizontal columns in an ordered image (a sprite image that is used to generate an animated image):

From this image, I'm trying to generate a meta-data file like so:

{
"frames": 12,
"cols": 6,
"width": 102,
"height": 89
}

Frames would be the total count of "elements" in the image, columns is the horizontal column count, and width/height is for the individual "element" and can be calculated, once you know the column count.

What I Have Already

I've been using numpy/scipy/python mainly since I am a Python guy, but not too experienced with scipy.

This answer showed me how to get the total count of elements in an image and got me this far ipython:

Where I'm Stuck

On most simple images, the ndimage.label works well, but once the image gets too dense, it seems to fall apart.

I've tried using a kind of line-by-line average of the file: subtract 1 horizontal line, get the ndimage.label count of total elements in the picture, then keeping subtract the whole image to build buckets and calc the average std deviation for the image; which would be the horizontal count. But this still isn't accurate on dense images like this:

Would anyone have suggestions for a better algorithm or counting method?
Thanks!

For ease of hacking I have a zip with the ipython notebook and sample images available here: http://asktherelic.com/priv/sprite_sample.zip

And it looks something like this currently:
http://asktherelic.com/priv/sprite_sample.html


texts: Question related to Discrete signal convolution

texts:
I have two finite signals $x[n]$ and $h[n]$, I want to convolve these signals

using the method defined in Example 2.2 of Signals and Systems by Oppenheim. I am getting this answer

$$ y[-3]=4, y[-2]=11, y[-1]=12, y[0]=8, y[1]=0, y[2]=-2, y[3]=-2, y[4]=-1 $$

and when I tried to solve this question using the method defined in example 2.1 of Signals and Systems by Oppenheim, I am getting different answer. Shouldn't  it be the same?
$$ y[-5]=4, y[-4]=11, y[-3]=12, y[-2]=8, y[-1]=0, y[0]=-2, y[1]=-2, y[2]=-1 $$
its 2 unit shifted right side


texts: Sine Dipole formation using two hydrophones

texts:
I am trying to do MATLAB simulations for generation of SINE Dipole using two hydrophones spaced distance 'd' apart for signal coming from direction 'DOA'. The MATLAB code is given below. The confusion is that there is constant phase difference of 90 degree b/w SINE Dipole generated using difference of two hydrophones and simple SINE Dipole generated by multiplication of signal with sin(DOA). There is also a difference b/w amplitude of two Dipoles. The resultant graph of MATLAB code is also attached.
Am i doing right or something is not right in my understanding?
clc
clear
close all

f_sig = 800;%signal frequency in Hz
f_samp = 64000; %Sampling rate
N=81920;%no of data points
c=1500;%sound speed in water in m/s
d=50e-3;%spacing b/w two omni directional hydrophones

DOA=135;%Direction of signal in deg

t=(0:N-1)/f_samp;

lemda=c/f_sig;

Hyd_1=sin(2*pi*f_sig*t+2*pi*(d/2)*sind(DOA)/lemda);
Hyd_2=sin(2*pi*f_sig*t-2*pi*(d/2)*sind(DOA)/lemda);

%Formation of Sinusoidal dipole using two hydrophones Hyd_1 & Hyd_2
Sine_Dipole_1=(Hyd_1-Hyd_2);

%Formation of Sinusoidal by multiplying with sin(DOA)
Sine_Dipole_2=sin(2*pi*f_sig*t)*sind(DOA);

plot(Sine_Dipole_1(1:1000))
hold on
plot(Sine_Dipole_2(1:1000),'r')


texts: For numpy's rfft function, the length of the output is about half of N, the length of the input sequence. What is the reason behind this? What are the frequency bins?


texts: Circular buffer wrap around with chorus effect

texts:
I am developing an embedded DSP audio processor and am trying to implement a chorus effect. To my understanding, the chorus effect is multiple delayed versions of the original signal, where the delay itself is random. In my program I have set the delays to be randomly defined upon initialization and then remain static during the program execution.

The challenge I'm faced with is that in using a circular buffer to store my past signal, I cannot simply wrap delayed signals back around the circular buffer as there is multiple delays present.

With a single delay I can simply check if the delay required exceeds the current position in the circular buffer, if so, I can jump to the end of the circular buffer subtract the delay and add my current position in the circular buffer.

if (Delay > Current_Position_in_Buffer)
{
    Circular_Array[Length_of_Array + Current_Position_in_Buffer - Delay];
}
else
{
    Circular_Array[Current_Position_in_Buffer - Delay];
}

Is there an efficient way to check and adjust the position in my circular array of each delayed signal, without separately checking each delay with an if statement?


texts: The order of processing the prerecorded samples (DC removal, Hilbert transform, frequency shifting)

texts: I have a samples prerecorded by a radio device. Samples are not in baseband, contain large DC component and include only one channel (written in int32 format). My goal is to move it to the baseband, remove the DC spike and perform Hilbert transform to make it complex for further processing. My question is, what is the correct order of performing mentioned computations? Or it doesn't matter? I assume that first I need to remove DC by calculating mean (DC component) and correct each sample. Then go with Hilbert transform to get complex representation of the signal. After that I need to multiply the signal by a complex waveform to move it to the baseband. Can anyone confirm that my way of thinking is right or correct me if I am wrong.


texts:
My understanding of DFT is as follows

For a signal $x[n]$ of finite-length, the DFT is DFS of the periodic extension, $\tilde{x}[n]$, of that signal $x[n]$ and also another way to view DFT is that it’s a sampling of continuous DTFT.

Given that it is possible to reconstruct a original signal from sampled signal, provided the sampling is greater than Nyquist frequency.
We know that the DTFT for sampled signal is a series of replications of the spectrum of the original signal at frequencies spaced by the sampling frequency. Now, since DTFT is continuous and periodic, we can further breakdown DTFT at intervals and still be possible to reconstruct the DTFT and consequently the original signal.  This act of breaking down or sampling the DTFT is called DFT.

Is my interpretation of DFT correct? I would welcome any (true) facts or implications to test my understanding


texts: Preparations to implement FFT on a wav file (code Java, not Library)

texts:
I am making preparations to implement FFT on a wav File.wav Only Java.
I'm reluctant to use matlab

I have a File wav stereo, 16 bits.

I need to calculate the FFT, but I have confusing.

My File has a Frequency of 44100, the samples in bytes are 10 minuts ->

(10 minuts)*(60 seconds)*(44100 sample rate)*(2 bytes because are 16 bits)
= 52920000 >~ 52MB per channel.

As you can see it's a big file.

1. Question.
Can I to split my file in order to make smaller calculus?
If yes, My file can be variable, How I can calculate a moderate lenght working in function of frequency (greater frequency will need greater length FFT).

2. Question.
According to FFT the size need to have a lenght = mantissa = Pow(2, Integer).
Can I to fill with zeros to reach Pow(2, Integer), Example I have a file with a lenght of 65000 samples, then I will need a FFT with order of 16 -> mantissa = 65536, Can i to fill with zeros the others 536 samples?

Thank you.


texts:
I am struggling to find or derive the relationship between Doppler frequency and the associated phase shift.  Let's say I have a signal transmitted at a given frequency $f_c$.  I then down convert from $f_c$ to baseband at the receiver, but due to speed between the transmitter and receiver, I receive a frequency shifted by a Doppler frequency $\Delta f$.

If I wish to generate a matching signal to that being received, I can use

$$
\cos(2 \pi \Delta f t + \phi) + i \sin(2 \pi \Delta f t + \phi)
$$

The part I'm struggling to get to grips with is how does $\phi$ relate to $\Delta f$?  Is it simply the integral of $\Delta f$ with respect to time?

$$ \phi = \int_0^t \Delta f dt $$


texts: Understanding a mathematical statement in image processing

texts:
I am reading a document on Image processing and couldn't analyze a statement in it.

  For any $k \in \Psi_s$, the family of values $\{u[\varphi(p+l)+k-l]:l \in \Psi_s \}$ is
  representative of the value of...

The variables are explained below
$k$,$p$,$l$  - pixels
$u()$      - image intensity
$\Psi_s$     - patch of size 5x5 or 9x9 and so on.
$\varphi()$    - mapping function corresponding to that pixel

how do i get the values mentioned? i have tried to check other documents but couldn't find any.


texts:
I am doing some research into GNSS (Global Navigation Satellite Systems) and have come across various signals listed as having the in-phase or quadrature channels modulated with BPSK(2) or BPSK(10), etc.  However, I am struggling to find a definition of BPSK that includes this additional parameter.

What does the (n) signify in BPSK(n)?

I understand the basic concept of BPSK - Binary Phase Shift Keying and have implemented this in very basic tests by multiplying the LO by 1 or -1 for a 1 or 0 chip respectively.

It has been suggested by a colleague that the n is simply the chip rate and that BPSK(1) is a chip rate of 1MHz, BPSK(2) 2MHz, BPSK(10) 10MHz, etc. as mentioned in the comments by Jim Clay.


texts: Differences Using Maximum Likelihood or Maximum a Posteriori for Deconvolution / Deblur

texts: Are there any differences if you use Maximum Likelihood or Maximum a Posteriori to estimate the Point Spread Function for image deconvolution?


texts:
I have a MxN image matrix in, and need to get out matrix out size MxN as follows:

Each point out[i,j] is the average of all in[i,j] inside a window size WxW (if boundary allows). For example if W=10

out[10,10] is average of in[5:15,5:15]

out[1,1] is average of in[1:5,1:5]

This can be implemented as a correlation with ones(1:W,1:W)/W^2, but at the boundary the result is not correct. How should I apply the convolution? I tried pad zeros, reflect but it's not correct yet


texts: What is the transfer function of this block diagram

texts:
I and my friend have different answer for this block diagram

Mine:
$$y[n] = -\frac23x[n] + x[n-1] -\frac12[n-2]$$

Hence

$$H(z) = \frac{1}{-\frac23 + z^{-1} -\frac12z^{-2}}$$

My friend:
$$q[n]=x[n]-\frac12q[n-1]$$
$$y[n] = -\frac23x[n]+q[n-1]$$
$$Y(z) = \frac23X(z)+z^{-1}Q(z)=\frac23X(z)+z^{-1}\frac{X(z)}{1+\frac12z^{-1}}$$

Hence

$$H(z)=\frac{Y(z)}{X(z)}=\frac23+\frac{z^{-1}}{1+\frac12z^{-1}} = \frac{4z^{-1}+2}{3+\frac32z^{-1}}$$

I don't know how can he come to that result but I'm not sure about mine either


texts: How can I plot the frequency response on a bode diagram with Fast Fourier Transform?

texts:
Assume that we have an unknow dynamical system and we only want to estimate its parameters. The system can be discribed as:

Continous time:
$$G(s) = \frac{3s + 5} {5s^2 + 3s + 2}$$

Discrete time with sampling time $h = 0.5$:

$$G_d(z) = \frac{0.36735z -0.15316}{z^2 -1.6551z + 0.74082}$$

My goal is to find the amplitudes of $H(z)$ and its frequencies by using  Fast Fourier Transform(FFT). Later I'm doing system identification to find the model $H(z)$ of the input and output data.

I first begin to do the frequency input response that changes over time.

$$u(t) = A(t)sin(2 \pi \omega(t) t)$$

Where $A(t)$ is the amplitude over time and $\omega(t)$ is the angular frequency rad/s over time.

Now I want to find the amplitudes and frequencies:

$$H(z) = \frac{Y(z)}{U(z)} = \frac{\mathcal{F}(y(t))}{\mathcal{F}(u(t))}$$

Question:

How can I do that?

I first begin with to create the transfer function and it's response $y(t)$

t = linspace(0.0, 10, 3000);
w = linspace(0.0, 100, 3000);
a = linspace(0.0, 10, 3000);
u = a.*sin(2*pi*w.*t);
G = tf([3 5], [5 3 2]);
Gd = c2d(G, 0.5);
y = lsim(Gd, u, t);

And the input $u(t)$

And how I try to do FFT on both $u(t)$ and $y(t)$

fy = fft(y);
fu = fft(u);
H = fy./fu;
plot(w, H);

But that does not work for me! Why?

Update:

I have made this MATLAB code.

% Data
close all
t = linspace(0.0, 10, 3000);
w = logspace(-1, 2*pi, 3000);
a = linspace(0.0, 10, 3000);
u = a.*sin(2*pi*w.*t);
G = tf([3 5], [5 3 2]);
y = lsim(G, u, t);

Ts = t(2)-t(1); % Sampling time
Fs = 1/Ts; % Sampling rate
fy = abs(fft(y, Fs));
fu = abs(fft(u, Fs));

% Cut the amplitudes and frequencies
freq = (0:Fs-1)(1:end/2+1);
fy = fy(1:end/2)/length(fy)*2;
fu = fu(1:end/2)/length(fu)*2;

freq(1) = freq(2); % freq(1) = 0
semilogx(freq, 20*log10(fy./fu));

And it will plot this "bode" diagram. I think it looks like it's reversed bode diagram. Should not look like this:

And if I use this input response with amplitude 5 and frecquency 10.

u = 5.*sin(2*pi*10.*t);

I get this plot. It seems that I'm on right track anyway.


texts: Image Segmentation - Comparing GrabCut Method vs. Level Set Method

texts:
Checking the literature about image segmentation, if I am not wrong, there are two main approaches:

Variational approach e.g. level-set optimization in Chan-Vese
Combinatorial approach e.g. using graph cut in GrabCut

Can someone give me some high-level comparison between these two directions?

For example, I feel with level-set optimization one can easily  incorporate image structure (e.g. edges) into the energy function, which is not easy in Grabcut. Am I correct?

Thanks.


texts: Can realizations of a filtered Gaussian white noise process be represented as a Fourier transform?

texts:
Suppose we have a noise process $V(t)$ which is the result of passing Gaussian white noise through a filter with frequency response function $H(\omega)$.
Can we represent realizations of this process as a Fourier transform
$$V(t) = \int \frac{d\omega}{2\pi} M(\omega) e^{i \phi(\omega)}$$
where $M(\omega)$ and $\phi(\omega)$ are random variables?
If so, what are the statistics of $M(\omega)$ and $\phi(\omega)$?


texts:
Please check the link

What effect does a delay in the time domain have in the frequency domain?

Here it is said that if you delay your input signal by D samples, then each complex value in the FFT of the signal is multiplied by the constant exp(−j2πkD/N).

My question is that if i have a DFT vector F(u)={11,-3+2j,-1,-3-2j} and D=2,N=4 then I will get {11,3-2j,-1,3+2j}. But if we see this new vector we can see that here no translation
of the signal is done. Signal has not moved to the new location. Just the value of each coefficient has changed in it own location. According to the translation property the answer should be {-1,-3-2j,11,-3+2j}. What is the problem ? Please explain .


texts: How to filter out noise from non-stationary signal

texts:
I have this non-stationary signal.

the mean is roughly constant but the second moment (autocorrelation) does not depend only on the time lag $tau$.
Correct me if I am wrong in the above statement.
Anyway as you see I have high frequency noise components and I would like to clean it but avoiding any sort of phase lag introduced by a filter.
What can I do to achive my purpose?
I thought of using wavelets to extract the coefficients and then reconstruct the signal, but maybe there is a more efficient and correct way of doing it.
Can you also provide with a link/guide to code this in python?


texts: How to find out whether guassian or salt& pepper noise present in an image, Is there any algorithm

texts:
Is there any algorithm for identifying the noise in an image
I have to identify whether the noise present in a mammogram image is guassian or salt& pepper.


texts:
How we define frequency in an image?

Does the repetition of a single gray level defines the frequency?(Example: can a black(single color/constant region) background image be called high frequency image?) I think it is not so.

Or

Does the frequency depends on number of changes in the gray levels in an image? If so Why? I couldn't able to relate the image frequency with the signal frequency where we say high frequency signal when the same cycle is repeated many times in a unit time.


texts: Periodicity property of DFT in time and frequency domain

texts:
I am trying to understand the periodicity of the DFT. How can this property (both in time and frequency domain) be used and can be helpful while developing on a DSP?

It would be good to see some source code or pseudo code, in MATLAB preferably, where this property is exploited/demonstrated.


texts:
I was reading the following paper about direct conversion receivers from TI: link.

In this paper they compare the performance of direct conversion and heterodyne receiver with IQ mismatch.

The paper says that heterodyne architecture performs better with IQ mismatch because the image is separated by 2 times Intermediate frequency (IF). But for direct conversion receivers the image and the desired signal lie on top of each other (figure 6 in the document).
The paper says that the image signal is created by the IQ mismatch. But I don't understand what is this image signal.

How can IQ mismatch create an image signal? And:
Why it is separated by IF in heterodyne systems?


texts: What is the difference between Kalman filter algorithm and stationary Kalman filter algorithm?

texts:
I want to compute the stationary Kalman filter algorithm but I haven't found any information about that algorithm ( not even the pseudo code ) so, I wonder what is the difference between the Kalman filter algorithm and the stationary Kalman filter algorithm and how I can derive it from the Kalman filter algorithm. Could someone point me out resources I can read about it?

I just found this post:

How to derive the stationary Kalman filter predictor?

and this document:

http://www.uh.edu/~bsorense/kalman.pdf on page 5.

Basically what I understand is that you calculate beforehand ( before the recursive process ) the Kalman gain and the state covariance matrix when the Kalman gain goes to infinite using these two equations:

$$\bar{P} = A\bar{P}A^T - A\bar{P}C^T ( C\bar{P}C^T + R )^{-1}C\bar{P}A^T + Q$$
$$\bar{K} = \bar{P}C^T(C\bar{P}C^T+R)^{-1}$$

and in the recursive function, this equation:

$$\hat{x}(t+1|t) = (A-A\bar{K}C)\hat{x}(t|t-1) + A\bar{K}y(t)$$

Is that correct?

Notes:

Yes, it is a question from a DSP book ( https://users.aalto.fi/~ssarkka/pub/cup_book_online_20131111.pdf excercise 4.6 on page 83 ) but there is no information in that book about the stationary Kalman filter algorithm.


texts: Relation between Covariance matrix & Energy of a random signal

texts:
Let's say I have the below random signal:
$ Y[n] = [y(n), y(n-1), y(n-2), \ldots, y(1)] $

I have two random variables now: The first one $X_1 $ which express the maximum eigenvalue of the covariance matrix of $Y$. The second one $X_2$ which express the energy of the random signal.

Now my question is: Are the two random variables independent or dependent, when whether signal samples $y(n),y(n-1)\ldots$ are IID or correlated with each other?

By intuition the two random variables should be correlated!? Isn't it right!?


texts:
As I understand it, in image processing, when it is desired to apply a filter of some sort to an 2D image, a kernel is applied to all the pixels of the 2D image in a process called convolution. Median, Gaussian, Bilateral, all are examples of kernel. These kernels are applied in a similar fashion to that shown in this example http://www.songho.ca/dsp/convolution/convolution2d_example.html (which I found here, searching Signal Processing at StackExchange).

Is there a good list of all/many/most kernels, there uses, and an example before/after image?

Also, is it correct to say that all kernels are just matrices which get convolved against a source?


texts: Semantic Distance Measure Between Images

texts: I would like to compare 2 generic images, with same sizes and normalized values. Which metric would be better than the baseline Eucledian distance?


texts: Is there use of $\pi/8$-DQPSK as shown in MATLAB's documentation?

texts:
I was reading MATLAB's documentation on dpskmod. They gave an example of an $\pi/8$-DQPSK. I felt that this is strange as I have seen $\pi/4$-DQSPK and $\pi/8$-D8PSK, but I have not seen $\pi/8$-DQPSK.

Attached is a screenshot of the documentation showing $\pi/8$-DQPSK with 16 clusters in the constellation:

My question is: Is $\pi/8$-DQPSK actually used in industry or is this just a demonstration of the flexibility of MATLAB's functions?


texts:
i am looking for discrimination of speech from animal sound if you take a 150ms frame of speech and bird as shown below, what feature can i extract from them so that i can effectively state the difference

zero crossings ?
cross correlation of successive frames seems high in bird sound ? isn't it
any other feature from your side ?

one more example in above fig black-speeches,yellow siren,red bird,safron heavy wind the spikes are foot steps

above figure shows the difference in formant positions on spectrogram
in bird sounds the formants are differently spaced and less formants

will anything could be extracted from this analysis

the reason is i am looking for unsupervised(with out any training or SVM) speech discrimination form animal sounds because both are voice but computers cant classify the difference unless they are trained by any nueral network which need huge memroy and training database


texts: What should be the correct scaling for PSD calculation using $\tt fft$

texts:
I would to calculate the PSD of a signal using FFT however the result do not match with periodogram command.  What  did was as follow :

len=length(signal);
NFFT=2^10;
signal_fft=fftshift(fft(signal,NFFT));
px=signal_fft.*conj(signal_fft)/(NFFT*len);
f=-[NFFT/2:NFFT/2-1]/NFFT*Fs;
plot(f,px);

However I am wondering :

Should I use Fs instead of NFFT in the denominator for calculation signal_fft? Since most websites mentioned it should be Fs, but according to this link the number of FFT points are used. However NFFT makes more sense since that is number of points I have.

The reason is that if I take 1024 point FFT the resolution is different from $2^{20}$ points FFT so NFFT should be used somewhere to adjust for this change.


texts: In the early 1900s, Bernstein proved you could approximate any continuous function with the sums of polynomials.  I know this is a bit weak for DSP because it isn't strictly periodic, but is Bernstein ever used (or was ever used much in the past) for signal reconstruction or up sampling or anything else DSP related?


texts: I need to understand the meaning of an epoch in EEG signal. I have an EEG signal. Then how can I get the epoch?


texts: Which codec and format are Audible downloads?

texts:
Files downloaded with the Audible Download Manager are stored with the .aax file extension, but the information I can find about this format seem to vary.
Regarding this source, the files are stored in the M4B container (MPEG-4 Part 14), also a quick look into the file header of the .aax files reveals aax M4B mp42isom.
Furthermore, regarding this source, the audio is encoded with the ACELP codec.
If I would decrypt the .aax files DRM with my Audible authentication code without converting the audio, which format and codec would the audio be in?
(Also I'm not sure if this belongs here or in "Sound Design".)


texts:
I want to implement the pathloss effect using MATLAB simulation.
I use the D2D path loss model:
$$148+40\log_{10}(d)$$
I did not find the right way to add the pathloss effect in the received signal, which is a vector of QAM randomly chosen elements.


texts: Segmenting simple objects without shadows

texts:
I am trying to segment very simple objects like boxes and bottles. I am using GrabCut and it works extremely well when there are no shadows or when the shadows are soft - but as soon as there is a harsh shadow, Grabcut includes that in the segment. The goal is very simple: determine the polygon that makes up the box. That's it.

Note that I am using Grabcut in the Rect mode. I cannot use a mask because I don't know where the shadows may fall.

Some further details that I forgot to add: this is a video based system. The user places the a box inside the red rectangle on-screen. Currently, I am using Grabcut on 12.5% scaled images to speed up the process so that the video feels it is in 'real-time'.

The purpose of the program is to compare the segmented object's simlarity using perpetual hash. As I mentioned, the system works extremely well as long as the shadows are minimised.

Here is an example:

Most objects aren't as simple and can have multiple colours inside them.

Some solutions that I have thought about:

Lighting Based
This is part of a system that will be used in various locations where the lighting may vary. However, the system will have lighting built into it to compensate for the environment - but will that be enough? Can I use light to 'fill' in the shadows so that Grabcut works?

Use a pattern or grid beneath the object
What I have noticed is that if the shadows are even partially outside the Rect, Grabcut is able to segment the object very nicely. I have been wondering if I include a pattern like this and then determine the dots the adjacent to the box, determine the contour/rectangle of the adjacent dots and then feed that Rectangle to Grabcut for segmentation. This assumes that the shadows are somewhat tall.

This method works fairly well but then I run into issue: some dots are partially covered by the object and they are unfortunately still included by grabcut. Perhaps I can consider some other pattern here?

Use some advanced shadow removal algorithm
This seems like my best bet but it seems the majority of algorithms require a calibrated camera or professional camera. But I'm hoping there is some algorithm out there that can help me do this with a consumer grade webcam.


texts: Taking inverse Fourier transform in column-wise and solve it in row-wise

texts:
$\DeclareMathOperator{\FFT}{FFT}\DeclareMathOperator{\IFFT}{IFFT}$Assuming I have a matrix $X$ of size $64\times16$. Taking the $\IFFT$ for it in column-wise, I means that $Y = \IFFT(X)$;

Is it possible to get a relationship between every row in $X$ and its corresponding row in $Y$?


texts:
I tried to solve this question from basic

Here is my work

Image 1

Image 2

But the correct answer is Option $(B)$.What is the mistake i am doing?


texts: modelling wireless multi-path channel - is channel response sum of delta(t-path_delay) or "delta" should be smoothed somehow?

texts:
Consider the wireless channel. It is mult-path - means that signal is sum of sent signals with some delay and fadings.
The standard models for "impulse response" for multi-path channel in wireless is:

$ h(t) = c_1 \delta(t - t_1) + c_2 \delta(t - t_2) + ... + c_N \delta(t - t_N) $,

where $t_i$ are path-delays and $c_i$ are fadings.

Question I wonder is this model realistic  ? Is it really reasonable to assume "delta"-functions for each path or may be it we need to assume something more smooth ?
What is good reference, where the results of real measurements can be found ?

[EDIT] in response to comment.

I am interested in cellur telephone links. I know that the standard e.g. channel 3GPP models assume 6-9 paths with delta-functions. I am  suspicious about this assumption. So I want to see results of real measurements which support this model.

[EDIT 2] More details.
I am interested in channel estimation for OFDM system cellur system. Assume carrier frequency is something like 1GHz - 2GHz.
One user typically may have ~100 OFDM elements. Each  element is about 15kHz.
So the user bandwidth 1.5MHz.

What am suspicious about is that if we have 9 paths and we have about 100 pilot symbols, then  our channel estimation would be quite good , and BER will be close to ideal ch.est. Because we need to estimate ~9*2 unknowns from 100 of data - so we get good quality of estimation. This is in theory, but I am afraid if will test such system in practice
we mail fail, cause in practice it might be not 9 paths but 90 paths ...

So let me stress the following part of the question:

Where to find results of real measurements in urban requirement for  channel response ?

I guess that should be old stuff may be from 60-ies ? Cause many modern literature concern MIMO channels and pay attention to angular spread and so on - while I need more simple information.


texts:
I'm trying to grasp some intuition about why zero-padding the time domain sequence $x[n]$ interpolates the frequency domain bins of the $DFT\{x[n]\} = X[k]$ and how does this relate to the $DTFT$ of $x[n]$.
Let's say we have $N$ point signal $x[n]$ and we pad it with 0's in the time domain as usual.
So, as we append more and more zeros to $x[n]$ and perform the $DFT$, we know that $DFT$ makes the assumption that the signal is periodic, hence the period tends to infinity, hence we get frequency samples (more and more and padding increaes) of the $N$ point $DTFT$ applied to the original $x[n]$ ?
I'd love some insights and intution please.
Thanks


texts:
I have a signal sampled at a period of 0.01 and a channel impulse response sampled at 0.1250. I convolved the signal with the  channel impulse response.

It is right to perform the convolution between two signals with diffrent sample times?
If it is,  how can I calculate the sample time of the convolution result?


texts: Linearity, Causality and Stability of a System

texts:
Consider a system:

$$
y[n] = y[n-1] + u[n],
$$

where $y[n]$ is the output and $u[n]$ is the unit step function.

Is this system causal, linear, time-invariant and stable ?

My attempt at the question is that for the systems without any input, we can never talk about all the properties above as they are related to input/output relationships of the system, whereas there are is no input in the system.

However, I'm inclined to think about the system as follows:

$$
y[n] = y[n-1] + \sum_{i=-\infty}^{\infty} 0 . x[i] + u[n].
$$

So trivially, the system is non-linear as it produces non-zero output for zero input, non-causal as it depends on future inputs, unstable as no matter the input, the output is unbounded and time-variant as if we delay the input, the output stays the same.


texts: Finding Accurate BPM and Beat Time Values in Audio

texts: I working on writing a program to get the BPM rate and the Beat Times in audio songs but I am having trouble trying to come up with reliable testing strategies for my design.What do I benchmark my BPM rates and Beat Times against? Should I just use other softwares or is there ways of checking if my BPM rates and beat times are correct? (apart from physically listening and tapping along to the song).


texts: Do JPEG formats add significant overhead?

texts:
For an extreme example, I have the following image that was a JPEG before stackexchange converted it to a PNG:-

Before you perform all sorts of funky image processing tricks on it, it's just a black square.  This is what happens with my web cam when there is insufficient light.  It just gets low pass filtered out and a black square results. The interesting thing is that when I pull up 100 consecutive images from the camera, they're all exactly 6616 bytes long. There must be an internal  light level threshold.

My question is, why was this square's original file size fixed at 6616 bytes? That seems like a lot of overhead to store just a single repeated value of "0", and given that extremely low frequency images should compress greatly. Also, given the random (quantum) nature of the various noise sources impacting the sensor, I would expect some natural variation in size.

For reference, the original image is available here, and it came from this:-


texts: The grid frequencies In the design of a digital filter

texts:
I want to find many difference 'h' with same group delay and length filter using this code :

https://gist.github.com/mattdsp/17f508d2b368db61f47689e4622d8841/c1518f22a5aa451951601b56c5d9f72743868bfe

%desired filter length
N = 51;
f = [linspace(-1,-.18,164),linspace(-.1,.3,80),linspace(.38,1,124)];
%frequency grid
d = [zeros(1,164),ones(1,80),zeros(1,124)].*exp(-1i*pi*f*(N-1)/2);
%desired frequency response
w = [10*ones(1,164),ones(1,80),10*ones(1,124)];
A = w(:,ones(1,N)) .* exp(-1i*pi*f*(0:N-1) );
h = A \ (w.*d);

I'm trying to change the grid frequency ,but I find a problem to achieve an optimal filter,i read many articles about  'grid frequency' like
https://ieeexplore.ieee.org/document/9919/ , 'Typically, the number of grid points Ng is chosen to be 8 or 16 times the filter length N',in other article use 2N,4N...

Is There constant rule for chosen the frequency grid in passband and stopband in this case?

Is there any other way to finding a set of (h)?


texts: What should go to infinity in power's formula N or the repetition KN?

texts:
I have this question :

I should now calculate power of y[n], where the formula

well in the power's formula N which constant goes to infinity how could this be ?
i see in the question that N=7 which is constant,then should N or KN go to infinity ?


texts: IIR Filter for Smoothing (Low Pass Filter)

texts:
I am using IIR filter for smoothing

$$y[n] = ax[n]+(1-a)y[n-1]$$

My question is, if I add another IIR filter, will it be the second order of IIR filter? If not, what it can be called?

My second filter is

$$y_2[n] = ay[n] + (1-a)y_2[n-1] $$


texts: How does ICA handle inevitable delays in signals?

texts:
I am currently reading up on and teaching myself ICA from a number of good sources. (Also see this post for past context). I have the basic jist down, but there is something I am not clear about.

For a scenario where multiple signals are impinging on multiple spatial sensors, (of course, with number of sensors >= number of signals), it is inevitable that for any one sensor, all the signals arriving to it will have different delays/phase-offsets associated with them, as compared to those arriving at a different sensor.

Now, as far as I know, the signal model for ICA is a simple mixing matrix, where the total energy arriving at any one sensor is modeled as nothing but a simple linear combination of all the other signals of interest. Every sensor has a different array of linear combination coefficients associated with it. So far so good.

What I do not understand, is that inevitably there are going to in fact be some delay/phase-offset among individual signals arriving at individual sensors that differ from one another. That is, $s_1(n)$ might arrive at $sensor_1$ at some time 0s, while that same $s_1(n)$ arrives at $sensor_2$ attenuated, but also at some delay or phase difference. The way I see it this is physically inevitable.

...How can it be that this is not modeled in the mixing matrix? It seems that delays will make a huge difference. No longer are we talking about simple linear combinations anymore. How does ICA handle this? Have I missed something here?

I should also add as an addendum, if indeed ICA cannot handle delays, then what applications does it find usefulness in? Clearly spatial ones with sensors are out!

Thanks


texts: Fastest Available Algorithm to Blur an Image (Low Pass Filter)

texts:
Iam working with a camera that produces ugly artifacts:

by using ANY blur filter on the camera's output the visual quality improves drastically:

The above image was created using OpenCV's cv::medianBlur with a kernel size of 3.
I identified cv::medianBlur to be the fastest smooth/blur method in OpenCV.
However for my needs it is still too slow since it uses up to 80% of the whole processing time including encoding (ffmpeg MPEG4). I already tryed to use cv::UMAT but uploading each Image to the GPU and downloading the result again is taking even more time. So using OpenCL / Cuda isn't an option either!?

Therefore Iam looking for the fastest way to blur/smooth an image. However there are so many algorithms in so many librarys(OpenCV/IPP/swscale) to implement and test them all would take to much time. So do you have any suggestions which algorithms I can take a look at, or could offer a really good performance?

Here are some test results for 75.000 iterations of a 640x360 image:

+------------------------------+--------+----------+
|          Algorithm           | Kernel | Time(ms) |
+------------------------------+--------+----------+
| cv::medianBlur               | 3x3    | 18492    |
| cv::medianBlur ocl           | 3x3    | 54596    |
| ippiFilterMedianCross_8u_C3R | 3x3    | 15755    |
| cv::blur                     | 3x3    | >100000  |
| cv::GaussianBlur             | 3x3    | >100000  |
| cv::filter2d                 | 3x3    | >100000  |
+------------------------------+--------+----------+


texts: What is the highest relevant stopband attenuation for a 1-D digital filter?

texts: I have the impression there is little added value for more than 100 dB of attenuation in a  stopband of significant width (i.e. not just a specific frequency). What is the point at which there is little practical application for more attenuation (80 dB, 100 dB, 120 dB, ...) over a stopband of significant width? Also what factor drives this point of no added value? My guess is that the highest useful attenuation is determined by the limited precision that we can measure voltage or any parameter that we might want to filter.


texts:
I have a data acquisition board(A/D+Digital Signal Processor) and I want to check if a digital high-pass filter(implemented in DSP) at an extremely low cut-off frequency(0.05Hz) is actually working.

If this was a frequency I could generate with a signal generator it'd be easy to check, but 0.05Hz is too low and I can't generate it. How do engineers check this kind of filters?


texts:
so i have this lab in coursera course, well i tried first at Linux terminal at the first command %matplotlib inline, it doesn't work :
( bash: fg :%matplotlib no such job ), even if I apply it like matplotlib inline or matplotlib also doesn't work, I know those lines like IN[19] show when you write ipython in the terminal so even when I write ipython then %matplotlib inline it doesnt work, also for the command import ipython it doesn't work, since I am already in iypthon how could I import ipython


texts: Detect Frequency of Incoming Audio on Raspberry Pi

texts:
I've been lurking around these forums for a while and they've been a great help to me in the past. However, I've been researching this problem for the past 2 days or so and can't seem to find a solution even though I feel it should be fairly simple. What I want to do is read in the audio stream, and essentially ignore every frequency except for a specific one (or range), the particular one isn't really important at the moment. Anyways, I want to be able to detect when this frequency reaches a certain magnitude (ie the pi recognizes the frequency is playing) and record the time its detected. About I'll I've been able to figure out so far is how to record a wav file from the terminal using the arecord command. I seem to understand that I need to perform an fft on that file and read the magnitude of the corresponding frequency range, but I've hit a brick wall in attempting this. Any help would be greatly appreciated.

EDIT
Sorry, I am not allowed to comment until I have a minimum of 50 posts, and I've found that most forum type sites I use do not notify the others in the conversation of the change. As for the multiple accounts, one I created on stack exchange, and the next time I logged in I clicked the google log in and not the stack exchange one. I apologize for any inconvenience and appreciate you moving my mistaken answer box to the correct location. I'd appreciate it if you cold direct me in deleting one of the accounts, but more importantly how to get numeric level for a specific frequency(or range) for either a wav file or input stream in python haha :).


texts: How to find peak value of an analog signal efficiently after sampling in the digital domain?

texts:
I have a bandlimited analog signal for which I want to find the peak value in real time. The signal is sampled and processed digitally at just enough sampling rate. Since the peak of the analog signal may not be sampled exactly, taking the maximum of the digital samples would give a lower than actual value. So how do I find the peak?
Theoretically, the only way I can think of, is to upsample the signal using an ideal sinc interpolation filter to very high sampling rate, so that we obtain a sample close to the actual peak of the analog signal. Then we can just take the maximum of the digital samples. But this seems roundabout and computationally expensive. Is there is a simpler method to do this?


texts: A few questions about Slepian and generalized gaussian windows

texts:
I'm trying to add documentation for all the window functions in scipy.signal, and I'm stuck on the Slepian (same as DPSS?) and Generalized Gaussian windows, which I'd never heard of before.

There are two variables that are shape parameters of some type, p in the generalized Gaussian, and width in the Slepian.  (sig appears to be sigma, the standard deviation.)

2 questions:

Instead of me reverse-engineering and guessing, can anyone explain what these variables are called and what they do?
Can you explain what these windows are useful for or where they are used?

def general_gaussian(M, p, sig, sym=True):
    """Return a window with a generalized Gaussian shape.

    The Gaussian shape is defined as ``exp(-0.5*(x/sig)**(2*p))``, the
    half-power point is at ``(2*log(2)))**(1/(2*p)) * sig``.

    """
    if M < 1:
        return np.array([])
    if M == 1:
        return np.ones(1, 'd')
    odd = M % 2
    if not sym and not odd:
        M = M + 1
    n = np.arange(0, M) - (M - 1.0) / 2.0
    w = np.exp(-0.5 * (n / sig) ** (2 * p))
    if not sym and not odd:
        w = w[:-1]
    return w

def slepian(M, width, sym=True):
    """Return the M-point slepian window.

    """
    if (M * width > 27.38):
        raise ValueError("Cannot reliably obtain slepian sequences for"
              " M*width > 27.38.")
    if M < 1:
        return np.array([])
    if M == 1:
        return np.ones(1, 'd')
    odd = M % 2
    if not sym and not odd:
        M = M + 1

    twoF = width / 2.0
    alpha = (M - 1) / 2.0
    m = np.arange(0, M) - alpha
    n = m[:, np.newaxis]
    k = m[np.newaxis, :]
    AF = twoF * special.sinc(twoF * (n - k))
    [lam, vec] = linalg.eig(AF)
    ind = np.argmax(abs(lam), axis=-1)
    w = np.abs(vec[:, ind])
    w = w / max(w)

    if not sym and not odd:
        w = w[:-1]
    return w

Possible matches:

nipy's dpss_windows function uses NW, the "standardized half bandwidth corresponding to 2NW = BW*f0 = BW*N/dt but with dt taken as 1"

Matlab's dpss uses time_halfbandwidth Is this the same window?  Is time_halfbandwidth the same thing as width?

This DPSS definition has $ \omega_c$ "the desired main-lobe cut-off frequency in radians per second".

Generalized normal distribution has β (equal to twice p?) which is just called a shape parameter, with normal distribution for β = 1 and Laplace distribution for β = 2.


texts: Group Delay for Hilbert Transformer and Resulting Dispersion

texts:
An ideal Hilbert Transformer shifts the phase for all positive frequencies by $-\pi/2$ and all negative frequencies by $+\pi/2$ while maintaining constant magnitude everywhere. Group Delay is the negative derivative of phase with respect to frequency, so apart from the discontinuity at frequency $\omega=0$ the group delay would be 0.

Linear phase filters do not cause distortion to a waveform that has many frequency components as each of these components would remain aligned in time at the output of the filter as they were at the input.

Yet the Hilbert Transformer is clearly dispersive meaning different frequency components of a waveform would experience different delays in order for the phase shift to maintain  a $\pi/2$ relationship between the input and output of the network at all frequencies.

The phase of the Hilbert Transformer is linear, so in this case we observe linear phase but still the system is dispersive. How is this explained as this appears to be an exception that I haven’t really seen in definitions of Group Delay or linear phase?

Further imagine a case that is often used in practice with two phase tracking networks used to split a signal into two over a wide frequency with a quadrature relationship. We could imagine a condition with the first network as a linear phase filter and the second network having the same linear phase with a $\pi/2$ offset at all frequencies of interest (generalized linear phase). Here the derivative of the phase with respect to frequency is not zero but constant yet we would have the same dispersive results in order to maintain the constant $\pi/2$ offset.


texts: Controlling audio high/mid/low in frequency domain

texts:
Is it a realistic mapping to divide the frequency bins in 3 parts, high/mid/low frequencies?

How can these bins then be manipulated to control the level of these bands in the time domain?

Is it sufficient to adjust these bin segments and do an iFFT to time domain?


texts: What is the Center Frequency of Gabor Filter?

texts:
If the standard form of a Gabor function is as follows,

$$
g_{\lambda, \theta,\varphi, \sigma,\gamma}(x, y)=\exp\left(-\frac{x'^2+\gamma^2y'^2}{2\sigma^2}\right)\cos\left(2\pi\frac{x'}{\lambda}+\varphi\right)$$

where $$
x'=x\cos\theta+y\sin\theta\\
y'=-x\sin\theta+y\cos\theta$$
How can I find the Center Frequency from this equation?


texts: How to remove a common noise signal from a set of signals?

texts:
I have 2D measurement results which seem to have a constant non-trivial background as shown here:

For every column in this image, there seems to be a similar oscillation. I'd like to distinguish this oscillation from the real measurement signal, e.g. the oblique band which goes from about (15,1080) to (25,1140) in the image coordinates.

I already tried several things, including: FFT filtering for each individual column; using a column where no additional signal seems to be for normalization; and independent component analysis (ICA) implemented in python's scikit learn. With ICA, I was able to find a quite satisfying result, as demonstrated in this graph:

where each row of the above image is plotted as a red line and the ICA result as a blue line. Unfortunately, the ICA result needs to be rescaled and it gives differing reults from time to time.

Could anyone give some hints on how to solve a task like this and how to substract the background properly and automatically in the end? Python code is highly appreciated.

Thanks!


texts: Why Does the Odd Multiple of $ \frac{\pi}{4} $ on Gaussian Cause Loss in Repeatability Under Image Rotations?

texts:
I couldn't figure out below paragraph on SURF paper and hope that someone can help me to understand it. Why image rotations around odd multiples of $\frac{\pi}{4}$ lead to a loss of repeatability?

  Bay H., Ess A., Tuytelaars T. Van Gool L. - Speed-Up Robust Features
  (SURF), page 3, column 2

  Gaussians are optimal for scale-space analysis, but in practice they
  have to be discretized and cropped (figure 2 left half). This leads to
  a loss in repeatability under image rotations around odd multiples of
  $\frac{\pi}{4}$. This weakness holds for Hessian-based detectors in general.
  Figure 3 shows the repeatability rate of two detectors based on the
  Hessian matrix for pure image rotation. The repeatability attains a
  maximum around multiples of $\frac{\pi}{2}$. This is due to the square shape of
  the filter.


texts: Two way Audio crossover MATLAB code using Bessel

texts:
Could MATLAB's besself function be used in designing an Audio crossover (Tweeter and Woofer) with highpass and lowpass filters?

Most likely the same with this code but using Bessel filter.


texts: estimation of the position of the magnetic source

texts:
I have a flying robot with magnetic coil as a sensor. An output from the coil is measured every second in different position. I know the position of the coil and its angles. I need to estimate the unknown position of magnetic source.

As the output is with noise I assume I need to use Kalman filter, but not sure how to start in this case. Do you know if i can implement Kalman to estimate the position of the source? Do not really know how to start. Did anyone know similar example described somewhere?

Thanks for all advice.


texts: What are good estimates for phonemes length?

texts: I am working in a phoneme recognition project, the language that I am using is "English". I have a tool that converts each written phrase in phonemes. Also I have an estimation of the time length of each word. I would like to know also the duration of every single phoneme. Does any one know if there is a good source where I can resort to know the duration of the phonemes in the English language?


texts: What is the standard way to handle images of different sizes for classification?

texts:
I'd like to create an image classifier that takes a set of labeled images and creates a classifier to be used on some unknown images. Most of the examples I see assume all images are the same size (m x n pixels), but my training set will have pictures of various sizes. This is a problem because training my classifier will have the following steps:

Load each image into m x n array
Employ some filter
Transform m x n array into 1 x (m * n) array
Feature selection
Train classifier

The different sized images is a problem because step 3 will yield arrays of different lengths if the images don't have the same number of pixels.

I have a background in statistics, not image processing, and I haven't been able to find any general guidelines for how to handle this problem. I'll be working in Python, and it would also be nice to know if there are libraries perform image resizing.