texts: Fourier Transform/Series DFT/DFS textbook problem (simple?)

texts:
Suppose $x_c(t)$ is a periodic continuous time signal with period 1 ms and for which the Fourier series is

\begin{align*}
  x_c(t) &= \sum\limits_{k=-9}^9 a_k e^{j(2000 \pi k t)} \\
\end{align*}

The Fourier series coefficients $a_k$ are zero for $|k| > 9$. $x_c(t)$ is discretely sampled such that:

\begin{align*}
  x[n] &= x_c\left(\frac{n}{6000}\right) \\
  &= \sum\limits_{k=-9}^9 a_k e^{j(\pi k n/3)} \\
\end{align*}

$x[n]$ is periodic with $N=6$

Question: Find the DFS coefficients of $x[n]$ in terms of $a_k$.

My Work: The DFS coefficients of a periodic signal are:

\begin{align*}
  W_N &= e^{-j(2\pi/N)} \\
  X[k] &= \sum\limits_{n=0}^{N-1} x[n] W_N^{kn} \\
\end{align*}

Changing the variable $k$ in $x[n]$ to $m$ to avoid conflict and combining yields:

\begin{align*}
  X[k] &= \sum\limits_{n=0}^{N-1}
    \sum\limits_{m=-9}^9 a_m e^{j(\pi m n/3)}
 W_N^{kn} \\
  X[k] &= \sum\limits_{n=0}^{N-1}
  \sum\limits_{m=-9}^9 a_m e^{j(\pi n/3 (m - k))} \\
\end{align*}

I'm stumped on how to simplify or process this further.

I suspect this is the wrong approach. The problem gives Fourier series coefficients of the continuous function, there should be a direct way to convert them to the discrete Fourier series coefficients.

Textbook Answer: The answer given by the textbook is as follows. I am trying to figure out how to get to this answer.

\begin{align*}
  X[k] &= 2\pi \begin{cases}
    a_0 + a_6 + a_{-6} & k = 0 \\
    a_1 + a_7 + a_{-5} & k = 1 \\
    a_2 + a_8 + a_{-4} & k = 2 \\
    a_3 + a_9 + a_{-3} + a_{-9} & k = 3 \\
    a_4 + a_{-2} + a_{-8} & k = 4 \\
    a_5 + a_{-1} + a_{-7} & k = 5 \\
  \end{cases}
\end{align*}


texts: Add harmonics to a FFT decomposed signal

texts:
i would like to add even harmonics from the data of FFT of a signal.

How do i do that ? do i have to search for higher magnitude frequencies then add the $2f$ then $4f$ etc ?

I understand how to do it from a sin wave for example but not from a noisier signal.


texts: Matlab and R functions for fft(): N-point FFT and dimension issue

texts:
In MATLAB, Y = fft(X,n,dim) returns the Fourier transform along the dimension dim. For example, if X is a matrix, then fft(X,n,2) returns the n-point Fourier transform of each row. However, in R is different. Do you know any function to solve this; so that takes into account n and dim, to get a n length complex vector? See that in the example that n>ncol(X).
MATLAB code
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1000; % Length of signal
t = (0:L-1)*T; % Time vector

x1 = cos(2*pi*50*t); % First row wave
x2 = cos(2*pi*150*t); % Second row wave
x3 = cos(2*pi*300*t);  % Third row wave

n = 2^nextpow2(L);
dim = 2;
X = [x1; x2; x3];

Y_right = fft(X,n,dim); %Result: 3*1024 complex double

 Y_wrong = fft(X); %Result: 3*1000 complex double (I am looking for the above result)

R code
Fs <- 1000
T <- 1/Fs
L <- 1000
t <- (0:(L-1))*T

x1 <- cos(2*pi*50*t)
x2 <- cos(2*pi*150*t)
x3 <- cos(2*pi*300*t)

n<-2^ceiling(log2(abs(L)))
dim <- 2
X <- t(matrix(c(x1, x2, x3), ncol=3))

Y <- fft(X)
# Result: 3*1000 cplx and it is not the same as `Y_wrong` (operates along each row)
#To get Y_wrong:

Y <- matrix(0, nrow=3, ncol=1000)

for (i in 1:ncol(X)) {
Y[,i] <- fft(X[,i], inverse = T)
}

My aim is to get Y_right, and Y think that by using apply we get the same as Y_wrong. Thank you in advance.


texts: Find cut-off frequency of a filter given its transfer function

texts:
I have a high pass filter given by the time-domain relationship between input and output:

$x'(t) = x(t) - \alpha \times x(t-1)$.

I would like to get its cut-off frequency. How can I proceed?


texts:
I would like to know the correct units to make a SNIR computation.

I am using the following formula:

$$
\text{SNIR} = \frac{1}{\frac{1}{\text{SNR}} + \frac{1}{\text{CIR}}}
$$

I have SNR in dB and CIR in dBm.

Shall I convert SNR to dBm to get the SNIR in dBm, or the CIR to dB to get the SNIR in dB, or there is no need to make the units change?.

I want to use the SNIR to compute a BER which is $\approx \frac{1}{4\textrm{SNR}}$

Regards


texts: Does the DFT calculate spectral components up to half the sampling frequency, $f_s/2$?

texts:
This question is prompted by a statement made in this response (reproduced below):

  The DFT calculates spectral components up to $f_s/2$, no matter what the input signal is.

A book I'm reading explains that the DFT of a signal $x(n)$ is the result of the inner product of $x(n)$ with each of the sampled complex sinusoidal basis vectors $s_k(n)$. Here is the author's definition of the DFT:

The value $k$ is called the bin number and $\omega_k$ are harmonics of the sampling frequency $f_s$ (expressed in angular unit of radians, alternatively represented as $f_k = \frac{k}{N}f_s$).

Since $k$ is taken from $0$ to $N-1$, $X(\omega_k)$ is defined up to and including $f_{N-1} = \frac{N-1}{N}f_s$. Why would Deve (answer author) say $f_s/2?$


texts: Correcting for Doppler shifts at the speed of sound for a 800 MHz signal

texts:
I'm working with a system which is planned to reach velocities of about 340m/s. It's likely that we'll be using a frequency around 800 MHz for rx and tx. At these speeds, supposing a fixed source, the Doppler effect may lead to a frequency shift of about 890 kHz (supposing my math is correct).

This question did provide some information, but does not specify the higher frequency or higher vehicle velocity.

Supposing we don't have to worry about interference, how should I go about correcting this frequency shift? I was thinking about using an FLL or a PLL, but I'm not sure where whether these could support such important shifts.


texts: Why don't DSLR cameras default to png instead of jpeg?

texts: I'm working with a new DSLR camera for a Computer Vision application and I noticed most of them default to saving in the lossy JPEG format. Initially, this caused some problems in my application and I started working with the RAW format, and saved them as png. I wondered what was the reason behind defaulting to JPEG as the compression encoding. Wouldn't it be better to support png as a default format due to its lossless quality and compression factors? (I assume DSLR users like to have quality and compression both). I'm curious as to whether this has a scientific reason I have not thought of.


texts:
Okay I am starting to understand the idea of neural networks but I still haven't been able to understand the use/benefits/implementation of convolutional neural networks especially for image processing.

What I don't understand is how to detect an object of different size.

Say we have a weights matrix of 50*50 and a face in the training set which is of 50*50 size . Now when you take the weighted sum of the matrix it will return a particular value say "X" . So now I understand the idea is to run the weights matrix over the entire image to get a lock over a region which gives a weighted sum of ~"X" now you have detected a face.

If the above mentioned understanding is true Then how is that an image of size 25*25 going to churn out a value anywhere clone to "X" . So the basic question is how to deal with relative sizes of the image .

If possible please suggest some good tutorials for the same .


texts: How do I check controllability and observability using Gramian matrixes?

texts:
I have a pending exam and this is one of the must-know questions. It will be about checking controllability/observability of a simple MIMO linear system, using Controlability Gramian/Observability Gramian.

More precisely, the system will be given in state-space representation, with the system matrix A of size 3x3.

Searching around, both Gramian matrixes are well defined. However, I am unable to solve the integral equation.

Do I need to solve the integral equation from the definition?

EDIT:

Here is a very nice tutorial with an example. I still don't understand the final substitution for t in the first example.

I understand that a gramian matrix of full rank means the rows or columns of the matrix are linearly independent. But what has that to do with controllability?
 * If so, how do I compute exp(A) on paper for A being a 3x3 matrix?
 * From this example, I conclude that the definite integral of a matrix is computed element-wise. Is that so?

I know those are a bunch of silly question. What I am looking for is just a tutorial or a sample calculation


texts: Is Hilbert transform not defined for complex signals?  In MATLAB, the function hilbert ignores if you give a complex sequence as input.  Why?


texts:
I hope this isn't a dublicate . I checked but maybe didn't see everything.

Here goes :

I've been scratching my head over some EQ related questions. I read a lot of papers but my limited math and DSP knowledge prevents me from fully understanding them, so I thought I'd ask the experts.

I hghave a good library (http://www.kvraudio.com/forum/viewtopic.php?t=249926 in case you wonder) of standalone filters. There are biquad filters and higher order filters. From that, I'd like to create an equalizer. This is C++ but I don't think it's relevant;. My questions refer to the signal processing side.

1) Can I just casacade the filters :

input signal -> processed through f1 -> ... -> processed through fn -> output signal ?

2) Given that filters are not perfect, does the order matters ?

3) Do you know how I can calculate the transfer curve of the EQ, from each filter's transfer curve ?

4) Finally, what kind of filter is best ? From what I read, I think it's better to use high order filters instead of quadratic, so I think I should use Butterworth or Chebyshev filters. Am I right ?

I'm currently a bit lost so thanks for ANY insight ! What I would like is to maximize the sound quality 9i.e : make a transparent eq, nothing too fancy) , even if the CPU cost is high, or even better, provide options like optimise for speed/optimise for quality

P.S. : If you've got what it takes to create this, and you're interested in contract work, please feel free to contact me.


texts: pixels in the same image are correlated but how can I visualize it?

texts: I am new in image processing.I know that pixels in the same image are correlated with each other but I don't know how can I draw the relationship b/w these pixels in the form of graph?.


texts:
How long does it take for FIR filter to produce first output sample for given window / kernel / impulse (not sure what is best name) length?

Does it differ between minimum phase and linear phase variants? Lets say we have two FIR low pass filters,one minimum phase,other linear phase,both have 100 sample long impulse response/window length,how long will it take to obtain first output sample?

My guess is the minimum phase needs 100 sample long delay while the linear phase 50 samples.


texts:
Why is it that reflecting any poles or zeros of a rational function gives a minimum phase system? And why is doing that make a unique minimum phase system?
I understand the all-pass function absorbs the poles or zeros when you reflect it, not sure if that has something to do with it. Also, wouldn't reflecting any poles or zeros potentially cause some poles and zeros that were before in the stability region to be out of it?


texts:
A filter that can be used for digital signals like audio, video or image processing can be defined using a matrix ("kernel") that weights the surrounding area (this is a description I read in lecture notes from someone else).

The kernel
$$\left(\begin{array}{ccc} 1 & 1 & 1 \\
1 & 1 & 1\\
1 & 1 & 1\end{array}\right)$$
 defines an erode filter.

Could you please tell me how this kernel is applied to e.g. an image (and therefore a 2D field of pixels)?
Thank you in advance!


texts: Can you represent an audio signal in any other domains besides time and frequency?

texts: Maybe a stupid question, but if there is a time-domain representation of audio signal, and also frequency-domain, so is there any other domain that signal can be represented in?


