texts: Zero padding in frequency domain, any tricks to speedup?

texts:
there are many situations when one has to carry some operations on spectra, like splitting a spectrum Z wide in two Z/2 spectra, or vice versa merging two Z sized spectra in a 2Z sized one. The only solution without having to go back to time domain and then to freq domain again (which is stupid imho) is operating convolution in frequency domain.

One example: I have two Z sized spectra representing, respectively, a STFT signal frame and an impulse response, which were NOT zero padded to start from;  I want to convolve them non-circularly so I have to transform both spectra to double size spectra, zero padded and left justified; I have therefore to expand both spectra to 2Z sized ones by simply doubling the bin positions leaving the odd ones empty (resulting in a 2Z spectrum representing a repeating copy of the signal in the 2nd half); convolve with a Dirichlet kernel representing a binay square wave of unitary frequency (here is the point), so to zero the second half; then I can multiply the two 2Z sized spectra to obtain linear convolution; then carry the inverse operations to split the result in two spectra of size Z for subsequent overlap-save. This is a total of four convolutions in frequency domain.

I anticipate the answers: why not simply acquire zero padded frames of proper size at the origin? Well let's assume that I can't for many reasons. One is that I am working in a STFT context already adopting a standard frame format, like non-zero padded frames, where I get frames of a given format and am expected to return frames of the same size and format as result of my processing.

OTOH, if I avoided the frequency domain convolutions I would have to do IFFT on both spectra, zero pad in time domain, FFT again for multiplying the spectra, IFFT for splitting the result and then FFT again, for a total of seven fourier transforms, which is perhaps even more stupid...

So I am asking whether some math tricks exist to carry such operations with spectra as zero padding and splitting or any trick to speedup convolution in frequency domain without having to go back to time domain. Thanks


texts:
i try to calculate the $\mathcal z$-transform of $x[a-n]$ (where $n$ is my variable)
i can't find any transform. the best suited transform is $x[-n] \longleftrightarrow X(z^{-1})$
i took the sum definition of the $\mathcal z$-transform but i couldnt find.


texts:
I'm trying to perform upsampling in Python. Given the signal 's' and factor of upsampling N, I wrote the following code:

> y = np.zeros(N*len(s))
> for i in range(0, N*len(s), N):
>     for j in range(len(s)):
>             y[i] = s[j]
> return y

However, when I have a signal with first value '1' and factor of upsamling 3, my output of the function is like [1, 0, 0, 1, 0, 0] etc, no matter what the rest of the signal looks like. Is there a way to make this code work properly?


texts:
Is anyone aware of any research/papers/software for identifying a trail (as a line or point-to-point curve) in an image of a forest scene (from the perspective of the camera standing somewhere along the trail)?
I'm trying to find an algorithm that could take an image like:

and produce a mask, identifying a likely "trail", such as:

As you can see, the original image is a bit blurry, which is purposeful. The image source can't guarantee perfect focus, so I need to be able to handle a reasonable amount of noise and blurriness.
My first thought was to apply a Gaussian blur, and segment the image into blocks, comparing adjacent blocks looking for sharp color differences (indicating a trail "edge"). However, I quickly realized that shadows and other changes in lighting easily throws that off.
I was thinking about extracting SURF features, but I've only had success with SURF/SIFT when the image is perfectly clear and with consistent lighting.
I've also tried scaling the images and masks down to much smaller sizes (e.g. 100x75), converting them into 1xN vectors, and using them to train a FANN-based neural network (where the image is the input and the mask is the desired output). Even at such a small size, with 1 hidden layer with 75% the size of the input vector, it took 6 hours to train, and still couldn't predict any masks in the testing set.
Can anyone suggest any other methods or papers on the subject?


texts: Using Parks-Mcclellan (or others) for FIR differentiator?

texts:
I have never seen the use of Parks-Mcclellan for differentiator - most uses tend to be lowpass filters. Is this because Parks-Mcclellan implementation of FIR differentiator has numerical problems and cannot be successful?

It seems though that Parks-Mcclellan for a differentiator should be more studied and obvious, because in terms of fit of a function, a differentiator has frequency response that is basically a sloped straight line or an identity function.

In general, I am having some difficulty finding established optimal ways to implement FIR differentiators. Are there other known ways that are commonly used for FIR differentiators? What about lowpass differentiators, where frequency response basically is a differentiator up to some frequency and from some frequency to $\pi$ it is filtered out, with transition band in the middle?


texts:
Can you create a zero phase IIR filter by transforming its impulse response into frequency domain and only taking the magnitude of that frequency repsone?

I have seen this in an open source project in the following steps:

get filter response
transform it into frequency domain
take the magnitude of the frequency data (-> phase response becomes 0)
multiply with frequency data of a (to be filtered) signal

Does this make any sense? Is this method applicable? I have never seen this described in any literature.

Thank you in advance


texts: Equivalence of the Power Spectral Density definitions

texts:
I am trying to show the equivalence of the following Power Spectral Density definitions in Matlab:

Definition 1:

$$ P(\omega) = \sum_{k=-\infty}^{\infty} r(k)e^{-j\omega k} $$

Definition 2:

$$ P(\omega) = \lim_{N\rightarrow\infty} E\left\{\frac{1}{N}\left|\sum_{n=0}^{N-1}{x(n)e^{-j\omega n}}\right|^2\right\} $$

So long as the following convergence property is satisfied:

$$ \lim_{N\rightarrow\infty} \frac{1}{N} \sum_{k=-(N-1)}^{N-1}{|k||r(k)| = 0} $$

I have tried to demonstrate that if the convergence property above is not satisfied then the equivalence does not hold through a simulation in Matlab, however I have had no success. I have tried calculating both methods for the function $y=x^2$ which should clearly not satisfy the convergence property as well as $y=sin(x)$ which should also not. I have also found the estimated spectral density for white noise and it looks like the following:

I am not sure therefore if my method is correct, since surely the white noise spectral estimate should have been a flat line.

I hope that somebody can help me with this. Thanks.


texts: How can I use a trained model to generate related images?

texts: Suppose I have a data set of a large number of related images and I extract HOG features and train it using SVM Classifier or KNN Classifier. How can I use this model to generate a new image which is related to the images in the dataset (rather than testing on a new image which we do traditionally)?


texts: Why are the mark and space tones of these FSK signals reversed?

texts:
I'm working on a project involving FSK-modulated signals. I'm trying to reverse-engineer these signals to determine the preamble pattern used, because the protocol is proprietary.

Shown below is a plot of the real parts of two captured transmissions that seem to follow the same pattern - except their frequencies appear to be inverted. This is further evidenced by the instantaneous frequency plots also shown. I captured these signals using an RTL-SDR dongle, which outputs complex I/Q samples. What does this mean?


texts: Reconstruct FIR frequency response from the coefficients

texts:
There is a lot of tools for designing FIR filters. Using one such tool I have designed a filter that satisfies my needs. It's coefficients are as follows:

 0.000106519966569472
 0.000164942422133671
 0.000154198611135164
-0.000051344150552581
-0.000527514219352601
-0.001228193882673074
 ...
 0.176493072494376790
 ...

In my system, 0.0001 / 0.1764 is about the same as ADC noise (well, not quite, but close). I'd like to know if a shorter filter, with some taps stripped off (zeroed) on either side still satisfies my requirements. This could be done by taking the modified array of the coefficients and reconstructing the frequency response of the modified filter.

Any tools for it (the cheaper the better)?

Edit

The tool works great. I post the result below. Good news is that only higher frequency response is visibly altered. Bad news is that by quite a lot. I am more interested in pass-band and slope, but I will look at more filter design tools to see if any of them has this sort of tradeoff built in. Thanks jojek.


texts: What is the difference between a controller and a compensator?

texts:
I recently revisited some texts on control theory. In some textbooks the term compensator is used, seemingly interchangeably with controller (see e.g. The Control Handbook by Levine, chapter 14 on classical control system design methods).

This confuses me. In my field (aerospace engineering), we always talked about controllers. Since it's some time since my days at university I may have missed/forgotten some subtle differences...

Please help me to understand the difference:

What is the (technical) difference between a compensator and a controller?
When do you call it one way or the other?


texts: How do I normalize accelerometer signals values to a relative scale?

texts:
Different smartphone devices have accelerometers manufactured by different manufacturers.

Say I want to categorize vibrations recieved from various devices into one of the following scales :

LOW_MOVEMENT
MEDIUM_MOVEMENT
HIGH_MOVEMENT

How can I devise a scale such that -

LOW_MOVEMENT of one device is LOW_MOVEMENT of every other device when subjected to the same vibrations. And so on for MEDIUM_MOVEMENT and HIGH_MOVEMENT? (with a certain degree of possibility ofcourse)

The only data I know about the make of the accelerometer is accelerometer resolution and maximum range of accelerometer.

P.S. I plan on normalizing x^2 + y^2 + z^2 under root.


texts:
Does anyone have a algorithm for DFT without FFT function in matlab?

and second question is how can I make zero padding in this algorithm?


texts:
Show that any continuous-time signal $x(t)$ can be represented as $x(t)= x_e(t) + x_o(t)$

where $x_e(t) =\frac{1}{2}[x(t) + x(-t)]$ and $x_o(t) = \frac{1}{2}
[x(t) − x(-t)]$
are even and odd functions, respectively.


texts: Windowing function for Inverse Fourier Transform

texts:
It is a common practice to apply windowing function, such as Hann or Hamming, to a time domain signal before FFT, in order to reduce spectral leakage. Often, we do 1) Windowing, 2) FFT, 3) frequency domain processing, such as filtering, then 4) Inverse FFT. My questions are: before inverse FFT, do we need to apply a windowing function in frequency domain as well? If we do, how?
Thanks in advance.


texts: Where did the k of $a_k$ disappear from Fourier Reverse Transform if $\omega=\omega_0k$?

texts:
Where did the $k$ of $a_k$ disappear from Fourier Reverse Transform if $\omega=\omega_0k$?

We turn $\omega0$ to be $d\omega$, but $\omega=\omega_0k$, so shouldn’t there be a $k$ in the reverse transform?

Attached reference below:


texts:
A medical Image has a size of 8x8 inches. The sampling resolution is 5 cycles/mm. How many pixels are
required? Will an image of size 256x256 be enough?

I know sampling in 1D signal but cannot get the intuition for a
2D image.

I first converted 5 cycles/mm to cycles/inch which came to be about 127 cycles/inch.

So as I understand it, this means we take 127 values for each inch of the input image and each of this is a pixel. So I figured for a 8x8 inch image, we would need

  127*8x127*8 = 1016x1016 pixels

Am I right in my thinking or will Nyquist theorem have to be used?

Any kind of help is appreciated.


texts:
I'm studying Digital Communication and I couldn't understand the relationship between temporal orthogonality and sampling theorem.

Definition of the Temporal Orthogonality is as follows:

$$\mathrm{ACF}= \int s_i(t)\cdot s_l(t-kT) \ \mathrm{d}t= E_{il}\cdot \delta [k]$$

In the text, it is stated that:

  [...] This means that with respect to the represented symbol sequence
  lossless discrete-time signal processing is possible using only one
  sample per symbol interval, even if the sampling theorem is not
  fulfilled.

We are at the output of the transmitter.


texts: Does the hold part in sample and hold turns the signal from discrete to continuous?

texts:
I am trying to link sample and hold to discrete and continuous time domain.
Could someone please confirm:

When sampling but not holding for "an extended" period of time, you have discrete samples.

When sampling AND holding you lose the "discretion" and obtain an approximated continuous signal.

Is this correct?


texts: How to determine number of poles or zeros in prony's method?

texts:
I would like to use Prony's method for signal modelling. I want to design a filter such that its impulse response is equal to the message signal. I use the function prony in MATLAB to calculate the filter coefficients whose unit sample response is equal to the message signal. Inputs of that function are number of poles and zeros and the message signal.

