texts: Finding Fourier series coefficients for discrete time signal

texts:
Let $x[n]$ be a periodic sequence with period $N$ and Fourier series representation $$x[n] = \sum _{k=<N>}a_ke^{jk\frac{2\pi}{N}n}$$ Determine the Fourier series coefficients for
$$y[n]  =
\begin{cases}
x[n],  & \text{if $n$ is even} \\[2ex]
0, & \text{if $n$ is odd}
\end{cases}$$

My try
$N$ even
We have $x[0], 0 , x[2] , 0 , \dots x[N-2] , 0 , x[N]$.
Since $x[0] = x[N]$ the sequence $y[n]$ is periodic with $N$. Also we have
$$e^{jM\frac{2\pi}{N}n}x[n] \leftrightarrow a_{k-M}$$Let $M = \frac{N}{2}$, then $(-1)^nx[n] \leftrightarrow a_{k-\frac{N}{2}}$.
In this case $$b_k = \frac{1}{2}(a_k + a_{k-\frac{N}{2}})$$
$N$ odd
By writing the first terms of $y[n]$, we see that $y[n]$ is periodic with period $2N$
$$x[0], 0 , x[2] , 0 , \dots x[N-1] , 0 , x[N+1] , 0 , x[N+3] , \dots , 0 , x[2N]$$Which is $$x[0], 0 , x[2] , 0 , \dots x[N-1] , 0 , x[1] , 0 , x[3] , \dots , 0 , x[0]$$
So we write
\begin{align}
b_k &= \frac{1}{2N}\sum _{n=<2N>}y[n]e^{\frac{-jk\pi n}{N}}\\
 &= \frac{1}{2N}     \sum _{n=0}^{\frac{N-1}{2}}x[2n]
                e^{\frac{-jk2\pi n}{N}} +
    \frac{(-1)^k}{2N}\sum _{n=1}^{\frac{N-1}{2}}x[2n-1]
                e^{\frac{-jk\pi (2n-1)}{N}}.
\end{align}
I don't know how to proceed further and how to relates $b_k$ and $a_k$.


texts:
I have a sample speech recording with background noise. I managed to extract part of the noise signal, and put the noise and the contaminated signal in the same plot.

I have done fft-analysis on both speech and noise, and since their frequency bands with centralized power are close to each other, I cannot simply apply a bandpass filter. Is there another way to remove the noise from the speech signal with knowledge of the noise itself? (No, subtraction does not work)


texts:
The integral

$$\int_{-\infty}^{\infty}|X(f)|^2df$$

of the absolute Fourier spectrum squared is the energy in the signal, but what about the integral of the 'simple' absolute Fourier spectrum?

$$\int_{-\infty}^{\infty}|X(f)|df$$

Does it represent anything?
I couldn't find any information on that point. Any hint would be appreciated!


texts:
I am doing 1D wavelet decomposition and I am particularly interested in parts at the border of the signal. These parts are affected by boundary effects.
I know that some of the methods to extend the signal are periodic and reflexion, but none of these solutions are acceptable in my case.
I would like to extend the signal by the value at the border (something a bit like zero padding, but with a non zero value)

Does something like this has already been tested for wavelets?


texts: Restore real signal from its complex representation if sampled under Nyquist frequency

texts:
Assume we have:

real signal: $s(t)$
its analytic representation: $s^+(t) = s(t) + j*H(t)$,
where $H(t)$ - Hilbert transform of $s(t)$

Spectrum of $s^+(t)$ has only positive part, so may be sampled with frequency $f_p = F_n/2$ (without aliasing); where $F_n$ - Nyquist frequency for real signal. Its for example LTE20 case which IQ representation is sampled with $f_p=30.72MHz$.
The question is: how to restore real signal from analytic representation if sampled under $F_n$?
(Typical literature response is that just imaginary part can be discarded, but they silently assumes that $f_p >= F_n$.)


texts:
White Gaussian noise has constant power spectral density $N_0/2$. I know that the area under the power spectral density curve between two points gives the power of the signal between these two points.

If I want to know the power of a certain frequency in the signal (not in a range of frequencies), can we say that the power of each frequency in the signal is exactly $N_0/2$?

The total of power of additive white Gaussian noise is infinity, what does this mean? Is it reasonable to assume that the noise added to the signal have an infinite power?


texts: The image shows the frequency spectra of a signal recorded using a SDR. The SDR is of DirectDownSampling type and has some compensation in the signal chain to compensate for the DC spike which would appear at 370MHz the center frequency. But unfortunately this has caused a dip at the centre frequency. Now since the Tx channel is varying the signal power fluctuates which is shown in image 2 and image 3. The null at 370MHz is at about -22dB but this null should be at about -17dB with the other nulls. I want to be able to dynamically compensate for the 370MHz null during varying channel conditions bringing it up to -17db and also compensate for the slope on the flat tops adjacent to the 370MHz null. I have been trying of fit a line to the top of the flat tops with little success.


texts:
(Question already asked on Math StackExchange)

Let's say we have a white noise process $x(t)$ such that:

$E(X(t)X(t+\tau))=N\delta(\tau)$

$E(X(t))=0$

In particular, with $\tau=0$, $E(X(t)X(t))=E(X^2(t))$ is infinite.

Now, I want $X(t)$ at each time $t$ to have a normal distribution of 0 mean and $\sigma^2$ variance. That is:

$E(X^2(t))=\sigma^2$

This is not consistent. I guess the expectations mean something different in both cases, but I don't find an explanation. This prevents me from moving ahead in a study of the mean, variance and autocorrelation of a process $y(t)$ defined as $y(t)=1$ if $a<x(t)<b$ and 0 otherwise.


texts: generating log mel spectrogram using librosa

texts:
I have come across 2 different ways of generating log-mel spectrograms for audio files using librosa and I don't know why they differ in the final output, which one is "correct" or how different is one from the other.
#1
path = "path/to/my/file"
scale, sr = librosa.load(path)
mel_spectrogram = librosa.feature.melspectrogram(scale, sr, n_fft=2048, hop_length=512, n_mels=10, fmax=8000)
log_mel_spectrogram = librosa.power_to_db(mel_spectrogram)
librosa.display.specshow(log_mel_spectrogram, x_axis="time", y_axis="mel", sr=sr)

#2
path = "path/to/my/file"
scale, sr = librosa.load(path)
X = librosa.stft(scale)
Xdb = librosa.amplitude_to_db(abs(X))
librosa.display.specshow(Xdb, sr=sr, x_axis='time', y_axis='hz')

The respective images are:

** EDIT ** Now that I specify the number of mel bins to be = 64, I obtain the spectrogram as below:

If I want to process many such spectrograms, should I trim off the bold blue portion above as it is common to all? What does the bold, dark region represent? Is it advisable to use fmax parameter to trim it?


texts: Matching an LPC Magnitude Spectrum to FFT Magnitude Spectrum

texts:
I'm trying to get an LPC magnitude spectrum to match to an FFT magnitude spectrum.  Basically I want the peak height in the LPC Spectrum to match the peak height in the FFT Spectrum.

Thanks to numerical recipes I have  some code that produces me an LPC spectrum with what looks like the correct shape.

bool CLPC::BuildMagitudeSpectrumFromLPC( float* pOutSpec, unsigned int outSpecSize )
{
    int spec    = 0;
    while( spec < outSpecSize )
    {
        const float theta = (M_PI * 2.0f) * ((1.0f / (outSpecSize * 2)) * spec);
        const float wpr   = cosf( theta );
        const float wpi   = sinf( theta );

        float sumR  = 1.0f;
        float sumI  = 0.0f;

        float wR    = 1.0f;
        float wI    = 0.0f;
        int i   = 0;
        while( i < mNumLPC )
        {
            const float wTemp = wR;
            wR      = wR * wpr - wI     * wpi;
            wI      = wI * wpr + wTemp  * wpi;

            sumR    -= mLPCs[i] * wR;
            sumI    -= mLPCs[i] * wI;
            i++;
        }

        pOutSpec[spec] = mMeanSquareError / (sumR * sumR + sumI * sumI);
        spec++;
    }
}

Its worth noting that I manually re-scale it to a dB scale elsewhere.

My problem appears to be that I can't figure out the scaling on this spectrum.  The above code returns values of greater than 1 (at seemingly the correct peak locations) for values that are not greater than 0dBFS on the FFT magnitude spectrum.  When I overlay the 2 the toughs also appear to be too high as well.

Has anyone any idea how to get the peak heights and troughs to correspond between the 2?

I'm NOT windowing before passing to the LPC.  Should I be?

Aso, Am I right in thinking that this line is a bit odd:

 pOutSpec[spec] = mMeanSquareError / (sumR * sumR + sumI * sumI);

I would have thought I'm taking the absoloute of the complex number represented by sumR and sumI.  Wouldn't this mean calling sqrt on it? ie.

 pOutSpec[spec] = mMeanSquareError / std::sqrt( sumR * sumR + sumI * sumI );

Doing the above doesn't help my problem all it does is squash up the LPC spectrum somewhat ...


texts: Reducing noise on several Transfer Function measurements

texts:
INTRODUCTION

I want to obtain the transfer function of certain system (a ground "path", in this case) using an impact hammer for the excitation and one accelerometer (measuring vertical direction only) for the response.

I performed 20 impacts and recorded those 20 force and acceleration signals since, in theory, that helps reducing noise by performing signal averaging.

I perform signal averaging in the frequency domain both for the auto and cross spectra of the force and acceleration signals. The way I do this is by calculating the arithmetic mean accross the 20 signals, for each frequency bin.

PROBLEM

The noise level is quite big compared to that of the excitation response as it can be seen in the next figure (no clear response to the excitation is observed), so I am not sure if signal averaging is enough to solve the issue.

QUESTIONS

1) Am I implementing signal averaging correctly?

2) Is there any other way to reduce the noise present in the signals using the information that having 20 recordings of the "same" transfer function may provide?


texts: How does summation over time samples influences DFT?

texts:
In case of DFT where we have following
$$
Y_{k}=\frac{1}{N}\sum_{n=0}^{N-1}y_ne^{-j{\frac{2\pi nk}{N}}}
$$

What happens in case when we change summation, e.g., increase or decrease number of $n$ that we are summation over?
How does the rest of equation change?
For example if we decide to sum over $NM$ (if $M<1$ we have windowing and if $M>1$ we have zero padding so I do not assume adding any new info data just scaling the duration of the signal) samples would we rewrite the latter equation like this
\begin{equation}
Y_{k}=\sum_{n=0}^{MN-1}y_ne^{-j{\frac{2\pi nk}{MN}}}\tag{1}
\end{equation}
or this
\begin{equation}
Y_{k}=\sum_{n=0}^{MN-1}y_ne^{-j{\frac{2\pi nk}{N}}}\quad \tag{2}
\end{equation}
And what is the explanation behind. Also what is the appropriate scaling when summation limits change?


texts: Why is an interleaver often placed between an outer block code and an inner convolution code?

texts:
It seems that when doing FEC with a concatenated-code, an interleaver is often placed between the outer block code and the inner convolution code.  The explanations I've seen say that this is because the convolution decoder often has errors in bursts.

However, if we assume that we're using a Reed-Solomon decoder with 8-bit symbols, then spreading the bursts onto multiple blocks would seem to increase errors rather than decrease them.  What am I missing that explains why this interleaving is good?

Rough idea of the decode and encode process:

Encode:

