texts: Help in Retraining a HOG Descriptor using SVMLight

texts:
I am currently trying to count cars using OpenCV 2.4.4 with a HOG descriptor. Because a model for car detection is not available in OpenCV, I am creating my own model using SVMLight and a dataset of cars from the INRIA car dataset here (positive and negative samples).

I created the model using the positive and negative samples with SVMLight (I resized the images to 128 * 104 because a HOG image must be power of 2), by following this tutorial and code. I applied the model to my program, and it detected cars correctly, but also with lot of false positives (3- 8 false positives per image).

I read in Dalal paper about the HOG Detector, and I found out that the model needs to be retrained using false positives found by applying the preliminary model on the negative samples. The resulting patches came in varying sizes, so again, I resized it to 128*104 px.

I reran the HOG training program using positive and negative samples like the preliminary run, but this time, I added the false positives on the negative samples (this is what I think of retraining based on the paper by Dalal). Then I have the retrained model.

Unfortunately, I ran the car detection program using the new model, but all images returned with no car detection although I used positive sample images and other images with a car in it.

This is very interesting and I am curious if any of you can point out what have I done wrong.


texts: Definition of "Power" in "Power Spectrum" (for translator)

texts:
I'm a technical translator who recently undertook translation of documents related to signal processing. Being a novice in the field, I'm searching the web for terminology and concepts.
It appears that local web content includes two instances of translation for "power spectrum":

(electric power) spectrum
(power) spectrum

Upon my query, the requestor says it's not appropriate to translate "power spectrum" as "(electric power) spectrum". But there are quite a number of translation as "(electric power) spectrum", so I'd like to know the exact definition of "power" in the "power spectrum" to make sure that the translation as "(electric power) spectrum" is wrong.
The following is a Wikipedia page that my requestor provided as a reference:
https://en.wikipedia.org/wiki/Spectral_density#Power_spectral_density

... For continuous signals over all time, such as stationary
processes, one must rather define the power spectral density (PSD);
this describes how power of a signal or time series is distributed
over frequency, as in the simple example given previously. Here, power
can be the actual physical power, or more often, for convenience with
abstract signals, is simply identified with the squared value of the
signal.

My questions are as follows:

Is the highlighted part applicable as definition of "power" in "power spectrum" as well?

If so, is "(electric power) spectrum" incorrect translation because the "power" spans other types of physical power in addition to "electric power" (and also because "power" can imply the squared value)?
Otherwise, could someone provide better explanation?

Thank you.


texts: Is it okay to interpolate between overlapping areas obtained using a sliding window?

texts:
I am using a 50x50 pixel sliding window which moves left to right every pixel so that it covers a whole binary image which is about 2000x2000 pixels. In the window, the ratio value of black to white pixels is calculated. I have then been uploading the values into matlab as xyz coordinates with x and y being the centre of each window square and z as the ratio value and interpolating between them to create a meshgrid colormap to help visualise the image.
This is outside the realms of my expertise but I was wondering is it okay to interpolate between these values in matlab as they are not really discrete points but overlapping areas. The colormaps come out looking really good and seem to be a very good representation of the original binary image but it's more the theory that I am having trouble with and I am not having much luck searching.
Is it okay to interpolate overlapping sliding window values in this way using matlab's standard linear interpolation mesh and does anyone have any links to helpful resources regarding this?
Any help would be greatly appreciated!


texts: Lower bound of weighted average of sequence

texts:
Can anyone prove that
$$\mathrm{avg}\left(\frac {a_i}{\left(1+a_i\right)^2}\right) \ge \frac{\mathrm  {avg}({a_i})}{\left(1+\mathrm{avg}{(a_i)}\right)^2}$$
for a sequence of positive valued elements $a_i, \quad\text{with}\quad i= 1,2,\ldots,N$?


texts: Force an unstable IIR filter to be stable by forcing a nonlinearity in the digital block diagram

texts:
I am modeling an analog filter with digital software and have reduced the model to a 4th order FIR filter in discrete space with transfer function

$$ H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2} + b_3 z^{-3} + b_4 z^{-4}}{1 + a_1 z^{-1} + a_2 z^{-2} + a_3 z^{-3} + a_4 z^{-4}} $$

It happens to be unstable, but I have noticed that most analog "musical" LP filters distort non-linearly when in this realm of high resonance rather than blow up to infinity (of course).
Is it possible to simulate this by adding a nonlinear element to the IIR block diagram?

Clipping with $y[n] = \operatorname{clip}(x[n] + \ldots)$ creates a periodic [-1, -1, 1, 1, ...] in the output signal, so is there another way I can prevent numerical blowup?


texts: Spectral flatness or Wiener Entropy for AR(1) and AR(2)

texts:
I'm sudiying compressibility of random processes by using Spectral flatness aka Wiener Entropy

I would like to know if there is any reference which derives this quantity, for autoregressive processes AR(1) and AR(2) in terms of their coeficients.


texts: How to generate IQ component for transmitting 2FSK

texts:
I am trying to generate IQ components for 2FSK modulation.
I have started off from this thread FSK and IQ modulation , but I don't quite understand the IQ TX components plotted in the example there by GordonFreeman.

In my view, in a 2FSK modulation, the angle of I+jQ shall vary linearly with time (constant frequency +/- Δf), drawing a circle either counter-clockwise with frequency Δf if TX data is equal to 1, or clockwise with frequency Δf if the TX data is equal to -1 (given e.g. a random -1/+1 sequence). In this convention, the difference between high and low freqs in 2FSK is 2*Δf.

This is well explained from about 07:00 in the following video: https://www.youtube.com/watch?v=5GGD99Qi1PA (can be played at faster speed if convenient).

If I understand correctly, for 2FSK modulation:

I(k)=cos(2*pi*freq(k)*t)

Q(k)=sin(2*pi*freq(k)*t)

with e.g. freq(k)=Δf*k where transmitted symbol k=-1/+1 if we have a binary data stream of +1/-1. In this sense, I(k) will be just a cosine wave, while Q(k) will be a sine wave which will be pi shifted every time there is a data change. An example are below IQ components I generated by a pyscript:

The above components are generated when bitrate is maximum(4*Δf).

Does this make sense?

=====

Thanks for your comments Dan.

Some more info-  I started off from a 2FSK modulated signal of this form:

modulated(t)=cos(2*pi*(fcarr+freq(k))*t)

where fcarr is the carrier frequency, freq(k) is either +Δf or -Δf as discussed depending of the transmitted data.