My aim is to send filter coefficients instead of message signal such that the signal can be reconstructed by using that coefficients in the receiver side. However, I am not sure about how to determine number of poles or zeros for that message signal.

I ask for your help.


texts: What are the known ways of changing an audio signal that are not audible to humans?

texts:
For instance, I believe we cannot detect global phase shifts.  And of course frequencies above ~20kHz or below ~20Hz.

I've heard of "frequency masking", but don't know much about it and would appreciate a brief explanation.

What else is there?


texts:
From my reading, I see that there are two ways people usually do carrier synchronization:

Decision directed, where the transmitted symbols are unknown are the receiver, decisions are made, and then an error is computed. This assumes the receiver knows the type of signal was sent (in order to make the symbol decisions).
Data aided, where there is some known symbol sequence that is used for adjusting the phase and drive the error to zero.

Are there any carrier synchronization techniques which are non-data-aided and blind in the sense that all they require are IQ samples? I'm thinking of a scenario where I could give the technique a QPSK signal or a 16-QAM signal and the frequency offset would be fixed for both signals.

The best idea I have so far is to use a combination of signal identification and one of the two methods above (IQ samples $\rightarrow$ Signal ID alg. $\rightarrow$ Choose correct traditional technique). Maybe this is a good way to go about it, but if there is some more formal method, I am unsure.

Edit #1

Things that I know or have existing ways to estimate:

Symbol rate
Pulse shape
Bandwidth
Equally likely symbols
Modulation could be PSK or QAM
Assuming a single carrier system

Edit #2

The fourth power method is something that I known of but not in the way that is being described by Dan and Marcus. Apparently can be used for general constellations:

% make some random constellation by choosing 10 points within a 10-by-10 grid
constSize = 10;
iComponent = 10*(rand(constSize , 1)-0.5);
qComponent = 10*(rand(constSize , 1)-0.5);
const = iComponent + 1j*qComponent;
symbols = const(randi([1, length(const)], 1000, 1));

pulseFilter = rcosdesign(rolloff, span, sps, 'sqrt');
basebandSig = upfirdn(symbols, pulseFilter, sps);
basebandSig = exp(1j*2*pi*f0*[0:length(basebandSig)-1]'/sampleRate) .* basebandSig; % adding frequency offset f0 Hertz
basebandSig4 = basebandSig.^4;

% Fourth power estimate
fax = -sampleRate/2:sampleRate/nfft:sampleRate/2-1/nfft;
fftBasebandSig4 = fftshift(fft(basebandSig4));
[~, maxInd] = max(abs(fftBasebandSig4));
f0Hat = fax(maxInd)/4;

The problem is I don't fully understand what is happening. I understand for BPSK or QPSK how raising to the fourth power, all the points go to a single phase and then you can see the frequency offset but for the random constellation I generated, this doesn't happen.

To try and understand what is happening I plotted what happens to the signal when raising to the fourth power:

I see more points around (0, 0), but this also happens if I raise to the fifth power, as well as a peak at 5x the true frequency offset. What is special about the fourth power and do raising to other powers ever offer any benefit? (For a classic M-PSK constellation, you'd raise to the $M^{th}$ power)

Edit #3

In case of future readers, between the accepted answer and the paper, Blind estimation of frequency offset in the presence of unknown multipath, I was able to gain a better grasp of the "raising the oversampled signal to a power" method.


texts: How to find the coefficients of the following differential equation

texts:
An arbitrary signal $v(t)$ pass through the following system,

$w'(t) + 5 w(t) = v'''(t) + 320v''(t) + 40 v' (t) + 40v(t)$

How to determine the coefficients of the following differential equation, where the input signal is $w(t)$ and the output signal is $z(t)$,
So that the output $z(t) = v(t)$ (after long time when there is  no transient exist any longer)?

$z'''(t) + d_2 z''(t) + d_1 z'(t) + d_0 z(t) = e_3 w'''(t) + e_2 w''(t) + e_1 w'(t) + e_0 w(t)$


texts: What is the difference between Constant-Q Transform and Wavelet Transform and which is better

texts:
i have been seeking for a better Transform than STFT with high overleaping. The Transform should more suitble for the human auditory system.

And i learned that there are at least 3 Methods i may use like MFCC, CQT and CWT.
Just ignore MFCC and considering of CQT and CWT, i have red some paper and thesis, but can't really tell which is better. Some of the papers i red says that CWT is only special case of CQT, and CQT is better. Other says CQT is the special case of CWT. (like this question here :Difference between CQT and WT) Some Paper said that the CQT is not invertible because some samples never get analysed

So i'm now confused, what is the difference between CQT and CWT? Which is better if i need both time and spectral analyse? And if im seeking for a good transform for both speech and music analyse, which transform would be best for me?

And a stupid question: do these Transforms need overleap in order to get better result?


texts: What exactly does up triangle \land symbol mean in the context of peak detection?

texts:
Folks, I'm reading this paper: User Adaptive QRS Detection Based on One Target Clustering and Correlation Coefficient, and have a question about notation.

In describing peak-detection, they use the following notation:

I understand this to mean something like for j=0 to 2: S(i-j) should be greater than S(i-j-1), and S(i+j+1) should be greater than S(i+J), where S is the signal.

But what is that up arrow symbol called? Is it just a logical and? As in this must be true for each of the j?

Thanks!


texts:
I am new to Lanczos filters and trying to figure out how they can be used to generate a zero-phase lowpass filter with good time-domain properties.
This example shows how to implement such a filter in Python but does not give any justification for the choice of window length, despite it determining the filter order, which I would think a relatively important parameter. Also, I am not sure about its phase response.
Does anyone have insights about the uses of Lanczos filters in this sort of context, their pros and cons, and how to choose the window size objectively?


texts:
I'm trying to implement an sound card-based OFDM modem. A paper says:

  ...A serial to parallel converter is applied and the IFFT operation is
  performed on the parallel complex data.

Say I have a stream $S$ of complex numbers, then after serial-to-parallel (S/P) conversion, it becomes $S_1$ and $S_2$. But as far as I'm concerned, OFDM requires the sub-carriers to be orthogonal to each other. So can I just perform IFFT twice directly on the streams without defining the frequencies of sub-carriers? I'm quite puzzled. Any help on this will be greatly appreciated. Thanks.


texts: How to properly convert from dB back to amplitude

texts:
I am new to signal processing.

I have a signal that I want to convert to dB, process and then transform back.

My understanding of the transformation to dB scale is

$X_\mathrm{db} = 20 \cdot \mathrm{log}_{10}(|X|)$ and therefore $|X| = 10^{X_\mathrm{db} / 20}$

However, when calculating the reverse of my audio the sample sounds distorted. See reproducible example below

Can someone explain why this occurs?

import wget
import os
import librosa
import IPython.display

filepath = str(os.getcwd()+"/metallic-drums.wav")
wget.download("https://tinyurl.com/wx9amev", filepath)

MD, sr = librosa.load('metallic-drums.wav')

#Playing the orginal file
IPython.display.Audio(MD, rate = sr)

#Chaning to db
MD_db = librosa.amplitude_to_db(MD)
#Changing back to amp
MD_r = librosa.db_to_amplitude(MD_db)

#Play the result
IPython.display.Audio(MD_r, rate = sr)


texts: How to deal with low fundamental when using AMDF for pitch extraction?

texts:
I am using the Average Magnitude Difference Function to estimate the fundamental frequency of a quasi-periodic audio signal. The AMDF is defined as

$$ D_n = \frac{1}{N-n}\sum_{k=n}^{N-1}|S_k - S_{k-n}| $$

where $N$ is the length of the signal. This function exhibits a minimum when the signal is shifted by an amount equal to its period.

This is the code I am using to extract the pitch (in Matlab):

 a = amdf(f);
 a = a/max(a);
 [p l] = findpeaks(-a, 'minpeakprominence', 0.6);
 pitch = round(sample_freq/l(1);

However, I am dealing with an audio signal where the fundamental frequency is very low:

As a consequence, a pitch doubling problem arises: the detected minimum corresponds to half the period of the signal (i.e. the second harmonic):

I tried to extract the largest peak and not just the first, but sometimes this problem remains. How can I improve my code and/or the AMDF function in order to deal with low fundamental?


texts: Using the given identities, find the inverse DTFT

texts:
Using the given identities,

$$ a^nu[n] \Longleftrightarrow \frac{1}{(1-ae^{-jw})}$$
and
$$\delta[n-k]\Longleftrightarrow e^{-jwk}$$

Find the inverse DTFT of,

$$ H(e^{jw}) = B\cdot\frac{e^{-jw}}{(1-ae^{-jw})}$$

my attempt:

$$h[n] = B\cdot\delta[n-1]a^nu[n]$$

It seems straight forward enough, just plug in the inverse dtft. This is not correct though, there is no delta to be found in the correct solution.

The correct answer is:

$$h[n] = Ba^{n-1}u[n-1]$$

It's like the delta disappeared and the delta convolution property was used.

$$x[n]*\delta[n-1] = x[n-1]$$

But using the identities above, I do not want to use convolution. I am confused why the delta disappeared and the signals it was multiplied with became shifted, any help in understanding how to get the correct answer using the identities would be appreciated!


texts: Why does this not work: Alt. way to compute the period of a discrete periodic signal that is a sum of 2 complex exponentials

texts:
I want to compute the fundamental period of the following discrete time signal:

$ x[n]= \exp^{(j\frac{2\pi}{3})n} + \exp^{(j\frac{3\pi}{4})n}$

I know I can do this by taking the fundamental periods of the first term $\exp^{(j\frac{2\pi}{3})n}$, $N_1=3$ and of the second term $\exp^{(j\frac{3\pi}{4})n}$ $N_2=8$ and taking the least commmon multiple which gives $N=24$.

However I tried to express $x[n]$ as a single term as:

$ x[n]=\exp^{(j\frac{8.5\pi}{12})n} (\exp^{(j\frac{0.5\pi}{12})n}-\exp^{(j\frac{-0.5\pi}{12})n}) $

$ x[n]=2\exp^{(j\frac{8.5\pi}{12})n}.\cos(\frac{0.5 \pi n}{12}) $

Since the modulus of the complex exponential represents the magnitude of the signal, the fundamental period then equates to $N=48$ using only the cosine term. I tried this for varying frequencies and using this method I always got a the value for the period that was twice the correct value.

I know there is a flaw in my reasoning but could someone point that out ? And is there a reason why the fundamental period computed in this way always comes out to be twice that of the correct value ?


texts:
Notation:

$\mathcal F\left\{a\right\}$ denotes applying the discrete forward Fourier transform to the histogram $a$. Similarly for $\mathcal F^{-1}\left\{a\right\}$ and the discrete inverse Fourier transform.
Capitals represent the discrete fast Fourier transform of the lower-case counterpart, e.g. $A = \mathcal F\left\{a\right\}$.
The convolution of two histograms $f$ and $g$ is denoted $f\star g$.

Say I have histograms $a$ and $b$ with $a=[1,2,3]$ and $b=[4,5,6]$ (the heights) and the edges given by $e=[0,1,2,3]$. I.e. For the histogram $a$, there is one entry in the interval $[0,1)$, two entries in the interval $[1,2)$, and three entries in the interval $[2,3]$.

In order to perform a linear convolution as opposed to circular, $a$ must be padded such that len($a$) = len($a$) $+$ len($b$) $-1$. Similarly for $b$.

The convolution theorem states:
$$\mathcal F\left\{a\star b\right\} = \mathcal F\left\{a\right\} \cdot \mathcal F\left\{b\right\}$$

So if $c = a\star b$ and $d = \mathcal F^{-1}\left\{A\cdot B\right\}$, then $c = d$.

On performing the Fourier convolution of the $a$ and $b$ mentioned above,  I obtain a result if $d = [4,13,28,27,18]$.

My questions:

Where does $c$ sit in terms of bins?
Do I need to expand the bin edges, $e$, in some way?
In which direction should I expand them?
Should the extra bins have the same width as the originals (in this case, $1$)?

Intuition tells me that there should be an extra bin on either side of $e$, of the same width.

Furthermore, if I was to crop $c$ such that it has the same length as the unpadded kernel or the signal, where would I make the cut? Is this even possible?


texts: Phase relationship of cosine components in real signal using DFT

texts:
Background Info
I have a real signal comprised of 8 frequencies 400Hz-680Hz in 40Hz increments. The signal is generated from 8 cosines of equal amplitude (A=1) and phase (Phase= 0rad), summed together. This signal is fed through a transmitter to a receiver, and on the receiving end I wish to recover the frequencies and phases of each component. My transmit and receive sample rate is 48kHz. I have verified that I can recover the phase and frequency when I feed directly from the "generation" algorithm to the "processing" algorithm without passing through the tx->rx cycle. I am using FFTW3 in C++.
What's Working
I have a DFT on the receive-side which correctly identifies the 8 component frequencies with great reliability and accuracy. The FFT length is 1200.
What's not Working
When I try to derive the phase, (I'm using std::arg() in C++), the phases are all over the place, and I do not get what I expect.
What I've Tried
I understand that when I recover the signal at the receiver, I don't have a perfect starting sampling point as I do when I cut the tx->rx cycle out. I've tried "sliding" my DFT window along the signal to try finding the place where the 400Hz component's phase is 0rad as I expect, but even when I find "windows" where the phase for 400Hz is correct, the other phases are goofy and make no sense.
Example output from my receiver
--------------- ITER 23 ---------------
400Hz @ -0.582348 degs
440Hz @ -117.297 degs
480Hz @ 136.052 degs
520Hz @ 36.7404 degs
560Hz @ -59.7696 degs
600Hz @ -152.054 degs
640Hz @ 118.413 degs
680Hz @ 30.3169 degs

Updates
Edit 1
Dropping down to two tones gives a similar result, although a pattern emerges.
While moving the DFT window along the samples one-by-one, every 1200th iteration of this action shows the periodicity, and the phase is not off by much. This makes sense as every 1200 sample window should be identical over the whole signal sample.
<snipped>
--------------- ITER 3411 ---------------
400Hz @ 0.102598 degs
440Hz @ -5.95263 degs
--------------- ITER 4611 ---------------
400Hz @ -0.277188 degs
440Hz @ -6.18412 degs

--------------- ITER 5811 ---------------
400Hz @ -0.270323 degs
440Hz @ -6.75208 degs

My Question
How can I reliably recover the phase from this complex signal? Is there anything wrong with my approach? What would a better approach be if so? Any other inputs are appreciated.


texts:
I am trying to make sense of FFTs and binary data.

Say I have a series of random binary data, which is measured with a repetition rate of 400Hz (interval time of 0.0025s). I have a total of 12489 points, which corresponds to a total measurement time of about 31 seconds.

I would like to be able to learn more about what I would expect an FFT of this data to look like.

Some things I would like to understand the significance of:

What should be the average amplitude of the data, post-FFT?
what is the significance of the maximum amplitude of binary data that is not random, but consists of 1,0,1,0,1,0 data (12489 points). How can this help me find my y-scale?


texts: I want to implement a gradient operator on an image in Matlab. Should I have to pad the image before its implementation? How do I decide which padding to use e.g. whether to use zero-padding or Symmetric padding? How are they differ from each other? I am new to this field of image processing, Can you provide some references to learn this stuff?


texts:
I should take FFT of a very long vector of length 1,636,399,763 (i.e. length order is 10^9) preferably in MATLAB. However, on 128 GB RAM, my code throws Out of Memory error on line  part2Vec = repmat(part2Vec_OneRepetition, 1000, 1) from script below which  is attempting to build a vector of length 1,636,763,000 before even attempting to build totalVec which is of length 1,636,399,763 and take FFT which would be of length nFftLen = 2,147,483,648.
Any thoughts how do do this? For instance, can I take FFT in chunks and if yes, how I can do that?
%part1Vec = this is a "complex" column vector of length "1,636,763". Also, "complex" means each element is a complex number a+b*j.
%part2Vec_OneRepetition =  this is a complex column vector of length "1,636,763"
part2Vec = repmat(part2Vec_OneRepetition, 1000, 1); % This is a complex column vector of length "1,636,763,000".
totalVec = [part1Vec ; part2Vec]; % This is a complex column vector of length "1,638,399,763".
nLen = length(totalVec);% This is "1,638,399,763".
nFftLen = 2.^(nextpow2(nLen));
myFft = fftshift(fft(totalVec, nFftLen));


texts: Understanding LPC for Formant Estimation

texts:
I went through the Matlab tutorial on Formant Estimation using LPC Coefficients. Though I vaguely understand the details, it's not entirely clear why we need to do this. From http://person2.sol.lu.se/SidneyWood/praate/whatform.html:

  A formant is a concentration of acoustic energy around a particular frequency in the speech wave

Why is it not enough to take the DFT of the audio signal (after some pre-processing if necessary)? In the frequency-domain, the peaks correspond to these concentrations, correct?


texts:
I have a question. Why a chirp signal has the Fresnel ripples in slobes? I thought it has the equal amount of frequencies from lowerband to high band, so we should see the flat magnitude. Is that related to the chirp signal is the finite in time? I heard the complex chirp has the flat magnitude but what's the complex chirp?
I tried to reproduce a complex sinusod with the modulated frequency but anyway it has the ripples.


texts: Convolution a 3-D signal with 2-D signal

texts:
I have a 3D signal $M(x,y,t)$ and I want to do convolution with signal $G(x,y)$ and $Et(t)$,

I mean, how to calculate this Convolution below in Matlab?

$$A(x,y,t)=M(x,y,t) \star G(x,y) \star Et(t)$$

In my case, $M(x,y,t)$ is a movie with $k$ frame; $x,y$ are position in image and $t$ depend on frames number and frame rate.
$G(x,y)$ is a gaussian shape with $x,y$ and $Et(t)$ is a simple exponential in time.


texts: Perfect reconstruction: what properties must the analysis LPF satisfy

texts:
I have been reading on conjugate quadrature filters (CQF). The linked article explains that, if we have a lowpassfilter $h_0$, we can create a set of filters for a perfect reconstruction filterbank. The analysis highpass filter $h_1$ and synthesis low pass/highpass filters $f_0$ and $f_1$ can be generated as follows:

  \begin{align}
h_1(n)&=-\left(-1\right)^n h_0\left(L-1-n\right)\\
f_0(n)&=h_0\left(L-1-n\right)\\
f_1(n)&=-\left(-1\right)^n h_0(n)=-h_1\left(L-1-n\right).
\end{align}

This works excellent for a set of Smith-Barnwell coefficients. Yet it does not work for every lowpass filter that could be designed. For instance a Kaiser-Bessel windowed sinc-function with a cutoff at $\pi/2$ (as described in the article as well) does not lead to perfect reconstruction.

Are there any particular requirements on $h_0$/$H_0$ before this will work ?


texts: Time for a preamble (underwater acoustic communication)

texts: What is the maximum duration of a preamble for underwater acoustic communications? For example, can we have a preamble $>10 \textrm{ sec}$?


texts:
I am working on my own shift vector function that will be used later to compute the convolution of two signals. The function has to shift the vectors either left or right depending on the magnitude and direction of the shift value. My code is:

%This function shifts a vector either left or right

function sv = shiftvector(v, n) %Where v is the vector and
                                %n is the shift value
vnew = zeros(1,length(v));

for i = 1:length(v)-n

if n>0

vnew(i) = v(i+n);

elseif n<0

    vnew(i+1:end) = v(1:end-n);

end

end
sv = vnew;
end

The issue I have is, whenever I input a negative shift value, MATLAB gives an error. Need help!


texts:
Problem

A student is given an unknown DT system. Upon entering a test signal x_tst[n] = [-1, 1] into the system, an output y_tst[n] = [0,-1,-1,2] is observed. Determine the impulse response of the system.

note: bold digit - x[0] or y[0]

What I tried:

Something similar to this:

Choices
A.) h[n] = [0,-1,-2]

B.) h[n] = [0, 1,-2]

C.) h[n] = [0, 1, 2] -->correct answer

D.) h[n] = [0,-1, 2]