$$\boxed{\textrm{Data}}{\longrightarrow}\boxed{\textrm{RS Encoder}}{\longrightarrow}\boxed{\textrm{Interleaver}}{\longrightarrow}\boxed{\textrm{Convolution Encoder}}{\longrightarrow} \boxed{\textrm{Modulator}}$$

Decode:

$$\boxed{\textrm{Demodulator}}{\longrightarrow}\boxed{\textrm{Convolution Decoder}}{\longrightarrow}\boxed{\textrm{De-interleaver}}{\longrightarrow}\boxed{\textrm{RS Decoder}}{\longrightarrow}\boxed{\textrm{Data}}$$


texts:
much has been said about convolution of continuous time signals. But what about frequency convolution?

For instance, consider the function:

$$f(t) = \text{sinc}(t)=\frac{\sin x}{x}$$

I take the Fourier of f(t):

$$\mathscr{F}\Big\{f(t)\Big\} = \mathscr{F} \Big\{ \text{sinc}(t) \Big\}$$

$$F(\Omega) = \text{rect}(\Omega)$$

where: $$\text{rect}(\Omega) = \begin{cases}1 & |\Omega|< 1/2 \\ 0 &|\Omega| >1/2\end{cases}$$

Then perform convolution of $F(\Omega)$ with itself in the frequency domain:

$$G(\Omega) = F(\Omega) * F(\Omega)$$

$$G(\Omega) = \text{rect}(\Omega) * \text{rect}(\Omega)$$

$$G(\Omega) =  \int \limits_{-\infty}^{\infty} \text{rect}(u) ~\text{rect}(u-\Omega)~ du$$

answer according to wolfram alpha

its a triangle between -1 and 1.

I would have thought that graphically you perform this convolution by sliding $\text{rect}(u-\Omega)$ across $\text{rect}(u)$ starting at $u=-1/2$ and ending at $u = 1/2 + 1 = 3/2$.  since the width of $\text{rect}(u-\Omega)$ is 1 in length.

but this contradicts the $\Omega$ range given by wolfram alpha of -1 to 1.

what gives?


texts:
What is a robust way to fit piecewise linear but noisy data?

I'm measuring a  signal, which consists of several almost linear segments. I'd like to atomatically fit several lines to the data to detect the transitions.

The dataset consists of a few thousand points, with 1-10 segments and I know the number of segments.

This is an example of what I'd like to do automatically.


texts: Reconstructing a sine wave from an interval shorter than half its wavelength

texts:
I know that the function that I search is a sine wave of the form
$$A \cdot \sin(x) $$
where my $A$ is unknown. I have samples of the sine wave at discrete points within an interval that's shorter than $\lambda/2$ represented by the red line in the plot.

It must be possible to somehow determine $A=1$ through reconstruction or so from my samples given by the red line. How can i do that?


texts: How to filter a signal using a bandpass filter consisted of two moving average filters?

texts:
I want to filter a PPG signal on a microcontroller. I have limited memory and a was searching for low computational methods. I found the work of Kazuhiro Taniguchi, Earable POCER: Development of a Point-of-Care Ear Sensor for Respiratory Rate Measurement where they use moving average filters (m3, m30 and m80) in order to filter their data and obtain freequencies between certain values, specifically they create a a passband between 189 mHz and 504 mHz. Their idea is that after the initial m3 moving average(every 3 values) they create the m30 and m80 and they apply an iteration between them ( r= m30 - m80). This is their way to obtain the values corresponding to the passband of interest, eventhough, as they specify,

The moving average does not have an ideal lowpass filter
function, and so some frequency elements other than those in the passband may pass, even if they are attenuated.

to obtain the window size for their moving average filters they applied the following equation:

I couldn't quite understand where this equation (5) was coming from but as soon as you replace the value $n$ with 30 or 80 you get the values of the passband cut-off freequencies 189 mHz and 504 mHz.
When I asked for specifications on how they did it, they send me to a japanese forum that unfortunately I couldn't translate but there were two links to stackexchange, on cuttoff freequency and filter design.
I tried to adapt all these new staff on my model but couldn't get the passband wanted (0.1 Hz - 0.8 Hz) using the equation (5) from the image above with my parameters (sampling freequency of 50Hz, cut-off freqs etc...).
I don't understand what is the problem and my question is the following:
What are the moving average filter windows that I have to use and in which order to be able to filter a signal with a sampling frequency of 50 Hz in order to isolate the frequencies between the passband 0.1 Hz - 0.8 Hz?


texts: Establishing the function of a decaying signal

texts:
I have a set of samples from a signal. The signal is erratic in behaviour at the beginning but then it settles down and oscillates around the value of 100 (the frequency of oscillation is not necessarily a constant). Having settled down, the signal also begins to decay ever so slightly. Given that I only have samples for the beginning of the signal, how might I estimate the remaining samples in the signal until the point at which it flat-lines. That is, the point at which all consecutive samples will have a value of 100.

Here are my samples:

3
84
200
130
106
80
70
65
66
73
78
92
105
120
120
103
94
79
72
73
78
93
101
109
108
104
90
81
78
79
80
97
101
104
100
92
87
82
87
99


texts: How to write time waveform of transmitted sequence with certain chip rate?


texts:
I am trying to bandpass filter a signal using a butterworth filter, but I am getting the following result (click to enlarge):

The original signal is the blue and the filtered one is the green.

Why does the first part of the filtered signal (from 0 to 50) is changing so much from the original? Can you help me understand why this is happening?

Here goes some details:

Signal length: 256
Frequency: 22Hz
Cutoff frequencies: 0.7Hz and 3.0Hz
Filter order: 6

Python code:

nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
y = lfilter(b, a, data)


texts: How to build a program that gives you on the fly the chords of the song while listening to it?

texts:
I am trying to think how can I program a SW that can recognize Chords on the fly.
since I know nothing about music, Can I assume that the chords are orthogonal and unique? I guess I can since it is linear combination of sinusoidal signals in different frequencies.

a. What is the rate I have to sample the song?

b. Are Chords Unique?

c. Can I assume I can store and have all the chords? is it finite set?

I found this question but it doesn't answer my questions


texts: Ways to find three curves from palm image

texts:
I am asked to extract three curves from palm images.

               original image

                   expected result.
The curves has lower intensity than neighboring pixels. So I try to morphology to extract the pixels. The matlab code is followed.

RGBImage = imread('E:\ImageProcessing\Palm\Matlab\IMG_20140817_144549.jpg');
GrayImage = rgb2gray(RGBImage);
GrayImage = imresize(GrayImage, [768, 1024]);
se = strel('disk', 10);
GrayImage = imbothat(GrayImage, se);
figure; imshow(GrayImage);

The result is shown below

The curves still have a little higher intensity values than neighboring pixels.  Maybe I need use ridge filter to enhance the curves. I use the filter from matlab file exhange(http://www.mathworks.com/matlabcentral/fileexchange/24409-hessian-based-frangi-vesselness-filter). The filtered result is not satisfactory.  I hope to get any advance or links or papers.


texts: Selecting the Low Pass FIR Filter, Decimation, DSP

texts:
I'm studying DSP, but I have weakness about it.

I was reading this: http://www.eetimes.com/document.asp?doc_id=1275556

But, I don't know how select the Low Pass Filter.

I am assuming that this depends on the sampling frequency, But I need explanation "as with clay".

I know what is a FIR Low Pass Filter, but I don't know what is the specification for this case (Decimation)..

Thank you!!


texts: Processes: Orthogonal, Uncorrelated, Statistically Independent

texts:
How are they all related? You can define them as:

Orthogonal Processes: $E[XY] = 0$
Uncorrelated Processes: $E[XY] = E[(X - \mu_x)(Y - \mu_y)] = 0$
Statistically Independent Processes: $E[XY] = E[X] \cdot E[Y]$

If two processes are orthogonal:

they are also uncorrelated
they are not necessary independent

If two processes are uncorrelated:

they are not necessary orthogonal
they are not necessary independent

If two processes are independent:

they are uncorrelated
they are orthogonal

Is that correct? I'm not sure.


texts: Algorithms for detecting the difference between two signals

texts:
If I have two signals $X$ and $Y$, where $X$ is a clean signal and $Y$ is the same signal with linear white Gaussian noise and an amplitudes of $10^{-4}$. How could one use an algorithm to detect if there are similarities between the signals.

I have currently come across cross correlation, which I am still trying to understand but are there any other methods that could be use, the idea is that I would be able to code it in matlab, so no tool boxes can be used. Could there be a matrix approach where you read the signal into a matrix form and decompose the noise and amplitudes from the matrix to get back to the original signal

This is currently a project I am doing for one of my course, so I am not looking for someone to give a answer, I am looking for advice and where I should be look, maybe relevant documentation.

The two samples are 16-bit and sampled at 44.1Khz

My apologise I have just been informed that the Y signal was renormalized after the Gaussian white noise and amplitude modulation.


texts: Circular Convolution Formula Deduction from DFT

texts:
I am trying to get to the circular convolution formula from the product of the DFT of two input signals. I came across this webpage, which contains the following.

Could someone help me to solve that equation?

I have something like this

$$
x_3(n) = \frac{1}{N} \sum^{N-1}_{k=0} \exp{\left [ \frac{j 2 \pi k n}{N} \right ]}
\left [
\sum^{N-1}_{m=0} x_1(m) \exp{\left [ \frac{-j 2 \pi k m}{N} \right ]}
\right ]
\left [
\sum^{N-1}_{m=0} x_2(m) \exp{\left [ \frac{-j 2 \pi k m}{N} \right ]}
\right ]
$$

I am not sure what is next. The following doesn't seem to be right.

$$
\begin{aligned}
x_3(n) &= \frac{1}{N} \sum^{N-1}_{k=0}
\left [
\sum^{N-1}_{m=0} x_1(m) \exp{\left [ \frac{-j 2 \pi k m}{N} \right ] \exp{\left [ \frac{j 2 \pi k n}{N} \right ]}}
\right ]
\left [
\sum^{N-1}_{m=0} x_2(m) \exp{\left [ \frac{-j 2 \pi k m}{N} \right ]}
\right ]\\
\\
&= \frac{1}{N} \sum^{N-1}_{k=0}
\left [
\sum^{N-1}_{m=0} x_1(m) \exp{\left [ \frac{-j 2 \pi k (m-n)}{N} \right ]}
\right ]
\left [
\sum^{N-1}_{m=0} x_2(m) \exp{\left [ \frac{-j 2 \pi k m}{N} \right ]}
\right ]\\
\end{aligned}
$$


texts:
I have to find the partial derivative of an image with respect to its x dimension. I am using central difference method i.e

$ \partial_x F(x) = \frac{F(x+1,y)-F(x-1,y)}{2} $

Here $F(x,y)$ represents the image and if I want to use spatial filtering for the same then I can use filter mask as

$0.5 \times [0, -1, 0;0, 0, 0;0, 1, 0],$

and then simply do filtering of F with this mask.

Now I want to know:

whether central difference can be applied for finding partial derivative?
whether the filter mask (which I have proposed above) can be used or not for finding partial derivative?
if not, please suggest me a filter mask which can perform it better and also mention how is it performing the required operation.


texts:
There are other shape properties scale-rotation invariant except HuMoment?
There are example that show me how can i implement them?
I find this example in c++ https://stackoverflow.com/questions/8675878/opencvc-calculating-moments-from-contour but i prefer working in python

Which is the difference between WeightedNormalizedMoments, WeightedHuMoments and HuMoments? (http://scikit-image.org/docs/0.6/api/skimage.measure.html)


texts: Where can I read up on zero state and zero input response for Discrete Time LTIs?

texts:
There seems to be something I'm just not understanding about this topic.
Every question I work out that asks for zero state or input I get wrong.

Hence I think I am just not understanding the definition properly, could someone guide me to a preferably beginner friendly text that covers this topic in detail?

One of the Examples:

In 6b) I honestly have no idea how to tackle the question, but here's what I did:

I tried convoluting h[n] with u[n]. My reasoning is, that this way I can obtain y[n].
Then through some magic, I can get the zero state.

Here's how I derived y[n]:


texts:
I am currently frequency filtering a 3D image in matlab, with x,y,z dimensions of different lengths. The matlab filter takes normalised frequency as an argument. What does this mean for an image and how do I calculate it?

Note : the distance between each pixel is 2mm


texts:
The same floating-point AMD X86-64 digital signal processing system mentioned in my previous question has a problem where it sometimes slows down substantially when signals attain values very near (but not exactly) zero.

The problem is that denormalized floating point values require special processing by the CPU which is dramatically slower than dealing with normal floating point values.  This can cause the DSP system to run too slow--taking longer than $1/f_s$ to compute everything that needs to be computed in one cycle.

A workaround is to add a small offset to all numbers to force them into the range of normal numbers.  Is there a way to instead instruct the FPU to simply not generate denormal numbers in the first place?

The OS is Linux and the compiler is gcc.

EDIT: Also, what are the numerical consequences of disabling denormal numbers?


texts: FFT "Brick Wall" Low Pass Filter Not Smoothing Output

texts:
I'll try to be as brief as possible. I have very limited signal processing experience. I have a data set that consists of essentially a big old sine function (with deviations from ideality), and lots of high-frequency noise (what I don't want). I desiced on a low pass filter because it doesn't change amplitude much or significantly shift peak/band locations.