texts: Find a simple sine wave buried within noise, FFT or cross-correlation?

texts:
My recorded signal x = s + v, where s = A*sin(ωt) and v = noise. SNR < 1 or ~ 1. So the sine wave is buried under a lot of noise.

I need to compare the relative amplitudes of s for each recording window, so essentially track the ability of the system to receive the stimulus. The good news is that I know what I'm looking for (the stimulus and signal are causally linked, so I know ω) and my system is highly linear.

Question: is this a task for FFT or Cross correlation?

In more detail:
Should I just perform a simple FFT and compare the amplitudes of the Fourier peak at frequency ω?  Or could I do better by cross-correlating it with a reference signal sin(ωt)? If cross-correlation is the answer, should I apply a matched filter before cross-correlating? The SNR is a big problem which is why I'm exploring options outside of the FFT. As a non-expert to the field, a explanation of pros/cons to these two techniques would be greatly appreciated.

PS. as far as FFT goes, I know there are tricks such as band-pass filters and hamming windows. With these applied, I'm getting decent but not great results.


texts: Signal processing - why compute imaginary part?

texts:
I'm new to signal processing.

Could somebody explain to me what are the benefits and reasons for decomposing a signal into real and especially imaginary parts?

I'm looking at the hilbert transform in matlab.
Matlal hilbert transform

The imaginary part is a version of the original real sequence with a 90° phase shift. What exactly is a phase shift of 90 degrees.

For example if I have a data sequence of [100, 100, 200, 100, 200], how are the imaginary parts calculated? How do you phase shift 90 degrees?

Thanks


texts: Realtime filtering on a microcontroller, with dynamic cut off frequencies

texts:
Is it possible to dynamically filter a signal in realtime on a microcontroller?

What I mean by dynamically is to change the cut off frequency of the filter on the fly.

I have some DSP knowledge and realize that I probably do not have the computational power to do an FFT on the fly. Instead I should be looking at creating an IIR or FIR filter that I can continually convolve with my signal.

The issue is now whether or not I have enough computational power to generate the filter coeffecients quickly and then convolve with the signal. I'm guessing that because of this I'm going to have to be very lenient on the response of the filter which is ok for my application.

I have looked at algorithms such as the Remez Exchange algorithm and believe this may be able to work but am not sure. I wanted to check before I start the lengthy process of implementing whether or not I am on the right track.


texts:
I've already read and understand what does OFDM mean and what does it stand for and why we use it in our wireless technology today.
My question that I didn't understand is what does it mean number of "OFDM symbol per frame is 1 or two or 3 ..whatever"?
to clear more, lets assume I have pattern of data to transmit : [0 1 0] , and at each frame number of OFDM symbols is 2.
so what does it mean? is it mean the following claim on the data:
the data [0 1 0] will be stored in three frames and at each frame there's two OFDM symbols? so for is instance

0 is stored in frame and it has two OFDM symbols
1 is stored in frame and it has two OFDM symbols
0 is stored in frame and it has two OFDM symbols

So if that's true , what does it mean that 0 have two OFDM symbols? I need to understand what does it mean that certain frame has N OFDM symbols.
Appreciated for any help.


texts:
Question:

The fourier series coefficients is given as:

$$c_k= \begin{cases}
 1 \qquad & k \ \text{ even} \\
 2 \qquad & k \ \text{ odd} \\
\end{cases}$$

the period of the signal is $T=4$, what is signal $x(t)$?

Attempt:
when i am trying to find the signal by applying the general formula at the end i am getting exponential term now i am finding that hard to convert it into impulse again because i know answer of this signal will be a impulse but i am not getting any idea to convert it into impulse again? Please help with this?


texts: In repeated upsampleing and downsampling by 2, how do i calculate the output Y(z)?

texts:
For example, if X(z) -> {downsampled by 2} -> {upsampled by 2} -> Y(z)
Given that: X(z) = 1+z^2+z^12+z^19
How do I compute the value of Y(z)?


texts: Zigbee Transceiver Using OQPSK Modulation under Fading Channels

texts:
I am working on transmitting ECG signal over wireless body area networks. According to IEEE802.15.4 standards , I am using ZigBee transceiver at 2.4 GHZ . Complex baseband equivalent channel model is used.

The steps are as follows :

1.      Signal Compression

2.      Quantization

3.      Coding

4.      OQPSK modulation using the matlab function (oqpskmod)

5.      Fading Channel plus AWGN

6.      Equalization

7.      OQPSK Demodulation using the matlab function (oqpskdemod)

8.      Decoding and Dequantization

*  According to the IEEE 802.15.4 standard, a pulse shaping step is performed in the transmitter after the OQPSK modulation step .