How do you solve these kind of problems?


texts: How to Map CWT to Synchrosqueezed wavelet transform?

texts:
I don't understand the mapping time-scale plane to the time-frequency plane in synchrosqueezed wavelet transform, i.e. $(3)$. You can find the paper here.

For the given signal of $x(t)$ and mother wavelet of $\psi$, the continous wavalet transform is:

$$W(u,s)= \int_{-\infty}^{+\infty}  x(t)\psi_{u,s}^*(t)dt\tag{1}\\$$

From $(1)$, a preliminary frequency $\omega (u, s)$ is obtained from the oscillatory behavior of $W (u, s)$ in $u$:

$$\omega(u, s) = − i\left(W(u, s)\right)^{−1} \frac{\partial }{\partial u} W(u, s)\tag{2}$$

$W(u,s)$ is then transformed from the time-scale plane $(1)$ to the time-frequency plane $(3)$. Each value of $W(u, s)$ is reassigned to $(u, \omega_{l} )$, where $\omega_{l}$ is the frequency that is the closest to the preliminary frequency of the original (discrete) point $\omega(u, s)$.

$$T(u, \omega_{l}) = \left(\Delta\omega\right)^{-1} \sum_{sk:|\omega(u, s_{k} )−\omega_{l}|\leq\Delta\omega/2}^{} {W(u, s_{k})s_{k}^{−3/2}\Delta s}\tag{3}$$


texts: Real time spectrum analyzer display problem

texts:
In real time spectrum analyzers, it is said that data is captured without any loss in time domain and user can see any event that happend in the captured time.

In case of high bandwidth and low frequency resolution, there are too many FFT bins to show on the screen.

How does real time spectrum analyzers handle this problem? Is setting a 30 FPS constant refresh rate a good way to solve this? What about the bins that are not shown?


texts: frequency spectrum of the conjugate of $x(t)$

texts:
Is the frequency spectrum of $x^*(t)$ the same as the one of $x(t)$.

I'm telling this because I found that $$X^\ast(f) = (X(-f))^\ast$$

So to find $X^\ast(f)$, intuitively i would just flip $X(f)$ because of the minus sign and reflip it because of the conjugate. Then flipping two times gives me the original spectrum.

Tell me if I'm doing something wrong.

Thank you very much.


texts:
I have a doubt about something. GMSK Modulated signal is equal to I+Q (with I = cos and Q = sin) or I+i.*Q ?

Thank you.

Best regards.


texts:
Could you please help me to answer this question ?

We have a Shannon formula for Capacity as
\begin{align}
   C=B\log_2(1+\frac{h*P}{B*N_0})
\end{align}
where h is a random variable which denotes the channel gain with channel mean power
\begin{align}
   \Omega=E[h]
\end{align}

When I do the simulation such as for Rayleigh fading. I have to set a value for $\Omega$. But I don't know if $\Omega > 1$ or it must be smaller than 1. I have read many papers from IEEE. Some of papers set value of $\Omega > 1$, some of them is smaller than 1.

Could you please explain for me?

1- When it is greater than 1 and when it is smaller than 1.

2- In practice, how the range of $\Omega$ is ?


texts: How to get Instantaneous Magnitude for a Instantaneous Frequency From FFT?

texts:
My understanding if a frequency in my signal doesn't line up exactly with a bin, it is smeared over a few bins to the right and left.

How can the instantaneous magnitude be determined? (do I have to worry about the windowing function?)


texts: Time Frequency Signal Analysis in Mathematica (MMA)

texts:
I want to know " Whether there is any Tool Box in Mathematica (MMA) for the Time-Frequency (TF) Signal Analysis".