I played around with QTIplot (scientific plotting soft-ware) and found I can smooth the dataset quite well by simply doing a FFT Low pass filter with a  1Hz cut-off (seem image below).

So I looked at the source code in QTI plot to get an idea of how they implemented it. It turns out it's a brick wall algorithm. Their code goes like this -

//(C) 2007 - 2008 by Ion Vasilief, Knut Franke

double df = 1.0/(double)(d_n*(x[1]-x[0]));//Sampling frequency
gsl_fft_real_workspace *work = gsl_fft_real_workspace_alloc(d_n);
gsl_fft_real_wavetable *real = gsl_fft_real_wavetable_alloc(d_n);
gsl_fft_real_transform (y, 1, d_n, real, work);//FFT forward
gsl_fft_real_wavetable_free (real);
...
//Brick wall
for (int i = 0; i < d_n && ((i+1)/2)*df < d_low_freq; i++)
    y[i] = 0;
break;
gsl_fft_halfcomplex_wavetable *hc = gsl_fft_halfcomplex_wavetable_alloc(d_n);
gsl_fft_halfcomplex_inverse (y, 1, d_n, hc, work);
gsl_fft_halfcomplex_wavetable_free (hc);
gsl_fft_real_workspace_free (work);

So I borrowed from their code but translated it into JAVA and decided on using the JTransforms FFT library. The JTransforms FFT library leaves the first two index positions for storage of the transform and the rest of the indices are alternating Re, Im components ("Bins").

    int size = recievedData.size();
    DoubleFFT_1D fftDo = new DoubleFFT_1D(recievedData.size());
    double fft[] = new double[size*2];
    fftDo.realForwardFull(fft);
    double df = 1.0/(((double)size)*(0.027413951));
    for(int i = 2; i < 2*size && (((double)i+1.00)/2.00)*df < cutOffFreq; i++){
        fft[i] = 0.0;
    }
    fftDo.complexInverse(fft, false);

Now when I run my code I see no real noise reduction. Sometimes I see the minima of my signals increase to some weird baseline, if I allow the FFTinverse to scale my code sometimes I see all blocks. Ultimately it seems the code does little to nothing to my signal, while the QTIPlot code is exactly what I want.

So a couple questions:
- What am I doing wrong in my code? Or is it the library differences (GSL vs JTransforms)?
- Is there a better way to do this kind of filtering? If so can you take me to a resource to learn how it's implemented. I read about using masks everywhere but could not find a single example of them that wasn't "hard-coded", IE: my data may be dynamic. Seems most people who did masks like to show pictures but not detail how to implement them even in lecture powerpoints from universities.

Also this is not for homework or anything I'm just playing around with an electronics project.


texts: How to go from wav file to spectrogram back to wav file in python?

texts:
Close to this question but different : Wav To Spectrogram, Back To Wav

I already posted this on StackOverflow(https://stackoverflow.com/questions/54743968/how-to-go-from-wav-file-to-spectrogram-back-to-wav-file-in-python), but I figured this question might be more suited to be here :

Here's my problem. I have some wav files. I want to create their spectrogram. Then I want to do some stuff with the spectrogram and then I want to recreate a wav file associated to the new spectrogram. I am aware that the spectrogram doesn't have the phase information, however, since I have an original file, I can (theoretically) extract the phase from the original wav file.

I want to do that in Python (if possible), do you know a good library that would allow me to do that?


texts: ICY feature detector and edge detector in opencv

texts:
I need to trace the internal feature boundaries of blobs (blood cells) in OpenCV to train a classifier.

As a good reference from ICY in java, the following sequence of operations gives good, workable edge contours.

Edge Detector( Feature Detector( CLAHE (Original Image) ) )

[UPDATE1 @Amitay] In the above image, the first reddish blob is the original image, the second one is the result of the Feature Detector operation from ICY and the third one is the result of applying the Edge Detector on the detector features.

Attempting this in OpenCV using the LabEdgeDetector.cpp ( by Austin Walters) followed by Canny Edge detector, I get the following - not so smooth results. There are lots of X and Y directional artifacts throwing the edge detection off.

From what I can see in the java source, the ICY feature detector plugin uses steerable filters for its operation (steerabledetector.java).

Are there equivalent featuredetector algos in OpenCV?  If so please list them.
How can I improve on my results? Please guide me on any other sequence of existing OpenCV operations that can produce similar results to those from ICY above.

p.s I dont have enough reputaions to post more links and references.


texts: Envelope detector for non-zero mean signal (Matlab)

texts:
I used hilbert transform to get an envelope signal.

envelope = abs(hilbert(inputSignal))

This works for zero-mean signal:

But, for nonzero-mean case, the output is not what expected.

If I do not want to remove the mean level of signal,
How can I extract the same envelope as in the first case?


texts: Finding delay where squared error between signal and data is minimal

texts:
I have a set of points  which correspond to part of a known signal. What I want to do is estimate the delay between the set of points and the known signal.
In this case, I don't think cross correlation is appropriate, since the approach should work even if only a small number of points are available. I think this is an optimization problem that minimizes the error between the data points and the known signal with respect to the delay.

Is there any operator similar to cross correlation that achieves this, or does it need to be solved by going through each delay seperately?


texts: what does musical noise sound like and is there a sample clip for it?

texts:
Musical residual noise is created when a noisy signal passes through a noise reduction algorithm. For instance, please see the paper:  Esch, T; Vary, P: "Efficient Musical Noise Suppression for Speech Enhancement Systems", IEEE Intl Conf Acoustics, Speech and Signal Proc, (ICASSP): 4409-4412, 2009.

  Noise reduction techniques that are relying on spectral weighting
  rules often generate annoying musical noise artifacts in the processed
  signal.

What exactly does it sound like? Are there any sample clips available (for example, a wav file before passing through a noise reduction algorithm routine and a wav file after noise reduction with musical noise) for comparison?


texts: How to re-program/modify sound frequencies without DSP processor?

texts:
I'm developing a mobile application that controls Bluetooth sound-speaker functions, which includes an equalizer to modify the output audio frequencies.

The audio processing module on the speaker only has an Audio Codec processor (but no Digital Signal Processor, DSP). Is it possible to still implement a program that modifies the audio frequencies (but only relying on the DSP of the host device i.e Apple, Android device), and then transmits the modified frequencies to the speaker (Audio Codec Processor)? Thus, can you bypass the DSP?

Beginner


texts: What algorithms can automatically determine a 3D scene from one or a few 2D images?

texts:
For a project I'm doing, I'm trying to model a scene based on a phone camera's video input, and then insert arrows into it that indicate direction in three dimensions.

I've looked around, and this paper looks quite interesting, and I suppose I could try to adapt its methods:
http://kevinkarsch.com/publications/sa11-lowres.pdf

However, it has the problem that users must input some reasonable spatial constraints into it beforehand, whereas doing this for every frame of a live and constantly changing video is unreasonable.

Another thing that I found allows reconstruction of a 3D object from a few photos of it in various directions, but I can't seem to find the original source anymore.

Any ideas?


texts: Improvement of Minimum description length (MDL) estimate

texts:
I earnestly request apology if this question is inappropriate for the forum. The question has two parts one technical and the other is not technical. I would appreciate any response.

Let me consider a specific use of MDL: model order estimation. For radar/sonar it is equivalent to the estimation of the number of targets (location of target is not considered here). MDL has two parts: maximum likelihood (ML) estimate of the parameter and a penalty function. Many variations exist in the literature related to the penalty function but ML estimate is hardly touched as ML is considered optimal. The model, the ML estimate and the MDL estimate all fine with large sample size; but for small sample size or high noise it is not the case as the 'model' is not accurate. The model is valid only as an expected value which is an asymptotic value.

I have an algorithm which improves the estimate of the number of targets considerably at low number of sample size or higher noise. The algorithm uses concepts of quasi-maximum likelihood.

My questions are: 1) Can we prove that a asymptotically good model, whose parameter we want estimate, for small sample size can have better estimator than ML?

The non-technical question is:

2) Anyone interested in this problem or use MDL for number of targets?

Thanks a lot.


texts: Sum of correlated exponential random variables

texts: How do we find PDF of sum of correlated exponential random variables. I know for independent random variables. But how to find it for correlated exponential random variables.


texts:
How does one average a group of frequencies? Frequencies taken for example using FFT.

That is, given n frequencies over m time intervals (n $\leq$ m), how should one "interpolate" between those frequency values so that one gets a response that's "average", rather than direct.

I don't mean to calculate the average of all those frequencies and then assign every time interval the average value. Rather, how to take the response of those frequencies closer to "following an average", i.e. a more slowly changing and more "averaging" response.

Pseudocode?


texts:
Very basic question here. I searched it on the net but cudn't get very convincing answers.
Can anyone explain me Homodyne and Heterodyne detections in rf domain. Mathematically is much appreciated.


texts:
First, I apologize for the vague title, to be honest, I'm not even sure how to describe my question in a title. If someone would like to edit it so its more reflective of what I'm asking, then please do.

I have simulink model running in real time gathering data and doing stuff in real time (1ms).

One of the things its doing is reading a signal from an external source. When the signal comes in, its in pretty bad shape, but if you look carefully, you can see that it "kinda" resembles the signal we are expecting. So some filtering should take care of it!

I collected some data and then started playing with the various filter options that matlab has, and I found one in the signal processing toolbox called filtfilt that works wonders. It pretty much pulls out the signal im looking for from the messy input signal. And it closely matches what the reference signal is. Win! (All this was done through a script).

Since our model is in simulink, I'd like to be able to simulate how the filter would work in a simulink environment so I created a function block with a tapped delay to "simulate" data coming in one sample at a time, it...does not work. Meaning the output does not look like my filter when ran through a script.

How can I get my simulink to behave like my script ?

This is actually my first time using simulink. I have used matlab in the past before for scripts but never simulink.