I didn`t perform this pulse shaping process, and I obtained reasonable results. Is it necessary to perform this step ?
If  yes , How should the receiver be modified ?


texts: Inverse Laplace transform of two-sided and one-sided Laplace transform

texts:
As I read in Wikipedia, there are two types of Laplace transforms

One-sided Laplace transform: $F(s) = \int_{0}^\infty e^{-st} f(t) dt$
Two-sided Laplace transform: $F(s) = \int_{-\infty}^\infty e^{-st} f(t) dt$

But they give only one formula for Inverse Laplace transform:

$\hspace{3.0cm} f(t) = \frac{1}{2\pi i} \lim_{T \to \infty} \int_{\gamma - i T}^{\gamma + i T} e^{st} F(s) ds$

My question is that, does the type of Laplace transform I use affects the Inverse formula ?

p.s:

I've proved the Inverse Laplace transform above corresponding to Two-sided Laplace transform using Fourier transform. But I've not come up with any idea of proving the correctness of the Inverse Laplace transform corresponding to One-sided Laplace transform.

According to my proof, the Inverse transform above is correct for One-sided transform if $f$ satisfies $f(t) = 0$ $\forall t < 0$. In other words,

$\hspace{3.0cm} f(t) = \frac{1}{2\pi i} \lim_{T \to \infty} \int_{\gamma - i T}^{\gamma + i T} e^{st} F(s) ds$, $\forall t \geq 0$


texts: Interpreting this plot cross-correlation

texts:
I have an input signal $x(t)$ that is a white Gaussian random signal with mean 0 and variance 1. The signal $y(t)$ is the output of a linear filter with impulse response $$h(t) = |\operatorname{sinc}(t − 2)|.$$ I have plotted the cross-correlation and auto-correlation of the two signals, but have a hard time interpreting what the plots mean. For the cross-correlation, what do all the different spikes mean? What does the peak near 0 mean?
For the auto-correlation of $x$ as well, why is there noise but a peak at 0?
What about the auto-correlation of $y$?

Input and output signals:

Cross-correlation:

Auto-correlation:


texts: New capture card YUV 4:2:2 leads to different images

texts:
I have just bought a new video capture card whose output format is YUV 4:2:2 (as my old one) and surprisingly when I capture images with both cards I get different results. Differences are very small (have to zoom on edges if you want to see something) but I would like to know where do they come from? I was wondering if it was the transformation:

YUV 422 -> YUV 444

That could change from one driver to another?

Here is the original image:

Here is the capture with my old card:

Here is the capture with my new card:


texts:
I am quite new in DSP and generating the spectrogram of an audio file. My spectrogram is not smooth and it is showing the quite raw image with pixel values, something like this

While I am looking for a smooth spectrogram like this

Where I am doing mistake? Is it because of size of window size? My code to generate Mel spectrogram is
def readData(file):
    origData,origSampFreq = librosa.load(file, sr=None)
    return origData, origSampFreq

def resample(originalData, origSampFreq, targetSampFreq):
    resampledData = librosa.resample(originalData, origSampFreq, targetSampFreq)
    return resampledData

def normalizeSound(resampledData, axis):
    """ Axis is 0 for row-wise and 1
    for column wise"""
    normalizedData = normalize(resampledData, axis)
    return normalizedData

def calculateMelSpectogram(normalizedData, hop_length, win_length, sr):
    #newSamplingFreq = 16000
    S=librosa.feature.melspectrogram(normalizedData, sr=sr, hop_length=hop_length, win_length=win_length)
    return S

#Plot melspectogram

def plotMelSpectogram(S, sr, name, ref=np.max):
    plt.figure(figsize=(10,3))
    S_dB = librosa.power_to_db(S, ref=np.max)
    librosa.display.specshow(S_dB, x_axis='time',y_axis='mel', sr=16000,)
    plt.colorbar(format='%+2.0f dB')
    plt.title('Mel-frequency spectrogram')
    plt.savefig('./chunk_images/' + name + "mel.png",dpi=(300), bbox_inches='tight')
    plt.tight_layout()
    plt.show()
def featureExtraction(audioFile, name, targetSampFreq = 16000,
                      axis =0 ,
                      hop_length= 256,
                      win_length=512):

    y, y_sr = readData(file=audioFile)
    print(y, y_sr)
    resampledData = resample(originalData=y, origSampFreq=y_sr, targetSampFreq=targetSampFreq)
    normalizedData = normalizeSound(resampledData, axis=axis)
    S = calculateMelSpectogram(normalizedData=normalizedData, hop_length=hop_length, win_length=win_length, sr=targetSampFreq)
    plotSound(soundData=normalizedData, sr=targetSampFreq,x_axis_string='time' , name = name)
    plotMelSpectogram(S, sr=targetSampFreq, name = name, ref=np.max)
    return S

# plot orginal time domain data

def plotSound(soundData, sr, x_axis_string, name):
    plt.figure(figsize=(10,3))
    waveplot(soundData, sr, x_axis=x_axis_string)
    plt.savefig('./chunk_images/' + name + "sound.png",dpi=(300), bbox_inches='tight')


texts: which programming language is the best for image processing?

texts: I used matlab for my projects but wondering is there any framework similar but easier than matlab.


texts: How to partition collagen into separate fibers?

texts:
I have a picture representing collagen fibers of a tissue:

Image is binary consisting of a background (pixels with value 0) and white collagen (pixels with value 1). A zoomed in section of an image looks like this:

I want to find a way to partition the white collagen into multiple fibers,
so that I could measure the length and width of each fiber separately.

One idea was to perform a
skeletonization and then split the skeleton on every branch point. The problem with this is that the irregular shape of the the original collagen induces unnecessary branches in the skeleton:

Here we see a skeleton composed of hundreds of segments, whereas the actual number of segments covering the "triangle" should be 3.

Any idea of an algorithm that could partition such image into multiple parts?


texts: What is the difference between linear and non-linear filters?

texts: How a mean filter is called as linear filter and a median filter is called as non linear filter? I understand how a mean and median filter operates, but I was not able to relate with the term linear and non-linear. Please explain me with an example.


texts: Connection with system analysis and laplace&Z transform

texts:
Laplace&Z transform is just frequency analysis of a system with a multiplication of decaying exponential.  We analyse frequency with varying Laplace Exponential, which can be seen in the formula below for laplace transfrom.

From my simple aspect I can't make the theoretical connection, how inspecting frequency  with decaying exponential helps with understanding how system will behave? And how it helps with coping with differential functions for example "Analysis of Electric Circuits". And even with IIR filters.

What further surprises me the things laplace&Z transforms used. They seem to me completely different .But somehow multiplying the system with decaying exponential works for them all.
The only similarity I see between; for example RLC curcuits and IIR filters is; these systems are not memoryless(output depends on prev. outputs).

When I search the net I see only laplace-table's, questions etc.. I don't want to solve a problem, I want to understand the problem. If somebody can explain or direct me to a link I will be thankful.


texts: Problem with a code of FIR Lowpass filter

texts:
I'm making an interpolator (filter) to remove aliasing but this doesn't work.

I see also some strange behaviour: x[i - j], but what if j > i? I simply followed FIR definition but still don't understand why this doesn't work.

const size_t M = 200;
double h[M + 1]; // h is filled with coeff

inline void process(double* x, double* y, size_t len)
{
    for (size_t i = 0; i < len; ++i)
    {
        y[i] = 0.;
        for (size_t j = 0; j < M + 1; ++j)
        {
            y[i] = y[i] + x[i - j] * h[j];
        }
    }
}


texts: Regarding Complementary Filter for Accelerometer- Gyroscope sensor fusion

texts:
When you talk of filter, how can it be defined in terms of two constant weighing coefficient? Instead it should be defined in terms of first or second order transfer functions (as per normal literature on filters).

My application is finding tilt of a cantilever structure. I am using gyro and accelerometer sensor fusion. What I found was the tilt angle can be found using complementary filter as: tilt= xgyro + (1-x) accl; where, gyro and accl are angles calculated from gyroscope and accelerometer output signals respectively, while x is the weight factor, whose value usually is $0.95-0.98$.

My question is how this algorithm acts as a filter. Though its easy to understand it weighs gyro output higher under motion condition, how does it undermine gyro output as compared to accelerometer under static condition.

Can anyone explain how exactly filtering occurs in case of Complementary filter? Thanks


texts: Implementing overlap add method for convolution with a slice of the filter

texts:
In overlap add method for convolution a filter $x$ of length $M$ will get convolved with a signal $y$ of length $N$ where $M << N$, i.e., $z = x * y $.

Here the signal $y$ is sliced into subparts each of length $M$.

Can I slice $y$ into subparts of size $P < M$ and then do the convolution by overlap add method. What should be the algorithm for this.

The method I have tried for overlap add method is given here(in MATLAB).
In the above code, in the for loop, I wish to have filterLength < 16.
How should I modify this code.


texts: Computing N-point inverse DFT with N/2-point forward DFT

texts:
I'm trying to implement IDFT using multiple smaller forward DFTs but am confused as to how to do so.

So, I know that the N-point IDFT can be expressed in terms of the forward DFT by:
$$
IDFT = \frac{1}{N}[DFT(X_n^*)]^*
$$

Also, an N-point DFT can be implemented with two N/2-point DFTs by performing a DFT on the even-indexed samples and another on the odd-indexed samples.

How would I go about combining these concepts?


texts: Integer upsampling - leave original samples unaltered

texts:
I'm looking at the problem of integer upsampling (i.e. interpolation). This can be achieved by first increasing the sample rate by factor $L$ (i.e. inserting $L-1$ zeros between the original samples) and then low-pass filtering the signal (see e.g. Oppenheim/Schafer, "Discrete Time Signal Processing", Sect. 4.6.2).

When I compare the the samples of the original signal with the corresponding samples of the upsampled signal, I observe a slight difference in amplitude. Is there a way to avoid this and to leave the original samples unaltered? That's what I would expect of an interpolation method.

The filter I used is a symmetric FIR filter with an even number of coefficients and for comparison I compensate the delay introduced by that filter.

I know that there are other interpolation methods (linear, cubic, hermite, etc.), but I would like to use this particular method.

I hope I could make myself understood. Thanks in advance for your help!


texts: Is it possible exctract sinusoids from non periodic signal?

texts: Digital signal UT1-UTC is not periodic but is including many sinusoids (periodic elements in IERS nomenclature) that are not multiples of some fundamental. For example tidal sinusoids are not multiples of yearly seasonal sinusoid because lunar month is not submultiple of the year. Then, is it possible these sinusoids be extracted from UT1-UTC by Discrete Fourier Transform?


texts:
I don't understand how to make frequency shift in fft2 or higher dimensions.  Could anyone explain it, please?

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

%matplotlib inline

numb_steps = 100
x = np.linspace(-10, 10, numb_steps)
y = np.linspace(-10, 10, numb_steps)

X,Y = np.meshgrid(x,y)

R = 1

Z = np.zeros((100, 100))
# circle
for i in range(numb_steps):
    for j in range(numb_steps):
        if x[i]**2+y[j]**2 > R:
            Z[i,j] = 0
        else:
            Z[i,j] = 1

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_surface(X,Y,Z)

I only can get those plots

fig = plt.figure()
ax = fig.gca(projection='3d')

Z_fft = np.fft.fft2(Z)
FreqCompRows = np.fft.fftfreq(Z.shape[0],d=2)
FreqCompCols = np.fft.fftfreq(Z.shape[1],d=2)
FreqCompRows = np.fft.fftshift(FreqCompRows)
FreqCompCols = np.fft.fftshift(FreqCompCols)

S,D = np.meshgrid(FreqCompRows, FreqCompCols)

ax.plot_surface(S, D, np.abs(Z_fft))

plt.imshow(np.abs(Z_fft))

plt.xticks(range(len(x_ax)), np.round(x_ax))
plt.yticks(range(len(y_ax)), np.round(y_ax))

P.S. Yes, the ticks overlap is my problem as well


texts:
I am studying about the sampling theorem in conjunction for ADC. I got little confused while reading about aliased frequencies. I see that as per the Nyquist theorem, the sampling frequency (fs) should be larger atleast twice the signal frequency (fsig=(2*fs)) to avoid aliasing, which would position all the aliases of the form: ((mfs)+fsig) and ((mfs)-fsig) above the nyquist frequency.

Since I see that the sampling is closely related with mixing operation (sort of modulation), like - its just a multiplication of two frequencies - what happens to the alias - ((mfs)+(nfsig)) and ((mfs)-(nfsig))?

Wouldn't that come below the nyquist frequency?

For example, if fs=100 MHz, fsig=50 MHz, (fs-(3*fin))=40 MHz - analogous to Third order intermodulation product.

Normally, when measuring the ADC output spectrum, it has signal power, some harmonics and quantization noise. the Dynamic range is the difference in signal power and highest harmonic content. So, these harmonics come  from ((mfs)+(nfsig)) and ((mfs)-(nfsig))? Is this understanding correct?


texts: SQNR when multiplying 2 16 bit signed integers and truncating result?

texts:
I'm trying to figure out what the Signal to Quantized Noise Ratio (SQNR) is if I multiply 2 16-bit signed integer values and store the result as a 16-bit signed integer, dropping the least significant bits. Since this is signed multiplication, I'm dropping 15 bits of precision.

For example:

a (16 bit signed) * b (16 bit signed) = c (16 bit signed) without the LSBs.

And to be more clear about what's after this, I am summing many successive values of the resulting 'c' - this sum is stored in an infinite length signed integer representation.

How do I calculate the SQNR in this situation?


texts: How to estimate and compensate for doppler shift in wireless signals?

texts:
I was wondering what good method(s) exist for the estimation (and subsequent compensation) of doppler shift for transmitted signals, be they acoustic or RF, in the context of comms.

The question: Specifically, if the degree of doppler shift is varying over the duration of a packet, how best to estimate (track it?) and then compensate for it. Assume we have a trainer sequence. You may also assume the signal passband BW is on the order of its carrier. (e.g, if the passband signal exists from 2500-7500 Hz, its BW is 5000Hz, as is its carrier.)

Some additional background for context:

One method I found during my research:

Since I have a trainer sequence and know its frequency, first I estimate its received      frequency.
Next, I resample the entire packet by a ratio that is related to the speed of the wave in the medium, my known transmitted frequency, and my new estimated doppler shifted frequency.
This works well in simulations, but the weak points are that the frequency estimation must be very accurate, and it also assumes the doppler shift is not changing during the duration of the packet.

Are there any other methods that can be utilized to solve the problem when the doppler is changing during the duration of the packet? What is the opinion of the above aforementioned method?

Many thanks!


texts: Obtain Envelope and Pitch curves of my Singing Voice

texts:
I wish, in real time, to hum into a mic and produce via dsp the envelope and pitch of what I am humming, before outputting these two signals to my analog synth. This synth takes a gate and a cv signal.
Control Voltage/Gate is an analog method of controlling synthesisers, drum machines and other similar equipment with external sequencers. The control voltage typically controls pitch and the gate signal controls note on-off (or ASDR).
I'm trying to figure out what algorithms would be suitable for establishing these two signals. I have made an attempt using a sliding blackman window and zero-padding. I apply an fft in order to extract the pitch and loudness of these windows. I'm using a sampling rate of 8kHz and I'm humming melodies within roughly a two octave range.
I'm wondering about other approaches. I have read a little about the hilbert transform and noted that it is used to find the envelope of narrow band signals. Am I right in say that my voice would not be suitable in this case since as it contains multiple harmonics? Could I bandpass around the fundamental harmonics in the frequency spectrum (fft window)?, before applying an ifft. What about the fact that the attack portion of a note is often rich in higher harmonics. I presume I would need to compensate for this if bandpass filtering is an option. Could I possibly use the hilbert approach? Any other suggestions?


texts: Minimum sample frequency that allows reconstruction of information signal but VIOLATES Nyquist?

texts:
Say in the frequency spectrum, you have an information signal between (-100, 100) Hz, and a noise signal between (-700, -500) and between (500, 700) Hz.  What is the minimum possible sample frequency that allows reconstruction of the information signal without distortion? Any ideal filter can be used.

At first I thought Fs = 400 Hz.  But when plotting this out in the frequency domain, I believe aliasing will occur if the noise signal has non-zero components at say -700 or -500 Hz.  When Fs = 800 Hz, the same phenomen occurs.  But When Fs = 800 + 0.00000001 (some really small number), the potential for aliasing is zero if an ideal low-pass filter is used. Am I right in my reasoning?


texts:
I am trying to calculate an actual frequency response from a desired frequency response.

fftSize = 128;
fs = 8000;

I have 2 input arrays: f[] and aDesired[], both of which are Real and length fftSize+1 (DC + Nyquist included). The f[] array is linearly spaced between 0 and fs/2 (0:4000). The aDesired[] array is either gains in dB or linear values.

I can easily change the length of f[] and aDesired[] as I have an interpolation function which gives any size outputs, but i thought this was a good number.

I would like to take an IFFT of ADesired[] to generate coefficients (with a configurable length), window and truncate the coeffs, and then FFT to show what the actual response would be, aActual[].

How can I take an IFFT/FFT of this data when the inputs are both Real? Or how do I prepare the data more?

Finally, it doesnt matter about the phase, if its linear or not it doesnt matter.

Is there maybe a library that could be of use with my input data?

Summary:

Input: f[129] : linearly spaced fc's
       aDesired[129] : Real values of linearly spaced gains at fc's (either in lin or log),

Processing:
       coeffs = IFFT(f, aDesired)
       coeff_new Truncate(window * coeff)
       aActual = FFT(f, coeff_new)

Output: aActual[]

Many thanks


texts:
Are the eigenvalues of the FIR convolution matrix the zeros of the corresponding FIR filter?

Suppose I have an FIR filter $H(z) = h_{0} + h_{1}z^{-1} + h_{2}z^{-2}$. I want to implement it using a matrix, so I have:

$$ H = \begin{bmatrix}
    h_{0} & 0 & 0  \\
    h_{1} & h_{0} & 0  \\
    h_{2} & h_{1} & h_{0}
\end{bmatrix} $$

Can I find the zeros of $H(z)$ by finding the eigenvalues of $H$?

I know that in general, the roots of a polynomial are given by the eigenvalues of its companion matrix. However, can I just find the eigenvalues of $H$ for this example instead?


texts:
I have some images (generated from some processing). Some of those images have approximately the same view of the scene with illumination changes. But there are other images which may show the view but with a different viewpoint. I am trying to remove the second set of images mentioned above. I've tried using correlation coefficient as a measure of finding similarity. But most of false image pairs seem to have high correlation coefficient. Then I've tried using mean-square error. On setting  the value at 1500(guess), results have improved. Note all the images have similar size. This setting of 1500 changes for different images. So how do I choose this quantity? Or is there a better way to compare such images?
(The images are gray-scale)

Edit:
I am sorry I was not specific. I have found SURF correspondences between the images and used the transformed images (obtained by projective transform) for matching between the transformed image and part of scene image(the ROI was extracted by transforming coordinates by obtained matrix above).
I have used SSIM as one answer suggested but that metric seems to punish illumination changes which is not what I want.


texts: IQ FM Demodulation of Wow and Flutter Signal in Software

texts:
Background:

I have a recording device that exhibits Wow and Flutter, or periodic frequency deviation. I use this device to record a calibrated 3.15kHz test tone from a tape film to generate a .wav file on my PC.

In an ideal world, an FFT on the data contained in the .wav file would result in a single sharp peak at 3.15kHz. In the real world, there is deviation in this frequency due to mechanical errors such as head scrape, non-concentric film rollers, motor vibration which all cause the tape film to either speed up or slow down slightly.

These deviations are called Wow and Flutter, and appear as errors frequency modulated by the 3.15kHz test tone.

What I would like to do:

Assume I have the .wav file, sampled at 48kHz. Let's say it contains an FM waveform with carrier frequency at 3.15kHz, and a message signal with bandwidth ~200Hz.

I'd like to build a python script to analyse and demodulate the signal to give me just the 200Hz signal. I've tried several models across the internet simulating PLLs, slope detectors etc. But these are all hard coded difficult to understand and I just can't seem to mould them to be used in my application.

I want to try implementing an IQ FM demodulator but I am unable to find a good reference to how FM waves are modulated via IQ signals and I definitely can't find one for demodulation.

Can someone point me in the right direction and let me know off the bat if there are any problems or roadblocks with what I'm trying to do?


texts: FIR filter design with flat passband but equi-ripple stop-band

texts:
I am looking for a lowpass FIR filter with flat passband but equi-ripple stopband. In other words, it likes Chebyshev_filter Type II except that it is FIR instead of IIR. Linear-phase is preferred.

Thanks


texts: Average Power Spectral Density of PAM signals

texts:
I am reading through the PAM transmission scheme and about the power spectral density of the signals. Given that the Average Power Spectral Density of PAM Signals is:
$$
\Phi_{ss}(f)=\Phi_{aa}\left(e^{j2\pi ft}\right)\frac{\lvert G(f)\rvert^2}{T}
$$

(We consider that the amplitude coefficients of PAM $a[k]$ is a cyclo stationary discrete stochastic process and hence compute average of a PSD).

There are three remarks made after this:

It becomes obvious that the minimum bandwidth of the pulse $g(t)\overset{\mathcal F}\rightarrow G(f)$ has to be at least $1/T$.
The PSD $\Phi_{aa}\left(e^{j2\pi fT}\right)$ of the discrete time sequence $a[k]$ is periodic with period $1/T$.
If $G(f)$ has smaller bandwidth than $1/T$ a full period of the data spectrum is not contained in the PSD of the transmit signal.

I am not sure if I have fully understood the remarks. Here is my understanding on the above:

Since we have taken an Average PSD, the PSD repeats over the time
interval $T$ and the bandwidth of the pulse is $1/T$. (I am not sure how that became the minimum bandwidth).
The PSD of the discrete sequence $a[k]$ is periodic since it's a cyclo stationary process and vary over a time period $T$.
If $G(f)$ would have had less bandwidth than $1/T$, that is the pulse has a higher frequency than $1/T$, the data spectrum would have smeared into each other leading to ISI.

Please let me know if the above understanding is correct/valid. Please add/correct if anything is missing.


texts: Camera Pose Estimation from Vanishing Points

texts:
I want to estimate the pose of camera (Location and Orientation). Can I use Vanishing Points to get the location and orientation of the camera?

There is object in the image which I also know his size, can it help?


texts:
I have the following FFT result charts. Searching for a way to forecast the future AMPLITUDE steps from the Time Domain Plot if possible, or the next maximum/minimum deviation based on some previous AMPLITUDE in time.
Is that possible when we have a Frequency Domain Plot which looks like that:


texts: Implementation of basic 2-pole low-pass filter

texts:
I know this question has been asked to hell and back from many people, and that it will probably get downvoted until it's deleted, but please bear with me.

I am designing a sound engine for one of my projects, which needs to support low-pass filtering (no other filtering required, so no need for extremely robust equalization or high-pass filters).

Unfortunately, I'm not exactly well-versed in DSP math (as I'm more a programmer than anything else), so this has been getting tricky.

What I've found by searching on the internet is a "1-RC and C filter" which is implemented as:

// Coefficient computation
// Cutoff and reso are [0,128) integers
c = 0.5^[(128-Cutoff) / 16.0]
r = 0.5^[( 24+Reso)   / 16.0]

v0 = (1.0 - r*c)*v0 - c*v1 + c*input
v1 = (1.0 - r*c)*v1 + c*v0

On the same website, I also found that c can be written frequency-wise with the formula

c = 2.0 * sin(Freq * pi/SampRate)

Since I'm only doing variable low-pass filtering with no resonance, this leads to

c = 2.0 * sin(Freq * pi/SampRate)
r = pow(0.5, 24 / 16.0) = 1 / sqrt(8) = ~0.3536

Since the sound engine is mostly MIDI-related, I've used the frequency cutoffs I've found elsewhere on the internet, which led to a relatively simple formula of

CutoffFreq = 250.0 * 32^x

Where x is bound to [0.0,1.0], which leads to a frequency range of 250Hz~8kHz.

However, this is where my issues start.

Let's assume that we're using a maximum cutoff frequency (that is, there should be no filtering on the data) and that I'm mixing at 44.1kHz.

c   = 2.0 * sin(8000.0 * pi/44100.0) = ~1.0791
r   = 8^(-0.5)                       = ~0.3536
      1.0 - r*c                      = ~0.6184

Now let's assume the input signal is a basic triangle:

Input[] = {0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 0.8, 0.6, 0.4, 0.2}

Applying the code above leads to

// Beforehand...
v0 = 0.0
v1 = 0.0

// 1st Sample [works okay]
v0 = 0.6184*0.0 - 1.0791*0.0 + 1.0791*0.0 = 0.0
v1 = 0.6184*0.0 + 1.0791*0.0              = 0.0

// 2nd Sample [incorrect]
v0 = 0.6184*0.0 - 1.0791*0.0 + 1.0791*0.2 = ~0.2158
v1 = 0.6184*0.0 + 1.0791*0.2158           = ~0.2329 [residual 0.0329]

// 3rd Sample [more than doubly incorrect]
v0 = 0.6184*0.2158 - 1.0791*0.2329 + 1.0791*0.4 = ~0.3138
v1 = 0.6184*0.2329 + 1.0791*0.3138              = ~0.4826 [residual 0.0826]

As you can see, this doesn't exactly work correctly.
In fact, judging from the sound of it, it's as though I had introduced a slight high-pass filter as well as increased resonance slightly.

As such, I was wondering if anyone could offer an explanation a more programming-related person could understand for computing low-pass filter coefficients and equations, as well as shed some light on how to properly implement this.

Thanks in advance.


texts: Is $y[k] = y[k-1] + x[k]$ an integrator?

texts:
It looks exactly like an integrator to me.
Since $$y[k] = y[k-1]+x[k] = y[k-2] + x[k-1] +x[k] = \sum{x}$$

Applying the Z-transform gives
\begin{align}
Y(z) &= Y(z)\cdot z^{-1} + X(z)\\
\Rightarrow\frac{Y(z)}{X(z)} &= \frac{1}{1-z^{-1}}
\end{align}

When I convert $\frac{1}{1-z^{-1}}$ into Lapace transform in Matlab using d2c, it does not return $\frac{k}{s}$. Instead, it returns $\frac{1+s}{s}$. It seems there is a proportional term inside, when thinking in PID control point of view.

Could anyone explain on that?


texts: On the channel estimation based on vector

texts:
I have a matrix $X$ of size .i.e $(8,8)$ with $M$ columns and $N$ rows.  Suppose I took it's $iFFT$ column wise resulting matrix $x$ of size $(8,8)$ too,

$x = F^HX_{(:,m)}, $     ...... (1),

where $F^H$ is Fourier matrix which is complex numbers and $m = 0,1,....M-1$ the selected column.

After organizing  signal $x$ in row-wise, $x' = [x_0, x_1, ....,x_N]$ where $x_k$ denotes the $k^{th}$-row of matrix $x$. Then, after convolution with channel $h$, the resulted signal can be written as :

$y = h⨂x'$ , ...... (2),

where $⨂$ denotes the convolution operation.

Then by converting $y$ into frequency domain:

$Y = HX'$  , ...... (3),

where $Y, H$ and $X'$ are  the frequency-domain signal of $y,h$ and $x'$, respectively.

To estimate the channel $h$ based on $Y$, it's straightforward by performing $h = iFFT(Y/x')$, and $x'$ is equal to $x$ reshaped in row-wise.

The problem is I don't want to use all matrix $x$ as pilots.

I need to estimate $h$ based on some pilot vectors in matrix $x$, which means the pilots vectors in matrix $x$ are $x_p = x(1:4:N,:)$ and $x_p$ is the pilot vectors here.

So how can I get the relationship between pilots vectors in $x$ and their correspondent in $Y$ based on $Eq.(3)$? Which means how can I estimate the channel $h$ based on vectors row in matrix $X$?


texts:
I need detect object in series of pictures. This object has something like nonsymetric relief structure with some irregularities. In this conditions.

Light conditions can change from almost dark to overlight (sometimes from only one side).
Object can be in different sizes, i. e. I am interested in scale invariant shape of that object.
Object can be sometimes badly focused. i. e. contours are sometimes hard to find and identify.
Object can be turned along vertical axis, but obejct is symmetric along this axis.
Sometimes part of this object can be hidden behind some other object.

Is there some way how to construct general, robust algorithm for this?

Thanks in advance


texts: FFT of sine signal with phase discontinuities

texts:
I am detecting sine signals within a specific bandwidth [0,B] Hz,

The received sine have multiple phase discontinuities, as shown below

I want to measure the frequency of the sine signal but I get a distorted spectrum as expected

What's the best practice to get rid of the high leakage? I have tried windowing but did not really work, I also tried FIR low-pass filter with f_c = B Hz, but also did not work.


texts:
Suppose that

$y(t) = \lfloor x(t) + \epsilon(t) \rfloor$,

where $\epsilon(t)$ is zero mean, independent noise.

Is there any techniques on recovering $x(t)$ from $y(t)$?


texts: variance in the time domain versus variance in frequency domain

texts:
Hi All: I'm trying to better understand the connection between variance of a time series and the integral of the spectral density over all frequencies. Rather than going through all of the relations, if one looks at the link below,

https://en.wikipedia.org/wiki/Spectral_density, the relations are shown there in the power spectral density section.

To summarize what is said there:

The power, $P$, is defined as the limit as $P=\lim_{T \to \infty}
\frac{1}{2T} \int_{-T}^{T} |x(t)|^2$.

$S_{xx}(\omega)$ is defined as the limit as $S_{xx}(\omega)=\lim_{T \to \infty} E|\hat{x}_T(\omega)|^2$. So, I think of it as the expected instantaneous power at frequency $\omega$. I hope that's the way to think of it.

$\hat{x}_{T}(\omega)$ is defined  as $\frac{1}{\sqrt T} \int_0^{T} x(t) e^{-i\omega t} dt$. So the fourier transform of $x_t$ divided by  $\sqrt T$.

Finally,  $\gamma_{0}$ is defined as the power contained in the total frequency band so $\int_{\omega} S_{xx} (\omega)$. My confusion is the following:

In the time domain-econometrics world, $\gamma_{0}$ is defined as  $\mathrm{Var}(X_{t}) = E(X_{t} - \mu)^2$ where $\mu$ is the mean of $X_{t}$.

So, my confusion stems from the fact that when the variance is defined as power, there is no mean subtracted from $X_{t}$. Does that mean that $X_{t}$ has already been de-meaned when it's written as $X_t$. If not, then how can $\gamma_{0}$ be viewed as the variance when statistical variance is the (expected value of the deviation of a random variable from it's mean) squared yet the view of variance in the DSP world is a weighted (by frequency) combination of $E(X_{t}^2)$ over all frequencies.  My only conclusion is that the mean is already being subtracted out or is assumed to be zero ? I basically don't understand how variance is defined in the DSP framework. Is it viewed as expected power rather than expected variability ? Thanks.


texts: Applying Circular Cross Correlation in MATLAB

texts:
I have searched Google for circular cross correlation using Matlab, and I have found it only for one dimensional signals.
Could you please help me implementing circular cross correlation between two images using MATLAB?


texts: high & low pass correlated dither noise question

texts:
I read a pretty cool article the other day: Robert Katz - Dither noise Probability Density Explained.
It says that if you have two dice (A and B) that you can roll both dice and then...

Re-roll die A and sum A and B

Re-roll die B and sum A and B

Re-roll die A and sum A and B

repeat to get a low pass filtered triangular noise distribution.

It says that you can modify it for high pass filtered triangle noise by rolling both dice and then...

Re-roll die A and take A - B

Re-roll die B and take B - A

Re-roll die A and take A - B

repeat to get a high pass filtered triangular noise distribution.

What i'm wondering is, what is the right thing to do if you want to do this with more than 2 dice? (going higher order)
For low pass filtered noise with 3+ more dice (which would be more gaussian distributed than triangle), would you only re-roll one die each time, or would you re-roll all BUT one die each time.
I have the same question about the high pass filtered noise with 3+ more dice, but in that case I think i know what to do about the subtraction order...  I think the right thing to do if you have N dice is to sum them all up, but after each "roll" you flip the sign of every die.
Can anyone illuminate the correct way to do this?
Edit: I'm looking to get high and low pass filtering with more dice, but am fine with the distribution changing from triangle to gaussian or other shapes.


texts: Initialization of population for genetic algorithm in matlab

texts:
I randomly generated initial 10 population(let each of size n) of genetic algorithm as follows

for i = 1:10
    for j=1:n
        population(i,j)=randi([MinIntensity,MaxIntensity]);
    end
end

Assume that I have the individuals of one population.For example let the first population of size 10 is [100 110 120 130 140 150 160 170 180 190].Is it possible to generate the remaining 9 population such that the individuals are near to the first population?(It is for the quick convergence of genetic algorithm).Also each population is a grayscale image with intensity values represented in row major order.Hence the individuals should be in the range of 0 - 255.
Please help.Thanks in advance


texts: calculating the stop-band edge frequency of a low-pass FIR

texts:
I have three information about a low-pass FIR filter.

pass-band edge frequency
pass-band ripple
stop-band ripple

I want to get the stop-band edge frequency I've been googling for the last hour to find a formula to get, but without success .
can any tell me how can I calculate it if have those 3 values ?
thanks in advance


texts: How do delay lines create so many effects?

texts:
I was trialing this audio plug-in from SonicCharge (there's a program demo in the site).

It claims to be based on a delay line and uses some logic to modify it:

  At its core is a 12-bit digital delay with variable sample rate from $0$ to $352\textrm{ kHz}$. The delay is controlled by a programmable processor that allows you to change and modulate the delay time with various "operators".

I know from previous readings that delay lines can be used to construct a pitch shifter.

What are the properties in the delay line that allow for such numerous applications? I.e. what is it based on that the delay line can create such a varied amount of effects?


texts:
I am building an LPC analysis tool, and am at the point of needing to do pitch period analysis.  I was initially interested in using the Gold & Rabiner algorithm for this, and got a hold of a FORTRAN implementation.  Before I start converting that implementation to a modern programming language, I was curious if anyone here had any suggestions for other pitch detection algorithms that are maybe a bit more modern and robust...  And even better, if there are any open source libraries that have apis for pitch period analysis that my tool can hook into?

EDIT:  I am building an LPC analysis tool for speech waveforms.


texts:
I have quite a straight-forward question. What I aim for is the generation of a certain set of random numbers with a normal distribution (mu = 0, sigma = 1).

Now, the best way to approach the above mentioned gaussian bell is to generate quite a large number of samples.

Unfortunately, in my case, I can only generate a retained subset of samples: usually around 2048 samples, which lead to a poor fit.

I am actually wondering if there is any way to improve the fitness, by first generating a larger set of samples or more subsets of the same size (as 10 times 2048 samples) and then pick those 2048 which approximate the best for desired mean and standard deviation (and the gaussian of course).

What would you suggest or how would you proceed?


texts:
I have an image like the one above, and what I need to find are the red circled areas. They are caused by how the nerve layer is in the eye, and I have no idea what method to use to extract them. (I am looking for a brighter background from the nerve layer)
I have found all the blood vessels, so I can ignore those area easily. But I don't have any concept of how to begin the search for these areas. Note that the bright spots on the right top side (lets say 12 o clock / 1 o clock from the image center) are not caused by the nerve layer, but from being in a young persons eye.

Can someone point me to a method to extract these areas? Note that the areas could also be non-existant, or be formed like a cross, or like an hourglass.


texts:
Which one is the best answer?

Companding is used []

a. to overcome quantizing noise in PCM
b. in PCM transmitters, to allow amplitude limiting in the receivers
c. to protect small signals in PCM for quantizing distortion.
d. in PCM receivers, to overcome impulse noise.

I think c is the best answer. am i right?


texts: How to get coordinates of complex RTL-SDR signal?

texts:
As I have already explained here (https://stackoverflow.com/questions/49358449/python-how-to-get-coordinates-of-complex-rtl-sdr-signal-peaks?noredirect=1#comment85722604_49358449), I need to find the coordinates of the peaks in my signal. While my original question is related more to the programming part, this one is about understanding what my signal has to look like for the peak finding to work at all.

It is my understanding that I'm getting a bunch of complex data from my RTL-SDR. For visualisation purposes I plot this data as a PSD, showing the frequencies on the x-axis and the power level in dB on the y-axis.

Now, I would like to use the Python peakutils.peak.indexes() method to get the y-coordinates of all peaks above a certain power level, e.g., -20.

This power level is specified as threshold in the method, which apparently means that the input data, i.e., the signal, somehow needs to represent all the power levels of the signal (so the method can search for those standing out)?! Is this assumption correct?

And if so, how do I get a representation of the signal that I could use to detect peaks by power level? Right now, the method seems to scan through frequencies (represented by my complex signal?!), looking for a power level (!) of -20, which probably is why it returns lots of useless results.

I already tried converting the complex signal array to a real array, which didn't work. I also tried converting the signal via fft and fftfreq, which didn't get me any further either.

As I said at the beginning: I can figure out the programming stuff myself. But I need someone to explain to me first, what I have to do, please. How do I need to convert the complex signal?


texts: Probability error for antipodal systems and orthogonal systems

texts:
I know that the error probability for antipodal systems is  Q (√((2Fs)/No)) and for orthogonal systems it is Q (√(Fs/No)), however, can anybody give their derivation? Because I am finding different ones on the internet I am getting confused.

I found pages 74-75 useful but I think their derivations are quite short here:
http://www.sps.ele.tue.nl/members/F.M.J.Willems/TEACHING_files/5JK00/signalenergyorthogonalsignals.pdf


texts:
My prof said that when a transfer function described by a z-transform is not polynomial, then i can't perform the anti-transformation.
But, what does it means to be not polynomial ?
Can you explain to me ?


texts: Frequency modulation of audio signals. Does increasing the pulse width of frequency tone result in larger operating distance?

texts:
I have a simple frequency modulation scheme where in I am sending simple textual data by encoding it into specific frequencies(for example 'a' is converted to ASCII value of 97 and I use 10 frequencies to map decimal values from 0-9. 17 khz for 0,17.2 for 1,17.4 for 2 and so on.) A sound file is created by encoding such data,  and when I playback the tone,  I have a decoder on my phone which decodes that data. Currently each tone has a duration of 500 ms and the phone can get the data even from 10 m from the speaker with 100% accuracy. When I try to reduce the duration to 250 ms in order to increase the speed,  I find that the accuracy decreases drastically for distances >2 m.
Does this imply that if I increase the duration, there will be increase in operating distance?


texts: How can I identify the damping of the modes in a signal by Cmor wavelet method?

texts:
I read several papers which proposed a method to identify modal parameters. such as natural frequency and damping ratio.I've tried to implement those methods by Matlab.but I couldn't get the result.It seems I missed something.anyway it must be some problem with my codes.Please check it and see what's the problem. here you can access to the paper which I've tried to implement its method.
here you can see the brief relationships to identify damping and frequency.

and here is the code. please look and see if I am doing these relationships right or not.also if you have another method to extract the damping of a mode,please do tell me.
Best regards.

t=linspace(0,30,300);
Fs=ceil(inv(t(2)-t(1)));                               % sampling freq
x=sin(2*pi*t*0.1).*(t<10)+sin(2*pi*t*0.3).*...
 (t<30)+sin(2*pi*t*0.6).*(t<10).*exp(-t*.1);           % my signal[0.1Hz,0.3Hz,0.6Hz]
wname = 'cmor20-1';                                    % define wavelet name
scales = 1:1:256;                                     % scales range
freq = scal2frq(scales,wname,1/Fs);
coefs = cwt(x,scales,wname,'lvlabs');                  % Get coefs of x
abscof=abs(coefs);                                     % |coefs|'
logcof=log(abscof);                                    % Ln|Wx(a,b)|
argcof=angle(coefs);                                   % arg[Wx(a,b)]
%--calculating linear regression to get alpha & omega--
for j=1:256                                            % for all scales
n=length(t);
aa(j)=-((n*sum(t.*logcof(j,:))-sum(t)*...              % its alpha
sum(logcof(j,:))))/(n*sum(t.^2)-(sum(t))^2);
ba(j)=mean(logcof(j,:))-aa(j)*mean(t);
aw(j)=-((n*sum(t.*argcof(j,:))-sum(t)*...              %its omega
sum(argcof(j,:))))/(n*sum(t.^2)-(sum(t))^2);
bw(j)=mean(argcof(j,:))-aw(j)*mean(t);
f(j)=aw(j)/(2*pi);
dmp(j)=-aa(j)/sqrt(aa(j).^2+aw(j).^2);
end
%%
% this bit will give me freq of all modes in the signal.but i must get these
%information with f(j) too. however my main problem is getting the damping.
figure;
modI=max(abscof');                                      % get  max |coefs| coresponde to freqs of x
modI=modI/max(modI);                                   % scale each clumn 0-1
plot(freq,modI)                                        % Plot all modes. contain all
grid on
axis([0 3 0 max(modI)*1.1])                            % seting the axis
xlabel('Pseudo-Frequency (Hz)'); ylabel('abs(coefs)'); % seting the axis


texts: Using white noise to test filter freq. response?

texts:
If I want to test a digital filter, is using white noise a good way? I mean input white noise to the filter, and visualize the frequency out from the output.

Is that procedure the same as testing a sine wave freq. by freq., to plot the freq. response.

Hope the question makes sense.


texts: Extremely large reconstruction errors in NMF

texts:
First time in this stack...
I am doing some audio analysis. I have a spectrogram ($N\approx 33000, M=1024$) and I need to run an NMF algorithm on it. I am using the Scikit learn implementation. And the code on Github.

Immediately, what strikes me strange, is if you look at the fit_transform functions, the returned signal representation is called W, which makes me believe that the dictionary learned is our H. Aren't the naming conventions for these two components the opposite?
Second, my reconstruction error is in the thousands. Any suggestions on what I may be doing wrong?

My spectrogram is non negative, as required.


texts: Sampling with an alternating impulse train

texts:
The have the following question:

A signal $m(t)$ with bandwidth 500Hz is first multiplied by a signal
$g(t)$ where $\displaystyle g(t)=\sum_{k=-\infty}^{\infty}(-1)^k \delta(t-0.5*10^{-4}k)$. The signal is then passed through an ideal low
pass filter with bandwidth $1$kHz. The output of the low pass filter
would be?
The solution is given in the below image:

I am slightly confused with $G(f)$. As we know after sampling of a message signal $x(t)$ with frequency $f_m$ with the sampling rate being $f_s$, the output of the sampled signal $x_s(t)$ should have the following frequency components:
$$nf_s \pm f_m$$
Where $n=0, 1, 2, ....$
Then why according to the solution given there is nothing at $n=0$ i.e. $0 \times f_s \pm f_m=\pm f_m$, why there are no $\pm f_m$ components in the sampled signal or in other words why there in no component at $f=0$ for $G(f)$?
I was wondering if something is different due to the alternating impulse train.


texts: Camera Calibration - why do you have to move the calibration board?

texts:
I understand the mathematical derivation of Zhang's Method for camera calibration but what I don't understand is why we need to move and rotate the calibration board for several frames in order to get accurate calibration results? One obvious reason is that in order to detect radial distortion you want the control points to be uniformly distributed along the field of view of the camera. However, couldn't we have also just ensured that the calibration board fills the FOV of the camera and just keep it static? Why do we have to move it around?

Thanks!


texts:
In some DSP slides, I've noted that when we try to choose a window for truncating a signal, sometimes a window is chosen that minimizes the processing delay (in my example there were a rectangular, Hamming and Bartlet)...but what is exactly this processing delay?

The minimum process delay I would have to have with Rectangular window?

Sorry, but why is Bartlet? I thought that the minimum phase was proportional at the width of the main lobe (I've resolved thanks, I did not remember that energy end amplitude is related.)


texts: Calculating distance between two blobs in a binary image in microns

texts:
I have a monochrome CCD camera with resolution 960 X 1280 and can give up-to 15 fps
I am working on python opencv.

I want to track the distance between two rectangular blobs in binary images in real time (1 value per 2 or more secs)

My field of view is 40 mm and i want to obtain the resolution of upto 1 micron with +-1% accuracy.

Can this be achieved using binary image or is there any other way to achieve this ?

all suggestions are welcome


texts:
Could someone tell me where it is that I might be going wrong with the following problem?
Ok, so I'm computing a spectrogram, and, trying to return the PDS of the signal (to show where the signal has the most energies) which I will then use in plotting the decibels.
In my approach, I multiply each of the frames by the Hanning window, perform FFT of the resulting blocks and then only take the first half of the result (resulting vector).
Finally, I take each of the blocks (computed by the STFT) and perform PSD.
The problem that I'm having is this:
The chart below illustrates the results that I'm getting using my own C++ code:

Whereas in Python, using matplotlib if I replicate this, then I get the following:

I can't understand where the "noise" is coming from. I can only think that it could be some periodic noise which could be due to little discontinuities at the start and at the end of each frame. But I don't know where I have gone wrong.
The NFFT = 256 hop size = 128
Thanks


texts: Is convolving a signal by a wavelet (in time domain) equivalent to wavelet filtering?

texts:
I am a noob in signal processing. Please help me understand if the following relation is true or not:
 Convolution(signal(t),wavelet(t)) = inverse wavelet transform(some filter operation in frequency domain(wavelet transform(signal)))


texts: How to sample $f:=f_{1}\cdot f_{2}\cdot...\cdot f_{K}$?

texts:
Let $f_{k}$ be $\sigma_{k}$-bandlimited, $k=1,2,...,K$ and define $f:=f_{1}\cdot f_{2}\cdot...\cdot f_{K}$; then how should I choose $T>0$ such that we can recover $f$ from samples $f(nT)$?

According to the Shannon sampling theorem, we must choose $T$ such that $\frac{1}{T}>2\cdot B$, where $B$ is the bandlimit. Hence the question boils down to how we determine $B$.

Now, we have to choose $B$ such that $\hat{f}(\xi)=0$ for $|\xi|>B$. If we compute

$$\hat{f}(\xi)=\mathscr{F}(f_{1}\cdot f_{2}\cdot...\cdot f_{K})(\xi)=\hat{f}_{1}(\xi)\ast\hat{f}_{2}(\xi)\ast...\ast\hat{f}_{K}(\xi),$$

then this still seems inconclusive to me, so I'd appreciate some help in this regard.


texts: Pulse detection against various noise floors

texts:
I'm decoding a pulse amplitude modulation encoded digital signal. The goal is to detect the individual pulse against a background noise floor. The amplitude of the pulses varies depending on the signal strength and quality.

My sampling rate is 2x the bit width such that one bit fits into sample. Thus a single bit is the large value amongst the noise floor (8-bit unsigned values):

6, 1, 18, 100, 9, 4, 7

Detecting the bit is simply looking for the large value relative to its neighbors (100 in the above example). This would be easy if the noise and pulses had known constant thresholds, but in real life they vary. What I actually see is varying noise and pulse amplitude depending on the quality of the signal. Consider these samples (47 and 52 are the bits I'm trying to detect):

2, 8, 12, 47, 19, 13, 10
23, 11, 30, 52, 17, 9, 11

I've been struggling with developing an algorithm that can dynamically determine the threshold and thus pick-out the bits. I'm approaching this with a general computer science background with little to no DSP knowledge.

What are some software techniques to reliability detect a pulse against varying background noise?


texts: Signal Resampling by a non integer factor with convolution

texts:
to start I am a newbie in signal processing, I just started a month ago so please be as detailed as possible.

From what I understood to resample a signal by a non integer factor you can do an upsample followed by a downsample. So, imagining a sample set of size 10 and if you want to upsample it to 15, you can upsample it by 3 and downsample it by 2, correct?

If that is true, does one can create a kernel by merging the two kernels the upsampling and downsampling ones?

To upsample by 3 we can use the kernel [1/3, 2/3, 1, 2/3, 1/3] and to downsample by 2 we can use the kernel [1, 0]. Can I create just a kernel to do both operations?

If instead I use interpolation, can I do it using a kernel as the above?


texts: Avoiding identifying objects within previously identified objects in MATLAB

texts:
Apologies if the question title is confusing.

I've got some code below in MATLAB, which identifies squares/rectangles in an image.

img = imread('image.jpg');
imgbw = im2bw(image);
filter = bwareafilt(imagebw, [800 10000]);
fill = imfill(imgbw,'holes');
area = bwareaopen(fill,15);
final = bwlabel(area);
dets = regionprops(final,'boundingbox');
figure(1), imagesc(I1); hold on;
for count = 1 : numel(dets)
    gg = dets(count).BoundingBox;
    rectangle('position',gg,'edgecolor','r','linewidth',2);
end

I keep getting results where I am identifying squares, within another square I have already identified. i.e.:

What I wanted, was to identify the yellow as one square/rectangle, and leave it at that.  But as you can see, I've identified my rectangle/square, but also identified squares in the middle.  Does anyone know how I can get ignore shapes, that are also inside previously identified squares?


texts: Amplitude of first harmonic of a square wave, $2/\pi$ or $4/\pi$?

texts:
I am getting really confused about the value of the first harmonic of a $50\%$ duty cycle $-1$ to $1$ square wave.
By doing the math I found $\frac{2}{\pi}$, in my lesson and Wikipedia it's $\frac{4}{\pi}$.
But now I checked with MATLAB and it's also $\frac{2}{\pi} \approx 0.6$
t = -100:0.1:99.9; % -> length = 2000
x = square(t, 50);
plot(abs(fft(x)/2000));

As you can see, on the spectrum the first harmonic is at $\frac{2}{\pi}$
And this is how I found $\frac{2}{\pi}$
\begin{align}
x(t) &= \text{rect}\left(\frac{t}{T/2}\right) \ast \delta_T(t) - \text{rect}\left(\frac{t}{T/2}\right) \ast \delta_T\left(t - \frac{T}{2}\right)\\
 &= \text{rect}\left(\frac{t}{T/2}\right) \ast \left( \delta_T(t) - \delta_T\left(t - \frac{T}{2}\right)\right)\\
\implies X(f) &= \frac{T}{2}\mathrm{sinc}\left(\pi f \frac{T}{2}\right)\cdot F \cdot \delta_F(f)\cdot\left(1 - \exp\left(-2\pi j f\frac{T}{2}\right)\right)\\
 &= \frac{1}{2}\mathrm{sinc}\left(\pi f \frac{T}{2}\right)\cdot\delta_F(f)\cdot\left(1 - \exp\left(-2\pi j f\frac{T}{2}\right)\right)\\
\implies X(F) &= X\left(\frac 1T\right) = \frac{2}{\pi}
\end{align}
Clarification and definitions I am using:
$$\text{FFT}\left\{\mathrm{rect}\left(\frac tT\right)\right\} = T\mathrm{sinc}\left(\pi f T\right)$$
$\delta_T$ is the dirac comb of period $T$.


texts: Beginner - use FFT to display spectrum/equalizer

texts:
At first, I want to say that I'm totally beginner in DSP and I don't have enough math education to understand Fast-Fourier transformation.

I'm a programmer and I want to archieve something like this:

My example file is in 8kHz, 16-bit samples, but currently, I'm trying to do with my own raw data - one sin(x) function. I know that I need to pass N samples to FFT function, but how interpret result? As I see, FFT need some input data (N samples) and gives N output data.

How I can know where is frequency and scale it - for example - to 5 scopes like 0 - 200Hz, 200 - 400Hz etc.

Or maybe I don't understand FFT correctly? I think that I can pass some samples and get information  "how much" is each frequency.

Technically, I'm using FFTW3 library.


texts: Integration of FTIR Absorbance Spectrum in Python

texts:
Hello I have a FTIR (fourier transform infrared) absorbance spectrum of a sample, Integrating the single lines is correlated to the quantity of substance present in the sample.
The spectrum part I'm interested in is something like this:

And I want to calculate the integral under a peak, in respect of the baseline, or something like this area:

My idea was to get the baseline with a filter or something to cut the peaks and then integrate the curve with simpson method (and subtract the baseline integral on the same interval) or subtract the baseline to the curve and integrate then.
Is there any way to get the baseline with packages like scipy or others? I'm new to spectrum analysis and I would be thankful for any suggestion!


texts: Achieve better noise reduction at frequency response function estimation

texts:
I have the following problem. I have $M$ synchronized, noisy measurements of a MIMO system (2 inputs, 2 outputs) of all inputs and outputs. The inputs are synchronized (no phase shift, coherent measurements) and linear independent, the noise is not synchronized, normally distributed and zero mean. My goal is to estimate the FRF (frequency response function) with phase from my measurements. There are several estimators (H1, H2, Hiv, Hev) suitable for the task. Using the coherency of my measurements, I would expect that simple time averaging (Hev) would give the best result. So:
$Y(jw) = H(jw) U(jw)$
Which would lead to
$H(jw) = Y(jw)U(jw)^{-1}$
where $Y$,$U$ $\in$ $\mathbb{C^{2x2}}$, representing one measurement(or the average of all measurements) of both linear independent input signals and corresponding output signals.
Using this formula, I don't see any way I can reduce the variance of noise apart from said time averaging. I would love to use something like welch's method, but I need the phase information, which I would lose that way. Is there anything else I can do, given the circumstances?


texts:
Input image

Listing-1

i = imread('Untitled.png');
i = rgb2gray(i);
F = fft2(i);
%%%F = fftshift(F);
F = abs(F);
F = log(F+1);
F = mat2gray(F);
imshow(F);

Output

.

Listing-2

i = imread('Untitled.png');
i = rgb2gray(i);
F = fft2(i);
F = fftshift(F);
F = abs(F);
F = log(F+1);
F = mat2gray(F);
imshow(F);

Output

Seeing the the above two outputs, can you answer the following questions,

Why does the FFT of an image produce such an spectrum where zero frequencies are at the corner of the image?
Why is that a problem (or, is that)?
Why does the shifting operation fixes that phenomenon?


texts: How can I translate what I have learnt in Transfer Functions to differential equations?

texts: I have gone through the entirety of K. Ogata's Modern Control Engineering, and I do not understand how can I translate all the transfer function models into differential equations? For example, how would a closed loop control system with PID compensation look like as differntial equations??


texts:
This is my system.

Is there a way to find a transfer function? I can’t help the YR(s) going inside B(s) without being sampled, and I think this is the problem. Any help?


texts: Algorithm for detecting whether a signal stored in rolling buffer is Increasing, Decreasing or staying Constant

texts:
I have a data signal which is generated at constant time interval. It is a real world measurement and thus exhibits some noise in its value (it fluctuates approx + or - 20 units). The noise is fairly consistent.

I obtain the measurement at a regular time interval and stash it inside a rolling buffer of sample data (done via a computer). This rolling buffer is a list of values which are located at positions (0,1,2,3,4,5... -> n) in the list. Once the nth position in this list is reached, my buffer rolls over and overwrites the value at the 0th list position followed by the value at the 1st list position and so on until the nth value is overwritten (then rollover again). The most current data point value is always tracked (so I always know the position in the list of values at which I am writing my data to). This data buffering process repeats over and over. I use the rolling sample data to calculate a moving average and a std deviation.

Now for my problem. The signal has the potential to exist in 3 states, increase at a constant rate or to decrease at a constant rate at any time t1 or to remain constant. An increase or decrease can suddenly happen at any point in my list and will continue to some time t2 after t1.

I want to detect whether the signal is Increasing, Decreasing, or is remaining Constant (within the typical noise profile) with reasonable statistical certainty. What sort of algorithm would effectively notice this?


texts: Gain function calculation (frequency response)

texts:
Define moving average process $y_t := 0.5 x_t + 0.5 x_{t-1}$ where $x_t := e^{i2 \pi t}$. Its frequency response is then:

$$H(f) = 0.5 + 0.5 e^{-i2\pi f}$$

Recall that the frequency response in polar notation is:

$$H(f) = G(f)e^{i \theta}$$

where $G(f)$ is the gain function. We then have that:

$$ H(f) = 0.5 \big( e^{-i \pi f} + e^{i \pi f} \big)e^{-i \pi f}$$.

QUESTION: Can someone please explain why the last step is true? An explanation with some detail is much appreciated (I am new to signal analysis).


texts: Why use Wavelet Denosing instead of Band pass Filtering

texts:
What is the important advantage of adopting a wavelet based denosing scheme such as SURE, SUREshrink, etc. than using approaches involving low pass, high pass, band pass, band reject filter for signal denosing?

More precisely, what is the advantage of using wavelet denosing on EEG signals than other methods.

Thank you!


texts: Starting off an IIR with plain averages to accelerate slow rise time

texts:
A 1-term IIR can easily be started off with the first data point, instead of 0.
For data that's all > 0,
this ought to be better than starting off with y = 0 :

def update( x, t, a=0.1 ):  # data x (scalar or vector), t 0 1 2 ...
    global y  # or self.
    if t == 0:
        y = x
    else:
        y += a * (x - y)  # fraction `a` of the way towards x
    return y

It's also easy to start off with plain averages (FIR) for the first few data points,
then switch to IIR:

def update( x, t, a=0.1, naverage=10 ):
    if t <= naverage:
        a_t = 1. / (t + 1)  # start off with plain averages, 1 1/2 1/3 ...
    else:
        a_t = a       # then IIR
    y += a_t * (x - y)

The goal here is to accelerate the slow rise time of y when a is small.
Is this reasonable ?
Are there less ad-hoc ways of doing this ?

Added 28 Nov, a plot showing the difference:


texts:
Having some trouble understanding this concept, really could do with some advice.

I want my STFT to have the following parameters: NFFT = 256 overlap/hop = 128

Now essentially, the algorithm will work as follows:

1) Split the signal into blocks of 256

This will result in around 72*265:

2) For each of these blocks, calculate against the Hanning Window

3) Create a "slider" that does an overlap of 128.. So, in theory it would
   therefore be: `size = 256 + 128`

Therefore, when I'm computing the DFT for each of the overlapped blocks, will my FFT remain at size 256 or will the size be 256 + 128 If this is the case, does each block in the resulting vector still have to be of size 256?

Thanks

EDIT:

This is now my result:

But, compare this to a spectrogram in matplotlib

Where am I actually going wrong? I cannot make any sense of this.

I've looked bat through all the data, the blocks are correctly overlapping, Hanning window is being applied correctly.

Could it be to do with the fact I'm using a 1D DFT? I.e.

std::vector<complex> FFT->transform(complex_vector[0...n], 256);


texts: How important is it to use power of 2 when using FFT?

texts:
Here is the problem. I have a 2D array of data, first column represents the time data and the second column represents the sinusoidal response data, based on the time data. I apply fft and I get my frequency (that I started with) in a specific bin as I expected and I find the amplitude and phase angle from that bin. Now the problem is I have the same set up but with more data points, I apply the fft again and the bin number changes (which is normal and it is where I expect it to be), the amplitude is the same but the phase angle is different) first is this normal? second, what approach should I take? Thank you

PS: neither of the set ups (mentioned above) give data of length of power of 2, say the first one gives 1620 data points and the second one gives 1745 data points, so should be taking the next power of 2 for both from the beginning?


texts:
Can any one help with the $y[n]$ and $x[n]$ relationship in this block diagram, I just keep have a $t[n]$ in my answer that I can't get rid off.

On my best try I got to $y[n] = 2t[n]-x[n-1]-y[n-2]+x[n]$

If you could also tell me how you got there it would be great.

Thanks anyone for help.


texts: Implementing MVDR beamformer in the STFT domain

texts:
I am trying to implement an MVDR beamformer for the first time. I was reading a couple of papers and books with many different notations and I am a bit confused.

In my case, without loss of generality, I have a spherical microphone array. Given that I produce the steering vector $d(f)$ with respect to a given 3D direction $\Omega_i=(\theta_i,\varphi_i)$, (azimuth and elevation). Let $y(f)=[Y_1(f), Y_2(f),\ldots,Y_M(f)]^T$ be the frequency representation of a single STFT frame. If I understood correctly my MVDR filter should be:

$$h_\text{MVDR}(f)=\frac{\Phi_y^{-1}d(f)}{\bar{d}(f)\Phi_y^{-1}d(f)}$$
Where, $\bar{(\cdot)}$ is the complex conjugate.

Now, my enhanced signal may be computed as:
$$Z(f)=h_\text{MVDR}^H(f)y(f)$$

I do this for each time frame, concatenate the result and follow to inverse STFT.

Is this a correct implementation?
If not, where was I wrong?
How do I estimate $\Phi_y^{-1}$ from my signal? Is that simply autocorr(y) in MATLAB?
Is there a nice python package with references or even one with an implementation for such a filter?


texts: Extended Kalman Filter for Linear Systems with Non Linear Measurements

texts:
I'm successfully using an Extended Kalman Filter for object tracking. My state vector ($x, y, v_x, v_y$) needs to be in cartesian coordinates. The measurement data is transmitted in polar coordinates.

The state transition equations (and thus the state transition matrix) are linear:
\begin{align}
x_{k+1} &= x_{k} + v_{x,k} \cdot \Delta t \\
y_{k+1} &= y_{k} + v_{y,k} \cdot \Delta t \\
v_{x,k+1} &= v_{x,k} \\
v_{y,k+1} &= v_{y,k}.
\end{align}

So the non-linear relation of the measurement vector in polar coordinates to my state vector in cartesian coordinates is the only reason why I used an EKF.

A simpler approach could include a "classic" transformation of my measurement data from polar to cartesian coordinates before feeding it into a standard Kalman Filter.

Assuming that I transform my measurement noise covariance matrix accordingly: Would this have an impact on the filter performance (e.g. because the measurement noise can't be assumed as gaussian any more)?


texts: The small red peak in the CIE standard observer

texts:
The human eye has 3 types of color cones: red, green and blue. Their spectral sensitivity peaks in short (S, 420–440 nm), middle (M, 530–540 nm), and long (L, 560–580 nm) wavelengths. See diagram below.

Then we have the CIE standard observer. Wikipedia says it can be thought as the spectral sensitivity curves of three linear light detectors yielding the CIE tristimulus values X, Y and Z.

I don't get why the red line in the CIE standard observer color matching function also peaks at 440 nm. To be more specific: What causes the x-line in a CIE standard observer color matching function to peak at around 440nm?

Can someone explain me that?


texts:
I am trying to produce ideal anisotropic diffusion outputs using the standard lena image. Using the first coefficient , the output is coming somewhat close to ideal ouput but when I increase the kappa value the bluring increases. When I am using the coefficient that prefers wide area diffusion over small areas,my output comes blurred dominantly.
I am providing the output images.!

INPUT:

DESIRED OUTPUT:

OUTPUT1:

OUTPUT2:

GOT A CLOSE OUTPUT:

How do i remove this blurring in images? because its hindering my research


texts: Laplace Transform of Cosine, Poles and Mapping to Frequency Domain

texts:
I am trying to understand the connection between Laplace transform ($s$-plane), and frequency domain calculation.

Let's take the Fourier transform of $\cos(\omega_0t)$, which equals to $\pi[\delta(\omega - \omega_0) + \delta(\omega + \omega_0)]$. So clearly the frequency domain has only two non-zero values at two particular frequencies, and others are zero. Fine!

Now lets do the Laplace transform of the same function: $\cos(\omega_0t)$, which gives me $F(s) = \frac{s}{s^2 + \omega_0^2}=\frac{s}{(s+j\omega_0)(s-j\omega_0)}$.

So there are two poles on the $y$-axis ($j\omega$ axis) as in above plot; $\beta$ is $\omega_0$ here. Now if I move upwards from the origin, I am staying on the frequency axis, and for every point except the pole locations, I am getting a non-zero value [from $F(s)]$, whereas only the pole locations should give me non-zero values (as can be seen from the fourier transform), and zero for all others points.

But this is not happening here. Where exactly I am going wrong here.

Your guidance will be greatly appreciated.


texts: wiener filter (non-causal) calculating covariance matrices

texts: I'm learning about the Wiener filter, and I'm working on my own implementation. I'm starting out with the non-causal filter, and I need to calculate some covariance matrices. If the signal is assumed to be a linear combination of a target signal and noise, then the signal can be modeled as: $$x[n] = y[n] + w[n]$$ where x is the observed signal, y is the target and w is noise. If I understand correctly, the weiner filter is a linear-minimum-mean-square-error estimation process. What I'm getting hung up on is that we need to compute a matrix of expected values based on the input signal x, namely $$E[xx^{T}]$$ and I know that to do this we need to apply the expectation operator to each element in the matrix $$xx^{T}$$ but I don't know how to do that computation, or what it even means.


texts: How do you plot an SPL vs frequency curve for a given set of pressure data?

texts:
I have a set of pressure data at a sampling rate of 262144 Hz for 3 seconds making it 786432 samples of pressure data. I want to plot a curve of the SPL (sound pressure level) vs frequency. I first converted pressure data to SPL using $20\log_{10}(P/P_{ref})$ and performed a 4096 point FFT for the 192 segments of data and averaged them.

However, I couldn't get the required SPL values in decibels. Was the approach correct? If not, could you please point out the mistake in my approach?


texts: Channel Estimation / Equalization - Estimate Channel Inverse Using White Noise Statistics Only

texts:
Given the system defined in the following figure:

We have a system $ G \left( f \right) $ which is unknown yet can be defined by $ {N}_{p} $ poles and $ {N}_{z} $ zeros.

The signal $ x \left( t \right) $ is an IID White Noise.
This signal samples can not be accessed.

The signal $ y \left( t \right) $ is the colored noise (Filtered).
This signal samples are available.

The filter $ H \left( f \right) $ is adaptive (Time changing).
Its model, which is to be determined, is given by $ {N}_{z} $ poles and $ {N}_{p} $ zeros.

The signal $ z \left( t \right) $ is the result of the $ H \left( f \right) $ Filter.
This signal samples are available.

How can one set the parameters (Poles and Zeros) of $ H \left( f \right) $ such that $ z \left( t \right) $ is White Noise?
This means how to adaptively set the parameters of $ H \left( f \right) $ to be the inverse filter of $ G \left( f \right) $.

Usually those kind of problems are solved using the Least Mean Square Filter yet since the samples of $ x \left( t \right) $ aren't accessible it is not the classic model.

Is there any other way to set the parameters of $ H \left( f \right) $ s.t. its output, $ z \left( t \right) $, is white noise without requiring access to $ x \left( t \right) $?


texts: Understanding the Conditions for Recovering a Discrete Time Signal Through Sampling

texts:
So, we had a very brief introduction to the Nyquist-Shannon sampling theorem (the discrete time version).

While discussing this, we have seen that multiplying a discrete time signal $x[n]$ by an impulse train $p[n]$, we get a sampled signal $x_p[n]$, and if certain conditions are fulfilled, then it is possible to recover the original signal.

In the frequency domain, what it means (informally) is that we are taking $X(e^{j\omega})$ and shifting it by integer multiples of $2\pi/N$ (i.e the sampling frequency) and "adding" all of this to the plot of $X(e^{j\omega})$ giving us the plot of $X_p(e^{j\omega})$ (in other words we have replicas of $X(e^{j\omega})$)

After looking on the internet and doing a couple of drawings, I've seen that one important condition to recover the initial signal $x[n]$ is that $\omega_s > 2\cdot \omega_m$, where $\omega_s$ is the sampling frequency and $\omega_m$ is the frequency of the original signal (i.e the frequency of $x[n]$).

However, the teacher, in his lecture only mentioned the following condition:

"If the original signal satisfies the following condition: $$X(e^{j\omega}) = 0, \text{ for } \frac{\pi}{N} < |\omega| \leq \pi$$ then the sampled signal $x_p[n]$ contains all the information about the original signal and we can easily recover $x[n]$ from $x_p[n]$".

This makes a little sense to me, as I understand that if $X(e^{j\omega}) \neq 0 $ for all $\omega$, then we do, indeed, have overlapping (i.e aliasing) and it is not possible to recover the signal. But I do not understand why $X(e^{j\omega})$ has to be $0$ specifically for $\frac{\pi}{N} < |\omega| \leq \pi$.

Also, how come the teacher did not speak of the other condition (namely that $\omega_s > 2\cdot \omega_m$) ? Has he forgotten it, or is there something I am missing ?


texts: Why is no phase information lost when a received signal goes through a mixer?

texts:
I'm sorry if the question is too philosophical or makes no sense, but I need to be able to explain why it doesn't make sense.
When we take the in-phase and quadrature-phase base-band components of an intermediate frequency signal, it's very easy to show that any one of the two orthogonal components alone would be insufficient to distinguish the variations in a single-carrier phase from variations in its amplitude. This tutorial makes it quite clear. The Q component, although real, carries the imaginary component of the phasor $A(t)\exp(2\pi f_I\cdot t + \phi(t) )$.

However, when we pass the RF signal through a mixer, there is no Q component lost. No phase modulation will be lost in the base-band signal obtained later. Why not?
A figure to help create context.


texts:
I am doing one example from my book as a preparation for exam.

The assignment is:

  It is given that:
  $$\mathbb{rect}(t)=pf(t) \leftrightarrow PF(f)=2AT_0 \cdot \mathbb{sinc}(2\pi fT_0)$$
  you need to calculate frequency spectrum of:
  $$pf(t)=\mathbb{sinc}(\omega t)$$

Truthfully, I have no idea where to start. I presume that the solutions is absolute value of sinc function, because I read it from solution, but in the solution there was only diagram.

I tried to solve directly using Fourier transformation on sinc function, but I got very messy equation at the end.

So, my question is: How can I solve this assignment?

Thanks you very much!!!

EDIT:
I found this pdf, on the 7(162) side it explains what I want to do, but this is only with pictures. I want to understand it.
http://ultrasound.ee.ntu.edu.tw/classnotes/ckt2/Chapter12.pdf


texts: Bayesian Inference / Likelihood of Byte-stream

texts:
Introduction
Let us consider the following problem; I receive a byte stream. The bytes are correlated, i.e.

It is possible that values will very quite close.
It is reasonable to assume that the stream may have some some spectral properties, i.e. exhibit only slow rate of change / specific frequencies.
The distribution is a priori unknown.

My Question
How would you suggest I go about estimating the distribution of the the correlated stream / estimating the likelihood function for possible values?
Any suggestions or references will be much appreciated.


texts: I want to test some motion estimation algorithms which compute motion with sub-pixel accuracy. I can create images shifted by the order of pixel (e.g. [2,2]) using MATLAB or OpenCV but I am not clear on how can I shift images with sub-pixel (e.g. [3.57,4.83]) accuracy. Any help regarding this will be much appreciated.


texts: What does the word 'bin' mean in the context of FFT's?

texts:
Everywhere I read about the FFT, I read about frequency bins. I can't find anything about what is precisely meant with 'bin'. What I wonder about is if this is actually meant to imply that the FFT returns binned data in the sense of the word as used in statistics.

I think this question can be rephrased into this example: if I have bins centered at 1Hz, 2Hz, 3Hz, etcetera, what would happen to a frequency component at 2.4Hz? If the frequency bins are actually bins, I think this would mean that the amplitude is simply added to the 2Hz bin.

If the bins are indeed bins as I interpret the word, I would really like to know why the FFT results are binned.
If not, then I am curious why they are called bins.


texts: Simplest way of detecting where audio envelopes start and stop

texts:
Below is a signal which represents a recording of someone talking. I would like to create a series of smaller audio signals based on this. The idea being to detect when 'important' sound starts and ends and use those for markers to make new snippet of audio. In other words, I would like to use the silence as indicators as to when an audio 'chunk' has started or stopped and make new audio buffers based on this.

So for example, if a person records himself saying

Hi [some silence] My name is Bob [some silence] How are you?

then I would like to make three audio clips from this. One that says Hi, one that says My name is Bob and one that says How are you?.

My initial idea is to run through the audio buffer constantly checking where there are areas of low amplitude. Maybe I could do this by taking the first ten samples, average the values and if the result is low then label it as silent. I would proceed down the buffer by checking the next ten samples. Incrementing  along in this way I could detect where envelopes start and stop.

If anyone has any advice on a good, but simple way to do this that would be great. For my purposes the solution can be quite rudimentary.

I'm not a pro at DSP, but understand some basic concepts. Also, I would be doing this programmatically so it would be best to talk about algorithms and digital samples.

Thanks for all the help!

EDIT 1

Great responses so far! Just wanted to clarify that this is not on live audio and I will be writing the algorithms myself in C or Objective-C so any solutions that use libraries aren't really an option.


texts: How to make equivalent system using the Noble Identity?

texts:
I am trying to get equivalent of this system using the Noble Identities:

$$x[n] \rightarrow \boxed{H(z^L)} \rightarrow \boxed{\uparrow L} \rightarrow y[n]$$

my answer is

$$x[n] \rightarrow \boxed{\uparrow L}  \rightarrow \boxed{H(z^{L\cdot L})} \rightarrow y[n]$$

Is this answer correct?


texts:
The question is as follow:

Let me do the analysis:

The downroad first:
\begin{align}
X_1(z) &= z^{-1}X(z)\\
X_2(z) &= \frac{1}{2}\left\{X_1\left(z^\frac{1}{2}\right)+X_1\left(-z^\frac{1}{2}\right)\right\}\\
X_3(z) &= X_2(z^2) = \frac{1}{2}\left\{X_1(z)+X_1(-z)\} = \frac{1}{2}\{z^{-1}X(z)- z^{-1}X(-z)\right\}\\
X_4(z) &= zX_3(z) = \frac{1}{2}\left\{X(z)- X(-z)\right\}
\end{align}
And the uproad:
    $$ X_6(z) = X_5(z^2) = \frac{1}{2}\{X(z) + X(-z) \}  $$

So the reconstructed signal is:
    $$ \bar{X}(z) = X_4(z) + X_6(z)  = X(z) $$

But I am very confused that this filter bank does not satisfy the perfect reconstruction according to PP V.'s Multirate systems and filter banks at page 193:

  $$F_0(z) =H_1(-z), \quad F_1(z) = -H_0(-z)\tag{5.1.7}$$

So I am very confused. Who could answer my question?


texts: Why Matlab fdatool designed butterworth filter and butter command's co-efficients are different

texts:
I met an great confusion.

Using below command I have got co-efficents for a 300Hx cut-off high pass filter of order two.

  [z p k] = butter(2,(300/44100),'high')
  [sos,g] = zp2sos(z,p,k)

Now this sos co-efficients are differ from what is obtained by fdatool.

As explained here https://dsp.stackexchange.com/a/19553/7868 , what i am wondering is why even for a 2nd order filter the co-efficients are different obtained by both methods.


texts: How to minimize peak-to-peak amplitude of periodic waveform through FFT phase shifts?

texts:
For one of my music projects, I'm playing back periodic audio signals (by looping single periods). Unfortunately, one of my waveforms sounds too quiet (even at maximum volume).

I'm trying to use FFT to obtain harmonic strengths, then phase-shift each harmonic to minimize the peak-to-peak amplitude, and then amplify the signal.

Is there any algorithm to find the optimal phase shifts, or should I use scipy.optimize.basinhopping (or generating thousands of random phases) for an approximate result?