I am well-versed in MMA Programming, so want to do TF Signal Analysis in MMA. I think if there is toolbox of TF Analysis, then it will be of very much great help in long programming.

Thanks in Advance!!!!


texts:
Have any of you done anything like QPSK Modulation in python? I am in the middle of it and having problems in setting up bits? like odd and even bits.

Have you got any idea?

Regards,

Sam


texts: Steganography - What techniques exist to hide an image in an audio file?

texts:
Can anyone mention me techniques to hide an image in an audio file ?

Thanks


texts: Is it possible to use a control scheme with a delay as prefilter?

texts:
I am studying control systems, and in my studies I have encountered the topic of control scheme of the form

and I have seen thaht this control scheme is really useful since it is possible to add a lag or lead compensator outside the closed loop, so it won't give stability problems.

At this point I was curious to know a little more and in particular I would like to know if it is possible to use a prefilter which  is a delay. In such a way it would be possible to avoid the problem of stability given by a system with delay.

So, to explain better, I would have for example:

$T(s)=e^{-s}\frac{C(s)P(s)}{1+C(s)P(s)}$

and so I could design a stable closed loop without delay, and then filter the reference with a delay, so use:

$C_r(s)=e^{-s}$

instead of using a closed loop with delay, which gives stability problems.

Do you think it would be a good idea?  Or it would be impossible or conceptually wrong?


texts: Choosing Codes or sequences with excellent Auto-Correlation properties

texts:
The Auto-Correlation function of Walsh-Hadamard codewords does not have a good characteristics.

It can have more than one peak and thus, the Walsh-Hadamard codes do not have the best spreading behavior or correlation property.

The cross-correlation function of the Walsh-Hadamard codewords can also be non-zero for a number of time shifts and unsynchronized users can interfere with each other.

My Questions:

Which other codes or sequences show :

A good auto-correlation attribute?
Good Cross-correlation Property ?


texts: How to draw the magnitude plot of a variable slope low/high pass shelving filter? (eg. as a function of cascaded shelving filters)

texts:
I am interested in making a magnitude graph of a variable slope low/high pass filter. I would like to set slope in dB/oct and a cutoff pitch. The y-axis should be amplitude from 0 to 1, and the x-axis should be frequency in Hz.

I have seen people construct very nice variable slope high/low pass filters, where a series of say 16 shelving filters are cascaded to create the desired effect. For example, in Reaktor: https://www.native-instruments.com/forum/threads/3-db-octave-lpf.323734/#post-1611335

These variable slope filters adjust the cutoff frequency of each individual filter to maintain an equally spaced interval between an arbitrary high point and the desired cutoff frequency. They will also evenly adjust the slope of each individual shelving filter to give the final dB/oct slope desired.

Here are the basic magnitude plots of low/high shelves, where c = cutoffFreq, z = zeroFreq, and where I got the equations:

https://www.desmos.com/calculator/ewvksxpd8v
https://db0nus869y26v.cloudfront.net/en/Equalization_(audio)

To graph a variable slope filter in the fashion I desire, I can just multiply ~16 of these variable slope equations in the same way, but I need to be able to figure out the parameters.

To elaborate, I know from the Reaktor variable slope filter project that the cutoff frequency per band in an array of shelving filters would be set from a global cutoffHz/cutoffPitch (where pitch means MIDI 1-135) knob as:

c[i] = cutoffHz * 2^((((135-cutoffPitch)/12) / numberBands) * i)

In an array of 16 bands, i = 0...15 and numberBands = 16.

But I am not sure how to get the z parameters per band to finish the graph. Any ideas for what the z formula might be in this case? Or any other suggestions?


texts: Cepstrum calculation with 5-smoothing zero padding

texts:
I am trying to compute cepstrum of a signal x

An implementation of this in python is:

x_fft = np.fft.fft(x)
cepstrum = np.real(np.fft.ifft(np.log(abs(x_fft))))
cepstrum = cepstrum[0:len(audio_signal_frame) // 2]  #
cepstrum_db = 10 * np.log10(cepstrum ** 2)

I wanted to zero pad x to hamming number length before the cepstrum calculation to make the fft more efficient, i.e.:

x_padded = zeros(fftpack.next_fast_len(len(x)))
x_padded[0:len(x)] = x
x_fft = np.fft.fft(x_padded)
...rest of the cepstrum calculation...

However I am worried that this will affect the ifft in unintended ways (besides changing the quefrency resolution by the padded amount)

Looking at the Interpolated Cepstrum Estimation section of this paper it seems that there is an additional step 6 where they pad the fft signal by power of 2. However I am not sure if this step is required or how to implement if padding isn't in powers of 2 since hamming number is not strictly K power of 2.


texts: How does Overlap-Add work for IIR filter?

texts:
So let's say I'm trying to implement something like an LPC vocoder. I analyse a speech signal by breaking it up in small chunks and determining their LPC coefficients, which are by design, the coefficients of an all-pole (IIR) filter.

So far, I understand that for an FIR filter, the impulse response is a finite M samples, so when performing an overlap-add (OLA) block convolution, each signal of length N is extended into a sequence of N+M-1 length, and for a naive implementation, we can overlap and add these M-1 samples in the tail, with the next chunk.

If I want to process a buffer of audio with the IIR filter coming from the LPC analysis, the IR should be infinite, so the only way I can think of using a block convolution is by convolving a delta with the IIR to get a long FIR and truncating it (which I think is terrible).

I also see pages like this that say to use the Block Recursion method, which seems to establish the IIR filter coefficients as columns of a matrix (states?), and that if it is causal the upper-right triangle of this matrix is filled with zeros. I don't understand how this works or why such a matrix is needed?


texts: FFT frequency-magnitude not correct when a positive gain EQ point is applied

texts:
I have a measurement system, which applies a log sine sweep as stimulus to a DUT and records the return signal.

I then extract the impulse response, and perform an FFT on this to examing phase and magnitude in the frequency domain of the device.
In this scenario, I have an audio interface connected to my computer, the output goes to an audio processor, where I have a single EQ filter, and the output back to my audio interface.

When I measure the device with no EQ inserted, I am given a flat response in both phase and magnitude.  If I give the EQ point negative gain, I see the filter as expected.  If I give the EQ positive gain, the phase looks correct, however the magnitude seems smeared over several bins.

Below is the measurement with the EQ point just above 1k.

Below is the same EQ point but boosted:

I have tried several measurements, including averaging across 3 measurements, and the result is the same, which leads me to think my methodology is incorrect.

I have the two audio signals. (one my original stimulus, and one the recorded return signal)
I get the impulse response by performing a forward FFT on each signal, then dividing the referenceFFT by the recordedFFT.  Finally I perform an inverse FFT to get back to the time domain, giving me my impulse.
To get the magnitudes, I window the impulse response, and then perform a forward FFT on this.  I then use:

$$\text{mag} = 20 \log_{10} \left(\sqrt{\Re^2 + \Im^2}\right)$$

for each complex result to give me my magnitude in dB.

Does anyone know why I cannot detect positive EQ correctly?  and if so, how I rectify this?


texts:
Inverse DFT is given as:
\begin{equation}
y_n=\sum_{k=0}^{N-1}Y_k e^{j\frac{2\pi nk}{N}}\tag{1}
\end{equation}
and knowing that Fourier transform of a real value signal has Hermitian symmetry property, i.e., $Y^*_k=Y_{N-k}$ with $\frac{N}{2}$ positive and $\frac{N}{2}$ negative frequencies, Eq. (1) can be rewritten in which of following ways:

Notation 1:
$$
y_n=\sum_{k=0}^{\frac{N}{2}-1}Y_k e^{j\frac{2\pi nk}{N}}+\sum_{k=0}^{\frac{N}{2}-1}Y_{N-k} e^{j\frac{2\pi n(N-k)}{N}}
$$
Notation 2:
$$
y_n=\sum_{k=0}^{\frac{N}{2}-1}Y_k e^{j\frac{2\pi nk}{N}}+\sum_{k=1}^{\frac{N}{2}}Y_{N-k} e^{j\frac{2\pi n(N-k)}{N}}
$$
Notation 3:
$$
y_n=\sum_{k=0}^{\frac{N}{2}-1}Y_k e^{j\frac{2\pi nk}{N}}+\sum_{k=\frac{N}{2}}^{N}Y_{N-k} e^{j\frac{2\pi n(N-k)}{N}}
$$


texts: Binary classification of grayscale image with little texture

texts:
I want to carry out a binary classification/segmentation on a grayscale image with very little texture. The only prior knowledge that's supposed to be available is that the object of interest is rather dark (i.e. low gray values) and comprises a significant portion of the image (maybe around 30%-70%). The object of interest should basically be a connected component (although this needn't be the case every single time), but can contain "blobs" of brighter clutter objects. Also, there might be patches of dark pixels in the clutter areas as well, but they should not be as homogeneous and as large as the object of interest.