My filter is just

fc = 32; %cutoff freq
fs = 1000; %sample freq
fn = fc /(fs /2 ); %nyquist freq
pole = 12; %pole
Av =7.6; %gain for butteworth
[b,a] = butter(pole,fn,'low'); %10 pole butterworth
lpf_out = Av*filtfilt(b,a,data); %apply filter

Reference Signal

Input signal

Filtered Signal


texts: How to get the sum of unit steps and unit ramps from a discrete signal?

texts:
I have the discrete-time signal depicted below.

This signal can be written as follows

$$y[n] = \{0, 0, 2, 4, 6, 6 ,6,0,0,\ldots\}\,,$$

or as the sum of shifted impulses as:

$$y[n] = 2 \delta [n-2] + 4 \delta [n-3] + 6 \delta [n-4] + 6 \delta [n-5] + 6 \delta [n-6]\,.$$

In this case, how can I obtain the sum of steps and ramps from this signal?

The answer is:

   $$y[n] = 2r[n-1] - 2r[n-4] - 6u[n–7]$$


texts: Reconstruction of a signal based on non-uniform samples and a well below nyquist sampling rate


texts: Common Filter Types for Audio Applications

texts:
I'm beginning to write a basic "virtual analog" synthesizer and want to implement a lowpass with variable cutoff frequency and resonance. Does anyone have insight into filter types commonly used to mimic the sound of traditional analog gear?

More generally, what are common filters types found in audio applications such as synthesizers, equalizers, etc. I took a basic DSP class many years ago but never gained an appreciation for design choices to consider for audio. I would appreciate any references along these lines.


texts:
in many texts about modulators I have seen there is a component called "Serial to Parallel Converter". For instance, let's consider this scheme and let's focus on the second block (reference):

The text about that block says:

  The input serial data stream is formatted into the word size required for transmission, e.g. 2 bits/word for QPSK, and shifted into a parallel format. The data is then transmitted in parallel by assigning each data word to one carrier in the transmission.

Somewhere I have read also that this device converts a signal from serial to parallel by halving the transmission rate.

But,

I do not understand what serial to parallel conversion exactly means, and if I have to see it from and electronic and circuital point of view (from a signal between a wire and GND we get two signals between two wires and GND) or from a signal theory point of view (but I do not know how to see it).
Which is the math relationship of the output signals (between them and between them and the input signal)?


texts: Calculate SNR from packet error rate on micro-controller unit

texts:
I have the problem of calculating the Signal to Noise Ratio for a packeted transmission using FSK or BPSK modulation with convolutional coding on a micro controller unit which communicates with an RF chip (AX5043).

The only information that is available is the RSSI, background RSSI and the packet error rate which will be calculated on the MCU. The RSSI is known as being not so reliable for SNR calculation, so my question is if there is another way to estimate the SNR, perhaps using the PER.


texts: Does 1 kHz sine tone means $\sin(2(1000)\pi t)$ or $\sin(2(500)\pi t)$?


texts: FFT: Does the result of $N \log_2(N)$ stand for total operations or (complex) adds and multiplies?

texts:
Calculate the amount of operations you need for the Fast Fourier Transform.

Take $N=2048 \times 2048$

$N\dfrac{\log(N)}{\log(2)}$

$\dfrac{\log(2048 \times 2048)}{\log(2)}$ is 22.

$(2048 \times 2048) \dfrac{\log(2048 \times 2048)}{\log(2)}$ is 92274688.

But does $92274688$ stand for total operations or $92274688$ adds AND $92274688$ multiiplications?

So the total amount of operations is $2\times 92274688=184549376$.


texts:
Thanks porten!
Thanks Bitstream!

But our professor has said that design your own filter!(not used built in function of matlab).

I am designing my own filter.The problem is still there.First, i have to know filter's  order(N). One way is to find from its transition width. The pass-band edge frequency is 500Hz and stop band edge frequency is 700Hz. But i don't understand how to get it?
Can you help me?


texts: Unit impulse vs Kronecker delta vs Dirac delta?

texts: Apparently these 3 terms are similar, but what is exactly difference between them and what is exact value of each of them at time zero,1 or infinity?


texts: Difference Between MFCC of speech and speaker recognition

texts:
I am doing my project on speaker recognition. One of my friends is doing his project on speech recognition. Both of us need to calculate the MFCC for feature extraction.

Is the MFCC going to be the same one for both of us? Is there any difference between the algorithm of MFCC for speech and that for speaker recognition?


texts: Are Z-transform time shifting and differentiation properties always compatible?

texts:
I'm currently studying the Z-transform, and I'm having issues in understanding the time shift and differentiation properties, to be precise: calculating a Z-transform explicitly, and obtaining it by using those properties yields different results.

For example, a common Z-transform is the transform of the discrete unit step function:
$$
\mathcal{Z}\left\{ u\left[n\right]\right\} =\frac{1}{1-z^{-1}}=\frac{z}{z-1}
$$
The time shifting property of the Z-transform states (leaving aside its effects on the ROC for the moment) that $\mathcal{Z}\left\{ x\left[n-k\right]\right\} =z^{-k}\mathcal{Z}\left\{ x\left[n\right]\right\} \quad\forall k\in\mathbb{Z}
 $, thus it implies that:
$$
\mathcal{Z}\left\{ u\left[n-1\right]\right\} =z^{-1}\frac{z}{z-1}=\frac{1}{z-1}
 $$
Since $\frac{d}{dz}\frac{1}{z-1}=\frac{1}{\left(z-1\right)^{2}}$, the differentiation property, which states that $\mathcal{Z}\left\{ n\, x\left[n\right]\right\} =-z\frac{d\mathcal{Z}\left\{ x\left[n\right]\right\} }{dz}$ gives:
$$
\mathcal{Z}\left\{ n\, u\left[n-1\right]\right\} =-z\frac{1}{\left(z-1\right)^{2}}=-\frac{z^{-1}}{\left(1-z^{-1}\right)^{2}}
$$
which appears to be wrong, since the correct result should be:
$$
\mathcal{Z}\left\{ n\, u\left[n\right]\right\} =\frac{z^{-1}}{\left(1-z^{-1}\right)^{2}}
$$
What am I doing wrong? Is there perhaps any case in which those properties cannot be applied?


texts:
Autocorrelation of white noise should have a strong peak at "0" and absolutely zero for all other $\tau$ according to this. Then why is output of this code a cone shape (with the expected of strong peak at "0" instead of being flat elsewhere except at "0")

y = ones(1,1000);
z = awgn(y,1);
[m l] = xcorr(z);
plot(l,m);


texts: What is the difference in the algorithm for noise reduction in SoX and Audacity?

texts: I've looked at this question, and I understand that SoX works way FFT of the noise, then subtracting that from the FFT audio, and then resynthesizing using FFT, but I don't quite understand how this differs from Audacity. I understand what FFT is, but I don't understand the rest of the explanation, and how it is different from SoX - I don't know much about signal processing. Thank you!


texts: Information i can take from coeficient intensity map in DCT transform

texts: What useful information i can take from the coefficient intensity maping after performing DCT transform?


texts: How MATLAB calculates matched filter gain

texts:
Here is a bunch of code from MATLAB documentation: Designing a Basic Monostatic Pulse Radar:

wav = phased.RectangularWaveform(...
    'PulseWidth',1/pulseBandwidth,...
    'PRF',PRF,...
    'SampleRate',Fs);
matchingcoeff = getMatchedFilter(wav);

hmf = phased.MatchedFilter(...
    'Coefficients',matchingcoeff,...
    'GainOutputPort',true);

[rx_pulses, mfgain] = step(hmf,rx_pulses);

How MATLAB calculates the mfgain (matched filter gain)? Any formula for that?


texts: fir filter - mean delay and snr from difference equation?

texts:
I'm trying to get my dsp sea legs a bit, and am trying to complete a problem that asks for the mean delay and expected SNR boost for a given difference equation: y[n] = (x[n] + ... + x[n-N+1])/N

I'd love some general guidance on how to learn more about how to address this. Specifically,

I'd like to plot the filter function in octave/matlab, but am not sure how to get there from the difference equation. most of the examples I've come across assume that I have a frequency band to specify, but I'm not sure how I can derive that from just the difference equation.
I'm not sure how to calculate the expected SNR boost in the absence of any info about the noise source. Is it possible to calculate some concept of the amount of 'smoothing' the filter is expected to provide, and consider that to be the reduction in noise between the input and the output?

Thanks for any hints!


texts: Basic sampling excercise - unsure of rationale informing np.arange parameters for time array

texts:
I'm extremely new to DSP, so I apologise if it's a very basic question.

I'm having issues understanding the following exercise:

"Create an array of 201 samples containing a sin wave with a frequency , f, of 2 Hz, i.e. the period is 0.5 seconds. Use a sampling rate, fs of 100 Hz, i.e 100 samples per second. Use the numpy method arange to generate the array. The first step is to declare the variables for f and fs and then create an array of times for the samples in a 2 second range, i.e.

t = np.arange(−1,1+1/fs,1/fs)

which gives a array starting at -1 and ending at 1.01."

I get how you create a range in Python, and I get that the parameters are the starting value, the end value, and the steps. However, I'm not quite sure what this is doing: why does it start at -1? Why does it end at 1+1/fs? Why are the time steps 1/fs? And lastly, what exactly is this giving me? Just the times at which the wave is sampled?

I've tried Googling, but I don't really know what I should be looking for. Even a pointer to the right keyword to Google to answer those questions would be greatly appreciated.


texts: How one apply correctly FFT in image denoising

texts:
I'm writing program (Qt widgets/c++) for removing noise from images. As denoising method, i selected non local means method. This method has incredible quality of restored images (that's why it's the only denoising method in OpenCV), but has huge computation cost, so i made a lot of modified variants of this method (some with multithreading, some algorithmic). But, i'm having problem with the one, involving FFT

I followed all the steps of this article (only one page, 1430) and all works perfectly, except for FFT part, there just 2 lines about it in the paper and i can't understand, HOW should one use fft

This problem has bothered me for months, any help or insight would be greatly appriciated.

Shortened version of question:
  How can i get summed squared difference of two arrays on the image (the one at top and one in the middle, values are colors) quickly? ( O(n^2) is huge cost, there are lots of this kind of operations, paper above states, that it can be done via FFT with O(n*log n) (says that this 2 arrays forming circular convolution somehow))


texts:
It could seem an easy question and without any doubts it is but I'm trying to calculate the variance of white Gaussian noise without any result.

The power spectral density (PSD) of additive white Gaussian noise (AWGN) is $\frac{N_0}{2}$ while the autocorrelation is $\frac{N_0}{2}\delta(\tau)$, so variance is infinite?


texts: DSP filter. Is prewarping performed when discretizing using Forward/Backward?

texts:
I am trying to derive the coefficients used for a IIR implementation for the lowpass portion of a SVF filter. I've seen finished expressions for the coefficients (smith (p.8) and victor), their discretizized transfer function looks something like (not super important for my question)

$$
H(z) = \frac{k_f^2 \, z^{-1}}{1-(2-k_f(k_f+k_q))z^{-1} + (1-k_f k_q)z^{-2}} \, ,
$$
with $k_q = \frac{1}{Q}$ and (next is central to my question) $k_f = 2 \, \sin (\pi f_c T) $ .

I would like to derive these parameters myself, which I have attempted, but I am having trouble with the parameters involving the cutoff frequency $f_c$!

This is my starting point, (from analysing SVF circuit), I get the following transfer function for the lowpass portion,