Then deriving the below I/Q components
(those that fed into a quadrature modulator would lead to the above modulated signal, I omit the full derivation but that can be derived either in freq domain https://en.wikipedia.org/wiki/Single-sideband_modulation or more simply in time domain with trigo formulas https://en.wikipedia.org/wiki/Quadrature_modulation):

I(k)=cos(2*pi*freq(k)*t)

Q(k)=sin(2*pi*freq(k)*t)

Therefore when freq(k) is changing from +Δf to -Δf, the I(k) which is a cosine will remain unchanged (if we multiply by -1 the arg of a cosine, the cosine won't change), while Q(k) which is a sine will change of a 180 degrees since sin(-x)=-sin(x).
In this sense, the rotation of the I/Q vector will be changing from counter clockwise to clockwise, but there will be a sudden phase shift of 180 degrees.

If maximum bitrate = 4*Δf is choosen, then duration of 1 symbol is 1/fourth of Δf period, or 90 degrees in the I/Q vector diagram.

So I/Q vector will start from (1,0) i.e. 0 degrees, moving counterclock wise to (0,1) i.e. 90 degrees, that will be within the duration of symbol "1" , then there will be a symbol change to "-1", that will produce, as mentioned above, just a change of I component from sin(2*piΔft) to -sin(2*piΔft). This will make the I/Q vector moving from (0,1) to (0,-1) and the vector will move now clockwise to (-1,0) for the duration of symbol "-1".

From this, the above I/Q plot was generated.


texts: difference between mean filter and order statistic filter

texts:
I am working on my paper about comparing between mean filter and ordering statistics filter, The mean filter is contraharmonic mean filter and the ordering statistic filter is alphatrimmed mean filter. So, I compare contraharmonic mean filter and alphatrimmed mean filter

and i've read a slide presentation that explain mean filter is good for removing some kind of gaussian noise (uniform noise) and order statistics filter is good for removing some kind of exponential noise and salt & pepper noise (rayleigh noise).

Can anybody here show me the book source of that statement? is it in gonzales book? Thank you so much, your answers will help me a lot
and sorry for my poor english :(


texts: Correlation in Image Processing vs Correlation of statistics

texts:
I am new to image processing. Please forgive me if you find this question naive or meaningless.
I was studying about correlation filtering in images to smoothen the image. I want to know if correlation filtering in image processing is in any way similar to correlation coefficient of statistics.


texts: MPEG Layer I: use of scalefactor and quantizers

texts:
I'm studying MPEG compression on the book "Introduction to Data Compression" by Khalid Sayood.
In the figure there is a paragraph piece about the subject.

I didn't understand a few things:

use and how the scalefactor works
use and how the 14 different quantizers work.

That are the parts highlighted in orange.

The scalefactor is a value that is used to decrease (or increase) the range of values, right?

I try to repeat what I understand:

Input signal is PCM samples over time
These samples are transformed into the frequency domain (I suppose with an FFT)
Samples are subdivided into frames of 384 samples each
Each frame is processed individually and subdivided into 32 equal frequency bands using a filter bank. Each subfield therefore contains 12 samples
encoder processes each sub-band individually and through a psychoacoustic analysis determine the number of bits to allocate for each quantized sample and possible quantization levels (linear quantization)
encode the samples and form the package
etc.

I know that point 5 is very superficial because I didn't understand the parts related to the scalefactor and the 14 different quantizers.
Can anyone help me?

Somewhere I've read the quantization steps are the same for each sub-band and they are 2 dB each (linear quantization), so what's the scalefactor meaning?
I think the scalefactor is a kind of exponent in the case of non linear and floating point quantization.
So MPEG layer I use a linear or not lineare quantization?

That's what I understand. Why does the book mention 14 quantizers?

I read (quickly) the book you've been advising me (Introduction to Digital Audio Coding and Standards from Bosi).
This is a piece that treats the part I didn't understand.

For each sub-band, the scalefactor (stored on 6 bits) is calculated from the 63 available and a quantizer (on 4 bits) of the 14 available.

The scalefactor is the largest sample of a sub-band.
Once I've calculated it I use to divide each sample, obtaining 12 samples whose value is in the range [0, 1].

The quantizer has a numeric value that expresses the number of bits I use to encode each sample.

This is my usual scheming:

Why do I need to normalized the samples?


texts:
For the time delay $e^{-sT}$ I shall find the Pade Approximation for $M = 0$ and $N = 1$.

$f(s) = \sum_i^{\infty} a_is^i \approx \dfrac{\sum_{n=0}^{N} b_is^i}{\sum_{m=0}^{M} c_is^i}$

$e^{-sT} = \sum_{i=0}^{\infty}\dfrac{(-sT)^i}{i!}$

Using the Taylor approximation for $e^{-sT}$ I yield

$1 -sT \approx \frac{P_N(s)}{Q_M(s)}$

$1 -sT \approx \frac{b_0 + b_1 s}{c_0}$

with $c_0 = 1$ per definition according to my materials.

This leads me to

$1 -sT \approx b_0 + b_1 s$

$b_0 = 1$

$b_1 = -T$

If I now want to check the step response of $e^{-sT}$ and my approximation MATLAB complains about my function having more zeroes than poles, which is not surprising as I thought I would get my transfer function from $G(s) = \frac{P_N(s)}{Q_M(s)}$.

I'm sure there is a basic misunderstanding of what I am doing here on my side.


texts: Frequency warping when integrators are replaced with backward-euler and forward-euler integration

texts:
Resonant controllers are used in the power industry. The transfer function
is
$G_{res}(s) = \frac{K_i s}{s^2 +2\omega_c s+ \omega_o^2}$
The "textbook" discrete implementation is depicted in the image The first integrator is a forward Euler and the second one a backward integrator. It is not possible to use Tustin integrators because this would create algebraic loops. Note that $\omega_o$ is not a constant, it will vary slowly and will be fed by a PLL or FLL.
Here's my question. How can one characterize the frequency warping?
In one paper, they evaluate frequency warping by applying the bilinear transform to $G_{res}(s)$, I feel like this is wrong.


texts:
To preface, this is not a homework related question but purely for self-study purposes.

I'm try to do the analyse of z-transform of $a^nu[n+1]$. It is clearly a non-causal signal, I try to explain it by using the definition.

Based on the causality of z-transform definition: If x(n) is a infinite duration causal sequence, ROC is exterior of the circle with radius a. i.e. $|z| > |a|$.

I am not sure if my explanation is correct:
$$\mathcal{Z}\big\{a^nu[n+1]\big\} = a^{-1}z+\sum_{n=0}^{\infty} (a/z)^{n}$$

The ROC of this function in z-plane is $|z| > |a|$ except at $z = ∞$.

It does not obey the causality definition because the boundary exists ( $|a|<|z|< ∞ $), i.e. the ROC pattern is a ring, it is a non-causal signal.

Am I correct? I am kinda confused with the causality definition.


texts: If you had supersonic hearing, would you be able to hear the carrier wave of an AM radio station?

texts: Would you be able to hear the carrier wave of an amplitude modulated station, if you could hear in the MHz range, or would the high frequency be filtered out after rectification?


texts: Fast/efficient way to turn real passband samples to complex baseband

texts:
I have real-valued samples of a bpsk signal i am receiving (see frequency spectrum in figure A), that I want to turn into complex samples for further processing.

However when I just use the received signal as the real part of my complex symbols, I get a mirrored version of the original (like in figure B) with two times the bandwidth of A. By shifting the signal to baseband, and then downsampling it to half the samplerate I get something like in figure C.

Question: Is there a more efficient way to get directly, i.e. in one step from A to C?


texts: Python scipy firwin2 has a low frequency error when designing arbitrary amplitude filter

texts:
I've been trying to design an arbitrary amplitude FIR filter which has a specific attenuation for each frequency. However I get an error at low frequency when comparing the results to my expected filter response as seen in the figure below. It doesn't change when raising the filter order. Can anyone help me? Thank you! The code is as follows:

import colorednoise as cn
from matplotlib import pyplot
import numpy
import scipy.signal as signal

# Generates a 3 seconds pink noise
x_raw=cn.powerlaw_psd_gaussian(1, 3*44100)
x_max=numpy.amax(numpy.abs(x_raw))
x=x_raw/x_max
fs=44100

# Vectors of the freq abnds and the corresponding attenuations
freq=numpy.array([0, 25.12, 31.62, 39.81, 50.12, 63.1, 79.43, 100, 125.89, 158.49, 199.53, 251.19, 316.23, 398.11, 501.19, 630.96, 794.33, 1000, 1258.93, 1584.89, 1995.25, 2511.89, 3162.28, 3981.07, 5011.87, 5012, 6309.57, 7943.28, 10000, 12589.25, 15848.93, 19952.62, 22050]);
att=numpy.array([-5.7,-5.7,-5.7,-5.7,-5.7,-2.8,-4.5,-3.9,-7.3,-11.2,-10.4,-11,-10.8,-10.1,-9.8,-7.9,-8.3,-7.7,-10.3,-12.8,-13.9,-15.1,-15.6,-17.3,-18.8,-18.8,-18.8,-18.8,-18.8,-18.8,-18.8,-18.8 ,-18.8])

gain=numpy.power(10,att/20)

b=signal.firwin2(8093,freq,gain,nyq=fs/2)

w,h=signal.freqz(b)
w,h=signal.freqz(b)
f=w*fs/(2*numpy.pi)

####### Plots the filter magnitude response ##########
pyplot.figure(1)
pyplot.plot(f,20*numpy.log10(numpy.abs(h)),label='Filter response')
pyplot.xscale('log')
pyplot.xlabel('Frequência [Hz]')
pyplot.ylabel('Magnitude [dB]')
pyplot.xlim((20,20000))
pyplot.plot(freq,att,label='Desired response')
pyplot.legend()
pyplot.show()


texts: Deriving Fourier Transform of Time-Windowed Discrete Signal

texts:
I'm trying to derive the Fourier Transform of a finite-length discrete signal to show the effect of windowing,e.g. spectral leakage and resolution, but I can't seem to arrive at the same answer.
Just some notation: normal braces, (), indicate the CT signal and square brackets, [], indicate the DT signal.
A continuous-time (CT) signal, $x(t)$, is sampled with sampling period, $T_s$, to give:
$$
x_s(t) = \sum_{n=-\infty}^{+\infty}x\left[nT_s\right]\delta\left(t-nT_s\right)
$$
and is then time-windowed with a tophat function, $h(t)$, of width $L$:
\begin{align}
x_L(t) &= x_s(t)\cdot h(t) \\
&= \sum_{n=-\infty}^{+\infty}x\left[nT_s\right]h\left[n\right]\delta\left(t-nT_s\right) \\
&= \sum_{n=0}^{N-1}x\left[nT_s\right]h\left[n\right]\delta\left(t-nT_s\right)
\end{align}
where $L = NT_s$. The corresponding Fourier Transforms are:
\begin{align}
X_s\left(e^{j\omega}\right)&=\int_{-\infty}^{\infty}x_s(t)e^{-j\omega t} \, \mathrm{d}t \\
&=\int_{-\infty}^{\infty}\sum_{n=-\infty}^{+\infty}x\left[nT_s\right]\delta\left(t-nT_s\right)e^{-j\omega t} \, \mathrm{d}t \\
&=\sum_{n=-\infty}^{+\infty}x\left[nT_s\right]e^{-jwnT_s} \\
X_L\left(e^{j\omega}\right)&=\int_{-\infty}^{\infty}x_L(t)e^{-j\omega t} \, \mathrm{d}t \\
&=\int_{-\infty}^{\infty}\sum_{n=-\infty}^{+\infty}x\left[nT_s\right]h\left[n\right]\delta\left(t-nT_s\right)e^{-j\omega t} \, \mathrm{d}t \\
&=\sum_{n=0}^{N-1}x\left[nT_s\right]e^{-jwnT_s} \\
\end{align}
I think the last equation above is the DTFT of $x_L(t)$ and is what I'm trying to achieve. Now I choose to write the time-windowing in terms of a convolution in the frequency domain:
\begin{align}
X_L\left(e^{j\omega}\right)&=\mathcal{F}\left\lbrace x_s\cdot h(t)\right\rbrace \\
&=X_s\left(e^{j\omega}\right)*H\left(j\omega\right) \\
&=\left(\sum_{n=-\infty}^{+\infty}x\left[nT_s\right]e^{-jwnT_s}\right) * H\left(j\omega\right) \\
\end{align}
I can't see how the infinite summation reduces to a finite summation over $N$ samples without $h(t)$. The transform $H\left(j\omega\right)$ is a $\mathrm{sinc}$ function so I'm not sure how to proceed to get the same result as above.


texts: Unable to interpret hypothesis testing whetehr a signal is periodic or not

texts:
The meaning of P value is probability which should be number between 0 (the event never occurs) and 1 (the event occurs always). significance testing for periodicity using Matlab gives a documentation on how to apply Fisher's statistics to a time series signal for periodicity testing. Some concepts are unclear to me and I shall be grateful for an intuitive answer:
Q1: In my example, I want to prove if the signal is periodic or not. So something that I want to prove to be true becomes the null hypothesis statement? Thus, would
 H0: the signal is periodic and H1: not periodic?

Q2: I got the value of pval for my signal as 2.3e-6 fmax (the maximum frequency) =  0.0078 andfisher_g = 0.1136`. How do I interpret this result? Is my signal periodic or not?
Q3:   If the calculated pval is less than the threshold which usually is 0.05 then we reject the null hypothesis. But in the documentation it is the opposite and the threshold is 0.000001 which I do not know how it has come. I am confused! Please correct me where wrong.


texts: Frequency response of a microphone using a sine sweep

texts:
I want to determine the frequency response (magnitude, phase) of a microphone. I have another "good" reference microphone whose frequency response I know.

I understand that I can use a good speaker and measure the two mics simultaneously using white noise. Regarding the magnitude response, I can estimate the power-spectral densities by a method of averaged periodograms. Next, I can find the magnitude response of the device under test by subtracting the power spectral densities in logarithmic scaling and adding the known magnitude response of the reference microphone.

Averaging over periodograms seems necessary to control the variance of the periodogram estimator. But what about the phase response? Does a similar inconsistency exist for the angle of the fft also?

If I use an exponential sine sweep $x(t) \propto \sin(\omega_0 e^{a t} t)$, how do I obtain the frequency response? Do I average over the entire measurement time or do I do no averaging at all?

Edit:
I did not explicitly state but implied that I perform the measurements in an anechoic room.


texts: Sweep synthesis in frequency domain: How to correctly adjust magnitude?

texts:
I'm attempting to synthesize a logarithmic sweep signal to measure the IR of a system. For the most part, I'm following Section 5.2 of the paper Transfer Function Measurement with Sweeps.
To generate the sweep, I have written a GNU Octave script. However, the resulting time-domain signal is incorrect, and I can't seem to get it right. Here's the code:
% fs = sample rate
% n  = number of FFT bins
function signal = sweep(fs, n)
  spectrum = zeros(1, n * 2);
  for i = 1:n
    ph = phase(n, i);
    spectrum(i) = cos(ph) + j * sin(ph);
    spectrum(i) *= 1 / i;  % ensure pink magnitude spectrum -- this is probably where it all goes wrong
  endfor
  signal = real(ifft(spectrum));
endfunction

% computes group delay for a given frequency bin
function tg = group_delay(n, f)
  persistent tg0 = 0.05;  % group delay of first bin
  persistent tg1 = 0.95;  % group delay of last bin
  persistent b = (tg1 - tg0) / log2(n - 1);
  persistent a = tg0 - b * log2(1);
  tg = a + b * log2(f);
endfunction

% converts group delay to phase
function phi = phase(n, f)
  phi = -2 * pi * integral(@(f_) group_delay(n, f_), 1, f);
  phi = phi - (f / n) * pi;         % ensure 0 phase at fs/2
endfunction

I have two questions:

The last paragraph on page 26 states that

It is important that the phase resulting from the integration of the
constructed group delay reaches exactly $0°$ or $180°$ at $f_S/2$. This
condition generally has to be fulfilled for every spectrum of a real
time signal.

Why is that?

Below are two plots of time-domain signals generated by sweep(1000, 500). The first one is obviously wrong. For the second one, I removed the magnitude adjustment (last line in the for loop). This one looks a lot better, although its amplitude is increasing. I can't think of any explanation for this. What's going on here?


texts: How to find frequency and phase shift in the recorded wave( .wav file )

texts:
I am working on BPSK at frequecies near 20 kHz with a sample rate of 44100 Hz.

We can't afford sample rates above than this due to computational complexities.

Have found that the frequency of recorded wave is also changing with different set of information, like for example if I send all zeros there was a frequency difference of 5 Hz between carrier and recorded wave and if I send random data it is around 400Hz.

I am extending my work after this Periodically-varying phase between transmitted sound and received sound.

So to do the phase correction while demodulation, frequency correction is also needed. So my question is:

Is there any better digital implementation for my case to do the carrier recovery at receiver side?

I tried Phase locked loop implementations but found that before sending the wave into PLL block of code I have to multiply the received signal and carrier signal then send them into a squaring block and then Band pass it to get a $2f_c$ signal¹.

But for implementing this method when I do the squaring my sample rate of 44100Hz is not sufficient for the doubled frequency ($2\cdot20000 $ Hz).

So I need help in either a way I could manipulate this sample rate problem like downsampling first then doing squaring (which I dont think it works) or any other carrier recovery methods to get a best estimate of received wave frequency and phase difference.

¹ method is in the book C. Richard Johnson  Jr, William A. Sethares, Andrew G. Klein-Software Receiver Design_ Build Your Own Digital Communication System in Five Easy Steps-Cambridge University Press (2011)


texts: Where should I set my anti-aliasing filter corner frequency for this signal?

texts:
I have a Fourier transform of an arbitrary digital signal. The transform has For 1024 frequency bins. The magnitude plot of the first 100 is below, with no surprises in the unplotted 924 bins.

Now, suppose that I want to design a single-pole anti-aliasing filter for this signal. How would one approach selecting a corner frequency for that filter?


texts: How do I compute the impulse response of a robot?

texts:
I am trying to model a robot (my question in robotics.SE), so that I may train it using some reinforcement learning techniques. I was wondering if I can compute an impulse response of a four wheel robotic chassis empirically? Or something similar that might help me model the robot. Does a thing like 'the impulse response of a robot' even make sense?

Since a single strobe of a PWM signal shall hardly cause any movement, but a steady stream of PWM signals will, can I consider the impulse response as an infinite impulse response that superposition to cause perceivable motion?

I am certain that the robot chassis is a non-linear system. Generally speaking, will impulse response make any sense on a non-linear system?


texts:
I have a doubt about this :
Iterative methods for optimization in FIR filter (on the one hand traditional like window,frequency sampling ,WLS,Remez Exchange...,on the other hand evolutionary methods like SA,PSO,GA....) ,it is used for :

Verify that the filter has linear phase  (symmetric).
or the symmetric is satisfied ,but have another problems in this type of
filters should be reduced or eliminated to be used in wider applications.

Please correct me if I am wrong about that.


texts: In z-transform, if z means "delay", why do we talk about the value of z?

texts:
I've been watching MIT's signals course and trying to understand $z$-transform. The course introduces $z^{-1}$ as an operator that delays the signal by $1$ time unit (which works very well with the given examples), but directly after that goes on to talk about values of $z$, regions of convergence, etc. If $z^{-1}$ is an operator, why/how does it have a value?? And what does that value signify??

Note: I tried other textbooks, but most just define the transform, without any interpretation. The only interpetations I can see are that

the transform correlates a signal by another complex exponential signal (described by $z^{-k}$)
the transform of the impulse response is the eigenvalue of a complex exponential input signal

But I'm an absolute beginner on the subject and my understanding might be wrong. Also, I can't see a direct connection to the "delay operator" approach.


texts: How to calculate the echo magnitude of an hanh echo using bloch simulation?

texts:
Stanford provided all basic functions/M-files needed for Bloch simulation. The following MATLAB code snippet was made on top of these M-files to simulate the Hanh Echo:
T = 1000;   % total duration
df = 10;    % Hz off-resonance.
T1 = 600;   % ms.
T2 = 100;   % ms.
tau = 50;   % ms. TE/2
TR = 500;   % ms.
alpha1 = pi/2;
alpha2 = pi;

% ===== Get the Propagation Matrix ======

[A,B] = freeprecess(tau,T1,T2,df);

% ===== Simulate the Decay 90 - 180 ======

M = zeros(3,3);

M(:,1)=[0;0;1]; % Starting magnetization.
% Let   M(:,1) be the magnetization just before the 90.
%   M(:,2) be just before the 180.
%   M(:,3) be at TE = 2*tau.

Rflip = yrot(alpha1);
Rrefoc = xrot(alpha2);

M(:,2)=A*Rflip*M(:,1)+B; % just before - P2
M(:,3)=A*Rrefoc*M(:,2)+B; % Echo
sig = abs(M(1,3)+1i*M(2,3)); %Echo Magnitude

% ===== Simulate the Decay 90 - 90 ======
alpha1 = pi/2;
alpha2 = pi/2;
M1 = zeros(3,3);    % Keep track of magnetization at all time points.
M1(:,1)=[0;0;1];    % Starting magnetization.

Rflip1 = yrot(alpha1);
Rrefoc1 = xrot(alpha2);

M1(:,2)=A*Rflip1*M1(:,1)+B; % before -P2
M1(:,3)=A*Rrefoc1*M1(:,2)+B; % Echo

sig1 = abs(M1(1,3)+1i*M1(2,3));

disp(sig1/sig) % should be 0.5

According to some basic knowledges, a spin echo using 90-180 would produce the maximum echo amplitude. While the maximum SE(Hanh Echo) intensity of a 90°-90° pair is only half as large as that produced by a 90°-180° pair.  This means sig1/sig should be 0.5 . But what I got is a number larger than 1. What's wrong with my simulation code? How to derive the following conclusion using Bloch Simulation?
In general, if the first RF-pulse has flip angle α1 and the second has flip angle α2, the maximum signal intensity of the Hahn echo will be smaller than the conventional (90°-180°) echo by a factor of  (sin α1)•(sin² α2/2).


texts: As DCT Does Compaction of Energy, Can We Say IDCT Does Energy Spreading?

texts: Like energy compaction transforms, the inverse transforms like IDCT are energy spreading transforms?


texts: Determine minimum distance between two symbols in 16-QAM using the average symbol energy

texts:
If the probability of bit error for a square M-ary QAM is

$P_M = (1-(1-P_\sqrt{M})^2)$

where

$P_\sqrt{M} = 2(1-\frac{1}{\sqrt{M}})Q(\sqrt{\frac{3E_s}{(M-1)N_0}})$

and $E_s$ is the average symbol energy, can I assume that $E_s=10A^2$?. $2A$ is the minimum distance between two adjacent symbols.


texts: What does it mean for an image to be "Markovian"?

texts: I've been following the recent lectures on Coursera for image processing. In the lecture on the use of the discrete cosine transform  (DCT) for image compression, he says that for images that are "Markovian", the DCT has the same properties as the Karhunen-Loeve Transform. He uses this argument to support the use of the DCT in general image compression, since small subsets of natural images usually have this property. What does "Markovian" mean in this context? Is he referring to Markov Random Fields where the graph is constructed by pixels as nodes and edges between neighboring pixels? What are some examples of images that violate this property?


texts: I understand that approximate and detail coefficient represent the different signal bands. But what do the values mean and how are they used?


texts: Applications of Correlation in Signal Processing

texts:
There have been discussions on the differences between convolution and correlation, autocorrelation, cross-correlation, et al.

In spite of looking at the visualizations, and understanding the formula for calculation of convolution and correlation, I don't understand the need for correlation - is it required for identifying a signal uniquely?
What is the distinction between correlation and cross-correlation (if any exists)?

I get that convolution can be important in determining system responses to any arbitrary input signals when the impulse response is known, but what are the practical scenarios where correlation is helpful?

I know the theoretical differences between the concepts and this link isn't helpful for my question.


texts: audio signal time delay estimation(TDE) in indiviual and separate mics

texts:
common TDE problems algorithms(such as GCC) often require audio signals in different mics concurrently, however, is it possible to estimate audio signal time of arrivals(ToA) in different mics separately in the noisy environment in order to estimate TDoA&TDE?

Also, since memory space limitation, cross-correlation related algorithms may not be feasible, starting point detection may be a possible solution(in noisy environment)


texts:
I’’m synthesising a simple sine wave using the IFFT.   I’m controlling the pitch of the sine wave by controlling the bin number and the phase for that bin number.

I’ve synthesised an F whose frequency is very close to a bin centre frequency and everything looks good.

however when I detune that same note away from the bin centre frequency I start to get additional harmonics showing up.   Like this:  (Note the -30db peak just after the significant peak, and the appearance of signal all the way to the left.)

Why is this occurring???


texts: How Do You Save / Convert an Image to Be in the Frequency Domain?

texts:
Quick Note: I don't believe this is a subjective question... however if it is I will gladly modify to be more objective

In ImageJ, if I take the FFT of an image, how can I save this new frequency domain image? The goal being that I would like to be able to open it up and take the IFFT.

When I try this, imageJ says you need to have a frequency domain image. This leaves me thinking that whatever information it has about the frequency domain is lost once I save.

My end goal is to take images that I have taken the FFT of from a python script that I am debugging and load them up in imageJ and take the IFFT.


texts: why z-transform differentiation is needed?

texts:
Find the z-transform and sketch pole-zero plot and ROC for

$$x(n)=|n|\left(\frac{1}{2}\right)^{|n|}$$

Right now, i can get the following,

$$x(n)=\begin{cases} n(\frac{1}{2})^n, & n \geq 0 \\ -n(\frac{1}{2})^{-n}, & n \lt 0 \end{cases}$$

Thus,
$$n\left(\frac{1}{2} \right)^n u(n) -n\left(\frac{1}{2} \right)^{-n}u(-n-1)$$

And,

$$\left(\frac{1}{2} \right)^n u(n) \underleftrightarrow{z} \frac{1}{1-\frac{1}{2} z^{-1}} ,|z|>\frac{1}{2}$$
$$\left(-2 \right)^n u(-n-1) \underleftrightarrow{z} \frac{1}{1-2 z^{-1}}, |z|<2$$

From here, i know my poles is $\frac{1}{2}$ and $2$. But, the solution that i have still continue working on to differentiate the equtions in z-domain and obtained the following,

$$\frac{\frac{1}{2} z^{-1}}{\left( 1-\frac{1}{2} z^{-1} \right)^{2}}+\frac{2z^{-1}}{\left( 1-2z^{-1} \right)^2} ,\frac{1}{2}<|z|<2$$

Does the differentitaion important and why does it need so?


texts: Removing a non linear noise trend from data

texts:
I have a dataset that looks as follows

Now, this is from an actual measurement (of the reflection coefficient of a microchip with four LC resonators connected in a periodic fashion) so there is obviously noise involved. For reference, this is what it should look like in theory (with different numerical parameters)

So there's a few things about the data. First of all there is gaussian(?) noise around the 'mean'. This is not really an issue; I'm only really interested in the positions/sharpness/depths of the resonances, and the noise doesn't complicate it too much. I suppose that if it would be very problematic, one could use Gaussian filter?

But then there's a more problematic issue, and that is also why I put accents around mean. The data is not in a straight line; there is some nonlinear trend over the range of the data. This is what my question is about; getting rid of this trend so that the data is on a straight line. Once that is done, getting it to have its mean at 1 is of course easy, and I'll have a dataset that can be fitted with the model.

My issue is that I don't really know where to start. I did some searching, but either my search terms are terrible or this hasn't really been discussed; it is quite specific after all. I'd like your advice on how to proceed, as personally I don't have any clue. Maybe I should fit the data with some general function? It does seem to be somewhat oscillatory, but not very nicely.

I apologize for not providing some code to generate similar looking data. I would, if I had an idea of how to go about that, but I don't as I'm not sure what kind of function would generate this type of trend. Instead I have uploaded the x-coordinates (Frequency in GHz) and the y-coordinates (complex reflection coefficient) here. As commented, this is a rather strange format for the data if you are not using Mathematica. Here is a different version which should work anywhere, and/but already has only the absolute value of the y-coordinates (as mathematica's way of storing complex numbers is a little nonstandard)

(Dropbox, should be safe and registration free to download it). I should definitely add that what is plotted above is the absolute value of the y-coordinates.

Note that it doesn't require registration. It'll pop up a registration dialog when you open the site, but you can close this, and then you can click the download button (although it seems greyed out, but it isn't). They write this here too dropbox.com/help/20

As for the source of the noise. This is one dataset of many, taken with a Vector Network Analyser. It's connected to the device with SMP cables, which are calibrated before doing the measurement. The calibration is supposed to take care of these trends, but in this case it didn't. So, does theory tell us something.. I'm not sure. I think the noise comes from the cables, and that it might have some oscillatory component to it, but beyond that I can't say to be honest, I have almost no experience with the system. The reason I don't just remeasure is that it is done at liquid helium temperatures, so I'd rather post process


texts:
My signal oscillates back and forth on the interval [-1, 1] at varying frequencies, with some added higher frequency noise components (example data shown below). I want to to estimate the phase of the slow oscillation at any given time. This means I would like to filter out some of the high frequency noise, and then calculate the phase at each time for the smoothed signal. However, my method isn't working so I'd really appreciate any ideas about how to do this properly!

I've attempted to do this with the Short Time Fourier Transform (FTST). The method I've tried is to calculate the Fourier transform for a sliding window across my signal, choose the frequency component with the highest magnitude, and then use the phase from that component.

However, I'm having trouble getting the result to match up with the slowly oscillating component that I can see in the signal. I've tried two methods and neither looks good:

using just the phase shift from the complex value of the fourier transform computed using Matlab's spectrogram() function
using the total phase based on the time and frequency return variables from the STFT plus the phase shift

Am I missing something? I'm new to signal processing, so it might be a conceptual misunderstanding or just an error in my implementation. I would really appreciate any help or suggestions!

Here is the Matlab code I'm using to generate the figure:

% define STFT options
window = 50;
num_overlap = window - 1; % because we need phase at every position
signal_length = length(signal);

% pad signal with zeros on both sides
pad_left = floor(num_overlap/2);
pad_right = num_overlap - pad_left;
padded_signal = [zeros(1,pad_left) signal zeros(1,pad_right)];

% calculate STFT
[S,F,T] = spectrogram(padded_signal,window,num_overlap);
component_magnitude = abs(S);
[m max_index] = max(component_magnitude); % get the frequency with maximal amplitude

% calculate the phase when the frequency components are maximized
for ti = 1:size(S,2)
   phase_shift(ti) = phase(S(max_index(ti), ti));
   signal_phase_total(ti) =  T(max_index(ti))*F(max_index(ti))+phase_shift(ti);
end

num_plots = 5;
% plot the initial signal
subplot(num_plots,1,1)
plot(signal, 'LineWidth', 2);
title('signal', 'FontSize', 18)
axis tight

% plot the STFT
subplot(num_plots,1,2)
imagesc(component_magnitude);
hold on
plot(1:length(max_index), max_index, 'y', 'LineWidth', 2)
hold off
colormap(bone);
title('STFT magnitudes with max component in yellow', 'FontSize', 18)

% plot the phase info
subplot(num_plots,1,3)
plot(phase_shift, 'k');
title('phase shift of maximal component', 'FontSize', 18)
axis tight

% try to superimpose the phase shift onto original signal
subplot(num_plots,1,4)
hs = plot(signal, 'LineWidth', 2);
hold on
% plot the phase of the max component
hp = plot(real(cos(phase_shift)), 'r');
lh = legend([hs hp], 'Signal', 'Phase');
set(lh, 'FontSize', 12);
axis tight
hold off
title('phase shift of max component superimposed onto signal', 'FontSize', 18)

% try to superimpose the total phase onto original signal
subplot(num_plots,1,5)
hs = plot(signal, 'LineWidth', 2);
hold on
% plot the total phase
hp = plot(real(cos(signal_phase_total)), 'r');
lh = legend([hs hp], 'Signal', 'Phase');
set(lh, 'FontSize', 12);
axis tight
hold off
title('total phase superimposed onto signal', 'FontSize', 18)


texts:
Good Afternoon Everybody.

I am developing filters for EEG signals in these days. During the Develop I find some problems:

The filter is FIR (band-pass using a convolution of low-pass filter and
high-pass filter) they are 5 filters in different bands and the order is high and the coefficients are very small. I have coefficients of range from 3.8145e-10 to 0.2279, and the filter orders are:

Alpha:     133
Beta:      117
Theta:     124
Delta:     11 (IIR filter)
Gamma:     125

The lines codes (only of the filters) are these:

%%Filtro for alpha, beta and gamma signals is the same
[n,fo,ao,peso]=firpmord([Fapp2 Fass2],[1 0],[0.005 0.005],2);
ba=firpm(n,fo,ao,peso);
[n1,fo,ao,peso]=firpmord([Fass1 Fapp1],[0 1],[0.005 0.005],2);
b1a=firpm(n1,fo,ao,peso);
ba=conv(ba,b1a);
Na=length(ba);

%%Filtro señal theta
[n,fo,ao,peso]=firpmord([Ftpp2 Ftss2],[1 0],[0.005 0.1],2);
bt=firpm(n,fo,ao,peso);
[n1,fo,ao,peso]=firpmord([Ftss1 Ftpp1],[0 1],[0.1 0.005],2);
b1t=firpm(n1,fo,ao,peso);
bt=conv(bt,b1t);
Nt=length(bt);

%%Filtro señal delta
[n,Wn]=buttord(Fdpp2, Fdss2,0.005,60);
[bd,ad]=butter(n,Wn);
[n1,Wn]=buttord(Fdss1,Fdpp1,0.005,60);
[b1d,a1d]=butter(n1,Wn,'high');
bd=conv(bd,b1d);
ad=conv(ad,a1d);
Nd=length(bd);Nd1=length(ad);

This part is only the pre-processing part but the coefficients are very
small. the Fs is 250Hz and the delay group will be 0.5320 seconds. If I
change IIR filter to FIR the order is near 200 and the delay group will be
major (I tried that using only the band-pass filter without the convolution but the order was major than the actual orders).
my questions are:

Are there methods for reduce order of the filter without lose quality
as the ripple or attenuation?
If I change FIR by IIR, could I lose or distort information?
Is normal that the coefficients be very small or how could I convert
them in bigger numbers (near to order of 0.01 or 0.001 as minimum)?

Also, I tried to use only High-pass filter and Notch Filter then to do the features extractions but I have similar problem with the delay group too because I want to implement in a FPGA or DSP (for real time process) but the delay group is high compare with anothers works like my work.

Sorry, my english is not good.
Thank you so much for your time.


texts: Question based on scaling property of dft

texts: Can you please tell how use the scaling property to solve this question?? i am new to dsp subject


texts: How to Improve the Kalman Filter for Tracking the Periodic Motion of a Car?

texts:
I have a quite typical Kalman filter to design. I really read a lot of articles about the design of this filter but the performances of my filter are still quite bad.
Here is my situation. I have a small car that does periodic constant motion. This little car is moving uniformly in a straight line with v in time t, with a velocity of 0 in time 4t (You can think of it as the little car moving at a constant speed v to a target place and do something, and then moving at a constant speed v to the next location.) I can measure the speed v of the car (with noise) and I use the model as follows to estimate my little car:
X_ =  X_last
P_ = P_last +Q
Here is my Matlab code: (I don't want to use the Matlab Kalman function ;) )

clear
clc
t = 1:628;
Z = square(t/50,50);
Z = Z+1.4;
Z = Z*80;
ZZ = randn(1,628);
ZZ = ZZ * 10;
Z = Z+ZZ;
plot(Z);

data = zeros(1,628);

Q = 0.1;
R = 3;
X_last = 0;
P_last = 1;
Dx = 0;

for i=1:628
    X_ = X_last;
    P_ = P_last +Q;
    Kg = P_/(P_+R);
    X = X_+Kg*(Z(i)-X_);
    P = (1-Kg)*P_;

    Dx = X_last;
    P_last = P;
    X_last = X;

    data(i) = X;
end
plot(t,data,t,Z);

My question is, is there a more appropriate model of a Kalman filter for the type of car that I'm trying to predict? Although the model works well for constant velocity, there's a trailing when the velocity goes from V to zero as Fig. shown. Is there a good solution to that? Thanks!
PS:
I control the velocity of the car by the current of its electrical motor, so I used the motor current to do matlab calculations（ y axis）


texts: Capacity and channel estimation algorithms: explanation of results

texts:
I study a spectral efficiency of a system with a precoding scheme with different channel schemes.
Algorithm A for channel estimation gives a smaller estimation error instead of Algorithm B.
I have computed the precoding schemes using the resulted estimated from Alg. A and Alg.B.
As a result, the capacity with precoding for Algorithm A is better ( bigger) than for Algorithm B.

How can I explain the results?
Can I say that the reason is in estimation error? ( estimate of Alg A
is better)


texts:
I am trying to calculate the phase spectrum of a 2D function, $f(x,y)$, where $x$, $y$, and $f(x,y)$ are real, using MATLAB's fft2. Thus my operation is $f(x,y)\rightarrow F(k_x,k_y)$. My function is such that $k_x$ only has positive values and $k_y$ has both positive and negative values.

Since my function is real, I only need the one-sided spectrum. I can calculate the one-sided amplitude spectrum by doubling the spectrum where $k_x>0$. The result I get is exactly what I expect.

When it comes to the phase spectrum, I get a function that is not continuous. The phases appear to jump around with an approximate difference of $\pi$. Is this related to phase wrapping? How do I get a continuous phase plot in positive $k_x$?

More information on my image and code:
Data can be found here

My signal in $x$ and $y$ looks like this:

figure; contour(y,x,eta_0)
xlabel('y')
ylabel('x')

The amplitude spectrum looks like this:

dx = mean(gradient(x));
dy = mean(gradient(y));
Nx = 64;
Ny = 32;

Fsy = 1/dy;
Fsx = 1/dx;
kx_fft = 2*pi * Fsx/2 * linspace(0, 1, size(eta_0,1)/2+1);
ky_fft = 2*pi * Fsy/2 * linspace(0, 1, size(eta_0,2)/2+1);
ky_fft = [-fliplr(ky_fft(2:end-1)) ky_fft];

amp_xy = circshift(abs(fftshift(fft2(eta_0)))/Nx/Ny,-1,2);
figure; plot(ky,kx,amp_xy)

I know that my function does not contain any negative $k_x$ values and hence I can take the single-sided amplitude spectrum by doubling the positive $k_x$ values, to get this:

amp_xy = 2*amp_xy([Nx/2+1:Nx 1],:);
figure; imagesc(ky_fft,kx_fft,amp_xy);

The phase spectrum looks like this:
    phase_xy = circshift(angle(fftshift(fft2(eta_0))),-1,2);

This clearly displays jumps from around zero (which is where I expect my phases to be) to $\pi$ and $-\pi$. Why is that and how can I avoid it?

To illustrate my point, I can take a cut through my signal at the centreline of $y$ and check the 1D amplitude and phase spectra. The 1D phase spectrum shows most of the phases close to zero, with the lowest frequencies having a phase close to $\pi$/$-\pi$ as I expected (from theory):

Now if I was to take a cut through the 2D phase spectrum where $k_y=0$, I see something similar, yet not continuous. It is as if I need to shift some phases by $\pi$ up or down:

In essence, the question is: how do I get a smooth 2D phase spectrum in positive values of $k_x$?

Edit: If I calculate the phase angle using atan, rather than angle, I get a smoothly varying phase plot. That is expected though, since atan limits angles to $-\pi$ to $\pi$ whereas angle uses atan2, which spans the entire circle.


texts: Derivation of Inverse Fourier transform from forward Fourier transform

texts:
Consider the Fourier pairs:
$$\psi(x,t) \stackrel{\mathrm{FT}}{\longleftrightarrow} \Psi(k,t)$$
$$\text{If } \quad \quad\Psi(k,t)=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} \psi(x,t) e^{-ikx} \, dx \quad \quad \dots(i)$$
$$\text{then, can we derive: } \quad \quad \psi(x,t)=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} \Psi(k,t) e^{ikx} \, dk \quad \quad \dots(ii) \quad ?$$
I have used comparison method to proof $eq.(ii) $
i.e., $$\text{consider:} \quad \quad x(t) \stackrel{\mathrm{FT}}{\longleftrightarrow} X(\omega)$$
$$\text{then, } \quad \quad X(\omega)=\int_{-\infty}^{\infty} x(t) e^{-i\omega t} \, dt \quad \quad \dots(iii)$$
$$\text{and, } \quad \quad x(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty} X(\omega) e^{i\omega t} \, d\omega \quad \quad \dots(iv)$$
Now, comparing $eq(iii)$ with $eq(i)$ , we find:
$w \to k$
$t \to x$
$x(t) \to \frac{\psi(x,t)}{\sqrt{2\pi}}$
$X(w) \to \Psi(k,t)$ , putting these values in $eq(iv)$, we get:
$$\frac{\psi(x,t)}{\sqrt{2\pi}}=\frac{1}{2\pi}\int_{-\infty}^{\infty} \Psi(k,t) e^{ikx} \, dk $$
$$\implies \psi(x,t)=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} \Psi(k,t) e^{ikx} \, dk$$
But can we derive $eq(ii)$ from $eq(i)$? {without using any comparison}


texts:
I am using a miniature car and I want to estimate the position. We can not use GPS modules and most of the tracking systems that I saw, are using IMU sensor with the GPS module. In our car we are able to find our exact correct location with image processing but for some parts that don;t have enough markings we can not do this. So we want to use the IMU as backup for our positioning. so as long as the positioning is close is good for us.

We are only interested in our 2D position since the car is on a flat ground.

I am using a IMU 9DOF sensor and I want to calculate my movement. I have seen some amazing works with IMU for tracking body movements but no code or simple explanation anywhere about it. So basically, I have the reading from accelerometer, gyro and magnetometer. I also have orientation in quarternions. From the device I am also getting the linear acceleration but even when I am not moving it in any direction the values are not $0$ which is really confusing.

Can you please help me how to approach this?

Thanks in advance


texts: How do you construct common waveforms (square, sawtooth, triangle, noise) from sine wave partials using an IFFT?

texts:
In the lovely image below we see the addition of sine waves making a square wave. I am coding a wave table synthesiser and thought it would be great to get the user to be able to fiddle with the values of the sine partials and then run an inverse FFT on them to produce the wave form.

I have some code for an FFT and you specify the number of buckets, real and imaginary arrays and the array length. The way it is used in the example is:

Imaginary array has all it's values set to 0
The real array has its 0th element set to 0
The real array has its arrayLength/2 element set to 0
Other values are set in the real array. Every time a value is set in the first half of the array one is set at the opposite end of the array, mirroring whatever is happening in the first half of the real array.
This spits out a single cycle of the waveform constructed using these sine partials

What are some common patterns for filling these partials to generate waveforms. How do you generate a square wave, a triangle wave, a sawtooth? Can you create noise or is that impossible if it is non periodic?

Extra: What are some tricks for producing 'good' waveforms? This is an opinion question, just a bonus if you have something to share about producing waveforms that sound good. (Good in your opinion :)

For those who would find it interesting there is a flash app here that lets you set the levels of the partials in order to construct waveforms, it's fun.


texts: Terminology: Camera Tracking, Camera Relocalization

texts:
I am reading the paper RGBD Datasets: Past, Present and Future available here, and two terms that I am not familiar with are presented.
On page three, middle left side of the page, the author refers to

Camera Tracking
Camera Relocalization

From what I understand, camera tracking is when you have a sequence of 2D frames, and you track the position of an object within those frames to determine the camera's pose as it moves in space. I am wondering if this is correct?
Further, I am not sure what camera relocalization means, and some Google searching did not yield a conclusive answer. Any insights appreciated.


texts: Video Compression - When would an average of the previous and next I or P frame be useful

texts:
I'm doing practice exam questions for my multimedia systems exam one tuesday and a topic which seems to come up frequently is the appropriate use of encoding B-frames based on:

1)  the previous I or P frame

2)  the next I or P frame

3)  an average of the previous I or P frame

I'm having a bit of trouble thinking up decent examples of these, and I'm not entirely sure when an average would be most appropriate.  Would someone mind checking my examples or maybe helping me think of some more concise or realistic ones?

1)  A dropped ball about to hit the floor.  The previous frame the ball is the same shape but in the next frame it gets deformed because of the impact of hitting the ground, so the previous frame is better.

2)  A man running along the pavement and a car moves between him and the camera temporarily in the previous frame.  Due to object occlusion the image of the man in the previous frame is not complete so is not a good predictive frame, but the next frame the image of the man is complete so it is better to predict from this.

3)  I'm not sure at all what to put on this one.  I was thinking about a car moving with constant velocity across the screen because then it's position in the target would be the average of the previous and next -  but this seems quite contrived!

Anyway, any help would be appreciated so if you have ANY thoughts let me know!


texts: What's the point of defining the signal over the whole time domain?

texts:
This question is classic for anyone starting with some signal processing course, suppose $y(t)=x(t/2)$ then the system is noncausal because we have that the output at t=-6 depends on the input at t=-3 which is in the future. Suppose the signal is only periodic for positive t, then the whole signal is aperiodic.
But how does it even make sense to write a negative value for time, shouldn't any "real world" signal start at some instant, which we would call t=0, does negative time do anything other than make us refrain from writing too many piece-wise defined functions?


texts: Differences between soft knee and hard knee in Dynamic Range Compression (DRC)?

texts: I want to know more about where it is advantageous to use a soft knee and where and why a hard knee is preferred. Also I would like to get my hands on some good resources which talk about implementation of soft knee in DRC


texts:
I am trying to recognize the wood chips in the image shown below. The ultimate goal is to try and recognize the width and length of each wood chip.
Currently, I am using an approach that involves bilateral filtering on a grey-level image + Canny edge detection + Hough line transform.

Results are somewhat iffy - can you recommend other algorithms to try out or is this a problem more suited to a statistical / machine learning approach.


texts: How to find Leq for a WAV audio file like an SPL Meter would?

texts:
Given an audio file (WAV), I need to find the $\rm L_{A_{eq}}$ (continuous A-weighted equivalent sound pressure level) of the audio file. For this purpose, I am following this workflow:

Get a frame of audio (say $0.125$ seconds of samples)
Scale the samples to find the $\rm SPL \ re \ 20 \ \mu Pa$ based on calibration factor obtained from a calibration tone.
Apply A weighting to the frame of audio data.
For each frame of audio data, find the SPL (dB) as:

$$
\begin{align}
\textrm{pressure}_{\rm Ref}    &= 20\times10^{-6};\\
\textrm{amplitude}_{\rm rms}  &= \sqrt{\rm mean( audData_1frame.^2 )};\\
\textrm{dBspl}_{\rm perFrame} &= 20\times \log_{10}\left(\frac{\rm amplitude_{rms}}{\rm pressure_{Ref }}\right);\\
\end{align}
$$

This gives the $\rm SPL \ re \ 20 \ \mu Pa$ of a frame of data. This would be the Short $\rm L_{eq}$.

How do I proceed further to get these 3 quantities:

$\rm L_{eq}$ = The total continuous equivalent sound pressure level. This wold be a scalar value for the entire audio file. If it has to be updated in a plot, how do we integrate the SPL of each frame with the previous frames?
$\rm L_{eq_{fast}}$ = Sound pressure level with $125\ ms$ time weighting
$\rm L_{eq_{slow}}$ = SPL with $1\ s$ time weighting


texts: White noise gain of uniform spline interpolation

texts:
Uniform spline interpolation is fully defined by its continuous-domain impulse response. I noticed that the integral of the square of the impulse response over its support gives the average amplification of the power of white noise error in the samples.

What is this figure or its square root called? Is "white noise gain" $(\operatorname{WNG})$ appropriate for the square root?

For example for linear interpolation:

Figure 1. Linear interpolation impulse response

$$\operatorname{WNG} = \sqrt{\int_{-1}^1\left(\left\{\begin{array}x+1&\text{if }x<0\\1-x&\text{otherwise}\end{array}\right.\right)^2dx} = \sqrt{\frac{2}{3}}\approx0.8164965809$$


texts:
Does removing the mean value of the signal effect the estimation of power spectral density(PSD)? If it effects, how?

What is the advantage we can get by removing the mean of the signal in estimating the PSD ?

Can the advantage be in dealing with the signal points whose magnitude is very large and we can not see the changes(also frequency content) in the signal since the changes are very small comparing the magnitude of signal points?


texts:
I'm trying to design a MATLAB audio player that includes something like a 31-band equalizer. Right now I have the filters working by using the FIR1() function to create an FIR bandpass filter at each frequency specified on the bands. This is great except that it's not exactly what I'm wanting to do. I want to either boost or cut the desired frequency, not isolate the frequency.

How would I go about using these FIR filters in parallel to boost or cut the signal instead of just isolating the signal?


texts: Determine constant $A$ such that $x[n] = x[n] \star x[n]$

texts:
Let $x[n] = A\delta[n] - \frac{\sin(\frac{3n}{2})}{\pi n}$. Determine constant $A$ such that for all $n$ $$x[n] = x[n] \star x[n] \tag{1}$$
I think it's not possible since $(1)$ leads to $$X(e^{j\omega}) = X(e^{j\omega})X(e^{j\omega})$$ And this means $X(e^{j\omega}) = 1$ or $X(e^{j\omega}) = 0$. Also $$X(e^{j\omega}) =  \begin{cases} A - 1   &0\le | \omega| \le \frac{3}{2}   \\ A &   \frac{3}{2}\lt | \omega| \le \pi \end{cases}$$
It means no value of $A$ works. I don't know whether is my answer correct. Maybe I've neglected something.


texts: Output signal as convolution of impulse response and step signal

texts:
Hi All: This question is kind of an add on question to the gorgeous answer by Juancho provided at this link:

How does this "simple filter" work?

The answer explains how the limit of exponential smoothing given an impulse response $x_0$, (so that new $x_i$'s are not arriving. only $x_0$ arrives) can be computed by convolving the impulse  with a step signal.

The difference between the framework at that link and my framework is that  actual series is not driven by an impulse response. By this I mean that the same process, occurs over and over because a "new" $x_i$ is arriving during each period so one could think of there being an impulse response as described but occurring in each period.  So, there is a step signal convolved with the first impulse response. Then, in the next period, another step signal is convolved with a second impulse, etc, etc. In other words, now there is $x_1$, $x_2$, $x_3$, ..... $x_n$, where each $x_i$ gets operated on in the same manner as described by Juancho.  Assuming that my setup is clear, my question is: is there a simple recursion for this non-impulse response case. Does my case have a name ?  It seems like there should be a way to use recursion  but I can't figure it out. Thank you very much for any references, answers, books, whatever.


texts: Is there a means to identify/separate multiple out of phase copies of the same frequency?

texts:
Given a signal that consists of three 1.xxx kHz signals added together (where xxx is never more than 0.01). Each of the three 1kHz signals is 60 degrees out of phase (first is offset by 0 degrees, next is offset by 120 degrees, and the third is offset by 180 degrees), What's the best way to detect the fact that there are three "instances" of very similar frequency present, and the phase offset of each?

I tried using FFT but it doesn't seem to have a notion of phase. I searched the internet a bit for FFT and phase but can't find any way to use FFT to extract multiple instances of a frequency separated only by phase.

I think in order to use FFT in the traditional sense, I would need to have an extreme number of bins (1000*sample_rate?).

I built a gnuradio flow graph to experiment with the concept.

The resulting FFT shows peaks at 0kHz and 1kHz. I can't think of a way to extract the original three signals out of the original.

My use case deals with input signals that differ in frequency by as little as 0.001Hz. Detecting the presence of the component signals and identifying  their precise frequency is what I need to do. Their frequencies vary ever so slightly over time.


texts: The Fourier Transform of a periodic function and it's series

texts:
Let $X(f)$ be the Fourier transform of $x(t)$:

$$ X(f) \triangleq \mathscr{F}\Big\{ x(t) \Big\} = \int\limits_{-\infty}^{\infty} x(t)\,e^{-j 2 \pi f t} \ \mathrm{d}t $$

$$ x(t) \triangleq \mathscr{F}^{-1}\Big\{ X(f) \Big\} = \int\limits_{-\infty}^{\infty} X(f)\,e^{j 2 \pi f t} \ \mathrm{d}f $$

The question here it's how can I mathematically relate the Fourier transform of a function with its Fourier coefficients $c_n$ (complex form)

$$ x(t) = \sum\limits_{n=-\infty}^{\infty} c_n e^{j 2 \pi (n/T)t} $$
where
$$ c_n = \frac{1}{T} \int\limits_{t_0}^{t_0+T} x(t)\,e^{-j 2 \pi (n/T)t} \ \mathrm{d}t \qquad \qquad -\infty < t_0 < +\infty $$

I mean, it's quite obvious that for a non periodic function $ T\cdot c_n = \mathscr{F}\Big\{ x(t) \Big\} $

However, if I have $x(t)$ periodic and take $x_m(t)=x(t) \cdot \operatorname{rect}\left( \tfrac{t}{T} \right)$

(that means we take a period of $x(t)$)

$$\mathscr{F}\Big\{ x_m(t) \Big\} = X(\nu) * T \operatorname{sinc}(T \nu)$$

($\nu$ is the frequency variable in Hz)

On the other side we may consider that

$$x_m(t) = \sum\limits_{n=-\infty}^{\infty} c_n e^{j 2 \pi (n/T)t} \longleftrightarrow \mathscr{F}\Big\{ x_m(t) \Big\} = \sum\limits_{n=-\infty}^{\infty} c_n \delta(\nu-\tfrac{n}{T}) $$

So what I've seen people doing was saying that we could replace $c_n$ for $\frac{1}{T}\mathscr{F}\Big\{ x_m(t) \Big\}$  and then if I have a repeated spectrum in time I can only calculate it's transform and I'll have the amplitudes on the frequency spectrum for each dirac.

I cannot see it mathematically nor can say if it's true.


texts: Generalized Likelihood Ratio test for correlated data

texts:
Consider a sequence of random variables $\overline{z} = \{z(k-M+1), ..., z(k)\}$, with probability density depending upon a scalar parameter $\theta$. It is intended to decide between two hypotheses

$$
H_0: \theta = \theta_0    \hspace{3em} for \hspace{3em}  k-M+1 \leq i \leq k \\
H_1: \theta = \theta_1    \hspace{3em} for \hspace{3em}  k-M+1 \leq i \leq k \tag{1} $$

It is assumed that all the parameters are known except for $\theta_1$ which is replaced by its MLE estimate.
Then, the GLR test is

$$L(\overline{z}) = \frac{p\left(\overline{z}, \; \hat{\theta_1}; \; H_1\right)} {p \left(\overline{z}, \; {\theta_0}; \; H_0 \right)} \tag{2}$$

where $\overline{z} = \{z(k-M+1), ..., z(k)\}$ is iid.

Then GLR test can be simplified to

$$L(\overline{z}) = \max\limits_{\theta_1} \left(  \sum\limits_{i = k-M+1}^{k} ln \frac{p(z(i)|\theta_1)}{p(z(i)|\theta_0)}  \right)\tag{3} $$

But what if $\overline{z} = \{z(k-M+1), ..., z(k)\}$ are correlated. I need to simplify $(2)$ for simplified Gaussian process.

Any help, referred references for correlated GLR test is highly appreciated.


texts:
I just recently started out with Image processing and taken up a course related to it in Grad school. But I already have a project to do without too much information about the subject, however I've made some steady progress. I am trying to segment the pills from their respective backgrounds. For images with contrasting backgrounds, I've been able to segment the pills using Otsu's method. With regards to images with similar backgrounds, Otsu's method doesn't quite work. I've been reading quite a few papers with regards to segmenting, but most of the papers that I've read use a manual thresholding value depending upon the kind of image. Is it possible to detect the correct thresholding value and automatically threshold an image and use techniques such as seed-growing or clustering to segment the image ?

The color space I've been using is Lab*, so I'd appreciate it if you could recommend the appropriate color space that I should be using too.

The images in question:

original 1

result 1

original 2

result 2

original 3

result 3


texts:
I have read in many places that Moving median is a bit better than Moving average for some applications, because it is less sensitive to outliers.
I wanted to test this assertion on real data, but I am unable to see this effect (green: median, red: average). See here:

Here's the sample audio data test.wav. Here's the Python code:
import numpy as np
from scipy.io.wavfile import read
import matplotlib.pyplot as plt

def median(lst): return np.median(np.array(lst))
def mean(lst): return sum(lst)/len(lst)

(fs, x) = read('test.wav')

x = abs(x)
env = np.zeros_like(x)
env2 = np.zeros_like(x)

for i in range(len(x)):
    env[i] = median(x[max(i-1000,0):i+1])
    env2[i] = mean(x[max(i-1000,0):i+1])

plt.plot(range(len(x)), env, color = 'green')
plt.plot(range(len(x)), env2, color = 'red')
plt.show()

I have tried with various values for Window width (here in the code : 1000), and it was always the same: the moving median is not better than moving average (i.e. not less sensitive to outliers).

The same with Window width = 10000 (10000 >> the spike width) :

Question:
Can you provide an example showing that moving median is less sensitive to outliers than moving average? And if possible using the sample .WAV file data-set (download link).
i.e. is it possible to do a moving median on this data such that the result is like this yellow curve? (i.e. no more spike!)


texts: Probability of a random signal being approximately sparse

texts: Given a random signal of length $N$, is there any way of estimating (or bounding) the probability of it having an approximately sparse DFT representation, with the degree of sparseness given by parameter $\delta$, and $k$ representing the number of approximately non-zero coefficients $(k = N^{\frac{1}{\delta}})$?


texts:
I am making a pronunciation Scoring system, and I need to know how to separate the pronunciation information of an MFCC of a given spoken word, so that later i can match this MFCC with  the MFCC of the word. can that be done threw matlab or HTK ?

Second Question:
In the matching part, shall I used DTW or standard edit distance algorithm or a simple MSE ??

Thanks in advance


texts: Calculating Transfer function numerator and denominator from the rationalfit model

texts:
I have a frequency response data called 'AC_data' which is a vector of complex numbers (real and imaginary part) at different frequency points.
I have calculated a rationalfit model for the AC_data using the following function in MATLAB:
[AC_fit, tol] = rationalfit(freq, AC_data, 'Npoles',[1, Npoles],'TendsToZero',true);

So this AC_fit is a rfmodel.rational array with (A, C, D, Delay) properties.
Now I am looking for a function that takes this rationalfit model (i.e. AC_fit) as an input and gives out the numerator and denominator vectors of the transfer function. Something like this:
[num_tf, den_tf] =  get_tf_from_rat_fit(AC_fit, Npoles);

How can I write the 'get_tf_from_rat_fit' function?
Is there a built-in MATLAB function that can do this job?
P.S. I am aware that I may be able to get the numerator and denominator of the TF from the AC_data by using other approaches, but for some reason I want to stick to this rationalfit method.


texts: Noise removal in medical segmented image

texts: Can anyone suggest methods for removing the noise (indicated inside the red square) from every where in the following image, while keeping the white lines?


texts: How to visualize and understand Gabor filter using MATLAB

texts:
I am reading a paper, in which the author defines gabor kernels as :

$$
\psi_{\mu,\nu}(x,y)=\frac{\lVert \mathbf{k}_{\mu,\nu} \rVert}{\sigma^{2}}\exp \left(-\frac{\lVert \mathbf{k}_{\mu,\nu}\rVert^{2}\lVert \mathbf{z}\rVert^{2}}{2\sigma^{2}}\right)\times\left[\exp\left(i\mathbf{k}_{\mu,\nu}^{T}\mathbf{z}\right)-\exp\left(-\frac{\sigma^{2}}{2}\right)\right]
$$
where $\mu$ and $\nu$ define the orientation and scale of tghe Gabor kernels, respectively, $\mathbf{z}=(x,y)^{T}$, and the wave vector is defined as

$$
\mathbf{k}_{\mu,\nu} = \left(k_{\nu}\cos{\phi_{\mu}},k_{\nu}\sin{\phi_{\mu}}\right)^{T}
\quad\text{with}\quad k_{\nu} = \frac{k_{\rm max}}{f^{\nu}}, k_{\rm max}=\frac{\pi}2,f=\sqrt{2},\quad\text{and}\quad\phi_{\mu}=\frac{\pi\mu}{8}$$

Now, I want to plot the graph of this function using matlab to visually see and understand the Gabor filter. I have very basic knowledge in using matlab.

Specifically, I am interested in viewing these Gabor Kernels at single scale $(\nu=0)$ and four orientations $(\mu\in\{0,2,4,6\})$ with $\sigma=1$

Right now I am trying to understand Gabor filters. Any help will be greatly appreciated.

Thanks in advance.


texts: How can I reconstruct a 3D structure from a set of images?

texts:
I have a set of contours (set of line segments) grouped in the following way:

$S_i = \{I^0, I^\frac{\pi}{4}, I^\frac{2\pi}{4}, \ldots, I^\frac{7\pi}{4} \}$

where

$S_i$ denote sequence of photos of one concrete object.
$I^j$ denote an image, with $j^{th}$ point of view ($j=0$ means front view).

Here is example of $I^\pi$ (rear view):

How can I reconstruct 3d structure of object with given $S_i$?

Can someone point me to some papers or even give me some keywords? I know that there are a lot of articles that operate with clouds of points and so on, but those don't work as I'm operating with lines.


texts:
I'm using an EKF and some gains are bigger than 1, is that possible? In the KF I understand that the typical values are [0-1], but in EKF??

I really appreciate your response. I was studying the equations for a simple system of position of a particle at constant velocity that I show in the figure, discretized with euler. In the Figure I show the equations to make the estimation for the three possible cases for this system, where we only measure x1, only x2 or both.

In the equations of the KF I see that for example I have expressions like xk1 + = (1-W11) * (xk1 -) + W11 * (z1), ie if W11 changes from zero (the filter uses only the prediction in this case to perform the estimation) to one (the system uses only the measurement in this case to make the estimation) and in the middle we have a mixture. That's why I thought that concept was unique. I do not understand when W should be greater than one. ("Mido" means meassure).


texts: Fast cross correlation with limited range

texts:
I am measuring the phase shift between two pseudorandom signals using correlation ifft(A.conjugate()*B) and picking out the maximum).
That works very well, but takes a lot of time. I roughly know where the peaks are, and don't need the correlation for other shifts.

Is there an adaptive cross-correllation algorithm that would speed up the process if I am only interested in the positions of maxima, and already roughly know their positions?
Analog to the sliding DFT?

Maybe running the cross-correlation on a decimated version of data, finding the peaks, interpolating, and then doing a manual correlation around the max?

I already know within 200 samples where the maxima are.
The record length is about 200k samples.


texts: Why is convolution or FFT breaking in this case?

texts:
It is well-known that convolution in real space corresponds to multiplication in the reciprocal space. Yet, I obtain different results using both methods in the case that I'm going to present. I am sure that I made a mistake, but I really can't see where.

The Python code:

%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt

# Create a signal: a gaussian
sig = np.exp(-(np.linspace(-10, 10, 1024))**2)
# Calculate its FFT transform
F_SIG = np.fft.fft(sig)

# Create an FIR filter from its transform
F_KER = np.empty_like(sig, dtype=np.complex128)
F_KER[:len(F_KER)//2] = np.exp(-1j*np.pi/3)
F_KER[len(F_KER)//2:] = np.exp(1j*np.pi/3)
F_KER[[0, len(F_KER)//2]] = np.cos(np.pi/3)
# Get its inverse FFT transform
kern = np.fft.ifft(F_KER) # is actually pure real value
print("Max real value:\t", np.abs(kern.real).max())
print("Max imaginary value:\t", np.abs(kern.imag).max())
print("Therefore 'kern' can be considered pure real.")
kern = kern.real

# From math books,
# multiplication in Fourier/Frequency space <-> convolution in real space
multFFT_sig = np.fft.ifft(F_SIG*F_KER).real # Again, pure real, can be checked
conv_sig = np.convolve(sig, kern, "full")

# Plot both of them
plt.figure()
plt.xlim([0,1024])
plt.title("Convolution vs. FFT multiply")
plt.plot(multFFT_sig)
plt.plot(conv_sig)

# Padding problem? Circular convolution problem?
plt.figure()
plt.xlim([0,1024])
plt.title("Original signals")
plt.plot(sig)
plt.plot(kern)
plt.legend(["Orig. signal", "Conv. kernel"])

plt.figure()
plt.xlim([0,2048])
plt.title("Zero-padded signals")
p_sig = np.append([0]*512, np.append(sig, [0]*512))
p_kern = np.append(kern[:512], np.append([0]*1024, kern[512:]))
plt.plot(p_sig)
plt.plot(p_kern)
plt.legend(["pad. signal", "pad. conv. kernel"])

# Calculate convolution padded terms
plt.figure()
plt.xlim([0,2048])
plt.title("Padded convolution vs. FFT multiply")
p_F_SIG = np.fft.fft(p_sig)
p_F_KER = np.fft.fft(p_kern)
p_multFFT_sig = np.fft.ifft(p_F_SIG*p_F_KER).real # Again, pure real, can be checked
p_conv_sig = np.convolve(p_sig, p_kern, "full")
plt.plot(p_multFFT_sig)
plt.plot(p_conv_sig)

The output:

Max real value:  0.551327165647
Max imaginary value:     2.55232033425e-15
Therefore 'kern' can be considered pure real.

I also tested with scipy.signal.fftconvolve and compared with the analytical answer: the FFT multiplication gives the right answer (clearly asymmetrical peak in blue) while the convolution (in real space or using FFT) is wrong.

Why is convolution not working as intended?


texts:
I'm working on studying an endangered language and have the following problem: while I already have labeled exactly what the speakers I worked with have said at given timesteps on the word level and I know what possible lists of sounds/phones/letters can make up the word, I need a way to automatically detect the boundaries of the sounds with minimal data (maybe a few hours of recording).
To handle the case where a word may only be pronounced one way at first, I wonder if finding the difference or angle between MFCC vectors to create a function of MFCC change and then finding the max n points could work, but I'm not sure if there is a better way of doing this. I also worry about the fact that some boundaries may be less pronounced between sounds than others. I also don't know how to handle the case where a word may be pronounced with varying numbers of phones (eg. "texts" /t eh k s t s/ -> [t eh k s] or [t eh k s t s]).
Any help would be appreciated


texts: Intuition behind cepstrum analysis terminology

texts:
In multiple books I found a parallel between spectrum-analysis terminology and cepstrum-analysis terminology that says

 low pass filter $\rightarrow$ short pass lifter

I didn't read explicitly what lifter does, but assuming a short pass lifter passes short rahmonics just as low pass filter passes low harmonics, why the parallel isn't rather

 low pass filter $\rightarrow$ long pass lifter

since low harmonics correspond to long rahmonics?


texts: How do the magnitude and phase spectrum of an imaginary function look like?

texts:
Say I have the function
$$x(t)=j \operatorname{rect}(t)$$
Is the phase spectrum even or odd?
I am confused whether the phase spectrum is an odd/even function of $\omega$ (angular frequency, Fourier transform variable).


texts: Translating SFFT expression to MATLAB code

texts:
The Symplectic Finite Fourier Transform (SFFT) of a 2D periodized sequence $x[k,l]$ with periods $(M, N)$ is defined as
$$X[n,m] = \sum_{k=0}^{M-1} \sum_{l=0}^{N-1} x[k,l] e^{-j2\pi \left(\frac{mk}{M} - \frac{nl}{N}\right)}$$
Is the above expression equivalent to an FFT performed on the rows of $x$ and IFFT performed on the columns? If yes, does the following code justify the observation?
function [X] = SFFT(x)

% 1. transpose the sequence x to convert rows into columns
% 2. execute fft() command to compute fft of the columns (which are originally
% rows)
% 3. transpose the matrix back to original form
% 4. execute ifft on the columns

X = ifft(fft(x.').');


texts: What is the pipeline DAC tollerable offset from plot

texts:
I have analyzed the circuit in full extent as shown bellow.
I know that I showed imagine two-stage back to back and see "which input could handle both".
Could you please show how exactly I get this tolerable offset from this case?
Thanks.


texts: What is the relation between the carrier frequency and the attenuation of electromagnetic waves?

texts:
For electromagnetic waves, what is the relation between the the carrier frequency, attenuation (absorption loss) and propagation distance?
I know that modulating high frequency carriers are required to reduce antenna size, and to transmit several signals simultaneously.

My question is : does the attenuation increase with these high frequecies when transmitted through air? If so, how is this problem solved?


texts:
I'm reading through the opencv documentation and some questions in SO but it doesn't seem to provide this information.

I've an image $I(x,y)$ and I want to find a gaussian function $f_{\mu,\Sigma}(x,y)$ such that
$$
f_{\mu,\Sigma}(x,y) \approx I(x,y)
$$
using LSE or MLE estimation. $\mu$ is the mean vector and $\Sigma$ is the covariance matrix. My question is if there's any opencv function that perform such task.

People suggest to implement the estimator from scratch, though some suggested to use LM algorithm for such purpose, and in general doesn't seem very difficult I wonder if there's any function for such purpose.

Is there any?

Thank you


texts:
Today I was talking to my collegue about clipping and he said that clipping produces harmonics in frequency domain as he showed me the clipped signal frequency response.

However when I asked him why does that happen, he couldn't answer. I did some googling and still not able to see why it is so.

This Link does mention about what we observed but didn't explain as to the reason why does it create harmonics? Does anyone know why it is so?


texts: What distance metric can I use for comparing image features like elongation and solidity of each image?

texts:
What distance metric can I use for comparing image features like elongation and solidity of a contour of each image?
Except Least Square and without using a support vector machine because i do not know at which class images belong.


texts: How does integration of a signal change the spectrum?

texts:
It's a very basic question, but I havn't found the question on google or dsp.stackexchange.com:
How does integraion of a signal change the spectrum?


texts: Can someone write down steps an totally beginner in EE and DSP needs to pass to become a audio engineer? From which subject to start with (math, electronics), and with which subjects to continue this road? My goal is to get a good knowledge in audio signal processing, things like creating sounds (sound synthesis), sound transformation, mixdown audio, understand fundamental things. I will be very grateful if someone give me instruction from where to start and what path to follow, and on what to mostly pay attention, I have a great desire to learn all of that, I have 6 years experience in electronic music production. Thank you very much!


texts:
I am trying to understand how to interpolate discrete sinusoidal data that I (for now) generate myself, and I get problems that I don't understand. I'm a newbie in this field so do not hesitate to point out even the most basic errors.

I have tried two approaches.

The first is to take (Python's/numpy's) fft(), get amplitudes with abs() and phases with
$$
\frac{\text{angle} - \pi/2}{2 \pi} * \text{signal_length}
$$

Then, for each sampling point $p$ I do a sine series,
$$
\sum_i \text{amplitude}_i * \sin(2 \pi i * \frac{p - \text{phase}_i}{\text{signal_length}})
$$

For artificial data where the (only) sine lambda is signal_length the fit is perfect regardless of the artificial data phase. However, if I generate the data with sine that has lambda of half the signal length, the fit is far from good for most phase offsets. Obviously, the fit is also not good when I generate a signal from several added sines of different lambdas.

Edit 1: Note that I can artificially correct the phases of different lambdas by dividing them by n, where n is signal_length / lambda of the generating function, but this doesn't help when I don't know the lambda of the generating function and/or when the signal is a mix of several sines.

The second approach was to get separate sine and cosine amplitudes from fft() output by real() and -1 * imag() and then do a summation similar to above for both sine and cosine terms. This works well whenever the phase offset of the generated data is n*2*pi but unwell when it's anything else.

Eventually I'd like to be able to interpolate data generated by a superposition of several sinusoidal functions of various lambdas and phases, but so far it's not looking good. I think there is something that I don't understand about Fourier/DFT.

Note that I can't/don't want to use any built-in ifft functions but I need to do some kind of a sine/cosine summation manually. I tried to write the definition of inverse DFT, but the built-in functions don't understand correctly things such as e^i. Ideally I would want to sum just the sine or the cosine terms, but not both.

Edit 2 LaTeXed some math


texts:
I'm in the process of building features for an EEG machine learning problem and have been doing some reading about what features may be useful. Turns out, that alpha band (8-12Hz) power can make a good distinction between my categories. The nuance is that for 1 category, alpha power rises and then falls over the time series, but for the other category alpha power begins low and then rises

I have a butterworth filtered signal which gives me a fairly clean alpha wave, but is it possible to determine power of this band at every time point over the series?

If I can get away with doing the calculations on just the filtered signal then that'd be ideal, without having to resort to running an FFT (the eventual goal is to do this online and my concern is speed)

Could it simply be the squared amplitude at every time point? Or do I need to run a specific FFT/time-frequency type analysis for this?

I've been trying to find some Python code for this but haven't had much luck because I mostly am not sure the best way forward


texts:
I want to use MFCC (Mel-frequency cepstral coefficients) and DTW (dynamic time warping) algorithms to make a speech comparison script. I calculated MFCC  and got 13 coefficients for each frame.

How do I calculate DWT from that? Should I discard the frames and just look at coefficents as an array. I read in this post: Speech recognition using MFCC and DTW(Dynamic Time Warping)? that you should calculate DTW between each frame, but I don't understand what I should do after I have calculated all those DTWs. If I have one audio sequence of $n$ frames and the other one of $m$ frames, then I get $n \times m$ DTW costs. And, where do I go from there.


texts: Finding the auto-correlation sequence $r_{xx}[k]$ for an AR(2) process

texts:
Consider the following recursive difference equation of a LTI system, where $v[n]$ is a white noise, zero-mean process with $\sigma_v^2 = 1$.

$
x[n] = v[n] + 0.75x[n-1]-0.25x[n-2]
$

I want to calculate the auto-correlation sequence $r_{xx}[k]$ for $k=0,1,2$. I started as follows:

$
r_{xx}[k] = E\{(v[n] + 0.75x[n-1]-0.25x[n-2])(v[n-k] + 0.75x[n-k-1]-0.25x[n-k-2])\} \\
r_{xx}[0] = E\{ v[n]^2 \} + 0.75^2 E\{ x[n-1]^2 \} - 2 \times 0.25 \times 0.75 E\{ x[n-1] x[n-2] \} + 0.25^2 E\{ x[n-2]^2 \} = \sigma_v^2 + \frac{5}{8} r_{xx}[0] - \frac{3}{8}r_{xx}[1]
$

As you can see, in the equation for $r_{xx}[0]$, a term with $r_{xx}[1]$ remains. If I then want to determine $r_{xx}[1]$, a term with $r_{xx}[2]$ remains, and so on. How is it possible to solve this problem?


texts:
I am working in digital image restoration field, recently i am studying a paper Blur-Kernel Estimation from Spectral Irregularities, in this paper i have got some terms, which i am unable to understand, can anyone please provide me specific description of these terms. [i have already google it, but i didn't get satisfactory answer].

four-point Laplacian filter

The Wiener−Khinchin theorem

Power Spectrum of an image

autocorrelation

Fourier slice theorem


texts: What is the name of these simple filter algorithms?

texts:
I found some snippets of code on the internet that are really simple signal filters. Unfortunately there wasn't much info to back it up. Using Google I've found similar code, but none of it backed up by research or documentation. I've tried it and it works well enough for my situation.

The low pass filter looks like this:

float RC = 1.0/(CUTOFF*2*3.14);
float dt = 1.0/SAMPLE_RATE;
float alpha = dt/(RC+dt);
float out[numSamples];
out[0] = in[0];
for(i=1; i<numSamples; i++){
    out[i] = out[i-1] + (alpha*(in[i] - out[i-1]));
}

And the high pass filter looks like this:

float RC = 1.0/(CUTOFF*2*3.14);
float dt = 1.0/SAMPLE_RATE;
float alpha = RC/(RC + dt);
float out[numSamples];
out[0] = in[0];
for (i = 1; i<numSamples; i++){
    out[i] = alpha * (out[i-1] + in[i] - in[i-1]);
}

I'd like to know if there is a name for these algorithms or who invented them so I can find more information about them.


texts: Conversion between DCT to DFT frequency domains

texts:
It is well known that the DFT can be interpreted as a filter bank. The same can be done for the DCT, for instance Fig. 3.29, pag. 129 in [1] shows a plot of the frequency response of a DCT filter bank. I am wondering how this plot (and similar plots for other transforms like DST, etc.) was obtained. For the DFT, we have the prototype filter $H_0(z)=\sum_{n=0}^{N-1}z^{-n}$. The frequency response of the $k$-th DFT bin is $H_k(z)=H_0(z\, e^{-j\frac{2\pi}{N}k})$. Using the transformation $z=e^{j\omega}$ we can readily find the frequency response for all bins (see the plot below).

As far as I know there is no z-transform equivalent for the DCT, so it's not clear to me how that plot was obtained. Any ideas?

[1] Malvar, H.S., Signal processing with lapped transforms, 1992, Artech House


texts:
If it is discrete LTI system,
How can i derive step response in terms of impulse response from the convolution sum?


texts: Are there preferred patterns for creating texture on objects to aid computer vision?

texts:
In the comment to this answer using a laser diode and diffraction grating to provide texture on a surface was suggested to aid in height calculations in a computer vision system.

I believe the pattern that I'm familiar with is projecting a chessboard pattern on the object.  I was under the (incomplete) understanding that the deformation of the projected image was somehow used directly.  That is to say the formerly square pattern that is projected becomes a curved polygon and the transformation back to a square gave some information about the 3D structure.  Is this incorrect?

Are there preferred patterns?  What are the dependencies in choosing a pattern?  Does it depend on the shape, material, etc, of the target object or is it more a function of the amount of variability in the features?


texts: Tradeoff between Filter Order and Sections

texts:
I have designed a bandpass IIR butterworth filter with desired response using the MATLAB FDAtool with the configuration shown in the figure below

Since this is multistage implementation, when I export the filter object to workspace I don't get numerator and denominator of transfer function as filter parameters and instead I get sos matrix and scale values as shown below

FilterStructure: 'Direct-Form II, Second-Order Sections'
              Arithmetic: 'double'
               sosMatrix: [12x6 double]
             ScaleValues: [13x1 double]
     OptimizeScaleValues: true
        PersistentMemory: false

The problem is I have to port this design to C code for implementation in firmware and the multi-order specification looks complicated to define an input-output expression. So I tried converting this design into a single stage filter(using convert to single section option under edit), but the following is magnitude response that what I get.

Not only is the response way-off, but the system is unstable.

My questions are the following,

1) Why is FDAtool not able to produce a good single stage equivalent filter?

2) How to calculate groupdelay of the multi-stage filter?

3) Is the groupdelay of the multistage filter simply FilterOrder*Sample time as in a direct form FIR or is it more complicated for IIR and multistage filters?

4) Will the groupdelay of multi-stage filter be the same as a possible acceptable(in terms of magnitude response) single stage equivalent?

5) How important is stability of the filter?

6) Does FDAtool have an option to visualize the filter structure?(Edit>Show Filter Structure doesn't seem to work)

7) What is the tradeoff between Filter Order and Number of sections in the filter other than structural complexity?


texts: Non Linear Remapping of the Pixel Values

texts: Suppose you take a photo of a beautiful scene of mountains and a lake. The representation devotes half of the scale between black and white to the bright surface of the lake, and the other half to the subtle shadings of the mountains. Is it possible to change the mapping so that only ¼ of the scale is devoted to the lake's colors, and ¾ to the mountains shades? If so, how would you do it?


texts:
Should carrier recovery be done always 1 sample per symbol? This is ok if carrier recovery is before timing. But Nco inside carrier recovery may work at higher rate

If my carrier recovery is first then should i do at n samples/symbol. ie 4
If number of samples / symbol are more is there any advantage.


texts: What sample rate should I use on my ADC?

texts: I have an ADC that will have a guitar track as an input. I want to find which notes are hitting via the frequency domain. Given that guitar frequency range is from 82Hz to 1046Hz which sample rate (window) should I choose? I had read on an article about some kind of rule but I can't find it..


texts: Is there an algorithm to compute the phase for a single frequecy?

texts:
If you have a function $f(t)=A \cdot \sin(\omega t+\phi)$, and reference sin wave $\sin(\omega x)$ what would be a fast algorithm to compute $\phi$?

I was looking at Goertzel algorithm, but it doesn't seem to deal with phase?


texts: What does "how to identify impulse response of a system?" mean?

texts:
I don't know where to start from, I'm not familiar with math.
I'm trying to understand this question "how to identify impulse response of a system?".

As you can see as below figure, as I know, the input delta function and output is $h[n]$.

In this case, if I put impulse (function) signal in to above system, then I can get the impulse response. Then I think the output $h[n]$ and impulse response are the same, doesn't it?

Question 1: What is the meaning of "how to identify impulse response of a system"? Is this asking about convolution or auocorrelation? I can't understand what it does  mean.
Question 2: I want to know how to identify impulse response of a system?
Question 3: Why do we get the output of $y[n]$ when if we know that input $x[n]$, impulse response $h[n]$. I mean the output $y[n]$ is the same $h[n]$ isn't it? I'm very confused.

If you have any hint, please let me know.

Update

I found a question in my case as below,

  1.2.8 Consider a discrete-time LTI system described by the rule $$y(n)=x(n-5)+\frac 12 x(n-7).$$  What is the impulse response $h(n)$
  of the system ?

How to identify $h[n]$?

the answer :

$h[5]$ = 1+ 0 = 1

$h[7]$ = 0 + 1/2 = 1/2

. . .


texts: Recommendation for courses / studies on digital signal processing

texts:
I hold a master's degree in mechanical engineering. However at my job I am more and more diving into topics of signal processing and data science. I find it great to discover about new topics and to learn on the go as I work on projects. During my study I had some basic courses on which I can build on. But sometimes I wonder if it wouldn't be easier and also more fun to for instance do a 2nd master or something similar on the topics I am trying to learn. I think my employer would support me if I want to and as I liked studying in the past I think that could be a great experience.
So with that the question arises what type of course/study would be a good fit? Ideally it would cover relevant topics* for my work/interest, be able to partake in part-time, be online (or taught block-wise in central europe) and include collaborative elements (I don't want to just learn and work by myself without interactions).
*some topics I recently dealt with that I would like to know more about:

Singular Value Decomposition
Kalman Filters (especially in the context of inertia measurement units and nonlinear problems)
Principal Component Analysis
Digital Filter Design
Control theory (implementing a control algorithm and tuning it for a problem)
Running a control algortihm on a microprocessor
Machine Learning for Audio Processing
Wavelet Transforms
...


texts:
Using a compilable programming language (not Librosa, Matlab, etc), I am attempting to perform ISTFT on filtered (masked) source STFT matrices obtained from NMF.  During the original construction of the mixed STFT matrix, I am using a window length of 1024, and hop length of 512.  When I run FFT on each window's $x(n)$ of length 1024, I can only use the first 512 amplitude and phase values returned, due to Nyquist.

After I generate filtered STFT's from each source after NMF, how can I estimate a $y(n)$ of length 1024 fin the time domain when I only have 512 inputs to IFFT?  (The 512 inputs for each IFFT are the elements in each column of the filtered source-specific STFTs).

Should I keep the full 1024 coefficients returned from the original FFTs, and use a mixed STFT with dimensions $1024 \times \#windows$ as the basis for the entire analysis?

Last, the filtered source-specific STFT matrices will not provide real and complex values returned from an FFT, which are required for IFFT.  Thus, my logic tells me OLA is a method to side-step IFFT.


texts: Understanding convolution of Chirp z algorithm

texts:
I dont´t understand how works the convolution part of the Chirp z.

I understand how the DFT is transformed

\begin{align*}
x(k) = \sum_{n=0}^{N-1} x(n) W_N^{kn}
\end{align*}

to this expresion:

\begin{align*}
x(k) = W_N^{k^2/2} \sum_{n=0}^{N-1} ( x(n) W_N^{n^2/2} ) W_N^{(k-n)^2/2}
\end{align*}

After that it can be expressed as the convulution of two series:

\begin{align*}
a_n &= x(n) W_N^{n^2/2}\\
b_n &= W_N^{n^2/2}
\end{align*}

Here i get lost. I can see where it is $an$ but the term $bn$ is confusing because it has "lost" its k and it appears outside of the sum.

After that x(k) is expressed by:

\begin{align*}
x(k) = b_k * \sum_{n=0}^{N-1} a_n b_{k-n}
\end{align*}

I don't understand this last step either.

I read the implementation of this question Chirp z algorithm clarification which truly helped me to undersand how its calculated but

2.I don't understand the answer to it:

  When creating the chirp signal used in convolution, the values of (k - n) which result in a negative need to be wrapped around and placed at the end of the signal rather than in the beginning

I think the content of the answer is related to where I get confused because of the first part that I don't understand.


texts: What is the distance metric in dynamic time warping?

texts:
I am reading the lecture slides from this site http://luthuli.cs.uiuc.edu/~daf/courses/CS-498-DAF-P/Lecture%2018%20-%20Time%20series,%20DTW.pdf

In slide 24, the lecture suggest using metric of the following

d(i, j) = ||f(i) - f(j)||

select top frequency in i and top frequency in j,
    find the Euclidean distance between the two

I am not exactly sure what do they mean by Euclidean distance between the two.

Did they meant to have top n frequency sorted in order and match the order for subtraction and find the euclidean distance?

For example

f1 = [1, 2, 3, 4]

f2 = [1, 100, 200 ,300]

d(1,2) = |1-1| + |100-2| + |200-3| + |300-4|

Any help would be appreciated

Thanks


texts: When should we use the full Gabor Function and when do we use only the real part?

texts:
In this YouTube video, we see that the guy is only using the real part of the Gabor Filter to implement his project.

My questions are,

When should we use the complex Gabor Function?
When should we use the real part of the Gabor Function?
When should we use the imaginary part of the Gabor Function? Or, do we ever need it?


texts: What is the relation between eigenvalues and state-space response in control systems?

texts: I understand the mathematics behind it but I want to know what happens physically in a real-life system. How do the eigenvalues come into the picture from a non-mathematical (physical) point of view? In linear algebra, a matrix is basically a linear transformation and eigenvectors are those which, on being applied this transformation, just stretches themselves (that is without any rotation, I'm limiting only to 2D space). So when I consider a physical system (I'm only considering a homogeneous or unforced system to make it simpler) what do these eigenvalues or eigenvectors physically represent and how do they relate to their mathematical interpretations?