Of course, I have already checked on simple thresholding (e.g. Otsu's method) or 2-means classification followed by some kind of in-painting, which both lead to similar results. However, these results are only satisfactory if the object of interest is very homogeneous and clearly separable from the clutter object's brighter gray value range. For rather heterogeneous sample images, there is often also clutter, which is put into the object class.

Therefore my question: Is there any interesting literature available about single-channel image classification without exploitation of texture features, but maybe incorporating spatial context? I have already done some research on google, but I have a hard time coming up with proper search terms...`

ADDITION:
Active Contours is very close tho the solution I am looking for. However, they generally work best for one distinct, convex, object, which is enclosed by background. In my situation, however, many convex objects are located in front of the background, so either one active contour for every foreground object is needed or a special case of active contours considering the background as object, being able to deal with clutter objects WITHIN the shape of the object, is needed. Any such method or literature available?


texts: How to Increase the Resolution of a Video from a Sequence of Photos?

texts: I have a video filmed in a relatively low quality and resolution and a sequence of photos of higher quality taken of the same scene at the rate of about one image every two seconds or so. Could those photos be used to filter the video sequence to upscale it without loss to the sharpness?


texts: Sampling $x(t)=\cos(4\pi t)+\cos(2\pi t)$

texts:
Imagine that we sample the signal $x(t)=\cos(4\pi t)+\cos(2\pi t)$ with a certain sample frequency $f_s$ and we obtain $x[n]$. Now, by ideal interpolation, we get $y(t)$ from $x[n]$.

How can we know the used sample frequency $f_s$ by looking at $y(t)?$

As a particular case, which $f_s$ verifies that $y(t)=2\cos(2\pi t)?$


texts:
What does SDMA's space mean?
I mean,T for TDMA is time,and unity of time is second. F for FDMA is frequency,and unity of frequency is Hz.Now i know the S for SDMA is space or spatial,but i don't actually understand what does this space mean?is it mean the area,so S's unity is $m^2$ ?


texts: How to derive the "well-known" solution to Unconstrained Array Gain?

texts:
Can someone point me to a webpage or other resource that shows how to analytically solve the beamformer Unconstrained Array Gain expression in Henry Cox's 1987 IEEE paper "Robust Adaptive Beamforming"?
$$ \max_{\mathbf{w}} \frac{|\mathbf{w}^H\mathbf{d}|^2}{\mathbf{w}^H\mathbf{Q}\mathbf{w}} $$
Cox says:

The well-known solution is $\mathbf{w} = \alpha\mathbf{Q}^{-1}\mathbf{d}$

I'd just like to better understand this by learning how to derive this myself.


texts: Any idea how can I optimize morlet wavelet parameters by Heisenberg uncertainty principal and Shannon entropy?

texts:
Based on a paper in here, they have proposed a method to optimize morlet function parameter. I have tried to implement their technique, but I can't get rational results. any idea?
In here you can see what they have done briefly:
Imagine you have a signal with following frequency and damping pairs :
$(f_i ,\zeta_i), (f_{i+1},\zeta_{i+1})$ and $f_i,f_{i+1} $ are two closely spaced frequency i.e. $1.01Hz,1,09 Hz$
now we define $f_{i,i+1}=\frac{f_i+f_{i+1}}{2}$ and $\Delta f_{i,i+1}=f_{i+1}-f_i$
based on Heisenberg uncertainty principle the $f_c\sqrt{f_b}$ must be in range of :
$2\alpha\frac{f_{i,i+1}}{2\pi\Delta f_{i,i+1}}\leqslant f_c\sqrt{f_b}\leqslant \frac{2\gamma}{\beta}Tf_i;[1_a] $
for another reason $f_c \geq  \frac{5}{2\pi};[1_b]$
which demonstrates that $f_c\sqrt{f_b}$should be chosen within an interval so that a compromise could
be made between frequency and time resolutions, Another consideration is that because $f_c\sqrt{f_b}$ is within an interval, there exist numerous pairs of $f_b$and $f_c$. Practically, it is necessary to introduce some other criteria to select optimum values of $f_b$ and $f_c$, the minimum Shannon entropy is used for criteria :
$E=-\sum_{i=1}^{M}d_i log(d_i)[2]$,  where $d_i$ is:   $d_i=\frac{|W(a_i,t)|}{\sum_{j=1}^{M}W(a_j,t)}$ $,M$ is number of scales
so we must minimize $E$ from equation[2] in range of [$1_a,1_b$].
I have used fmincon matlab function   to solve this non linear unequality constrain in matlab
1


texts: The impulse response of a LTI discrete system is $h[n]=\big(\frac{1}{3}\big)^n u[n]$. Find the response of this system to the input $x[n]= e^{jnπ/4}$

texts:
Hi I'm trying to solve the problem when studying for an upcoming test.
The given solution is
$1.2503 e^{jnπ/4 -0.2991}$, and is found by computing $H(Ω)$ and evaluating this at $Ω=π/4$.
when I try this I get $H(π/4)=(1/3)^8=0.000152$ and therefore the convolution is $0.000152e^{jnπ/4}$.
I'm not sure where I'm going wrong so any help would be appreciated so much!


texts:
Is there any existing application to sample someone's voice and use it to modulate any other voice or synthesize a text to resemble the original one?

For example, this Text-to-Speech Demo by AT&T lets you choose a voice and a language from presets that I guess are based on some human voice that have been sampled.

How do you call this process? Is it voice modulation? Voice synthesis?


texts: What is the purpose of a window function?

texts:
I've read that a window function is a mathematical function that is zero-valued outside of some chosen interval.

Can someone please explain what this really means?


texts: how can I make a simple lowpass filter with this constraints?

texts:
I'm searching for a simple low pass filter code in C with this constraints

a modulable frequency cutoff (how can I convert all these crazy coefficients into a frequency?) I could change with a slider.
a dB/Octave I can change in my code.
a resonance I can change in my code.

the graphical result will be a simple slider moving from 0-44Khz.
So far I've only managed to cut a bit of the high ends of my sounds by doing

int i = 0;
while (i < x.size - 1)
{
    y[i] = (x[i] + x[i+1]) / 2;
    i++;
}

where x is the input buffer (depends of the settings but it goes from 32 to 2048 samples) and y is the output buffer.


texts:
I am having some troubles understanding the algorithm.

My algorithm looks like this.

how come am i able to compute the DFT coefficient using this algoritm.
As far as i know
$$
X[k] = \sum_{i=0}^{N-1}x(n)W_N^k
$$

which using Goertzel is the same as $$X(k) = y_k(N) $$ and since $$y_k(n) = v_k(n) -W_n^kv_k(n-1)$$ and $$v_k(n) =2cos(\frac{2 \pi k}{N}v_k(n-1)-v_k(n-2)+x(n)$$ which means
$$X(k) = y_k(N) = v_k(N) -W_n^kv_k(N-1)$$ which isn't the same as $$X[k] = \sum_{i=0}^{N-1}x(n)W_N^k$$ ??

how come is Goertzel using $$|X(k)^2|$$ to compute the amplitude spectrum, where DFT uses $$|X(k)|$$ to compute the amplitude spectrum. ??


texts: generate a repeated square pulse train in python

texts:
Generate a pulse train with -2dBFS pulses of 20 sample duration every 8 seconds. I have referred here to generate a pulse train but not able to repeat it. How can I repeat this audio signal every 8 second and between aforementioned signal there has to be silence?

from scipy import signal
import matplotlib.pyplot as plt
import numpy as np

sampling_rate = 16000
time_seconds = 1
number_of_pulses = 20
pulse_frequency = 1/(time_seconds/(number_of_pulses/2))
t = np.linspace(0, time_seconds, sampling_rate, endpoint=False)
signal_dbfs = 0.8 #-1dBFS
plt.plot(t, signal.square(2 * np.pi * pulse_frequency * t) * signal_dbfs)
plt.ylim(-2, 2)
plt.show()


texts: Can't compute real cepstrum of real signal

texts:
I'm trying to compute the real cepstral coefficients of recorded telephone audio in Matlab using the rceps function.

On some audio frames (480 samples per frame -- 60ms of audio at 8kHz), I get a Matlab error:  "rceps:ZeroInFFT". The cepstrum does not exist because some of the DFT coefficients are 0. The frames in question are not zero, nor are any of the sample values complex. Going by the RMS of the frame, many of the frames that have errors have significant energy. About 10% of my frames give this error, so it seems like a bigger problem than a fluke.

I'm confused because this type of analysis is very common, especially for speech analysis, but I can't find record of anyone else having this problem.

Any advice would be greatly appreciated.

audio % is a 236000x1 vector of doubles containing PCM audio data at 8kHz
window_size = 3 %Working with multiples of 20-ms frames
errs = zeros(N_frames,1);
for i=0:N_frames-window_size
    %% Cepstral analysis
    s = audio((i*160+1):((i+window_size)*160)); %Grab 60ms of audio -- 480x1 matrix
    try
        c = rceps(s);
    catch err
        errs(i+1) = 1;
    end
end


texts: How we can encode/decode sparse signals?

texts: I have question and looking for help. Suppose we have a vector of real values (lat's say 64 length resulting from factorization 8*8 block image). We got a sparse representation of that vector (let's suppose that the sparse vector is 128 length with very few active elements, about 4 coefficients). I want to send this sparse vector through a channel, so I need bit stream of 1,0. Are there any efficient encoding/decoding technique for the sparse signals ?


texts: how is this filter an fir filter should not  it be an iir because of the y[n-1 ] term


texts:
I looked at an old thread, Nyquist Frequency Phase Shift, but was left wondering still about oversampling.

I learned Shannon 40 years ago, then worked 30 years in (s/w) engineering, but now retired I have only begun using/configuring complete digital audio setups. I find myself baffled by exactly the sort of hands-on question that was posed in the referenced thread. Yet most of the relatively simple (IMO) questions I've thrown at the search engines have landed on generic "Nyquist says" posts, and almost all graphs have been frequency domain.

Like the author of the referenced post, if I draw a simple sine wave and "sample" it with something just over twice its frequency, then vary the phasing of the sample points (or the wave) a few times, I end up with very different squarewave patterns. Especially for an illustratively short burst, it's impossible for me to deduce how even the most perfect linear-phase brickwall filter could regenerate the exact analog input (amplitude plus phase), which would be critical in preserving harmonic structure for any instrument. Certainly Nyquist had little to draw upon except filters as a physical 'decoder'.

It is very easy to picture that, for a tiny increment over 2*Fm, something very similar to the zero-output example given in the referenced post would be generated for a fairly long burst. It's equally hard to see how any procedure would regenerate a perfect image of the input burst, intermediate oversampling etc. notwithstanding, whereas for a much lower frequency (same Fs) it looks feasible.

Since available hw/sw has improved so radically since CDs and DAT first showed up, has anyone seen a genuine graphed experiment? Something like a 20khz pure tone riding on a (reasonably short) 2khz tone burst (or any such two-tone combination to give a gauge for zero phase shift), sampled at a rate just higher (say 5% e.g.) than twice the higher frequency. I would love to see the results, in time domain, input vs. output. I'd also love for them to be exact over multiple sample/decode tests. Then I could get over the feeling that not just oversampling but huge oversampling might be a good idea after all.

Or does insistence on a readable burst of short length throw such a monkey wrench into the spectrum being sampled that Fmax would in reality be way, way higher?


texts: Periodicity of transfer function of FIR filter proof (Parks and Burrus, Digital Filter Design)

texts:
In Digital Filter Design by Parks and Burrus, p. 19.

The transfer function of an FIR filter is given by the $\mathcal Z$-transform of $h(n)$ as:

$$H(z)=\sum_{n=0}^{N-1}h(n)z^{-n}$$

(where $h$ is the filter)

The frequency response of a filter is defined as

$$H(\omega)=\sum_{n=0}^{N-1} h(n)e^{-j\omega n}$$

where $\omega$ is frequency in $\textrm{rad/sec}$.

Then the text proceeds to show that $H(\omega)$ is periodic with period $2\pi$:

\begin{align}
H(\omega + 2 \pi)&= \sum_{n=0}^{N-1} h(n) e^{-j(\omega+2\pi)n}\\
&= \sum_{n=0}^{N-1} h(n) e^{- j \omega n} \color{red}{e^{-j2\pi n}}\\
&=H(\omega)
\end{align}
Could someone clarify how is that equal to $H(\omega)$ when there's the extra term $\color{red}{e^{-j2 \pi n}}$?


texts:
I am doing a simple $P_{in}$ - $P_{out}$ linearity test for my RF generator/receiver system. The generator provides an IQ modulated CW single tone with $P = - 80dBm$ at 1 GHz.

If we look at the RF front end of the detector;

We see that RF input is first shifted to IF band (diagram), then adjusted to cover ADC full range and filtered before ADC.
ADC has $f_{sample} = 250\,\text{MHz}$. Also, the device allows $f_{sample}$ down to 10 kHz.

When I check out the PSD window in FFT Analyzer, I observe the presence of the transmitted signal and that's fine.

What I also observe is the noise floor roll-off on both ends of the PSD figure.(below) For several sampling frequencies up to 100 MHz, the onset is at  ~ 80% $f_s/2$. Then, for the range covered at $f_s = 250 MHz$,  we observe that the flatness is severely degraded.

What is this phenomenon? Can you explain the mechanism behind it ?


texts:
My wife is trying her hand at making audio books and spends a lot of time cleaning up some voice actors breaths in their "finished" audio. We have tried some filters in Adobe Audition and it helps but not completely.

This is what I need help with specifically: I would like to make a python (it's the only language I'm comfortable with) program that will look through an audio file and remove all the breaths and replace them with just background room noise. I've never done anything in the audio field and I'm completely overwhelmed by all the different packages and concepts. Could someone please point me in the right direction?


texts: CTFT to DTFT why can't you always just substitute $\Omega = \omega/T_S$

texts:
This is something I've always wondered about in DSP class, but just accept as a fact because I never really fully understand why this is the case:

Given CTFT:

$$X_s(j\Omega) = 6000 \pi \sum \limits_{k=-\infty}^{\infty} \Bigg[ \delta(\Omega - 1200\pi k - 4000 \pi)
 ~+~  \delta(\Omega - 1200\pi k + 4000 \pi)\Bigg]$$

Then converting to DTFT using formula:

$$X(e^{j\omega})=\frac{1}{T_s} X_s\bigg(\frac{\omega}{T_s}\bigg)$$

But, Why is answer this:

$$X(e^{j\omega}) = 6000 \pi \sum \limits_{k=-\infty}^{\infty} \Bigg[ \delta(\omega + T_s(-1200\pi k - 4000 \pi))
 ~+~  \delta(\omega +T_s(- 1200\pi k + 4000 \pi))\Bigg]$$

instead of this:

$$X(e^{j\omega}) = 6000 \pi \sum \limits_{k=-\infty}^{\infty} \Bigg[ \delta(\frac{\omega}{T_s} - 1200\pi k - 4000 \pi)
 ~+~  \delta(\frac{\omega}{T_s} - 1200\pi k + 4000 \pi)\Bigg]$$

seems like this formula: $$X(e^{j\omega}) = \frac{1}{T_s} X_s\bigg( \frac{\omega}{T_s}\bigg)$$ should really be:  $$X(e^{j\omega}) = \frac{1}{T_s} X_s\bigg( \omega = \Omega T_s\bigg)$$


texts: Extract the count of particular macro block types(I, P and S) from the frames in the video

texts:
How can I extract the count of particular macro block types(I, P and S) from the frames in the video (H.264 and MP4)?
Also, I would like to extract the prediction residual of each of the P and B frames (computed from its corresponding reference frame) in the video from the encoded version itself while the package is decoding it.


texts: Understanding the Probability Distribution of Intensity Values

texts:
From "Digital Image Processing 4th ed. - Gonzalez, Woods"

  Let $p_r(r)$ and $p_s(s)$ denote the PDFs of intensity values $r$ and $s$ in two different images. A fundamental result from probability theory is that if $p_r(r)$ and $T(r)$ are known, and $T(r)$ is continuous and differentiable over the range of values of interest, then the PDF of the transformed (mapped) variable $s$ can be obtained as:
  $$(1)\ \ p_s(s)\triangleq p_r(r)\left|\frac{dr}{ds}\right|$$

I should specify that $T(r)$ indicates a single-pixel intensity transformation. Now, I understand what the two PDFs indicate, but I fail to understand:

The derivation of (1)
The utility of (1)

EDIT: I found that $(1)$ is basically the change of variable formula for probability density functions, which holds when $T(r)$ is monotonic.


texts:
I'm trying to write a C program that can get the PSD of an recorded audio file, I'm using for the fftw3 library. I wrote a program that calculate the PSD so far only for sinus function, but the result is correct, my problem is that I have some trouble to use the windowing method on my data.

Let's say that the audio file has following properties :

fs = 44100;
length = 10sec;

So I got 441000samples, and I want to use windows, doesn't matter which one, with the size of 512, 25% overlapping, and shift my windows for the data. How could I know which value of the result is representing which frequency?

In Matlab it was easy here what I've done for example  :

  [x,fs] = audioread('fileName.wav');
  [xPSD,f] = pwelch(x,hanning(8192),4096,8192*4 ,fs);

Thanks for any help or explanation!


texts: How to calculate sweep time of FMCW radar?

texts: I am designing a FMCW radar with center frequency 24GHz and sweep bandwidth of 150 MHz. How do I decide on the sweep time of the FMCW radar?


texts: Parameter selection for log distance path loss model

texts:
I am currently referring to the following book MIMO-OFDM Wireless Communications with Matlab in which the log distance path loss model is given by the equation:

$P_{LD}(d)[dB] = PL_F(d_0) + 10nlog(d/d_0)$

where $d_0$ is a reference distance and $PL_F(d_0)$ is given by $20log(4\pi d_0/\lambda)$.

For a system operating at 2.4GHz carrier frequency, should I consider $\lambda$ as $3e8/2.4e9$? How should I decide upon the path loss exponent $n$ and what reference distance $d_0$ should I consider?

The environment I am trying to simulate is the cabin of an aircraft. So, I need to vary $d$ between $1m$ to $50m$ but I am unsure of $d_0$ and $n$.


texts: Filtering with filters without even or odd symmetry in the fourier domain

texts:
I am doing a project where I have to use the fourier domain for convolution. I have been reading Digital Image processing by Rafael Gonzalez but I unsure about one thing, and I could not find anything in the book or online to answer my questions

The book states, in order to preserve a filter's odd symmetry you would place the filter in the center of a padded array before doing the fourier transform. If for example a filter is of size 4x4, which has a center defined at (1,1) which does not exhibit any symmetry (or can't in this manner), and I have an image of size 31x31, so the Padded Array size would be 34x34 for the image and filter.  Do I still need to place the filter in the center of the padded array before doing the fourier transform to get the same results as convolving in the spatial domain?

In addition to, do I need to place the image in the center of the padded array, or is the padding there just to get rid of any wrap around error?

Thanks


texts: LPF in the stage of IQ demodulator is it a analgor filter or digital filter?

texts:
I recently designed the LPF of the IQ demodulator using the Butterworth LPF refering to https://dspillustrations.com/pages/posts/misc/baseband-up-and-downconversion-and-iq-modulation.html. But I have a question. If you look at the block in the picture below, you can see the baseband block after passing the A/D Conversion. I think I applied IIR digital filter, but the composition of the picture below shows that LPF is analog domain. So I'm suddenly very curious. Is this LPF analog filter or a digital filter?

I designed Lowpass filter corresponding to LP block using Butterworth IIR filter design method in the IQ demodulator block diagram above. I first calculated analog butterworth filter coefficient, and then I calculated IIR filter coefficient b,a of z-domain using the bilinear transform. And with this, we calculated the waveform through the lpf using the filter(b,a,x) function of the matlab. So, we got the spectrum for Inphase and Quadrature phase as below. But in this process, I have a question. Obviously, I designed a digital filter of z-domain, and I wonder why digital filter exists in analog domain because it is before ADC in block diagram.


texts: Finding maxima and minima of a continuous time signal by using frequency method?

texts: I have a PPG signal and I wanted to write a code that gives the maxima and minima value of signal by using frequency domain method. Any suggestions?


texts: Basic FIR Filtering with audio buffer in C++

texts:
I am willing to implement a basic FIR filter using C++ and JUCE.

I wrote this simple algorithm using the information I found in the DSPGuide, but I only seem to get a variation in volume for all the frequencies, instead of a frequency filtering.

How can I correct it to effectively apply frequency filtering ?

if (channel == 0) {

    float result = 0; // initialisation to 0 of the result

    for (int sample = 0; sample < buffer.getNumSamples(); sample++) { // for each sample

        // moving the samples in the delay line
        for (int i = 0; i < 8; i++) { // delayLine being 9 values long
            delayLine[i + 1] = delayLine[i];
        }
        delayLine[0] = reader[sample];

        result = 0;
        for (int i = 0; i < 9; i++) { // for each tap
            result = result + delayLine[i] * filterTaps[i]; // multiply
        }
        writeback[sample] = result; // output
    }
}

Here are the coefficients used, which are supposed to produce a Low-Pass Filter in the audible range :

filterTaps[0] = 0.002385;
    filterTaps[1] = 0.011910;
    filterTaps[2] = 0.026352;
    filterTaps[3] = 0.039825;
    filterTaps[4] = 0.045351;
    filterTaps[5] = 0.039825;
    filterTaps[6] = 0.026352;
    filterTaps[7] = 0.011910;
    filterTaps[8] = 0.002385;

I have generated them using this website http://www.arc.id.au/FilterDesign.html
Can't remember the cut-off I chose, but it was between 1000 and 5000 kHz with a 44100 Hz sampling rate. These coefficients are just an example, as my initial goal was to make an anti-aliasing filter. Since the filter was not working properly, probably because of the algorithm, I chose another set of coefficients in the audible range to ease the debug process).

Thank you.


texts: Confused in Bit rate, Symbol rate, Sample rate and Data rate

texts:
I'm using GMSK modulation to send $300 \ \rm bits$ and assuming $1 \ \rm bit/symbol$. $BT$ product is $0.5$. Sampling frequency is $100\ \rm kHz$ and bandwidth of the signal is $28 \ \rm kHz$.

(a) Is bit rate calculated as $BT/B = 0.5/28\rm k$ ?
(b) Here, symbol rate = bit rate ?
(c) The sample rate of input will be equal sampling frequency i.e. $100\ \rm kHz$?
(d) How can I calculate data rate ?


texts: Statistics to characterize time-domain envelope of acoustic signal

texts: I am interested in comparing 0.5-second 44100/s signals when different ADSR envelopes are applied to them.  However, I don't want the comparison to be as fine-grained as simply calculating a 5000-dimensional envelope - ideally I'd like a <100 dimension vector that told me everything I needed to know about change in amplitude over time, and which was not influenced by the actual frequency. What are some 1-10 dimension statistics that could capture meaningful information about how the dynamics are changing over time?


texts: What is the relationship between image spatial domain and FFT powerspectrum?

texts: I am trying to perform contrast-transfer-function for pictures which were recorded in defocus. To do so, I have to calculate the contrast-transfer function from the Thon rings and fit the function to 1D radial average of the spectrum. Let's say that I have a picture in spatial domain where single pixel is 1.7 Angstrom size, which gives me a Nyquist Limit of resolution 2*1.7 A. So I know, that the resolution limit in my powerspectrum will be 1 / 2*1.7A. How can I connect the radial average from powerspectrum with the resolution? That is the relation of each pixel in the spectrum to resolution? I would be very grateful for some hints! Thanks!


texts: Estimating optimum sampling point for 16-QAM in MATLAB

texts:
I need to write a MATLAB function to estimate the best initial sampling point for demodulation of a 16-QAM.

I can do it by looking at the eye diagram, the point which at which the eye is "open", but can this be done in MATLAB?


texts: Chromatogram peak detection - bunching vs others?

texts:
Reading presentations from existing tool providers I noticed that in order to detect peaks they first use bunching (average N points) and then use slope and curvature to detect peaks. I'm guessing they use bunching to get rid of high-frequency noise.

Aren't there better alternatives like removing high frequencies with FT? I'm concerned that bunching requires peak width to be known to define Bunching Factor. Which means we first need to detect peak width in some other way before using curvature. But I've seen more than 1 presentation talking about bunching, so there have to be reasons to use this approach instead of others.


texts: What are some really accurate ways to get the value of a peak (local maximum) given some points around it? (To be used for autocorrelation peaks.)

texts:
I have looked everywhere on the internet for this and, surprisingly, haven't found much useful information.
Given 3 or more points closest to a peak (local maximum) what are some of the most accurate techniques I can use to obtain the value of the peak. In fact, I would like the x axis coordinate of that peak to determine the exact peak locations of the autocorrelation function of a discrete signal.
The best I have been able to do is quadratic interpolation which fits a parabola between three points and finds the maximum as follows:
\begin{equation}
x = \frac{1}{2} \frac{\alpha - \gamma}{\alpha - 2\beta + \gamma}
\end{equation}
Equation obtained here.
I tried cubic interpolation but either I'm doing it wrong or it's just not more accurate than the quadratic interpolation.
Anyway, can I not get better accuracy than quadratic interpolation? I would appreciate even just the names of algorithms or links to resources I can look at. (PS: I have way more than just three points close to the true peak).
Edit:
I'm not sure about the exact model of the peak, but it's one obtained when you do the autocorrelation of a sinusoid. To be more specific, I would like to use autocorrelation to determine, as accurately as possible, the exact fundamental frequency of an electrical grid.


texts: Convolution of one signal with an evenly spaced signal

texts:
I do not specialize in signal processing so I wonder if there is any references to the following procedure.

Let $[n]=\{0,1,\ldots,n\}$.

Consider the function $f:[n] \to \mathbb{R}$ and $g:[kr] \to \mathbb{R}$, such that $\operatorname{supp} g = \{0,r,2r,3r,\ldots,kr\}$. Assume for simplicity, $n/r$ is a integer.

We are interested in computing the linear convolution $f*g$.

If $r$ is large, one way to do the computation is partition $f$ into $r$ functions $f_0,\ldots,f_{r-1}$, such that $f_i(t) = f(tr+i)$, and $f_i:[n/r]\to \mathbb{R}$.

We also define $\bar{g}:[k]\to \mathbb{R}$ as $\bar{g}(t) = g(rt)$.

Find $f_i*\bar{g}$ to each $i$, then we can read off $(f*g)(tr+i) = (f_i*\bar{g})(t)$.

This make sure we apply $r$ convolutions on sequence of length $n/r$ and $k$. Instead of $1$ convolution on sequence of length $n$ and $kr$.


texts: Find Short Clip of Audio Within Longer Clip Of Audio

texts:
I need help figuring out a way to automatically synchronize two audio files that are both different recordings of the same source. More info below.

This example is from a concert, where there is only one audio source - the band.

In the first track of the image below, we have three minutes of audio
recorded from the soundboard of the concert venue. This contains a
crystal clear recording of the band's performance.
In the second track of the image below, we have roughly a minute and
a quarter of audio recorded using an iPhone in the crowd. This audio
still sounds ok, but is not great by any means. Still, it's very
useable.

Since both of these recordings were taken at roughly the same time of the same performance, the audio in track two synchronizes somewhere with the audio in track 1.

The image below shows where these two snippets of audio synchronize - about the 3 second mark.

I know that it's pretty easy to synchronize these two audio files up by hand and by ear, but I need to develop a script that synchronizes the two snippets automatically.

The Spectrogram and Spectrogram Log match up pretty well. I'm not sure if I can work with that or not.

Here is the spectrogram comparison:

Along with the spectrogram log comparison:

I've looked into Cross-Correlation of Waveforms using this video, FFT stuff, and other libraries. I'm lost and any help for my college project would be much appreciated!


texts: Buffering block and filter length in real-time processing

texts:
I have a signal sampled at 256 Hz, which I want to filter with a 50 taps long FIR filter in real time.
Would it be a problem, if my data block size is only 32 samples?
And should I then concatenate 3 blocks, convolve them with the filter and output only the middle part (to avoid discontinuities)?

And more general questions: were can I read more about all real-time aspects of time-series filtering? In particular about block processing?

Many thanks for help.


texts:
Is it possible to make 3D point cloud with RADAR? Both LIDAR and RADAR are EM waves, but with different wavelength. So, if it is technically possible to make point clouds with LIDAR, why is it not possible to do the same with a RADAR?

Is it because, the RADAR cannot have narrow beams like LIDAR? Or the problem is more related to the antenna? Also, why isnt doppler effect experienced on LIDARs?

In short, the question is how are RADAR and LIDAR technically different with respect to sensors?


texts:
We have a signal $s(t)$.

If we do an upsampling, does the signal duration increase?
What is the point of upsampling if the signal time increases?
Can we do an upsampling if we don't use a shaping filter?


texts: Chop out frequencies outside human hearing range

texts:
I have a bunch of audio files all sampled at 44100 Hz sample frequency. I am trying to remove all the frequencies which are outside the human hearing range (I use the following as reference: Frequency Range of Human Hearing, as well as robert.b's answer for determining the frequency value of a given bin: How to get Frequency from FFT result), and my basic approach is:

Perform an FFT on the files
Convert all frequency bin indices to actual frequencies
Remove those which are outside the range (i.e. below 20 and above 20,000 Hz)

Would that be a valid approach, and would it be possible to "put back" my signals to a state (using the inverse FFT) where I can play them and check if they still sound "normal"?


texts: How do I warp a 1 dimensional signal in frequency domain?

texts:
I want to implement VTLN (Vocal Tract Length Normalization).

It is equivalent to warping the signal in the frequency domain according to the following graph.

I can't wrap my head around how one implements such a transformation.

Suppose y = fft(x).

What should be y2 = f(y)?

What do I do after getting the warped frequency?

suppose x = [1, 2, 3, 4, 5]

y = f(X) = [ 10, 20, 30, 40, 50]

x_warped = [ 1, 1, 2, 4, 5].

What should y_warped[] be?

Do we delete some values and repeat some values in the y sequence?

is y_warped = [10, 10, 20, 40, 50]?

Image taken from

Pitz, Michael et al. “Vocal tract normalization equals linear transformation in cepstral space.” IEEE Transactions on Speech and Audio Processing 13 (2001): 930-944.


texts:
I have some questions regarding some concepts used in designing the OFDM transmitter which i got from different literature reviews but i got mixed up with these concepts.

•   The N-Ifft points and number of subcarriers are not same all the time. Why we introduce unmodulated or zero padded subcarrier between the modulated or useful subcarrier.

•   Should the training sequence be added before ifft operation or after ifft+cp inclusion operation? If both can be possible then what is the best approach between these two.

•   For the DAC conversion, raised cosine pulse shaping filters are considered to be the best among other shaping filters. What should be its roll off factors, No. of symbols and No of samples in each symbol (for OFDM). How much should be an oversampling factor for upsampling process.

•   Is Low Pass Filter should be used at the transmitter side too what is the purpose of using it at the transmitter side ?

I hope to get a prompt reply.

Thanks


texts:
I have a problem with the end of my code. I would like to display the last two curves, the problem is that at the beginning the size of YY is 288 and then after the equality with diff, my size goes to 238. So when I display the curves I have exactly the same thing, which is normal. But I wish I could show the curve for a size of 288 and I do not understand why YY changed size after the tie ...

Here is the code:

options = pd.read_csv("/Users/***/Documents/***",sep =',',header = 0)

n=prices.settle_sp_price.size
x=np.arange(0,n)

p1 =sp.polyfit(x, prices.settle_sp_price,3)
pp1 =np.polyval(p1, x)

diff = prices.settle_sp_price-pp1

Y=np.zeros(prices.settle_sp_price.size)

for i in range(1,prices.settle_sp_price.size):
 if Y[i] > .1*Y[i]:
  Y[i] = 0

Y=np.fft.fft(diff)
PP=np.fft.ifft(Y)
YY=[0]*(prices.settle_sp_price.size+50)
a=[0]*prices.settle_sp_price.size
b=[0]*prices.settle_sp_price.size

print('aa')
print(len(YY))
#=288

#interpolate the difference for 90days
for n in range(prices.settle_sp_price.size,prices.settle_sp_price.size+30):
    YY[n]=0
    for k in range(1,prices.settle_sp_price.size):
     a[k]=np.real(Y[k])
     b[k]=-np.imag(Y[k])
     omk=2*math.pi*(k-1)/prices.settle_sp_price.size
     YY[n]=YY[n]+a[k]*math.cos(omk*(n-1))+b[k]*math.sin(omk*(n-1))

    YY[n]=-YY[n]/prices.settle_sp_price.size

print('bb')
print(len(YY))
#=288

YY = [c for c in diff]
print('cc')
print(len(YY))
#=238

plt.figure()

plt.plot(x,prices.settle_sp_price,'b');
plt.plot(x,tot,'r')
plt.hold()

plt.xlabel('time(days)')
plt.ylabel(' price')
plt.title('Stock price. Actual vs. theoretical 505 days')


texts:
I have just a quick question about how to calculate Deltas from MFCC. I have found the formula for calculating deltas here:

$$d_t=\frac{\sum_{n=1}^{N}n\left(c_{t+n}-c_{t-n}\right)}{2\sum_{n=1}^{N}n^2}$$

Another source states it is a regression equation. From what I can see, it takes coefficient from a previous and next frame. For any $N$ e.g. $N=2$, $t-n$ in $c_{t-n}$ can refer to the past where there are no frames. Which values should I substitute in this case? Should it be simply 0?

Similarly, when $t+n$ in $c_{t+n}$ refers to a frame in future that not exists, should it also be 0?

Thanks


texts: Unexpected peaks in power density following downsampling and filtering

texts:
I first applied a 100 Hz lowpass filter to my data, which was recorded at 30000 Hz:

import numpy as np
from scipy import signal as ss
from scipy.signal import butter, lfilter, freqz
import matplotlib.pyplot as plt

def butter_lowpass(low_cutoff, fs, order=5):
    nyq = 0.5 * fs
    normal_low_cutoff = low_cutoff / nyq
    b_low, a_low = butter(order, normal_low_cutoff, btype='lowpass', analog=False)
    return b_low, a_low

def butter_lowpass_filter(data, low_cutoff, fs, order=5):
    b_low, a_low = butter_lowpass(low_cutoff, fs, order=order)
    y_low = ss.lfilter(b_low, a_low, data)
    return y_low

# Filter requirements.
order = 5
fs = 30000      # sample rate, Hz
low_cutoff = 100 # desired cutoff frequency of the filter, Hz

print('Filtering data')
filtered_array = butter_lowpass_filter(array, low_cutoff, fs, order)

Then I down sampled my data from 30000 Hz to 250 Hz

updated_array=ss.decimate(filtered_array, 12, ftype = 'fir')
newarray = ss.decimate(updated_array,10, ftype = 'fir')

And then apply the decimated result to a spectrogram:

frequencies, time, Sxx = ss.spectrogram(newarray,sampling_rate, ss.get_window('hamming', bin_size), noverlap=0, nfft=sampling_rate*4)

However, the resulted plot showed some signal higher than 100Hz even though I already used a lowpass 100Hz filter earlier.

For reference, this is the plot if the filter was not sed before decimation:

Is there any explanation for this?

Thanks a lot!


texts: calculate or decompose a Fourier transform signal amplitudes with unknown weights on sources

texts:
migrated from math-se...
I am trying to calculate , or approximate the solution of following Fourier-sine transform problem that can be expressed as a contributions of periodic sources $f_i(x)$ and  weights $a_i(x)$   :
$$F(k) =   \int_{0}^\infty  dx \space{}   \space{}  \sin(2\pi  k x) \sum_{i=1}^N a_i(x) f_i(x)  $$
Where $a_i(x)$ are known and have an analytical monotonous form  ($\sim  b_i x^{-c_i }$), and the numerical sum of all the individual sources $f_{tot}(x)=\sum_i f_i(x)$ is also known, but not the individual $f_i(x)$. The individual $f_i$ are unknown periodic functions (can be sums of sines, e.g. $f_1=sin(1.4x)+sin(4.9x)+...$ etc), so their expected transform should be peaks around their frequencies.  All functions are real-valued and smooth.
I have tried to make the following approximation:
$$F(k) \sim   \int_{0}^\infty  dx \space{}  f_{tot}(x) \space{}   \sin(2\pi  k x) \sum_{i=1}^N a_i(x)   $$
and got that the peak positions in $F(k)$ are obtained but their relative amplitudes are not accurate as expected because each source $f_i(x)$ is not scaled properly by its corresponding $a_i(x)$.
Is there a way to further use the information I presented in order to capture or deconvolve the amplitudes as well as the peak positions? Will having $N$ be a relatively small integer, so the number of $f_i(x)$ and the frequency peaks will be relatively low (sparse) be helpful? or is there a general approach like svd or other matrix decompositions that can help here, and I just dont see how to use it?


texts: How to estimate radial distortion from lens characteristics?

texts:
Is there a way to estimate the radial distortion coefficients without calibration, given the lens characteristics, such as its diameter and its focal length?

Typically for camera calibration a pinhole camera model is used, and then radial distortion is added on top of that. Radial distortion is a 4th or 6th degree polynomial with 2 or 3 coefficients. During calibration, these coefficients are not derived from anything. They are initially assumed to be 0, and then estimated from data using numeric optimization.

What I am asking is whether or not there is an equation relating lens characteristics that you can read off the manufacturer's spec (focal length, aperture, field of view) to the radial distortion coefficients from the typical polynomial distortion model? In other words, is it possible to get some approximation of the distortion coefficients from the camera spec, before doing the calibration.


texts: Non-linearly additive spectral subtraction?

texts: The following pictures describe my situation. Any thoughts on an appropriate algorithm I could use to solve this problem?


texts:
Recently, i have read image classification papers for a literature review. During the review, i have found "global information" and "local information" mentioned in many papers assuming they are well understood.

I have a vague understanding of the two words.

I would be so much thankful if anyone could give explanation with some examples.


texts: SNR computation in frequency domain with scipy.fftpack.fft

texts:
I have a noisy time series (gaussian coloured noise) to which I add a signal. I call the sum of noise+signal a segment. In the picture you can see an instance:

I want to compute the signal-to-noise ratio (NOT the logarithmic version) of the injected signal in the frequency domain using python's scipy.fftpack.fft module. So I wrote the following script.

def snr_inj_f(segment, noise, f_samp, f_max=2048):

    N = len(segment)        # number of points in time series
    T = 1.0 / f_samp        # sample spacing
    x_f = fftfreq(N, T)
    frequencies = x_f[0:N//2]     # only positive frequencies
    h = segment-noise       # signal, obtained removing noise from segment

    segment_f = scipy.fftpack.fft(segment)[0:N//2]   # segment fft only positive f
    noise_f = scipy.fftpack.fft(noise)[0:N//2]       # noise fft
    h_f = scipy.fftpack.fft(h)[0:N//2]               # signal fft

    h_f =  h_f[where(frequencies<=f_max)]            # if an upper cut on frequency is desired
    noise_f = noise_f[where(frequencies<=f_max)]
    Norm = shape(where(frequencies<=f_max))[1]

    snr_sq = np.sum(abs(h_f)**2/abs(noise_f)**2)     # SNR^2 as sum of ratio of squared fft coeff.
    snr_f = sqrt(snr_sq)

    return snr_f

However, I have doubts of doing things correctly. Since the number of samples N and the sampling frequency is the same, is it right to just basically sum over all the ratios of the psd bins? I am assuming that the $PSD$ is represented by the coefficients of the projection of a discrete time series $x_n(t)$, $\tilde x_k$, in the form: $PSD = \frac{1}{T} *|\frac{\tilde x_k}{f_{samp}}|^2$, where $\tilde x_k$ are the fast Fourier transform coefficients, not normalized. Since the duration of the time series $T$ and the sampling frequency $f_samp$ are the same for signal and noise, is it correct? Or am I missing a factor due to to the fact that I am only taking positive frequencies?

Furthermore:
1) Will whitening using, say, 300 previous seconds containing only noise, improve the SNR?
2) How should these SNR in frequency computation differ from the one in time domain? (Basically taking ratio of sum  of squares of signal and noise samples)


texts:
This question might not be exactly suitable to the question format of StackExchange but I couldn't find a better way to put it forward.

Lately, I have been dealing with ECG Signal processing and due to the characteristic of this specific channel, there is some multiplicative noise correlated with the ECG signal.

I am having difficulties to model this type of noise which depends on the input itself and has the same frequency with it. My question may sound very vague but I am looking for some tips to conduct further research because I am also not very experienced in the mathematical modeling of such systems.


texts: Meaning of lines on x- and y-axis of a centered FFT-spectrum of an image

texts:
I am currently learning about the Fourier transform of digital images, but I am wondering about one aspect.
In most visualisations of fourier transforms of images, a horizontal and a vertical line in the middle seem to be rather dense compared to the rest of the image. Below is an image of two pattern which, from my understanding, should only have three entries in the fourier spectrum each.

That there are more than three lines should be due to the fact that there are horizontal and vertical sinusoidal waves of most frequencies used to represent the original image.
These two lines in the FFT-spectrum seem to appear in most images, not only in such with regular patterns, so my guess is it has something to do with the discrete pixels, but i can't quite wrap my head around why it would use all frequencies and only in those two directions.
Even if it is about "sampling" the pixels, wouldn't diagonal lines be as well suited to represent quadratic pixels (for less regular images than above)?


texts: Jacobian Matrix of a Quaternion $q$ respect to Angular Velocity $\omega$

texts:
In the context of visual tracking and video processing I need to estimate variations of the orientation related to the angular velocity. I am trying to calculate the Jacobian matrix of a quaternion $\vec{q}_k$ respect to its (supposed to be constant) angular velocity $\vec{\omega}$.

$$\frac{\partial \vec{q}_k}{\partial \vec{\omega}}(\vec q_{k-1})$$

I found a method that uses the chains rule:

$$\frac{\partial \vec{q}_k}{\partial \vec{\omega}} = \frac{\partial \vec{q}_k}{\partial \vec{qwt}}(\vec q_{k-1}) \frac{\partial \vec{qwt}}{\partial \vec{\omega}} $$

where $\vec{qwt}$ is the quaternion form of the angular velocity. The first matrix is calculated with a matrix like this, where $q$ components are from $\vec q_{k-1}$

$$\frac{\partial \vec{q}_k}{\partial \vec{qwt}}(\vec q_{k-1})=\begin{pmatrix} q_w&-q_z &q_y &q_x \\q_z&q_w &-q_x &q_y\\-q_y&q_x &q_w &q_z\\-q_x&-q_y &-q_z &q_w \end{pmatrix}$$

I didn't find how to calculate the secon partial. It looks more tricky. Any ideas about how to start?


texts: About the fourier transform of Periodic Signal

texts:
I cannot understand some part of the period signal's Fourier transform.

Here this my note's methods,

  For periodic signal with period $T_0$, define as $s_{T_0}(t)$ as

  $$
s_{T_0} (t) =
\begin{cases}
s(t) for -T_0/2 <t<T_0/2\\
0 & \text{otherwise.}
\end{cases}
$$

  $$s(t)=\sum_{n=-\infty}^{\infty}s_{T_0}(t-n T_0) = s_{T_0}(t) * \sum_{n=-\infty}^{\infty} \delta (t-n T_0)$$
  So the fourier transform will be
  $$S(f)=S_{T_0}(f) \cdot f_0 \sum_{n=-\infty}^{\infty}\delta(f-n f_0) = f_0 \sum_{n=-\infty}^{\infty}S_{T_0}(n f_0) \delta(f-n f_0)$$

and the other methods is

  $$x(t)= s(t) \cdot \sum_{n=-\infty}^{\infty} \delta (t-n T_0)$$
  $$X(f)=S(f) * f_0 \sum_{n=-\infty}^{\infty}\delta(f- n f_0) = f_0 \sum_{n=-\infty}^{\infty}S(f-n f_0)$$

I cannot understand why I have "$\cdot f_0$" after Fourier Transform and why "$\delta(f-n f_0)$" can transform to "$\delta(t-nT_0)$"? And the last questions is, for the periods signal, why the note can use fourier transform directly with out considering the fourier serials?


texts:
for some reasons I'd like to minimize the secondary lobes of the FFT transform of a rectangular signal (shwon in the upper-left side of picture below)

so I've used window function to do that (bottom-left). However, if I want to do it directly on the complex transform of the signal (bottom-right), the values of attenuation of secondary lobe aren't the same as the temporal case.

Having the test code below, I'd like to know what is wrong with it:

pass to the EDIT

     Fs = 1000; L = 2000; t = (0:L-1)*1/Fs;
% the signal
y = zeros(1,L);  y(500:1500) = 1;     % rectangle signal

figure;
subplot(2,2,1);
plot(Fs*t,y); title('Temporal signal'); xlabel('time (milliseconds)')

NFFT = 6*2^nextpow2(L);
Y1 = 2*abs(fft(y,NFFT)); Y1 = Y1/max(Y1);
f = 0:Fs/NFFT:Fs/2;

% the FFT of the signal
subplot(2,2,2);
semilogy(f, Y1(1:NFFT/2+1), '.-'); axis tight; grid on;
title('Signal''s spectrum'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|');

w = window(@blackman, L);
y1 = y.*w';
Y2 = 2*abs(fft(y1,NFFT)); Y2 = Y2/max(Y2);

% the FFT of the windowed signal, in time
subplot(2,2,3);
semilogy(f, Y2(1:NFFT/2+1), '.-'); axis tight; grid on;
title('FFT windowing - temporal product'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')

% the FFT of the windowed signal, in complex
Y3 = 2*abs(fftshift(conv(Y1, fft(w,NFFT), 'same'))); Y3 = Y3/max(Y3);
subplot(2,2,4);
semilogy(f, Y3(1:NFFT/2+1), '.-');  axis tight; grid on;
title('FFT windowing - spectral convolution'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')

EDIT:
I've changed the code according to @Matt's remarks, but still there is a problem to the last graph (the noise on the convolutions of the FFTs)

NFFT = 6*2^nextpow2(L);
Y1 = fft(y,NFFT);
YY1 = 2*abs(Y1); YY1 = YY1/max(YY1);
f = 0:Fs/NFFT:Fs/2;

% the FFT of the signal
subplot(2,2,2);
semilogy(f, YY1(1:NFFT/2+1), '.-'); axis tight; grid on;
title('Signal''s spectrum'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|');

w = window(@blackman, L);
y1 = y.*w';
YY2 = 2*abs(fft(y1,NFFT)); YY2 = YY2/max(YY2);

% the FFT of the windowed signal, in time
subplot(2,2,3);
semilogy(f, YY2(1:NFFT/2+1), '.-'); axis tight; grid on;
title('FFT windowing - temporal product'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')

% the FFT of the windowed signal, in complex
YY3 = 2*abs(cconv(Y1, fft(w,NFFT)', NFFT)); YY3 = YY3/max(YY3);
subplot(2,2,4);
semilogy(f, YY3(1:NFFT/2+1), '.-');  axis tight; grid on;
title('FFT windowing - spectral convolution'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')'


texts:
A composite signal is defined as

$$x(t) = \sin(2\pi 10t) + \sin(2\pi 40t) + \sin(2\pi 60t) + \sin(2\pi 50t)$$

Separate the four frequencies without using any of the transform techniques.


texts: Non Equispaced / Non Uniform DFT Bandwidth

texts:
I need to construct Fourier transform of non-equispaced data.

That is, I have signal $s(t)$, $t\in[0,T]$ sampled at non-equispaced points $t_k$, $k=0...N-1$ with sample values $s_k = s(t_k)$. For Fourier transform I use approximation of integral:
$$
   \hat S(\omega) = \int\limits_{-\infty}^\infty s(t)e^{-i\omega t}dt \approx \hat S_d(\omega) = \sum_{k=0}^{N-1}s_ke^{-i\omega t_k}\Delta t_k
\tag{1}
$$
where $\Delta t_k = (t_{k+1}-t_{k-1})/2$. As sampling points in frequency domain I choose $\omega_n = \frac{2\pi}{T}$.

My question is: as I can evaluate (1) for any $\omega$, what is the maximum $\omega$ such $\hat S_d(\omega)$ "adequately" represents $\hat S(\omega)$? What is the maximum of $n$ for $\omega_n$ I can use? For DFT we got Nyquist frequency. Do we have something similar for NDFT? Any references would be appreciated.

Note: I'm aware of such things as NDFT and NFFT. Though formula for NDFT, as presented in most papers, is
$$
\hat S_d(\omega_n) = \sum_{k=0}^{N-1}s_ke^{-i\omega_n t_k}
$$
I strongly believe that I need to use formula (1) as I'm trying to build a periodogram.

And I'm not interested in fast ways of computing NDFT yet, so I'm not considering NFFT.


texts:
I'm trying to generate a sawtooth wave using the IFFT. I can do this successfully by first performing an FFT and then putting that analysed spectrum into the IFFT, however I would really like to be able to write a UI that enables me to draw the bin magnitudes and generate a full spectrum ready for IFFT from that. I have been partially successful, however the waveforms don't look/sound quite right even though the spectrum input is per the formula for synthesising a sawtooth wave.

My question is how do I generate a spectrum array of complex values for an IFFT when all I have are the magnitude values?

I know that bin 0 and 1 are zero valued. I've been trying to render the wave by only calculating the magnitudes and phases for the significant bins (bins with magnitude > 0).
Am I able to put white noise in the remaining magnitude bins and then calculate the accompanying phases at the centre frequency or alternatively calculate these non significant bins  as random phase?  my start phase is -90, bin size 1024, complex fft.   Thanks in advance for your contribution.