$$
H(s) = \frac{\Omega_0^2}{s^2 + \frac{\Omega_0}{Q}s + \Omega_0^2} \, .
$$

Next step is performing the discretization. I did this using the bilinear transform ($z = e^{sT}$), using from what I gather the Tustin/trapezoidal approximation ($s = \frac{1}{T} \log(z) \approx \frac{2}{T} \frac{z-1}{z+1})$.

Prewarping

This transform requires prewarping and was done as follows,

$$ \Omega_0 = \tfrac{2}{T} \tan \left( \tfrac{\omega_0}{2} \right) \,, $$

where $\Omega_0 = 2 \pi f_c$ and $f_c$ is my wanted cutoff frequency.

Now, already I can see that my derivation is going to result in a different expression than what the two links above are getting. Their frequency parameters shows up in expressions that look like $ f = 2 \sin(\pi f_c T) $

My Question

Basically, where is the $\sin()$ term coming from?

Could it be that they use Euler forward (or backward) as an approximation?

$$ s = \frac{1}{T} \log(z) \approx \frac{z - 1}{T} $$

And then done some prewarping for that case? I have looked around the web and can not find any mention of prewarping done for euler backward/froward. Is that usually done?

That would give me
$$ \begin{split}
s = j \Omega &= \frac{z-1}{T} \\
j \Omega &= \frac{e^{j \omega}-1}{T} \\
j \Omega &= \frac{e^{j \omega/2}-e^{-j \omega/2}}{T e^{-j \omega/2}} \\
j \Omega &= \frac{j 2 \sin(\omega/2)}{T e^{-j \omega /2}} \\
 \Omega &= \frac{2 \sin(\omega/2)}{T e^{-j \omega /2}} \\
\end{split} $$

Not sure what I am missing.

--

Thank you very much for any help regarding this!


texts: I am reading bishop book on pattern recognition and machine learning. Going through the introduction section, I am not sure if I get the differences between the two widely used term "test data" and "training data". Is training data the data you will have after the pre-processing stage which is also called feature extraction? Where test data is the original input. Am I right?


texts:
Could somebody explain how upsampling works with comb function. How comb function looks for upsampling process?
(if it possible I would appreciate if answer would be related to DFT)


texts: How to estimate the system characteristic function given experimental input and output

texts:
I have experimental signals  $y_i(t)$ for $i = 1,\ldots,n$ that correspond to different excitation inputs to a system $x_i(t)$ for $i = 1,\ldots,n$. The goal is to find the system characteristic function $h(t)$ such that:
$$ y_i(t) = h(t) \star x_i(t)$$ for all $i$ and $\star$ denotes convolution.
Is this possible? I know that deconvolution could be used to estimate $x(t)$. But how do we find this $h(t)$ that works for all $i$? What are the practical ways to go about that in MATLAB?
I tried:
$$ h(t) = \mathcal F^{-1}\left\{\frac{\mathcal F\big\{y(t)\big\}}{\mathcal F\big\{x(t)\big\}} \right\} $$
in MATLAB, but it did not work (I got a straight line!). I guess this is only valid in ideal systems.
I am not an expert in signal processing, so I would appreciate any simple answers and helpful references.
Thanks,


texts: Negative frequency of a sinusoidal wave on the magnitude spectrum: Physical explanation?

texts:
link to the video: Negative frequency

Must a cosine function be expressed as two exp functions with opposite frequencies/directions of rotation and half the magnitude/amplitude(1/2),
therefore resulting in two magnitude spectrum components?

Why can't there be one single component at w?

I know this is very basic but there are only videos about the "how" not the "why".Thank you in advance!


texts:
I have some problems rearranging exp terms to receive a cos or sin. I guess the solution is silly but I‘m not able to spot my mistake.

I know the solution (since i looked it up with wolfram alpha) has to be a $cos(\pi /4n)$ and therefore  $\frac{e^{-j\pi/4n}+ e^{j\pi/4n}}{2}$.
My goal is to rearrange the two terms $e^{j\pi/4n}+ e^{j7/4\pi n}$ (devided by 2) to receive this cos.
One can clearly see that by removing the $\pi/4$ e term on both sites of
$$e^{j\pi/4n}+ e^{j7/4\pi n} =e^{-j\pi/4n}+ e^{j\pi/4n}$$
this remains
$$ e^{j7/4\pi n}= e^{-j\pi/4n}$$ wich is true, when its drawn on the unit circle.

If one doesnt see this trick, my usual approach is to split an e term up to make the remaining two e terms conj. compex of each other. Like this
$$ e^{j\pi n} \cdot (e^{-j3\pi/4n}+ e^{j3\pi/4n})$$

Saddly this results (as far as I can see) in $(-1)^n\cdot 2cos(3/4\pi n)$, which is not what I‘ve expected.
How comes this rearrangement doesn‘t result in the same cos? Is this rearrangement in some cases prohibited?


texts: Time delay estimation between two complex signals(IQ)

texts:
I need to time align two complex signals. The two signals obtained were at different RF frequency before digitisation. So,I have two complex signals(IQ) and I need to do delay estimation and apply correction on one of the signal.

Cross-correlating the absolute values of two signals and finding the peak gives one answer while cross-correlating the complex values and then finding the peak from the absolute value of the obtained (complex)correlation gives another peak?

Which method shall I choose? what is the best way forward? Any insight into it?


texts: Using k Nearest Neighbour & Dynamic Time Warping for keyword spotting

texts: As stated in the title, I am currently researching a method using k-NN, specifically, as either an alternative or as a supplement to the DTW algorithm in keyword spotting based on MFCC. I have read through various answers on this forum (mainly Speech recognition using MFCC and DTW(Dynamic Time Warping)?) and I would like to know if anyone could direct me to somewhere I can find more research or implementations which employ the k-NN.


texts: Lloyd Max Quantization and Clustering : Part 1

texts:
The Lloyd-Max quantizer is a scalar quantizer which can be seen as a special case
of a vector quantizer (VQ) designed with the Linde Buzo
Gray (LBG) algorithm.

In k-means clustering, we are given a set of n data points in d-dimensional space  and an integer k and the problem is to determine a set of k points in $R^d$, called centers, so as to minimize the mean squared distance from each data point to its nearest center. A popular heuristic for k-means clustering is Lloyd's (1982) algorithm.

Confusion :

Is the Lloyd-Max algorithm alternatively in short called the Lloyd's algorithm ? Or are they completely different?

I am very confused, please help. Thank you.


texts:
Noob here, I read that any signal can be made by putting together sines and cosines, it always shows some kind of basic harmonic wave with constant amplitude such as square wave.

I understand that constant amplitude, constant frequency square and triangle waves can be made from sines, but what about square wave that sweeps its frequency or even suddenly jump to other frequency, what about square that has its amplitude changed?

What about noise, lets say I have 1 minute long 48KHz 16bit PCM signal that is just white noise, that can be reconstructed from bunch of sines too?

And what about transients, either the sudden square wave like ones or the gentle slow fade in type ones. Lets say I have signal that is silence and then square wave slowly and smoothly rises in amplitude, how can sines, which are constant in amplitude ever recreate it?

Basically, my point is these sines are constant in amplitude, frequency, and phase and they run the entire lenght of whatever signal we want to reconstruct, signals can have silence, transients, periods where amplitude and frequency is constant and periods where they change. I dont understand how can bunch of sines that run the entire lenght of complex signal ever reconstruct it. How can 1000 sine waves sum up into perfect silence and then suddenly sum into noisy square wave sweep?


texts: Here to find DTFT of $h(2n)$ they have scaled omega, while in RHS to find DTFT $x(2n+1)$ they didn't, why is that?


texts: Do I need an overlapping in STFT if I want to play the signal back?

texts:
I want to write an algorithm to implement a pitch-shifter, like in this article: http://www.guitarpitchshifter.com/matlab.html. And I need to do it in realtime, not with a signal already defined earlier. I don't understand if I need overlapping in STFT to play the sound back.

Why can't I just record, say, 1024 samples, then process them and then output it and so on (without overlapping)? This seems to be easier to implement but I guess there is a reason they added an overlapping which I can't understand.

Can you help me understand, is overlapping needed in there? And if yes, why?


texts:
I am trying to get a simple implementation of Lucas-Kanade-Algorithm in 1D using a sigmoid function just as an arbitrary choice!

In the following code i want to get the displacement $v$ of the two sigmoid-functions using the iterative method proposed in LK-paper!

but the problem is that $v$ is not converging to the real displacement value!
Can you tell what am i doing wrong?

by the way the code below is written in Julia.

x = linspace(-5, 5, 100)
λ = 1
dt = 0.5  # the real displacement
σ(t) = 1 ./ (1 + e.^(- λ .* t)) # sigmoid
dσ(t) = λ .* σ(t) .* (1 - σ(t)) # sigmoid derivative
g(t) = σ(t - dt) # shifted sigmiod

x0 = 0   # displacement at the center of coordinate system (0, 0)
v = 0    # displacement vlaue, should converge to dt
x = x0
# now starting with newton-mthod iterations
for i=1:5
    I_t = σ(x) - g(x) # temporal derivative
    I_x = dσ(x0)  # spatial derivative does not change
    v = v - (I_t/I_x)
    x = x + v
    print("$(v) \n")
end


texts: Can someone explain complex mapping as appears in Ogata's textbook

texts:
Refer to diagram above, in Ogata's text on discrete time control, he showed that you can map a curve in the S plane, namely curve 1,2,3,4,5 onto a circle in the Z plane through the complex mapping $e^{Ts}$

What I do not understand is why are we missing the negative branch? This is curious because we must have poles in the z-plane located on the negative branch. So if that branch is missing, how are we suppose to map those poles back to the S plane?

Can someone explain why the negative axis is missing in this mapping?


texts: Getting 16 bit image statistics in Photoshop

texts:
The histogram in Photoshop for a 16-bit image downsamples to 8 bits, showing a tonal range of 0 to 255. I appreciate to show tonal ranges for a 16 bit image a horizontal zoom function would be necessary.

However the mean, std deviation,... statistics also get downsampled to 8 bits with a corresponding loss of accuracy.

Is there a way of seeing the true mean, std deviation etc of a 16 bit image?


texts: Numerical computation of the derivative of a curve valued in $\operatorname{Diff}(\mathbb{R}^2)$

texts:
Assume we have a (discretized) sufficiently smooth curve $\alpha : [0, 1] \to \operatorname{Diff}(\mathbb{R}^2)$. Further assume that this curve is generated via a large deformation diffeomorphic metric mapping (LDDMM) given the endpoint diffeomorphisms $\alpha(0)$ and $\alpha(1)$. Namely, this is a two-dimensional image registration. Since this is within a computational setting, every point (diffeomorphism) along the curve $\alpha$ is extracted as the integral of a time-varying velocity field $v$ with respect to time:
$$
\alpha(t) = \int_0^tv(\mathbf{x}, t)\,dt, \text{     for $0 < t \leq 1$}.
$$
Clearly, the integral from $t = 0$ to $t = 1$ returns the full diffeomorphic registration between the source and target images. Hence, the data that I have is not the diffeomorphisms $\alpha(t)$, but rather the values of $v$ for discretized timesteps $\Delta t$. Given this, I'm interested in computing the derivative $\alpha'(t)$ for some time $t$. How would I go about doing this using the data I have? I assume that it's not as simple as computing finite differences on the velocity fields. Moreover, how would I go about computing the norm $\vert\vert\alpha'(t)\vert\vert$?


texts:
I understand the concept of the STFT. In order to avoid spectral leakage, you use a Hann window that overlaps by 50%. However, the problem that I have, is that the example code online does not account for this.

What I mean is, if the signal is overlapping by 50%, why doesn't anyone add the frequency content of the overlapping sections?

https://kevinsprojects.wordpress.com/2014/12/13/short-time-fourier-transform-using-python-and-numpy/

This is an example of what I mean. It looks like he is grabbing the overlap, but he is not adding the overlap pieces together. I don't see how the frequency content is being saved. He windows a function, does the FFT, then moves over and does the FFT again with the overlapping piece. I feel like he should be adding the overlapping pieces together. Is there something I am missing?

Thank you: John

Edit: I see the first answer, but it is still not hitting home. Hanning windows make the left and right information approach zero. So when it is overlapped, this removes this problem. However, when the FFT is taken, the information of the transform is put side-by-side. Wouldn't this mean, First Window=> upper time series information lower amplitude, Second window =>lower time series information lower amplitude.... This does not seem to solve the issue. You are still losing information with each window... is this not the case?


texts: Is Differentiation as a system, is an invertible system?

texts:
is the following system invertible?

as I understand it, invertible means finding an inverse function which should return back the original input from an output of the given system.

if so I understand correct. Then one could say, yes the system is invertible and the inverse function is

but for example, If our original input is x + 3 then its derivative is 1,  and if I try to use the inverse function it returns x + c.   is the nature of not knowing what exactly c equals makes the system non-invertible; meaning the original input cannot be restored. Does that make the system non-invertible


texts:
What are the differences between radix-2 FFT and radix-4 FFT,

Are the only differences following two:

In case of radix-2 $N$ is a number that is a power of 2 and in case of radix-4 $N$ is a number that is a power of 4
Incase of radix-2 the butterfly diagram increases or decreases density by a factor of 2, while in case of radix-4 the butterfly diagram increases or decreases density by factor of 4


texts: What are the Even and Odd Components of a 2D Signal

texts:
A signal $x$ can be decomposed into
its even, $x_e$, and odd, $x_o$, parts.
By,

$$
x_e(t) = \frac{1}{2} [x(t) + x(-t)]
$$

$$
x_o(t) = \frac{1}{2} [x(t) - x(-t)]
$$

What would be the equivalent for a multidimensional signal, such as a image signal?


texts:
I am using a template matching algorithm to find a region in an image.
Now there is something strange about the templates I am using. Some of them work and some others don't.
And I can't find out the difference. They share the same size, channels and file format.
The only difference I found is the size.
Can you tell me what the difference is?
See here:
Image1 (4kb):
https://www.dropbox.com/s/2fqlu7m5w6gtcg8/hist1.png
Image2 (5kb):
https://www.dropbox.com/s/5q6yasitszdzwn4/hist2.png


texts: Convert a 1D array into a 'rotated' 2D matrix

texts:
simply put, let's say I have this array - [1 2 1]
I want to try and get this output in Matlab

[1 1 1
1 2 1
1 1 1]

It's like my array was 'rotated' into forming the above matrix such that if I start at any peripheral element and move through the center of the matrix (in a straight line of course) towards the other end, then I get back my original array ( [1 2 1] )
Can anyone help me achieve this?


texts: How to Create a Convolution Matrix with a Variable Condition Number (CN)

texts:
I want to know the performance of a deconvolution algorithm with different CN, so I'm convolving my signal with different convolution matrices(different CNs) and then applying the deconvolution algorithm, then the error between the original and reconstructed signals is measured.

Is there a proper way to create the convolution matrix with variable CN.


texts:
I'm an animator trying to get a program that will use machine learning to automate the lip syncing process. The program I need made will have two files given to it: a seed, and an audio file.
The seed will be a video made in another program, it will be anywhere between a few minutes to a few hours of hand synced audio, done in a different program. The seed will be made uniquely for any new speaker, so as to train the program for every person.
A transcript of the video can be added if it would help, but I'm okay removing this if you believe it won't.
Then the audio will be added, this is the one needing to be synced. It will then need to go through, listen frame by frame and compare the sounds to the seed video. When it finds a match, it will save whatever image is in the video at that frame into a sequence.
The final output will be a png image sequence that can be played at 30 frames per second in a video editor along with the audio.
For the sake of quality, I would prefer that the seed also be an image sequence I upload into it with the seed's audio, this way the exported image sequence will have transparency, if that's possible.
Also when the audio is being recorded, there is a video being recorded as well of the speaker, if adding some sort of facial tracking could also help, I'd like that as well.
Lastly, I'd prefer this to run as quickly as possible. So not running real-time, seeing as the audio being synced can sometimes be up to several hours long. I will down the line like an ability to do lip syncing live (with perhaps a 5 second delay) and it just displays in a window and syncs to a chosen microphone or audio device.
So for example, when the program is listening to the audio that needs to be synced, let's say it hears the "Ah" sound. It will then search the seed audio for the best match to this sound, let's say it's the first time the word "and" is said. It hears a matching Ah" sound, and then looks to the video to see what image is currently being displayed. It copies that image, then moves on to the next frame/sound. In the end it should produce an image sequence that could play back at 30 frames per second in an editor alongside the audio.
So, which program or AI \ DSP \ ML  techniques will help in this?


texts: With the intention of converting a single rate LPF FIR filter to multi rate equivalent: what is the largest possible downsampling factor? I found one source that said it was the sampling frequency divided by the frequency at the centre of the transition band, but am seeking verification.


texts:
Problem

  Given the compound system below, with the input $x(t)=\operatorname{sinc(t)}$, the output of A is $y(t)=\operatorname{sinc(2t)}$ and the output of B is $z(t)=\operatorname{sinc(t)}$, determine which of the A, B systems are Linear time invariant (LTI).

  a) A
  b) B
  c) Both
  d) Neither

My approach:

Using two facts below (if I got them right):

A and B are inverse of each other (because the overall output is
equal to the input)
If an LTI system is reversible, then the reverse is also LTI.

after a quick scanning I crossed a, b as the answered. I concluded that either both systems are LTI or neither of them are.

For the next step, using the given information I derived the system A:

\begin{align}
x(t)&=\frac {\sin(\pi t)}{\pi t}\\
y(t)&=\frac {\sin(2\pi t)}{\pi t}=\frac{2\sin(\pi t)\cos(\pi t)}{\pi t}=\frac{2\sin(\pi t)\sin(\pi t+\frac{\pi}{2})}{\pi t}=2\pi t x(t)x\left(t+\frac{\pi}{2}\right)
\end{align}

now with the $t$ as the coefficient of the system we can say $y$ is not time invariant and therfore not LTI. so I chose d as the correct answer.
But the text book I'm reading proves that b is the answer, using another method.

Questions:

So my questions are:

Is my approach/facts flawed?
If so, what is the correct approach to solve this problem.
OR possibly did the book get it wrong?

Any help would be highly apprecieted!


texts:
I'm given a discrete time signal which is as follows:

$$ x[n] = \alpha^n u[n],\\$$
$$ h[n] = u[n],\\$$

Why is unit function neglected in the following step:

$$ y[n] = \sum_{k=0}^{n} \alpha^{k}\\$$


texts: Why ideal filter cannot realised practically?

texts: I know the difference between ideal and practical filterI just wanted to know why it not realisable?


texts: Apply Low Pass (Smoothing) Filter on a Set of Matrices and Reject Outliers

texts:
Given a set of a $ 3 $ by $ 3 $ matrices $ {H}_{i} $.
Each matrix is an Homography matrix.
They are used to stabilize Video Stream.
Yet some of them are outliers which creates "Jumps" in the "Stabilized Video Stream".
I would like to apply Low Pass filter on matrices in a manner which "Low Pass" the homography (Meaning, the Mapping).
Moreover, I'd like to reject Outliers, Matrices which compared to other rotates / scales the frame in a completely different way.
The problem I don't know any metrics which deals with that property of a $ 3 $ by $ 3 $ matrix.

Any idea?


texts: why is the signal divided into epochs in EEG classification?

texts:
I'm new in EEG signal classification.
Studying the literature on this topic, I wonder why the EEG signals are divided in epochs, so, instead of classifying the whole signal all at once, we usually classify "windows" of signal, splitting the original one. I searched in the literature for a possible explanation, but I find nothing which answers to my question.


texts: Apply Transfer Function in Continuous Domain in Matlab

texts:
I have the coefficients of a transfer function (i.e. numerator and denominator) in Laplace domain. How can I apply this to an input waveform using MATLAB script? I am looking for a function or piece of code that does the same job as 'Transfer Fcn' block in Simulink.

I know the 'filter(num, den, input)' command in MATLAB does not work in my case as this function only accepts discrete domain coefficients. I also want to avoid the c2d() command that converts the continuous system to discrete.

So basically I am looking for a direct solution in the continuous domain without using the simulink block.

Any help is greatly appreciated.


texts:
In Shannon's paper "A Mathematical Theory of Communication", in Theorem 8 he states:

Theorem 8: Let the system of constraints considered as channel have a capacity $C = \log W$. If we assign
$$p^{(s)}_{ij} = \frac{B_j}{B_i}W^{\ell^{(s)}_{ij}}$$
where $l^{(s)}_{ij}$ is the duration of the $s^{th}$ symbol leading from state i to state j and $B_i$ satisfy
$$B_i = \Sigma_{s,j}B_jW^{\ell^{(s)}_{ij}}$$
then H is maximized and equal to C.

My question is, what exactly is $B_i$ and $B_j$? It's not defined anywhere else. In a different section he mentions "a sequence $B_i$ of symbols from the source", but that doesn't make much sense here.


texts: What is the meaning of negative second for a Morlet wavelet?

texts:
I kind of familiar with wavelet transform (I just used it in code but do not have a deep understanding about it).
I've been reading an article and came across this sentence:

  where 4Fs is the length of the
  Morlet wavelet with -2 to 2 second support with sampling frequency Fs

and I can't figure out what the -2 second means. By the way the article link is: Deep Convolutional Neural Networks for Brain Computer Interface using Motor Imagery


texts: Quantization of Image which have taken from partially less dark

texts:
I have picture with high resolution with 20M memory space and this image has been taken from the standing away from the window in room which has significantly less light as compared to outside. Image has less contrast due to large number of bright pixels in it and also large number of near to dark pixels from room objects. I want to enhance the image contrast having pixels with high intensity values and also with having low intensity values without changing the remaining pixels which are in between these range. Image has been taken with almost half of the areas with having high intensity values and half of area having low intensity values.
I have read the quantization techniques with uniform quantization and non-uniform quantization Wiki but i am unable to understand the the concept I mean in what direction i need to understand the concept behind this to improve the contrast and what techniques are available to apply these kind of problems.


texts: High-pass filtering pre-processing before computing audio features

texts:
I want to compute acoustic features on a set of audio files. These features can be classical audio features as spectral flux, but also acoustic indices as proposed in the seewave R package ).

I need, in a pre-processing step, to remove low frequency noise (approximatively inferior at 200 Hz), that could be caused for example by wind or a distant road, and are not appropriated for the analysis.

As my features can be computed both from temporal and spectral values extracted from the audio signal, I am considering the use of a temporal high pass filter. This approach seem to me more adequate than a filtering on the spectral domain (with a reconstruction of the signal by an inverse Fourier transform). Am I right?

Therefore I am looking for an high-pass digital filtering method that will remove low frequencies, but preserve as much as possible the high frequencies. If it is possible, I would like that the amplitudes of the fft bins above the cutoff frequency could stay the same after the filtering.

What is the best method for this application? Is it relevant to use a temporal filter rather than a filtering on the fft bins?

Concretely, I will use a python implementation (with scipy). I am now considering the use of a butterworth filter with the filtfilt function. Is this method appropriate? Is there a better solution for this issue?

Ant help or suggestion will be appreciate.

Edit

Sampling rate of the audio files: 48 kHz
Low frequency band to remove: around 0-300 Hz


texts: On the stability and causality of a discrete system

texts:
On  MIT's open course a simple exercise with two questions is given. On the first part, they question about the properties of the following discrete system:

$$
y[n]=x[n]+0.5y[n−1]−2y[n−2]
$$

The answer states that none of the following properties can be determined, as no initial conditions were given: stability, causality, linearity, time (in)variance.

I would be inclined to say that the system is at LTI, as the coefficients are constant and the output is simply defined by a recursive relationship to itself and the input. Both poles are inside the unit circle and the system should be stable if it is causal, as the ROC includes the unit circle.

My first question is therefore: could you come with a(n) example(s) of initial conditions (or any argument for that matter) so that the system is: variant in time OR unstable OR not causal OR non-linear? The only conditions that I can think of that could make it behave strangely would be extreme ones such as +/- infinity. I assumed this was not the intent of the initial question.

Next, the following transfer function is given (unrelated to question above):

$$
H(e^{j\omega }) = \frac{1 - 2e^{-j\omega }}{(1 - \frac{3}{4}e^{-j\omega })(1 - 3e^{-j\omega })}
$$

Here it is also asked about its properties. On the final answer they state that, given that a transfer function is given, one can imply that the system is linear and time invariant. So far so good. Next, however, it states that the system is both stable and not causal, with the following argument:

...Further, from the existence of a frequency response you may conclude that the frequency response converges on the unit circle, i.e., that the system is stable. Given that the system is stable the region of convergence is also implied resulting in a two-sided sequence, meaning that the impulse response is not causal.

Hence my second question:

How was this concluded from this transfer function, given that no ROC constraint is there?

Thanks in advance.


texts:
Let
$$\hat{x}[k] = \frac{1}{2\pi}\int_{-W}^{W}X(e^{j\omega})e^{j\omega k}d\omega,\label{ift}\tag1$$
where
$$X(e^{j\omega}) = \sum_{n=-\infty}^{+\infty} x[n]e^{-j\omega n}\label{dft}\tag2$$
Also,
$$d[k] = x[k] - \hat{x}[k]\text.\label{error}\tag3$$

Show that energy of $d[k]$ goes to zero as $W\to \pi$. That is,
$$\lim_{W \to \pi} \sum_{k = -\infty}^{+\infty}|d[k]|^2 = 0\text.$$

My Attempt
Main problem for me is removing magnitude in some way. Writing $|d[k]|^2 = d[k]d^{*}[k]$ complicates equations. Also if we use Parseval's identity, the magnitude is still present. I don't know if we are allowed to move limit inside the summation or not. Even assuming it's possible, I couldn't found a way for calculating $\lim_{W \to \pi} |d[k]|^2$.


texts:
I'm working on an audio based application for android platform , I'm trying to use a low pass filter to a fixed or variable max frequency "depends on the cost of development".
first I've been playing around with FFT and I believe I can get results out of it "by muting the frequencies above the required frequency and then do inverse FFT".
but the processing time seems high so I've searched again and found that a real time LPF can be implemented and applied to PCM data "IIR , Butterworth".
any suggestions on the best approach keeping in mind low processing speed "CPU" and small available memory "around 20MB for dalvik virtual machine"


texts: Books/resources for implementing various mathematical functions in fixed point arithmetic for DSP purposes

texts:
I'm looking for books or resources that cover the following in detail:

implementing mathematical functions (e.g., logarithm, exponential, sine, cosine, inverse) in fixed point arithmetic for DSP purposes.
techniques like using lookup tables, Taylor series, etc.

I am fairly familiar with C programming and am more interested in the algorithms on how to go about implementing various mathematical functions in an efficient manner.


texts: Halving a floating point time series and it's effect on noise levels

texts:
Why does halving a floating point time series (audio) cause the noise shown in the spectogram to change?

From having a look, all the steps from getting the first half of X, stft() and amplitude_to_db() output the same values except in the last two frames closest to the halving point (which is expected but not expected to change specshow?).

So why does the graph show an increase in noise throughout the data?

Here is my code to create the two graphs:

audio_file = './nonvoice_snippets_stepvoices/t15_14steps.wav'
X, sample_rate = librosa.load(audio_file)

import matplotlib.pyplot as plt
import librosa.display
plt.figure(figsize=(15, 10))
D = librosa.amplitude_to_db(librosa.stft(X), ref=np.max)
plt.subplot(4, 2, 1)
librosa.display.specshow(D, y_axis='linear')
plt.colorbar(format='%+2.0f dB')
plt.title(audio_file)

#lets get the first half of that.
half = len(X)/2
half_X = X[:half]

plt.figure(figsize=(15, 10))
D = librosa.amplitude_to_db(librosa.stft(half_X), ref=np.max)
plt.subplot(4, 2, 1)
librosa.display.specshow(D, y_axis='linear')
plt.colorbar(format='%+2.0f dB')
plt.title(audio_file)

And the reason why I'm asking this is because I plan to get the Sum of absolute differences (SAD) for use in a Weiner filter to remove the noise you can see in both files. I figured that the first half of the file was a better representation of the noise in the file to get my SAD from but I need to know that this increase in noise won't cause unexpected effects.

Thanks community for being so helpful.


texts: FFT looking messy after filtering process

texts:
I have a vibration signal (25.6 kHz)  which has been through the following filters:

1: highpass (2000 Hz) -> (I'm not interesten in the harmonics of the system. I then perform spectral kurtosis to find the optimal bandpass bandwidth.)
 2: Bandpass (8750 Hz,9250 Hz) ->
 3: Rectification (abs(xi)^2) ->
 4.Lowpass (2000 Hz)

The fft of the final signal looks like this:

The Bandpass filter bandwidth and center frequency was selected based on the kurtogram of signal after initial lowpass.

I am no expert in signal processing- does the FFT look "correct"? It seems odd that the amplitudes rarely go below 0.05...

Updates

The original signal (25.6 kHz):

Zoomed in in original signal (25.6 kHz):

Final signal in time domain:

FFT of original signal (before step 1)

Objective of project:

To look for any fault development in the early stages of a gearbox fault on a wind turbine. I have signal data 412 days, in the form of 412 10-second intervals.
Want to extract features from time and freq. domain and cluster the 412 intervals, to see if there is a pattern.


texts:
I want to add a White Gaussian noise to noise-free signal given desired SNR value. To do that, I am looking for a way to estimate the power of the signal. The noise-free signal looks like the following:

Do you have any clue about how to estimate the power of the signal ( mean of the signal, the integral of the difference between the decreasing linear line  and the concave down decreasing line, ....)?
Many thanks in advance!!!


texts: How to find blood pressure from osciloscope image

texts:
We have measured the human blood  pressure with the sphygmomanometer connected to relative senzor of the pressure and osciloscope. We measured the offset of the sensor as $U_{OFF}=1.01\ V$ and the sensitivity $k=0.02425\ \frac{V}{mmHg}$.

By measuring the pressure on the human's arm, we got this image:

How to find systolic and diastolic pressure in there?

We got formula for counting the pressure $p$ out of the output voltage $U_x$
$$p=\frac1k\cdot (U_x-U_{OFF})$$

I thought the highest value is the first vertical cursor, which shoud be  $9.6\ mV$ according to the table in the right top of the image, but if I count with this value and the formula above, I get the maximum pressure $-40\ mmHg$. We didn't get very clear instructions how to count systolic and diastolic preassure either. I only know, systolic pressure should be half of the maximum value.

Can anybody help me with this?


texts: Are the error probability of orthogonal signal and on/off signal the same?

texts:
I have to write the error probability of orthogonal signal and on/off signal,and now i have finished the  error probability of on/off signal,but i don't know how to write the code about error probability of orthogonal signal.

Generally,we will introduce the orthogonal signal and on/off signal with the picture below ,first is orthogonal signal,second is on/off signal.

(a)  orthogonal signal

(b)  on/off signal

And the definition of orthogonal binary signal is that if we do the inner product with the signal 1 and signal 0 ,the result will become 0. I mean $\int s_0  s_1 dt = 0$

And i found that the on/off binary signal is also $\int s_0  s_1 dt = 0$,so can i say the on/off signal is the orthogonal binary signal too,so their error probability should be the same theoretically?


texts:
I struggling at transforming a 1D breathing signal into 2D spectrograms,
power spectral density as a function of time and frequency.
Does anyone have an idea about that?


texts: Frequency Domain Variant of Pearson's Sample Correlation Coefficient?

texts:
Suppose that you need to find (i.e. acquire) $x_1$, a short data packet with a known bit sequence preamble (i.e. a PRBS BPSK), in  $x_2$, quantized samples recorded from the output of an ADC. You don't know where the PRBS starts in the collected data. The preamble has an unknown phase but no carrier frequency offset (CFO). You need to set a threshold at the output of the matched filter to declare if the preamble is present. It seems to me that a detection threshold based on the the correlation coefficient would be more robust to narrow-band interference (NBI) than a fixed signal-to-noise ratio (SNR) threshold:

$\frac{S}{N}=\frac{signal_{peak}}{noise_{avg}}=\frac{max(fft(x_1)*fft(x_2)'))}{median(fft(x_1)*fft(x_2)')}$

As mentioned in a previous post and on Wikipedia, the sample correlation coefficient can be calculated as:

$r_{x_1x_2} = \frac{max(abs(ifft(fft(x_1)*fft(x_2)')))}{sqrt(max(abs(ifft(fft(x_1)*fft(x_1)'))))*sqrt(max(abs(ifft(fft(x_2)*fft(x_2)'))))}$

Why do you need the ifft's? What's wrong with leaving the numerator and denominator in the frequency domain like:

$r_{x_1x_2}' = \frac{max(abs(fft(x_1)*fft(x_2)'))}{sqrt(max(abs(fft(x_1)*fft(x_1)')))*sqrt(max(abs(fft(x_2)*fft(x_2)')))}$

In an effort to save the unnecessary floating-point operations (FLOPS), would the metric $r_{x_1x_2}'$ still be a measure of the degree of the relative likeness or similarity between $x_1$ and $x_2$ (and therefore a useful metric to base a detection threshold on)? If so, does $r_{x_1x_2}'$ have an official name from statistics or detection theory?

[I understand that $r_{x_1x_2}$ is a cross-correlation of $x_1$ and $x_2$ divided by the product of the auto-correlation of $x_1$ and the auto-correlation of $x_2$ with each correlation implemented in the frequency domain using fft's by the OP.]


texts:
I am banging my head against (specific aspects of) CDMA for a few days. At the basic level I am confused about the interrelation between implementations that are modeled as mixing and fully digital implementations. Example:

Mixing could use the the matrix $[ 1, 1 ; 1, -1]$ (appears in the example of https://en.wikipedia.org/wiki/Code-division_multiple_access#Example and https://en.wikipedia.org/wiki/Walsh_matrix). These matrices have elements -1 and 1 and flip signs and can be interpreted as mixing/multiplication. Makes sense
Other sources show these matrices as $[ 0, 0 ; 0, 1]$ (e.g. https://www.tutorialspoint.com/cdma/cdma_techniques.htm). My understanding is that these setups assume bit streams (as opposed to more general sample streams) and for each data "1" they would just send the normal PN sequence (e.g. $[ 0, 1 ]$) and for each data "0" they would send the 1's complement $[ 1, 0]$. Makes sense too.

Now I found a paper with yet another setup:

In the example station one has code $01$ and station two has code $10$. Station one sends $111001$ and station two sends $100111$. After CDMA code injection, station one transmits $010101000001$ and station two transmits $100000101010$. It should be noted that if these two transmissions are summed in the shared channel, the result is still a two-level waveform (=binary): $110101101011$! Demodulation is performed again by multiplying (=ANDing) the chip code and then OR-ing each bit. For example, station two would multiply/AND the received signal $110101101011$, and it with $10$ to get $100000101010$. OR-ing two adjacent bits gives the original sequence $100111$.

Questions:

Is #3 a valid CDMA modulation/demodulation scheme?
How does it relate to the setups #1 and #2 ?
How do setup #1 and #2 relate? (I would expect multiplication in $GF(2)$ is AND and addition is XOR ... but 2. is different)
How would setup #3 extend to code lengths $\gt 2$?
Why would someone use setup #3 and call it "CDMA" (instead of setup #2)? Do I miss the relationship to #2?

One one hand #3 would provide a more logical match with #1 because AND is a multiplication in $GF(2)$. However, addition would correspond to XOR instead of OR and I don't know where OR comes from.

On the other hand, I cannot make setup #3 work with codes that resemble normal Walsh matrices (e.g. $[ 1, 1 ; 0, 1]$. All that works are codes like $[ 1, 0, 0, 0 ; 0, 1, 0, 0 ; 0, 0, 1, 0; 0, 0, 0, 1]$. Yes, they are orthogonal but somewhat miss the point of CDMA: code spreading. They implement more time division.


texts: Investigating correlation for unequal signal lengths

texts:
I have measurements from two tablet sensors. The first sensor measures the touch pressure applied to the tablet and the second sensor is the acceleration of the tablet (in z direction). The sensor data are stored in csv files where the first column contains the timestamp (in milliseconds) and the second column contains the sensor data (either touch pressure or acceleration). I have uploaded the two sensors files:
https://1drv.ms/f/s!AlkQuYgB1McYgudFUrpMzMopUr2wVw

Now I would like to investigate if there exists a correlation between touch pressure and acceleration. I could just calculate the cross-correlation or plotting the pressure against the acceleration (and perhaps add a linear regression line).

The problem is that the acceleration measurements have a more or less constant sampling rate but for the pressure I have not a constant sampling rate. That means that the number of measurements for acceleration and pressure is also not the same (and the timestamps are therefore also not the same).

How can I still calculate the correlation and producing a accleration vs. pressure plot? I thought about a interpolation of the accleration measurements to the timestamps of the pressure readings but I don't know what type of interpolation to use (linear or cubic seems not to be right). Perhaps there is a better way of doing it.

Here are the plots of the two sensors:


texts: What is the output sequence of a Decimation filter

texts:
Consider x(n) as input, y(n) as output & h(n) as filter coefficient. The filter is of 16 taps(N=16) from 0 to 15. The decimation factor of the filter is 4.
When I apply x(n) to this 16 tap decimation filter with decimation factor 4, what is the output that i should get?
What is the general relation(give formula) between x(n) & y(n)?
Also, if you can simplify that formula by giving what y(0), y(1), y(2) will be in terms of x(n) & h(n).
This is the decimation filter using DSP 48 slice of xilinx


texts:
I am getting incorrect amplitude of my signal post FFT (90% error) and it does not improve after applying any of the window functions prior to FFT. After reading a number of articles, I believe FFT overlapping might improve the accuracy. However, I am not sure how to do it in Matlab. Please could anyone shed some light on that. I tried using spectrogram but I keep getting error on input X to be double precision vector.

Here is an example without performing FFT overlapping:

L = 1024; %signal length
Fs = 1000; %sampling frequency
t = (0:L-1)'/Fs;

NFFT = 2^nextpow2(L);
x = 11*sin(2*pi*250*t);

J = flattopwin(L);
JX = x(:).*J(:);

P= fft(JX,NFFT)/L;
M= 2*abs(P(1:NFFT/2+1));

f = Fs/2*linspace(0,1,NFFT/2+1);

plot(f,M)

The amplitude observed from the plot is approximately 2.4 at 250Hz which is much lesser than the actual amplitude, 11. Is there any reason for the significant reduction of the amplitude on FFT of a windowed signal?

Thank you.


texts: How to find bandwidth of a composite signal that can be decomposed into five sine waves with given frequencies and having all peak amplitudes same ?


texts: Frequency response of Low pass filter and High pass filter

texts: The transfer function of a Low pass filter is H(w). From this I want to develop a high Pass filter. I read in DSP by Proakis, Sec 4.5, that the high pass filter can be obtained by translating H(w) by  PI radians. I did not get how it will form a High Pass Filter? I think tt should form a Bandpass


texts: Binarization of image for varying background and foreground colors for OCR

texts:
I am trying to develop an automated OCR system for images obtained from the internet. The images mostly consist of computer generated text imposed on a background, so the OCR should produce near perfect results. However, the texts vary in color, and the background its imposed on can be of different colors too or even photos. The OCR tool often generates garbage when the colors are different enough, so I have to binarize the image properly, cleaning up the text content.

I found a promising article here, and implemented the algorithm using Python OpenCV. However, it seems to work poorly for most computer generated text. I also tried some local binarization algorithms, but they also fail to separate most text colors, like red on an orange background, the details being lost once converted to grayscale.

Is there an alternative image processing algorithm for this task ?


texts: Idea for Noise Level Estimation / Automatic Thresholding in the Presence of Peaks

texts:
I have the fft of some signal, and want a rough estimate of the noise level in order to choose an appropriate threshold for our peak detection algorithm. In general, the fft contains mostly noise with a handful of peaks (which are usually pretty high compared to said noise). For reference, I've attached a screenshot of a pretty typical fft:

Now to my proposed algorithm for noise level estimation, which is based on the following assumptions:

What i want is the mean and standard deviation of the fft
If the fft contained only (gaussian) noise, the median would be very close to the mean
Peaks shouldn't affect the median too much
The mean and standard deviation are independent of the order of the samples
Therefore i can sort the fft and still get the same result

So the resulting algorithm looks like this:

Sort the fft (ascending)
Calculate the mean and standard deviation of the sorted fft, but stop as soon as the mean exceeds the median
Use the calculated mean and standard deviation to choose the peak detection threshold
Profit?

I've tested this algorithm on some typical signals and the results seem to be pretty decent (keeping in mind that i don't need the exact noise level, but just something robust to choose an appropriate threshold). Sorting is a little expensive of course, but i don't expect the noise level to change too much, so i don't need to run it for every fft.

That being said, the algorithm itself feels kind of "wrong", because i don't ask the actual question "What would the mean and standard deviation be without the peaks?" but rather "What would the standard deviation be if the mean was X?".

So what are your thoughts on this?
Are there better algorithms for this kind of problem? (i bet there are)


texts: Estimating device height from 3-axis accelerometer data (possibly by supervised learning)

texts:
I'm trying to estimate the height of my device using an cheap integrated Freescale accelerometer.

First, I estimate the earth direction when measured acceleration is close to 1g, then I project the measurement on that direction and integrate twice.
Very quickly the estimated height drifts.

I was thinking maybe to use some machine learning algorithm, by feeding it aligned height from video tracking as examples.

Can you suggest algorithms that would help doing that?
Or any other way to make height estimation more precise?

Edit: Motion is known to be limited in a range of ±0.5m.


texts: Laplacian Operator with and without Diagonal Direction Elements in the Kernel

texts:
This is a general question on the laplacian operator, which has two different versions. The first version is :

\begin{matrix}
  0 & 1 & 0 \\
  1 & -4 & 1 \\
  0 & 1 & 0
 \end{matrix}

The second version includes the diagonal:

\begin{matrix}
  1 & 1 & 1 \\
  1 & -8 &1 \\
  1 & 1 & 1
 \end{matrix}
Including the diagonal direction will make the laplacian isotropic. But what exactly is isotropic? How would that affect the resulting image if the diagonal components are included? What happen if I don't include the diagonal components?


texts:
Please let me ask you about a phenomenon in DFT. Below DFT program outputs excellent results for low sample rates, but for high results are very bad.

Specifically: for sample rate 50 samples/sec, segment 1000 samples, existing frequency 36.7634 Hz, grid from 35.2364 Hz to 40.7896 divided by 40, outputs maximum magnitude squared 1.22629e+15 corresponding to testing frequency 36.7635.

But for sample rate 50,000 samples/sec, segment also 1000 samples, and same existing frequency and grid, outputs maximum magnitude squared 8.46881e+14 corresponding to testing frequency 38.2907 Hz. Error is 5 significant digits.

Are you aware of this phenomenon? If yes please explain me that.

// Grid is created by variables lowTestFreq and highTestFreq
// both of double type, and integer type M.

#include <iostream>
#include "math.h"

int main()
{
//Unchanged variables.
constexpr double pi = 3.141592653589793; //pure number.
int n = 0; // sample.
double xn = 0; //pure number.
double Re = 0; //pure number.
double Im = 0; //pure number.
double xn_cos = 0; //pure number.
double xn_sin = 0; //pure number.
double PowerSpectrum =0; //pure number. Name given by my dear dsp Teacher Mr. Lyons.

//Sampling frequency and samples of segment.
int samplFreq = 50000; // sample/second.
int N = 1000; //sample.

// 1st existing sinusoidal.
double ampl_1 = 70000; //pure number.
double existFreq_1 = 36.7634; // Hz.
double phase_1 = 0.67 * pi; // rad.
double unitAngle_1 = (existFreq_1 / samplFreq) * (2 * pi); // rad/sample.

// 2nd existing sinusoidal.
double ampl_2 = 60000; // pure number.
double existFreq_2 = 4505.75; // Hz.
double phase_2 = -0.37 * pi; // rad.
double unitAngle_2 = (existFreq_2 / samplFreq) * (2 * pi); // rad/sample.

// Testing grid.
double testFreq = 0; // Hz.
double testUnitAngle = 0; // rad/sample.
double testAngle = 0; // rad.
double lowTestFreq = 35.2364; //Hz.
double highTestFreq = 40.7896; //Hz.
int M = 40; // pure number.
int m = 0; // pure number.
double testFreqStep = (highTestFreq - lowTestFreq) / M; // Hz.

for (m = 0; m <= M; ++m)
{
testFreq = lowTestFreq + m * testFreqStep; // Hz.
testUnitAngle = (testFreq / samplFreq) * (2 * pi); // rad/sample.

Re = 0; Im = 0;

for (n = 1; n <= N; ++n)
{
xn = ampl_1 * sin(n * unitAngle_1 + phase_1)
   + ampl_2 * sin(n * unitAngle_2 + phase_2);

testAngle = n * testUnitAngle;
xn_cos = xn *  cos(testAngle);
xn_sin = xn * -sin(testAngle);

Re += xn_cos;
Im += xn_sin;
}
 std::cout << "Test Freq " << testFreq; // Hz.
 PowerSpectrum = Re * Re + Im * Im; //pure number.
 std::cout << " MagnSquared " << PowerSpectrum << std::endl;
}
return 0;
}


texts: I am reading the Digital Image Processing book by Gonzalez and i can't seem to understand Bottom-hat transformation. Can anyone explain it to me in easy terms?