texts:
I am currently working on a project in which I have a 10 x 2 matrix: A. I want to find the top 3 number of occurrences of each row using MATLAB.

 A = [ 1 2; 1 2; 2 4; 3 2; 3 2; 2 4; 1 2; 1 2; 5 8; 3 2]

In return I want to have:

[ 1 2 ], 4 times.
[ 3 2 ], 3 times.
[ 2 4 ], 2 times.

I have already tried hist3 and similar functions but couldn't get what I wanted.

P.S. My original matrix of statistics is very large (around 565000 x 2 double, depending on the image I analyze) and I am looking for around top 30 most occurred rows of it. In that case, I hardly believe if any loop based answer will cover it.

Edit: I have found the answer yesterday with the help of my professor.

What I have basically done is to set the range for hist3 on x and y axises. Let's say ( -5 : 5 ).

ctrs{1} = -5 : 5;
ctrs{2} = -5 : 5;
hist_A = hist3(A, ctrs);

Then by using sort function in descending format, I have calculated the occurrences and the indices of the elements of matrix A.

[hist_A_occurrence, hist_A_index] = sort(hist_A(:),'descend');

Finally, to pick the top 3 number of occurrences:

hist_A_index = hist_A_index(1:3);
hist_A_occurrence = hist_A_occurrence(1:3);

Performance:

It was able compute on A matrix, which is 563160 x 2, for the top 60 values in 0.147038 seconds with a Core i7 4th gen processor and 16gb ram.

The method is very quick, I hope this helps to the others.

Thank you all for the answers.


texts: Proof that spectrum analyzer measures mathematical Power Spectral Density

texts:
It seems to me the power spectral density (PSD) is defined as follows. Consider a signal $X(t)$ The windowed version of this signal is

Consider a signal $X(t)$. We defined a time-windowed version of $X(t)$ as

\begin{align}
X_{\Delta t}(t) = X(t)W_{\Delta t}(t)
\end{align}

Where $W_{\Delta t}(t)$ is a time windowing function. We will choose

\begin{align}
W_{\Delta t}(t) = \frac{1}{\sqrt{\Delta t}}\theta\left(t-\frac{\Delta t}{2}\right)\theta\left(\frac{\Delta t}{2} - t\right)
\end{align}

Where $\theta(t)$ is the Heaviside function. $W_{\Delta t}(t)$ thus windows $X(t)$ to the range $-\frac{\Delta t}{2} < t < \frac{\Delta t}{2}$ and scales by $\frac{1}{\sqrt{\Delta t}}$.

The Fourier transform of a signal is defined as

\begin{align}
\tilde{X}(f) = \int e^{-i2\pi f t}X(t) dt
\end{align}

I understand the PSD to be defined as

\begin{align} \tag{1}
S_{XX}(f) = \lim_{\Delta t \rightarrow \infty} \langle |\tilde{X}_{\Delta t}(f)|^2\rangle
\end{align}

Where $\tilde{X}_{\Delta t}(f)$ is the Fourier transform of $X_{\Delta t}(t)$.

My question is how to prove than the output of a heterodyne style spectrum analyzer approximates the power spectral density.

My understanding of such a spectrum analyzer is that it takes in a signal $X(t)$ which is mixed with a local oscillator signal $f_{LO}$. This mixing brings the component of the signal at frequency $f_{LO}+f_{IF}$ down to $f_{IF}$ where the mixed signal is passed through a narrow bandpass IF filter $\tilde{F}_{IF}(f-f_{IF})$. Here $\tilde{F}_{IF}(f)$ is a filter centered about zero frequency so that $\tilde{F}_{IF}(f-f_{IF})$ is centered about $f_{IF}$. The two steps of mixing + filtering can be combined into one step of passing the signal through an effective filter $\tilde{F}_{IF}(f - f_{IF} - f_{LO}) = \tilde{F}_{IF}(f - f_0)$ where $f_0$ can be tuned by tuning the $f_{LO}$

Finally after passing through the IF filter the total power in the signal is detected.

it then mixes it to an intermediate frequency $f_{IF}$ and then passes it through a narrow bandpass filter, $\tilde{F}_{IF}(f)$ and then detects the resultant power.

Let us define

\begin{align}
\tilde{F}_{IF,f_0}(f) = \tilde{F}_{IF}(f-f_0)
\end{align}

The output of the spectrum analyzer is then

\begin{align} \tag{2}
X(t) \rightarrow (X \ast F_{IF,f_0})(t) \rightarrow |(X \ast F_{IF,f_0})(t)|^2
\end{align}

Here, because the spectrum analyzer technically measures in the time-domain, I have shown the action of the IF filter as convolution with the filter impulse response $F_{IF,f_0}(t)$.

My question is how to show $(1)$ and $(2)$ end up being the same for measured signals. It is clear that they are intuitively very similar but I'm having a hard time showing their equality mathematically.

Here are my half-baked ideas towards a solution
I know that

\begin{align}
\tilde{X}_{\Delta t}(f) = (\tilde{W}_{\Delta t} \ast \tilde{X})(f)
\end{align}

This convolution in Fourier space due to the windowing in time is very suggestively similar to the "swept filtering" which comes from demodulating the signal with the tuned LO signal. It is clear that $W_{\Delta t}(t)$ is related to $F_{IF}(f)$. However, it seems tricky because in $(1)$ the convolution happens in frequency space while in $(2)$ the convolution happens in time space.

In a spectrum analyzer the averaging happens by taking the time average of the measured power, that is

\begin{align}
X_{sig}(t) \rightarrow \frac{1}{t_{aq}}\int_{t=0}^{t_{aq}} |X_{sig}(t)|^2 dt \rightarrow \langle |X_{sig}(t)|^2\rangle
\end{align}

where in our case $X_{sig}(t)$ is the output of the IF filter. Perhaps at this point I could assume $t_{aq} \rightarrow \infty$ to apply Parsevals theorem to get something like

\begin{align}
\int |\tilde{X}_{sig}(f)|^2 df = \int |\tilde{F}_{IF,f_0}(f)\tilde{X}(f)|^2 df
\end{align}

This is starting to seem close but it's still not quite the convolution that appears in $(1)$

Can anyone give me some direction on these mathematical manipulations?


texts: can I combine 2 raster with wavelet transform in R?

texts:
I Have same problem, i will combine 2 raster data with wavelet fusion

r1<-brick("mask data/r1_mask_black.tif")
r2<-brick("mask data/r2_mask_black.tif")


texts: convolutional deep Neural Networks for matrix

texts:
I have a  basic question about using convolutional neural networks. It's not my field but I'd like to read and understand about it.

What I know that convolutional neural networks is used for image processing, it means  that we have an image as input and then the output should be the equivalent of that image. I was wondering what's about if I have a matrix containing numbers and zeros as inputs as below example :

so, is it possible in that case to use the  conventional neural networks to detect each element and get the equivalent outputs?

For example, the order of numbers in every row in the above matrix should be changed, resulting 2^10 - 1  combinations. So I need to output to be 9 bits, which are 000000000 equivalent to first combination, and 000000001 equivalent to second, and so on till 111111111, and that should be for all rows too.

NP: I'm still at beginning of reading about that, if you have any link or videos explaining that in easy way (with Matlab is better than python), that will be appreciated.


texts: How to plot ROC curve for weka multilayerperceptron?

texts: I am working on an image classification project I use multilayerperceptron,how do I plot ROC curve.I use weka's perceptron.


texts: Relationship between signal rate, data rate, minimum bandwidth

texts:
I need to understand the relationship between bit rate, signal rate and minimum bandwidth. I read in a textbook that

  We define three cases for relationship between bit rate and signal rate for this, they are: the worst, best and average. Worst
  case is when we need maximum signal rate, best case is when we need
  the minimum. In data communication, we usually prefer the average case
  and the relationship between data rate and signal rate is

  $$S = c \times N \times \frac{1}{r} \quad\text{baud}$$

  where $N$ is data rate, $c$ is case factor, $S$ is no number of signal
  elements and $r$ is previously defined ratio.

I don't understand what the above formula signifies.

(i) $S$ is said to be the number of signal elements and not the signal rate, i.e number of signal elements per unit time. How does this then tell the relationship between signal rate and data rate?

(ii) What exactly is $c$ and $r$ in the formula?

(iii) Secondly, there's a formula given for calculating the minimum bandwidth  of a digital signal which is also exactly the same as the formula given above for the relationship between data rate and signal rate, i.e, $B_\text{min} = S = c \times N \times \frac{1}{r}$ . How does this same formula calculates the minimum bandwidth?


texts: What is the meaning of a inner system/transfer function?

texts:
In an academic paper I'm currently reading [1], the notion of an inner system is central. It is defined as follows

  A (linear) system $G$ (with $m$ inputs and $p$ outputs)
   is called inner if it satisfies $G^T (z^{-1}) G (z) = I_m$

Further along the article it is said that

  an inner function has all poles within the unit circle, and all zeros outside the circle.

which would mean that an inner function is always a (stable) non-minimum phase transfer function.
Are there other implications of the notion of inner function in terms of system characteristics? What does it truly mean for a system to be inner?

Thanks in advance.

  [1] Heuberger, P. S.; Van den Hof, P. M. & Bosgra, O. H. A generalized orthonormal basis for linear dynamical systems IEEE Transactions on Automatic Control, IEEE, 1995, 40, 451-465


texts: Unit impulse fourier transform confusion

texts:
I just saw this question.
What is the correct solution for Fourier transform of unit step signal?
But i cant understand how the 3d form is equal to the 1st one since de 1st one is purely imaginary and the 3d one is not.
Thanks


texts: Convolution of rectangular function with sinc function

texts:
I'm trying to create a rectangular function, defined between -0.5 to 0.5
I'm then convoluting it with a sinc function (using numpy.sinc) and plotting the convoluted signal alongside the original signal.
My objective is to find error between two signals and I'm expecting the error to go down if I increase the samples taken for rectangular and sinc function.
Now, since convoluted signal would be of different shape than the original function, I've constructed another rect function of same shape as convoluted signal and I'm using numpy.trapz to find squared error between the two.
Here's what I got so far
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal

fs=1000

# create the rect function
t = np.linspace(-5, 5, fs)
x = np.zeros(len(t))
x[abs(t)<0.5]=1
plt.plot(t,x)
plt.xlabel('t',size=15)
plt.ylabel('rect(t)',size=15)
plt.show()

# create the sinc function
sinc = np.sinc(t)
plt.plot(t, sinc)
plt.xlim(-5,5)
plt.xlabel('t')
plt.ylabel('sinc(fs)t')
plt.show()

# convolution with sinc
dx = t[1] - t[0]
convolved_signal = np.convolve(sinc, x) * dx
t_convolved = np.linspace(-5, 5, len(convolved_signal))
plt.plot(t_convolved, convolved_signal, 'r', label='convolved signal')
plt.xlabel('t')
plt.ylabel('xcap(t)')
plt.xlim(-5,5)

# recreate rect function according to the convolved output
x_sam = np.zeros(len(t_convolved))
x_sam[abs(t_convolved)<0.5]=1
plt.plot(t_convolved, x_sam, 'g', label='original signal')
plt.legend(loc='best')
plt.xlabel('t')
plt.ylabel('x(t)')
plt.show()

# squared sum for error
error = np.trapz((convolved_signal-x_sam)**2)
print("Error is="+ str(error))

Like I mentioned, I expect the error to go down as I increase the samples (fs), however, error increases with samples in the same proportion.
Am I doing something wrong?


texts: How do I reconstruct a covered-over part of a regular pattern

texts:
I have a set of images which consist of a fairly regular pattern - essentially a set of roughly concentric distorted ellipses - with a small area (<1% of the total image area) obscured by a circular disk. I'd like to be able, digitally, to reconstruct the part of the pattern which is hidden by the disk and produce an image which is 'complete', as it would look if the disk were not there.

Although the pattern is not completely regular (the ellipses are distorted and the centre moves around from image to image), it's pretty obvious to a human observer what the obscured part of the pattern would look like - one could draw it in with a pencil in a moment! I wonder therefore if there exists an image-processing algorithm which would enable me to do this automatically - for example, transforming the image into some suitable space that separates the circular disk from the rest of the pattern, filtering out the disk, then doing the inverse transform to reconstruct the image. Not being a specialist in this field, however, I don't really know what I'm looking for. Does anyone have any suggestions?


texts: Calculate amplitude in dB and dBA from audio signal

texts:
Progress
I'm a product developer so kind of light on DSP inner workings. I have captured an audio signal - 1024 samples at a time. What I want to know is the amplitude of the wave in dB, and in dBA.
dB
For dB, I've created a 10 deep circular buffer recording data every 100 ms, and averaging the maximum reading over the last 10 reading. Therefore my output looks less jumpy and is more human readable. To get the amplitude I just record the max and min of the signal and take the difference.

Q1: Is this the correct way (or a valid way) to get a dB amplitude from a sample? Analternative is to work out the running average and then do average RMS to get energy in the signal. But I don't think that really corresponds to the maximum audio sound level?

dBA
For dBA, I have windowed 512 captured samples with a flat-top window and done an FFT on the data. It all looks fine so far. ( I am resource constrained and can only fit 512 samples into my FFT).
Sampling at 44.1 kHz for standard audio, with 512 samples, I end up with 256 usable frequency bins of 86 Hz, 172 Hz, etc... up to 22 kHz. So far any corrections, please jump in.

Q2: How do I interpret this bin? As representing the band from 0 Hz to 80 Hz? Or as 80 Hz? Since the next step is to apply A-Weighting to the frequency measurements, I need to know what frequency to use.

A-Weighting: I've generated an A weighting table in code based on the values of the bins. In this case, 256 values for 86, 172 ... up to 22 kHz. Clearly the point is to add the weighing on to compensate for the human frequency response - which translates PSL to phons.
What is confusing me is that I have seen some formulae that suggest that the dBA measurement is done by taking only single measurements for each octave starting at a suitable low frequency i.e. 33.25 Hz. Then you create a table with 10 entries in it taking you up to 16 kHz and apply the A-Weighting to those. You basically do an antilog, average, log of the 10 values and bob's your uncle.

Q3: I have 256 bins, and I'd like to make best use of them for improved accuracy. The approach above would suggest that each entire octave contains an equivalent amount of energy for the averaging process. On that basis, if I were to average all 256 bins, the result would be heavily (and incorrectly) weighted towards the highest octave in my sampled set, since it contains half of the bins! Which approach is correct? Is there some magical reason that energy isn't distributed linearly across the frequency domain, albeit that we like to look at frequency in logarithmic scales.

Accepted Answer And Additional Detail
I have accepted @ZR Han 's answer as it succinctly provided the required information to solve the stated problem, deftly sidestepping the misdirection in the errant assumptions I originally made in the question.
Using the formula provided, the time domain approach works perfectly, yielding the answer in dB. I wanted to add that the 2nd order IIR cascaded 3 times with the coefficients taken from  jenshee.dk/signalprocessing/aweighting.pdf also works perfectly. I have tested this using a signal generator at various frequencies (old school I know) and the ratio is exactly 1 at 1 kHz, as expected for A Weighting. Problem solved.


texts: Sudden loudness changes producing unwanted noises?

texts:
What's that effect called? Is that one of the reasons for having attack and release parameters when implementing synths? And is there a generic method to avoid such sound artifacts?

Example: I have implemented a simple synth that uses a midi control channel to adjust loudness by applying the 128 discrete MIDI values directly to the generated audio signal. Whenever one touches the MIDI controller wheel, pretty nasty, scratch-like sounds get produced.


texts:
I'm doing autocorrelation (via fft) on pure, synthetic generated sinusoids and getting unexpected jitter in the results.  The jitter depend on where in the sine the signal buffer is started.  I get the correct results if I start the buffer at 0 and 180 degrees of a sine wave, and get the most error at 90 and 270 degrees.  I am padding with zeros after the signal buffer up to the next power of 2 above 2x-1 the signal buffer size.

I've been using scipy fftconvolve, as well as doing the auto-correlation with fft, multiply the results by it's complex conjugate, then inverse fft.   I get the same results both ways.   This makes me think I am not preparing my signal buffer properly or analyzing the autocorrelation function results correctly.

Below are two examples of autocorrelation of a 440hz signal.  The signal buffer the autocorrelator is analyzing is enclosed by the two vertical lines, approximately two and a half periods and 256 samples at 44.1khz sample rate.

In the first example, the buffer is filled with the sine starting at 0 degrees.  The result is 440.7 hz.

In the second example, below, the buffer is filled with the sine starting at 90 degrees.  The result is 453hz, a considerable error.

Any ideas on why the error is so large in the second example?


texts: Help required with BM3D Image denoising algorithm implementation

texts:
This is what I am doing and will be grateful for any help.

I selected 16 similar blocks to a reference block from a search block, put them in a 3D array, Wavelet Thresholded them, took inverse transform.
These 16 similar blocks belong to one 32 * 32 search block as mentioned above.
Now I should multiply each of these blocks with their weight, and then add them all up, creating a 2D array from a 3D array.
This new block then replaces all the 16 original blocks that I had selected before for hard thresholding.

Am I correct here? I will be absolutely grateful for a response.


texts:
Suppose you have k samples from each of the N elements of a uniform linear array (ULA) of sensors:

What is the physical meaning of a covariance matrix?
How do you form a covariance matrix with the samples?
How do you decide how many samples you need to use to form the covariance matrix?


texts: How to replicate/simulate experiments done on dsp kit 6713 without using hardware?

texts:
Due to covid, our university is now offering online classes to under grad students, even labs are conducted online.
But we are bit confused regarding evaluation? We make videos of demonstration of dsp kit 6713 and upload them to web and share their link with students.
But question is how we can evaluate / assess learning of students especially their ability of C programming to program DSP kit and especially in starting labs experiments for example switching on/off Led using dip switches available on dsp kit 6713.
It isn't practical  to deliver each student a dsp kit at home, please recommend other solutions!


texts: Finding linear chirp parameters from a low quality spectrogram, possibly with image processing techniques?

texts:
tl;dr: What is a fast way to get the equation of this line?

I have to extract the "line of best fit" from this data (shown below), and many others like it (so I need a robust method). It is a a spectrogram of a linear chirp. The x axis is frequency and the y-axis is time. The linear chirp came from a truck outputting 4-140Hz linearly over exactly 8 seconds, but attenuation in the ground and some other physical phenomena mean that we are seeing a signal for around 10 seconds.

I looked into using the Hough transform to find the gradient of the line, and then cross-correlating the data with a line of this gradient. But the Hough transform is too slow to perform en mass, which is what I need to do.

I thought about finding the maxima for frequency ranges (5-10, 10-15, etc.) and plotting a line of best fit through these, but in this particular example there are only two or three areas of strong intensity.

The other spectrograms look like this but the high intensity regions will move around to different points on the line, and some may have more noise.

Whats a good way of doing this algorithmically?

My current idea is:

Look for highest intesity regions.
Look at many pixels in their neighbourhood and estimate the "center of mass".
Draw line between them and find equation of line.

Is there a better way?


texts: what is the difference between $X(j\omega)$ and $X(\omega)$ notation

texts:
I am trying to understand Fourier Transform and Laplace Transform. What is the difference between  $X(j\omega)$ and $X(\omega)$ notation?

what is the meaning of $j\omega$ ? Is it represent frequency? If it is, what is the meaning of imaginary frequency?

Thanks in advance.


texts: Any Open Source Fast Wavelet transform libraries?

texts:
I am in need of an open source library for computing Fast wavelet transforms (FWT) and Inverse fast wavelet transforms (IFWT) - this is to be part of a bigger code I am currently writing.

The things I am looking for in the library:

1) Contains a good variety of wavelet families (Daub,Haar, Coif etc.)

2) Ability to run in parallel - VERY IMPORTANT

3) Reasonable documentation, so that I can include new wavelets of my own without having to modify the complete source ( Maybe an OOPS based approach would help?)

I am flexible about the language - C/C++/Fortran90/Fortran77/Python .... Any language would do for me, though I would prefer something which is optimized for speed and in parallel.

So far, I have found PyWavelets - it looks good, but it is in Python ( therefore considerably slow) and it doesn't run in parallel. I am going to use the DWT for processing really huge datasets, so speed is an important concern for me.

Its understandable there may not be anything with all the requirements I mentioned. But I wanted to hear from the community if they have any suggestions.


texts: Notations to Use in Formulating of Maximum Likelihood Estimation

texts:
The received
noisy signal $y_n \in \mathbb{R}$ is expressed as:
\begin{align}
y_n = \mathbf{h}^\mathsf{T}\mathbf{u}_n + w_n.
\tag{1}
\end{align}
$\mathbf{h} = [h_0,h_1,\ldots,h_{p-1}]^\mathsf{T} \in  \mathbb{R}^{1 \times p}$ of length $p$ which represents the impulse response of length $p$, and $\mathbf{u}_{n} = [u_{n}, u_{n-1}, u_{n-2},\ldots,u_{n-p+1}]^\mathsf{T}$  having variance $\sigma^2$. $w \sim N(0,\sigma^2_w)$ is the Additive White Gaussian  noise. $\mathbf{y} = [y_0,y_1,\ldots,y_N]$ and $\theta = [\mathbf{h},\sigma^2_w]$
I will be estimating the following terms of the model below using $y$. The estimation of the model is formulated as follows:
 \begin{align}
  z_n = {\mathbf{h}}^\mathsf{T}{\mathbf{u}_n}.
  \tag{2}
 \end{align}

I want to use a variable $z$ to separate what is known and unknown. Therefore, I have used $z$. But, if I use this new variable, the mathematical formulation should have the term $z$.
The condition pdf $\mathbf{y}$ given $\theta$ is given by
$P(\mathbf{y}|\mathbf{\theta}) =\prod_{n=1}^{N}\frac{1}{\sqrt{2\pi \sigma^2_w}}\exp(-\frac{(y_n -z_n)(y_n -z_n)^T}{2\sigma^2_w})$

My confusions are:

1) What notations to use for probability density function is it the one below:

$\mathsf{P}_y(y_n|{\mathbf{u}_n})$ or $\mathsf{P}_z(z_n|{\mathbf{u}_n})$
what goes in the subscript if I want to use $z$?

2) Is $P(\mathbf{y}|\mathbf{\theta})$ correct or $P_y(\mathbf{y}|\mathbf{\theta})$ or $P_z(\mathbf{z}|\mathbf{\theta})$?

3) If I want to use expectation maximization, then would $\xi$ which denotes the complete data set consisting of the input signal and the received noisy signal be written as:
 \begin{align}
 \xi &= \{u_0,\ldots,u_{N-1},y_0,\ldots,y_{N-1}  \} \tag{3}
 \end{align}
or
\begin{align}
 \xi &= \{\hat{u_0},\ldots,\hat{u_{N-1}},z_0,\ldots,z_{N-1}  \} \tag{4}
 \end{align}

4) Would the posterior be written as
\begin{align}
p_{\theta}(y_{1:N}|u_{1:N})p_{\theta}(u_{1:N})  = \prod_{n=1}^{N} \mathsf{P}_u(u_n|{u}_{n+1}) \prod_{n=1}^{N} \mathsf{P}_y(y_n|\mathbf{u}_n).
\tag{5}
\end{align}
 or
\begin{align}
p_{\theta}(z_{1:N}|u_{1:N})p_{\theta}(u_{1:N})  = \prod_{n=1}^{N} \mathsf{P}_u(u_n|{u}_{n+1}) \prod_{n=1}^{N} \mathsf{P}_z(z_n|\mathbf{u}_n).
\tag{6}
\end{align}
Please help what the correct notations are used to represent the pdf, likelihood, log-likelihood if I use the variable $z$ model.

Please point out any other mistakes as well. Thank you.


texts: how to extract 45 cycles from bunch of waveforms

texts:
I want to extract 45 number of cycles from the bunch of cycle which is similar to sine wave of varying amplitude. please help me to do so. in this picture i have capture only 45 cycles but i have continuous wave forms.i.e after each 45 cycles the signal is repeating.

thanking you,


texts:
If $x[n]$ is input signal, $y[m]$ is output signal, $h[m]$ is impulse response of the channel, then the following relation holds

$\lvert Y(\omega)\rvert = \lvert H(\omega)\rvert^2 . \lvert X(\omega)\rvert$

where $F(\omega)$ is the DFT of $f[n]$.

To verify this, I wrote following MATLAB code

x = randn(1,1000);
h = [1 2 3 4 5];
y = conv(x,h);
plot((abs(fft(h,1024)).^2).*(abs(fft(x,1024))));
hold on
plot(abs(fft(y,1024)),'r')

Result shows that second plot is at a much lower level than first plot. When I multiply second plot by $1024$ i.e. NFFT then both the plots overlap.

What is wrong with the original equation? I remember learning it that way in class.


texts: Appropriate channel bandwidth for my BPSK modulated Psuedo-Random code on direct conversion transceiver

texts:
My hardware is an analog device SDR+Xilinx FPGA (sdr = fmcomms4-ebz). The direct conversion transceiver (ad9364) has a tunable channel bandwidth of 200Khz - 56Mhz. I am employing BPSK modulation on a PRN code of 100K bits in length (repeats itself).My Tx Sampling rate is 6 Msps, thus the highest frequency present in my transmitted signal (barring harmonics) is 6Mhz.

My Questions:

1) According to Nyquist criterion the minimum bandwidth should be (Fs/2) where Fs is the sampling frequency. However, the main lobe of the BPSK spectrum is 2*Fs wide. Is my minimum Tx bandwidth 3Mhz or 6Mhz ?

2)On the Receiver side if I am oversampling by a factor of 2 (ie Fs_Rx = 2*Fs_Tx) should I adjust my Receiver's channel bandwidth to the sampling rate of the receiver or the transmitted signal? ie should my Rx channel bandwidth be equal to my transmitters channel bandwidth or double ?

3) Beyond the appearance of higher order harmonics and inefficient use of bandwidth, are their negative effects to using an arbitrarily large bandwidth for both my Tx and Rx nodes? (effects like ISI,RF interference)

EDIT 1:

Pulse shape currently using root raised cosine filter, however I am also testing unfiltered data i.e. rectangular pulses. How does this effect the bandwidth (i assume the root raised cosine would allow for lower bandwidth)

Inquiring about both (sorry I should have specified). My current understanding is that the required bandwidth at baseband is half that of passband. Is that correct?

Thanks !


texts: Bandwidth of time-varying harmonics of speech

texts: For speech signals, do the harmonics have a constant bandwidth above some threshold (arbitrarily, -6 dB  dropoffs)? Or does this bandwidth decrease with the upper harmonics? If this is not known, how can it be measured? (I could imagine one way would be find -6 dB dB points around peaks of a given frame of samples).


texts:
The following text is cited from a textbook, "Spotlight Mode Synthetic Aperture Radar: A Signal Processing Approach", I would like to ask if anyone knows the proof to the following statements, as the proof is not outlined in the book, and I am unable to prove it myself.

The function $f(t)$ is represents a pulse envelope waveform.

The effective duration of a pulse envelope waveform is given as:

$$T_{e}=\frac{\int_{-\infty}^{\infty}f(t)dt}{f(0)}$$

A corresponding measure of effective bandwidth of the pulse envelope waveform is given by:

$$B_{e}=\frac{1}{2\pi}\cdot \frac{\int_{-\infty}^{\infty}F(\omega )d\omega }{F(0)}$$

From the defining equation for the Fourier transform, the above measures can be shown to have a product which is constant.

$$B_{e}T_{e}=1$$

I have read elsewhere that the above is the time-bandwidth product. I have no idea what that means or what the physical significance of it is. Can anyone shed light on how the last statement can actually be proven? Thank you!


texts: What is the application difference between extent and solidity in image processing?

texts:
I've come across the image object properties, "extent" and "solidity."

Definitions are pretty straightforward to understand:
Extent of an image object is defined as area of the image object divided by the area of its bounding rectangle.
Solidity (convexity) of an image object is, area of the image object divided by area of its convex hull.

However, coming to think of these two properties in terms of the applicability, I can't seem to think how one would give an edge compared to the other. After a quick look-up of these terms, my thoughts are that solidity - as compared to extent - can be a good criteria of image object's roundness since the convex hull forms the minimum enclosing polygon around the object.

What other applications do these two terms have - in conjunction with each other or as building blocks for more advanced contour properties?


texts: Signal enhancing algorithm (deconvolution??)

texts:
I need an algorithm that will detect the correct peak location in a "signal" (actually a series of data points).
The signal is generated by a machine. The signal is nothing similar to an electrical signal (audio/radio frequency).

The data points could look like this: [1, 2, 1, 3, 4, 5, 4, 3, 2, 1, 13, 14, 15, 18, 23, 19, 17, 15, 15, 15, 14, 11, 9, 4, 1, 1, 2, 2, 1, 2]

I think we could imagine that the signal was accidentally passed through a low-pass filter, and now we want to restore it.

NOTES:

After a peak, if the signal is not coming down fast enough we can consider that there are multiple peaks (you can best see that in the 'red' signal at the end of the series).

One advantage on my side is that the whole data series is available (save on disk). So, the signal does not have to be processed in real time.


texts:
I know adding zeros will not increase the frequency resolution. I have couple of waveforms in time domain measured over months. I take the fft of the waveforms to find frequency components. The problem is I get several points around each peak, but only based on visual check i found that the real peak is not the one hit by discrete frequency points.

To shovel this, 1. I can add zeros to get finer structure so that the frequency points are more close to the real peak points.

My question is: I can perform the same procedure for all waveforms. But can I really compare the peaks identified with such zero padding so that I can get the conclusion about whether there is peak shift over time or not in terms of frequency.


texts: Suppose I have time series data at a one-minute resolution. Now I downsample data by taking mean of every 10-minute window, i.e., after downsampling, 60 readings will reduce to 6 readings. How should I show how good or bad my downsampling technique is? In a good downsampling technique, the downsampled sample should closely represent the original data.


texts: Why Is Non Linear Least Squares Method from MATLAB and Alglib Gives Different Results on the Same Data?

texts:
i'm trying to rewrite my Matalab prototype for some DSP to C++ and encountering a displeasing problem. I'm trying to fit data to a function $y = a * (\pi / 2 + arctg(b * x))$. In Matlab it works well with the following code:

fo = fitoptions('Method', 'NonlinearLeastSquares',...
                'Lower', [0, 0],...
                'Upper', [Inf, max(x)],...
                'StartPoint', [1, 1]);
[curve2, gof2] = fit(x,y,ft);

In curve2 I get a and b coefficients, which are pretty well.
I try to reproduce this in C++ with Alglib's lsfit using Levenberg–Marquardt algorithm:

alglib::real_1d_array y, c;
alglib::real_2d_array x;
... // filling x and y arrays with data
c = "[1.0, 1.0]";
alglib::ae_int_t maxits = 0;
alglib::ae_int_t info;
alglib::lsfitstate state;
alglib::lsfitreport rep;
alglib::lsfitcreatef(x, y, c, 1e-4, state);
alglib::lsfitsetcond(state, 1e-5, maxits);
lsfitsetbc(state, "[0.0, 0.0]", "[+inf, 5.0]");
alglib::lsfitfit(state, func);
lsfitresults(state, info, c, rep);

At the output (c) I get completely different coefficeints which are doesn't have any correlation with the same from Matlab.

x and y are the same in Matlab and C++ program. The only difference I see is the optimization algorithm: in Matlab I use trust-region method when in C++ I use Levenberg–Marquardt algorithm.

Could you explain me that strange behaviour?


texts: Rectangular Pulse Train and Sinc Function

texts:
I wanted to ask that in frequency domain the rectangular pulse is a sinc function, so is this sinc function periodic or aperiodic?
Also if signals that are continuous in time domain then they are aperiodic in frequency domain?


texts:
I am trying to convert some raw unscaled I/Q sample data back to the original input data. I've been reading a lot of different posts and articles in I/Q demodulation and the focus is almost solely on the process of combining the two separate I and Q pieces on the transmitter side into one and then separating them again at the receiver side. I haven't found any helpful documentation on how to do the final piece of this.

A lot of programs exist that output data directly in an I/Q raw format. In my case, I have 16-bit signed integers in the format of $i[0], q[0], i[1], q[1], ...$ . Presumably, the signal originated from a binary output on the transmitter end. After the first demodulation part, the separation of the I and Q values on the receiver end, what final steps are needed to complete the cycle back to that input binary value?

I realize this is most likely extremely simple, especially after all of the math that had to be done to get the two waveforms back from the single RF one. Nevertheless, I have yet to find a decent explanation of this final process.


texts: Advancing a causal IIR filter's impulse response

texts:
Given an infinite impulse response (IIR) filter as coefficients in a topology of your choice, what is a straightforward way to modify the filter so that the impulse response is shifted in time (advanced) by one sample to the left, discarding the sample that would make the filter non-causal?

Or is it necessary to modify the impulse response and solve the new coefficients from scratch?

(I asked this question because I wanted to know if it's possible to snip away, with a time shift, an arbitrary number of the initial samples of an IIR filter's impulse response without increasing the filter's complexity.)


texts: Is the Sobel filter a high pass filter, and if not, what is the difference between them?

texts:
I am an artist with an interest in signal processing. I realize that maybe this question very basic, but the web banner on the frontpage says "anyone can ask", so I assume that means beginners too.

I have been trying to wrap my head around the terminology related to unsharp masks, high pass filters, the Sobel filter, etc.

According to my understanding unsharp masks use a high pass filter. The high pass filter helps define areas of transition in pixel value. This also has the effect finding edges. The pixels which are next to pixels brighter than them get darker, and the pixels which are next to pixels which are darker than them get brighter.

A friend of mine mentioned the Sobel operator was used for edge detection. I understand the basic idea of the Sobel operator as being the image treated as a grid. A matrix is the math term I see used often. According to him, the Sobel operator finds edges by applying a darkening or lightening effect based on the pixels around it. This sounds very similar to the unsharp mask's use of a high pass filter.

When I look online I don't see Sobel techniques referred to as high pass. I see pages like this that explictly list out Sobel separate from high pass filters.

But then I find published research papers which describe sobel edge detection filters as being a kind of high pass filter.

To me, my friend's description of the Sobel method sounds a lot like the descriptions I find of the high pass filter. My friend says they are different and I'm not sure I understand how?

EDIT:

I think I need to clarify my question, since it's sort of a multipart question:

My questions are:

1) Is the unsharp mask using a high pass filter? Not IS it a high pass filter, but if it uses one.

2) Is the Sobel filter a high pass filter?

3) If it is, then what's the technical difference between the definition of the Sobel as a high pass filter and the high pass filter used in a digital unsharp mask?

I understand that digital unsharp masks are not high pass filters, but they do use them according to the signal processing pages I found.


texts: According to the literature, zero mean noises are those whose expected value is zero. But what does this mean in the context of images. Let us consider grayscale for now. The intensity values ranging from 0 to 255. The noise will also have values between 0 and 255. How can then the mean be zero?


texts: Downsample: resample vs antialias fitlering + decimation

texts:
I have a discrete signal sampled @Fs. I need to downsample it to Fs/k. Main reason is to reduce signal bandwidth and speed up computation : I'm only interested in a reduced bandwidth < Fs/2k. Some high frequency noise >> Fs/2k can exist : antialiasing is needed.
From what I understand, I have several options :

brute force : decimation (without taking care of aliasing problem!)
antialiasing + decimation : I can use for example numpy
decimate function
frequency approach : FFT then truncation then IFFT, can be done
    using resample

Only solution 2- 3- help solving antialiasing issue.
3- filters in frequency domain, supposing signal is periodic. 2- filters with IIR/FIR filter.

I can always use decimate without questioning, but I would like to precisely understand limitations behind. What are drawbacks / advantages of using solution 2- versus 3-?
Do you have some practical guidelines about downsampling? Some recommendations?


texts: Does windowing affect Parseval's theorem?

texts:
I have computed Fourier transform from ecg data.It does obey Parseval's theorem,
relation

$$\sum_{n=0}^{N-1} \Big| x[n] \Big|^2  = \frac{1}{N}  \sum_{k=0}^{N-1} \Big| X[k] \Big|^2$$

is fulfiled. But after I use window function (Blackman,Hann,Hanning) energy is not conserved anymore.Is this normal? If not,how can I normalize my windowed fft?

I calculate fft this way:

    N = signal.shape[0]
    frq = np.fft.fftfreq(N,freq)
    frq = frq[range(N/2)]
    window = window_func(N)
    fft_y = np.fft.fft(signal*window)/np.sqrt(N)
    fft_y = Y[range(N/2)]
    plt.plot(frq, abs(fft_y))

And thats how it look when I plot. I'm a little worried about how almost all windows drastically reduce amplitude,again is this normal?

Thank you in advance for all help.


texts:
I'm trying to figure out how to implement a continuous EQ filter.  I have in the past built a parametric EQ and then built a 10 channel EQ using 10 of these parametric filters.  This gave nice results.

However I'm now trying to create a continuous EQ filter.  Is this possible with a parametric EQ?  By selecting the Q factor, perhaps?  If so how would I fit the Q factors to the curve?

Failing that is there another better way to implement continuous EQ?  Could it be implemented from an FFT by extending the magnitude of each r,i bin based on the curve?  Or would this produce rather nasty EQ'ing?

Any thoughts appreciated.

Edit: To answer the comment and add a bit more.

I've been experimenting with trying to define an FFT filter.  Basically I define an arbitrary curve.  The curve defines dB increase or decrease.

I'm currently building my own FFT by looking up the y intercept on the curve for each frequency bin. (Well i'm converting from dB to a multiplicative factor).

Then, later, I'm FFT'ing a block of audio and then I'm multiplying it by the values in the "filter" FFT.  When the multiplicative factor is purely 1 then I get the audio passing through fine.  As I increase the multiplicative factor for a given bin I get a nasty crackling (though I do hear the correct frequency boosted).

Surely there must be a way of doing this in the fourier domain.

Btw, please don't give me matlab functions unless you can explain how they work because I'm trying to implement this on a mobile device so I can't use matlab.


texts: I am using Matlab to take the FFT of a series of pulses. Can anyone explain why there are multiple humps at high frequencies rather than a smooth roll-off?


texts: FFT algorithm gives wrong signs on my output numbers

texts:
I was told from another stack exchange (stackoverflow and computer science stack exchange) to post here - so hopefully now i can get some help from people who understand the algorithm, but if this is off topic here then i am kinda running out of places to ask....
I wrote my own FFT algorithm to learn it - but i am getting a different result to what i was expecting (correct numbers but wrong signs), but i cannot figure out why.
I am hoping some one here who has a good understanding on the FFT algorithm can understand what i did wrong, i currently suspect its my twiddle factors - but i am not sure at this point...
Firstly i precompute all the twiddle factors and indices. The twiddles are calculated like this:
        for (int stage = 0; stage < _passes; stage++) //log(N)/log(2)
        {
            for (int i = 0; i < _N; i++) //N = 2^n
            {
                //wing span, 2^1, 2^2 etc
                float span = pow(2, stage+1);
                float k = (i * _N / span) % _N;
                float a = pi2 * k / _N;

                //iFFT uses complex positive coefficients: exp(i*2*pi*k/N)
                Vector2 twiddle = new Vector2(cos(a), sin(a));

                //FFT uses complex conjugate: exp(-i*2*pi*k/N)
                Vector2 twiddleConj = twiddle.ComplexConjugate();

                int arrIndex = stage * _N + i;
                _twiddlesR[arrIndex] = twiddle; //inverse array
                _twiddlesF[arrIndex] = twiddleConj; //forward array
            }
        }

This was the output for N=4:
  First stage:
  [0] + (1+0i)[2]
  [2] +(-1+0i)[0]
  [1] + (1+0i)[3]
  [3] +(-1+0i)[1]
  Second stage:
  [0] + (1+0i)[2]
  [1] +  (0-i)[3]
  [2] +(-1+0i)[0]
  [3] +  (0+i)[1]

I ran the FFT with this code:
for (int stage = 0; stage < _passes; stage++)
{
    for (int k = 0; k < _N; k++)
    {
        PerformFft(stage, k);
    }
}

My FFT function:
    private void PerformFft(int stage, int k)
    {
        int arrIndex = stage * _N + k;
        Vector2[] twiddleArr = _isForward ? _twiddlesF : _twiddlesR;
        Vector2Int twiddleIndex = _twiddleIndices[arrIndex];
        Vector2 twiddle = twiddleArr[arrIndex];

        //ping pong between two read/write arrays by checking if stage is even or odd
        Vector2[] writeArr = stage % 2 == 0 ? _complexArr2 :_complexArr1;
        Vector2[] readArr = stage % 2 == 0 ? _complexArr1 :_complexArr2;

        Vector2 complexA = readArr[twiddleIndex.x];
        Vector2 complexB = readArr[twiddleIndex.y];

        Vector2 result = complexA + complexB.ComplexMultiply(twiddle);
        writeArr[k] = result;

    }

For the output i get the correct numbers but i get the wrong signs, here is some data:
Input:
0 + 0i
1 + 0i
2 + 0i
3 + 0i
Forward FFT Output:
6 + 0i
2 - 2i
2 + 0i
2 + 2i

But according to this FFT calculator i am close to the correct answer but the signs are wrong: https://scistatcalc.blogspot.com/2013/12/fft-calculator.html
Can any one see what logic mistake i am doing here? Been stuck on this for a week so far.


texts: How does a digital filter $H(z)=1/(1-z^{-1})$ change a continuous rectangular pulse?

texts:
I inputted the following signal

in this discrete time filter

and got this output

Could anyone explain how ? Also how does a discrete filter process a continuous time output ?


texts:
I read that the noise reduction of a moving average FIR can be expressed as the square root of N where N is the length of the filter.
How do you prove? I can't quite get it.


texts: Can a Fourier Transform exist even if the j$\omega$ axis is not in the Region of Convergence in it's Laplace Transform

texts:
A couple of confusions have been occurred. The Signal I'm considering is f(t) = sin(t)*u(t)

Fourier Transform of it can be derived.
$-i \pi  (\delta (\omega -1)-\delta (\omega +1))$
According to my mathematica code, the ROC of LaplaceTransformation didn't have the j$\omega$ axis in it's region of convergence.( Re{s}>0 )

So it's not stable. (Makes sense. sin(t) is not absolutely summable)
https://www.wolframcloud.com/objects/ramithuh/Published/misc_sin_laplace.nb

So, can a Fourier Transform exist even if the j$\omega$  axis is not in the Region of Convergence in it's Laplace Transform?

Things got worse when I considered f(t) = sin(t). It's Laplace Transform Integral didn't converge. So considering sin(t)*u(t) and sin(t)*u(-t) separately, I got two different ROC which doesn't have an overlap. Re{s} > 0 and Re{s} < 0. So it means that the Laplace transform of Sin(t) doesn't exist right? Initially what i thought is Laplace Transform can cover all the signals which FourierTransform covers.
Turns out it's not the case?

Please point out in which step of my reasoning is wrong...

Thanks a bunch! :)

Update: Thank you for pointing out my mistake. :D
$ \mathcal{F(sin(t)*u(t))} = -\frac{1}{2} i \pi  \delta (\omega -1)+\frac{1}{2} i \pi  \delta (\omega +1)-\frac{1}{2 (\omega -1)}+\frac{1}{2 (\omega +1)}$


texts: what is the reason for the result that has been obtained from the DFT of the signal of these two images. The first image is a DFT analysis of a physical signal u which has a time history shown below sampled at a 1000Hz the second image is the square of the signal u which has a time history shown in the image after the time history of u


texts: Is there any relationship between the convolution and cross-correlation of two signals?

texts: There are two square 2-D signals with the same size $m \times m$, if the result of convolution of those two signals is first picture, And the result of cross-correlation of those two signals is second picture.How to prove it in mathematics?


texts: Reading about complex signals, I learn a phasor is composed of real and imaginary components as $e^{2\pi j \cdot \omega}$ and $e^{2\pi ⁻j \cdot \omega}$. Why is this? How can a signal be imaginary?


texts: Should correlation diminish during Kalman smoothing phase

texts:
I am using a fixed-interval (RTS) 2nd-order linear Kalman smoother to filter/smooth skin marker data. The filter works very well. I am just trying to gain some more insight/comfort with how a Kalman filter/smoother is supposed to work. During the filtering phase, the correlation coefficient (derived from the entries of the state covariance matrix: Pearson correlation coefficient) between pos/vel and vel/acc remains high (above 0.8). However, in the smoothing phase, this correlation drops dramatically. Is this expected?
To clarify, my state variables are position, velocity, and acceleration. What is being measured is only position. I understand that the variance of the state variables should decrease during the smoothing phase, and indeed this does happen in my case, but I was curious about the correlation between the state variables.


texts: Finding specific spots in an audio signal

texts:
In theory, how would one process an audio signal to find the spots marked in the linked picture below.

Mel Spectrogram

Unfortunately I am not really conform with signal processing and could not find any fitting solutions while looking for similar problems.
I have read a lot about signal processing but might have looked in the wrong places.

Currently, my idea would be: windowing over the signal, applying FFT to each window and check if the frequency/signal strength exceeds a certain value. I am not quite sure if this would work out, plus it seems rather ineficcient.

Can anyone point me in the direction of where to begin and how to identify these spots?


texts: Inter Symbol Interference (ISI) / Equalization in Digital Signal Processing

texts:
I am studying the OFDM system and before to start I have decided to study the main concepts of modulation. And I have spent yet a lot of time to understand the concept of an equalization to reduce ISI.

I have found so many lectures and ppts, which provide and explain that. But it doesn't make sense for me.

What I understand, that the equalizer is a digital filter, that should be applied after receiver part. Is it right? And it reduces the ISI. A zero-forcing equalizer reduces the ISI complete.

But I can't find more detailed information about how the equalizer reduces the ISI. What is a principle of this type of the digital filter/ equalizer?

What is mean in this picture?

In OFDM DFT and IDFT work as an equalizer, sampling...

One more question: What is a role of a pulse shaper?


texts: What exactly is a 90 degree phase shift of a digital signal in FM demodulation appraoches?

texts:
I am working on an FSK demodulator (1200/2200Hz, 1200 baud) featuring a 90 degree phase shift operation. I don't exactly understand what 360 degrees mean for a digital signal.

My sampling frequency is 8 kHz. Is a 90 degree shift a delay by 8000/4 samples, or is it a delay by 4000/4 samples?


texts:
Anyone know what algorithm the Spice AC Noise Analysis uses?

http://vision.lakeheadu.ca/eng4136/spice/noise_analysis.html

Is it some spectral modeling synthesis? I.e. that it estimates the main signal using peak detection and subtracts those from the signal in order to get the noise?

https://en.wikipedia.org/wiki/Spectral_modeling_synthesis


texts: Are two jointly stationary white noise processes independent?

texts: I am currently dealing with a problem concerning beamforming, where two "jointly stationary zero-mean white noise processes" form the input of an adaptive system. One of those processes resembles the actual signal $s[n]$, the other is an interference signal $v[n]$. Is it clear from the stated definition above that they are independent from each other, i.e. $E(XY)=E(X)E(Y)$? Why?


texts: I'm trying to determine the processing time required to perform a FFT of length 500,000 on a Raspberry Pi in C/C++. I have had difficulty finding any information that would be useful for determining this. How would I go about doing this?


texts: Where does the delta function come from if we derive autocorrelation directly?

texts:
I am reading a book "Creating Noise" written by Hollos & Hollos and have a question about the autocorrelation function of the Gaussain white noise when reading the following passage:

From the theorem that the autocorrelation and psd are Fourier transform pair and the fact that psd of Gaussian white noise is $\sigma^2$, it is obvious that the autocorrelation of Gaussian white noise has a delta function $\delta(\tau)$ as formulated in (6). So at $\tau=0$, what we have is a pulse of inifinite amplitude. But if we derive the autocorrelation directly, as does the book in the passage, we only have $R(0)=\sigma^2$ which is a finite number, instead of an infinite pulse. I believe the autocorrelation result having a delata function is correct, but the direct derivation of it looks correct too. Being not able to find out where the mistake is, I am curious where the delta function $\delta(\tau)$ comes from if we derive the autocorrelation $R(\tau)$ directly from its definition. I wish you can give me some help with it. Thanks a lot.


texts: Effect of noise on high and low frequency components

texts: It is given that noise is present in the noisy image in the form of high frequency components. Can any one please explain this concept. Also please tell me that whether it is correct to say that "effect of white Gaussian noise is more on high frequency part of the image as compared to low frequency components" or not.


texts: Modulation classification via demodulation confidence?

texts:
I'm not sure if this is the right place to post this question, but will try anyway :-)

I recently started reading up on the field of automated modulation classification (AMC) where an algorithm tried to classify which modulation scheme an RF signal is using (eg BPSK, QPSK, etc..). Some if the common approaches include higher order statistics, deep neural networks, etc...

My question is, at least for digital modulation schemes with constellation diagrams, why cant this problem be solved by a very simple solution: try decoding the signal using various modulation schemes and see which gives you the most confidence. Confidence can be measured by something like mean distance to the closest constellation point of that scheme.

I realize that this may not be the fastest solution to the problem, and it cannot easily be applied to analog schemes (e.g. FM), but would it at least work? What would be its biggest issues?

Thanks

(PS: my background in not anywhere close to digital communications, so forgive any ignorance)


texts: get amplitude difference via cross correlation?

texts:
im currently comparing 2 signals:

A = some music
B = A + noise

and ive implemented cross correlation in frequency domain via complex multiplication to determine the time offset, which works perfectly so far.

Now what i need in addition to the time offset is the amplitude offset, means a faktor by which A should be scaled to match the amplitude of A contained in B.

Ive been given advice to do this i have to multiply my A by the cross-correlation peak but heres my problem: my peak is NOT as expected between -1 and 1 but much higher (e.g. ~300). (even though it shows the time offset perfectly)

So here are my questions:
am i missing some normalization of my CC values?
what exactly is the difference between normalized CC and "normal" CC.
what is the best way to get the amplitude factor?

Thanks!


texts: Does Circular Convolution Correspond to Periodically Expanded Linear Convolution?

texts:
I have a question whether circular convolution and periodically expanded linear convolution corresponds in following case or why it does not?

Think about a signal $x[t]$ and a signal $y[t]$ both of length $N$.
We expand the singal $x[t]$ periodically to a signal $x'[t]=[x[t],x[t]]$ with length $2N$. We zeropadd the signal $y[t]$ to a signal $y'[t] = [y[t],0]$ to obtain the same length $2N$.

My question is does the circular convolution result $(x[t] \star y[t] )_{mod_N}$, correspond to the bins $[N...2N]$ in the linear convolution result $x'[t] * y'[t]$?

Best


texts:
The double-density DWT is an improvement upon the critically sampled DWT with important additional properties: It employs one scaling function and two distinct wavelets, which are designed to be offset from one another by one half,
I wonder why double density DWT uses two HPF with offset 1/2 insteed of one HPF in DWT?
what he mean with offset from one another by one half?
how it impoved the lack of shift invariance?


texts: Was Studying a dsp design recently with many decimation and interpolation filters, and was wondering if there is a recommended book specifically on the subject of multi-rate dsp?  Preferably a book with worked examples and exercises at the end of the chapter.


texts: Constructing a tone through additive synthesis

texts:
This question follows from: Synthesizing harmonic tones with Karplus Strong

I am attempting to generate a full soundbank of 88 notes.

As far as I can see my three options are:

Using samples
Using something like Karplus Strong (as linked above)
Synthesising each harmonic and combining them

(1) does not give much flexibility and (2) is difficult: to gain any kind of control requires a sophisticated level of understanding of control systems, and I don't have any training. I've been looking through an online MIT lecture series, and I'm daunted. This would take me months or even years to understand.

One disadvantage of (3) is that it may not handle real-time composition as well as (2); it may be heavier to process. For me that's not a problem, I don't need real-time.

I think (3) should be much easier than (2). It should be possible to construct a formula for the amplitude A(t) of a particular harmonic.  But I imagine there must be some science of shaping these harmonics; I'm sure many people have experimented with this, and there must be publicly available literature.

And I'm guessing there are some techniques for improving the quality of the sound, for example maybe giving some A * exp( kt ) sin( wt ) wobble to each harmonic, and maybe a note that is struck louder could have a correspondingly higher value for A.

etc.

So my question is: what is the parameter space? i.e.  what are the best things to tweak?

Links to relevant resources are gratefully received!

π

PS please note that I'm not after any particular timbre, certainly I'm not try to emulate a piano, I'm simply after a harmonic tone that is pleasing to the ear.


texts:
While Im studying wavelet transform, I have this questions in my mind which can't find it's answer:

I understand that when we take longer time windows and take the fourier transform we would suffer in the time resolution, But Why if we take a shorter time window we would suffer in frequency resolution?
why longer time intervals are   needed for high frequency signals? and shorter time intervals are needed for low frequency signals? In another word, Why we want good frequency resolution for high frequencies and good time resoution for low frequencies?
If I have a signal contains frequencies from 0 Hz to 50 Hz, How can I define the range of low and high frequencies?


texts:
I have the function $$(1-e^{-2n})u[n-1]$$ where $u[n]$ is the step input.

I want to find the $z$-transform for this function. I know that the transform of $1-e^{-2n}$ will be $$\frac{z}{z-1} - \frac{z}{z-e^{-2}}$$ Now do I shift each element by one unit to the left to get the entire $z$-transform?


texts: System Identification using LMS Adaptive Filter

texts:
I just have a question about using an least-mean-squares algorithim adaptive filter for system identification. Consider the following

I am told that as the error converges to a small value, the adaptive filter coefficients w[k] will indeed repersent the unknown system h[k]. Now, that doesn't make sense to me since the n[k] is being used in the error calculation.

Won't the adaptive filter coefficients w[k] now repersent the unknown system coefficients h[k] AND the noise n[k]?


texts: Design of efficient digital interpolation filter

texts:
I came across this paper entitled "Design of Efficient Digital Interpolation Filters and Sigma-Delta Modulator for Audio DAC" where the author oversamples an input frequency, fsig = 1kHz with ratio L = 128 and update frequency, fsi = 64kHz. The interpolation filter specification is given by:

passband ripple = 0.001dB for frequency <0.45*fsi and
stopband attenuation = 174dB for frequency > 0.55*fsi.

For two-stage system using IIR Butterworth:

L1 = 2 and L2 = 64, how to get filter order of N1 = 77 and N2 = 21 respectively?
L1 = 16 and L2 = 8, how to get filter order of N1 = 120 and N2 = 7 respectively?


texts: How can I generate a sine and cosine function using an exponential function?

texts:
I have been trying to generate sine and cosine sampled graphs by a given sampling frequency.

fc = 4092; % Carrier frequency Hz

fs = 16368; % Sampling freq Hz
ts = 1/fs; % Sampled time

nn = [0 :4091] % Array with numbers from 0 to fc

y1 = exp(i*2*pi*fc*ts*nn); % Exponential equation

cosine = real(y1);
sine = imag(y1);

subplot(2,2,1);
plot(cosine);
axis tight;
grid on;

subplot(2,2,2);
plot(sine);
axis tight;
grid on;


texts: Fast algorithm for the MATLAB's $\tt impz$ function?

texts:
Does anybody here know what is the code algorithm behind the impz function?
I know it uses the recursive algorithm but how is such implemented in impz that it can get the impulse response of very high $N$ and $M$ orders (numerator and denominator coefficients)?

I can make a script that gets the impulse response of a second order LCCDE (linear constant coefficient differential equation) but I want to know a GENERAL code that can get the impulse response of any LCCDEs regardless of their order.


texts: How to extract text from a scanned document?

texts:
The task I am facing is extraction of rotated text (any angle) from a scanned image(attached Image). The image contains a blue sticker on it and need means in extracting the text (printed text) from it. The pattern of the sticker will remain the same for all the time.

As you can see the orientation is not stable and i would be really grateful if anyone could suggest a manner in which i could extract the text.

Reference to the question can be found here, or the technique How to remove text region in a document image? or extract image from a document image

Thanks


texts:
I have a single channel audio recording. I want to simulate the stereo recording when it is (hypothetically) played on a speaker in front of stereo mics (distance between them - say 10 cm).

Are there any tools which can do this?

Edit- I am looking for something more precise - as in for specific distance between speaker and mics and also for given room dimensions. I tried Audacity 'Reverb tool' which sort of does stereofication but there is no way to specify certain distances (speaker-mic, mic-mic etc.)


texts: Does it matter if the scaling term is in the DFT versus the inverse DFT?

texts:
From Wikipedia, the equation for the 1D DFT is

From a separate source, the equation for the 2D DFT is

Notice how the 2D DFT definition features a scaling term while the first definition does not. Is this just an artifact of where the scaling takes place between the DFT and inverse DFT? Does it matter which transform contains this scaling term?


texts: MATLAB - remove the frequency at zero in FFT

texts:
I am getting a high frequency at 0Hz. How can I remove it? I am not supposed to get it.

My code is

W = 3.64*2*pi;

Fs = 50;                      % Sampling frequency in hz
T = 1/Fs;                     % Sample time
L = 1000;                     % Length of signal
t = (0:L-1)*T;                % Time vector
v = 113*(1+0.40*sin(W*t));

theta0 = 12*(pi/180);         % in radians for 12 degree
theta1 = 6*(pi/180);          % in radians for 6 degree
theta = theta0-theta1*sin(W*t);

Lift = 0.5*1.225*v.^(2)*(2*pi).*theta;

NFFT = 2^nextpow2(L);         % Next power of 2 from length of Lift
Y = fft(Lift,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);

subplot(2,1,1);
plot(Fs*t,Lift);

subplot(2,1,2)
plot(f, 2*abs(Y(1:NFFT/2+1)))


texts:
I am reading this paper about speech enhancement using a minimum mean square error short time spectral amplitude estimator for our speech enhancement project. Basically in the paper they mix a clean speech with noise and try to recover the clean speech.

The paper keeps mentioning a priori SNR and a posteriori SNR. I am confused by what does it mean. A priori SNR is the SNR from before the mixing? But that can't be right. If we knew the clean speech signal from the beginning this exercise would be pointless.

This is the paper if you are wondering:
Y. Ephraim and D. Malah, “Speech Enhancement Using a- Minimum Mean Square Error Short-Time
Spectral Amplitude Estimator”, IEEE Transactions on Acoustics, Speech, and Signal Processing, Vol. ASSP-32,
No. 6, Dec. 1984.

thanks


texts:
I am having difficulty in understanding the use of CSP for EEG signal feature extraction and subsequently. Since I am using two classes, this query will be restricted to it.

In essence CSP requires 2 classes of trial data, i.e C1, the covariance matrix for class 1, and C2, the covariance matrix for the second class, for calculating W, the spatial filter matrix, using eigenvectors/eigenvalues. Following the procedure the log variance is calculated.
This is useful during the training phase.

However when I conduct a trial, it will belong to either C1 or C2. I cannot calculate the CSP for this particular trial.

How are features of the EEG Signal extracted then?

I am not too sure if this is the correct forum for asking this question. I apologise in advance. Please suggest the correct forum for the same.


texts: Please can anyone address me to routines (possibly for MATLAB/Octave) to identify system poles and zeros from its Bode plot (magnitude+phase)? I am aware there are functions for system identification included in the Control toolbox/package, but these seem to operate on time responses (e.g. step response) instead of Bode plots. How do they perform in terms of accuracy? Thank you.


texts:
I have $n$ discrete samples of a seismic signal $y[n]$:

I want to find local maxima in the signal.

A naive test for if $y[n]$ is a maximum would be:
$$y[n]: maxima \textbf{ if } y[n] > y[n-1] \textbf{ and } y[n] > y[n+1]$$

However the maxima are probably located in between samples, e.g. there may be a maximum at $i=4.25$.

In order to find maxima in between samples I believe that I need to interpolate $y[n]$.

How do I find maxima using interpolation ?
What form of interpolation should I use ?

As you can see my signal is not very noisy, however it would be good if the method also did a bit of filtering so that the maxima exceed a treshold and have a certain width (no spikes).

My biggest problem however is just to find peaks in between samples.
Any suggestions for a good way to do this ?

Thanks in advance for any answers!


texts:
I am trying to decipher a message hidden within a very noisy audio file(.wav)(I think it is white noise with an additional low drone).  The message is a six digit number. I have not have any further details about the noise.

I attempted to use a low-pass filter in the hopes that eliminating most of the higher frequencies would allow me to hear the numbers but, I seem to be unable to also get rid of enough of the low drone to hear the voice well enough. My attempt was as follows (the employed function freq_space_low_pass_filter is included at the end):

[data, SampleRate, NbitsPerSample]=wavread('noisy_msg6.wav');

y=data(:,1); % we will work only with one channel in this demo
N=length(y); %number of sample points
t=( (1:N)*1/SampleRate ).'; % time spacing is 1/SampleRate and we want column vector

Y=fft(y);

spectrum_freq=fourier_frequencies(SampleRate, N);

Freq3db=100;
[spectrum_filtered,g_vs_freq]=freq_space_low_pass_filter(Y, SampleRate, Freq3db);

y_filtered=ifft(spectrum_filtered);

y_filtered=real(y_filtered);

wavwrite(y_filtered/(0.1+max(y_filtered)), SampleRate, NbitsPerSample,
         'noisy_msg6_filtered.wav');

%%%%%%%%down sampling%%%%%%%%

indexes=(abs(spectrum_freq) < 10*Freq3db);
spectrum_freq_down_sampled = spectrum_freq(indexes);
spectrum_down_sampled = spectrum_filtered(indexes);
N_down_sampled = length(spectrum_down_sampled);

spectrum_down_sampled=spectrum_down_sampled*N_down_sampled/N;

SampleRate_down_sampled=SampleRate*N_down_sampled/N;

y_down_sampled=real(ifft(spectrum_down_sampled));
t_down_sampled = ( (1:N_down_sampled)*1/SampleRate_down_sampled ).';

sound(y_down_sampled, SampleRate_down_sampled)

function [spectrum_filtered,g]=freq_space_low_pass_filter(spectrum, SampleRate, Freq3db)
%% applies low pass filter in the frequency domain
% spectrum - result of fft on time series data (column vector is expected)
% SampleRate - measured in Hz, 1/dt where dt spacing of the points in time domain
% Freq3db - desired 3db roll off point in Hz

N=length(spectrum);

function G=filter_gain(freq, Freq3db)
    G=1./(1+1i*freq/Freq3db); % this corresponds to low pass RC filter
end

spectrum_freq=fourier_frequencies(SampleRate, N);

% calculate filter gain for each spectrum frequency
g=filter_gain(spectrum_freq, Freq3db);
spectrum_filtered=spectrum.*g;
end

Plot of the signal spectrum:


texts: Comparison/Difference between two distinct plots

texts:
I am making a project where I  can identify leaves by taking a picture of them and a database. I will use their widths to determine their shape. So, I worked across the stem of the leaf each width and plotted them onto the following graphs.

The data of my graphs are located at: https://docs.google.com/spreadsheets/d/1HnYYA9keX7jjkhp4tocd2gy-i8VtHzYaS28fax-Nofc/edit?usp=sharing

To compare two graphs, I take the minimum of two functions:

The sum of the absolute difference between two graphs for every X-axis  point
Reverse one graph, and then run another sum of absolute difference between the reversed and the other graph. This is in case if one of the two leaves is measured in an opposite direction from the other one.

i.e. min( sum(abs(a-b)), sum(abs(a’-b)), where n’ is the reverse plot of n (In case a plot is reversed).

So, the problem is, the difference between two very similar leaves is actually greater than two very distinct leaves.

(On top) I have three graphs, two of which are similar-pos,pos2 (which should return a smaller difference), both of which are the acer ginnala leaf and another is different-neg, the betula alleghaniensis (which should return a greater difference than the "similar"):

However, this is not the case. On the 2nd layer, the two graphs are very distinct. (one is acer, other is betula). However, running the above algorithm, the sums are 70648 and 27362, returning a result of 27362.

On the last layer, when two very similar graphs are compared, (both acer) they return a much higher difference, with 40084 (normal) and 85664 (reversed), and returns the minimum of 40084, which is a higher difference than the first comparison.

I’ve tried standard deviation of the differences, squaring differences, Intersection Correlation, but had no luck. So, since the current measurement metric doesn’t work on this, what is a concise, straightforward, and better way to measure the difference between two graphs?


texts: Using Matlab's filter() function for solving difference equation with initial conditions

texts:
I am trying to solve a difference equation with initial conditions using Matlab's filter function:

$$y[n]=\frac12y[n-1]+x[n],\qquad y[-1]=1\tag{1}$$

For $x[n]=6u[n]$, calculation of $y[n]$ by hand gives

$$y[n]=\left[12-(6-y[-1]/2)\left(\frac12\right)^n\right]u[n]\tag{2}$$

However, the solution produced by filter is different. Could anybody point out my mistake?

The code is shown below:

disp('Solution of a difference equation:')
% The example difference equation considered is
% y(n) = 0.5y(n-1) + x(n)
num_coef = [ 1 ]; % coefficient of x
den_coef = [1 -0.5]; % coefficient of y
n = 0:4; % Considering five samples
x = 6 * ones(1,5) % x(n) = 6u(n)
init_cond = [1];  % y(-1) = 1
y = filter(num_coef, den_coef, x, init_cond) % Solution returned by 'filter'
yM = 12 - (11/2)*(1/2).^n % Solution obtained manually
plot(y);hold on; % PLots for comparison
plot(yM,'r')


texts: How to adjust reverse range for Hue in cvInRangeS?

texts:
cvInRangeS method for HSV colorspace is used like:

cvInRangeS(imgHSV, cvScalar( hMin,sMin,vMin),cvScalar(hMax,sMax, vMax),imgThresh);

For hue value we generally use a range between two numbers, a pair of small and big one like $(10-50)$, which means $10,11,12...48,49,50$ .

Sometimes I need to use a reverse range for red colors. By "reverse range", I mean a range between a big and a small number like $(170-10)$ which loops at the value of $180$: $170,171,172 ... 179,180,0,1,2,3 ... 8,9,10$).

How do I adjust this reverse range to cvInRangeS method? Can anyone explain how to make this work?


texts: Detecting Arabic verses spanning multiple lines

texts:
I need to build a Quran app and I want to read out the verses when a user touches it. The problem I'm facing is that some verses may expand to one and half lines (highlighted red verse) or just fit in a quarter of a line (highlighted green verse). So adding each verse to textview or some other view wont work it seems.

I want to detect verses like the red ones in the second image. I have audio files for the verses so no need of text to speech conversion


texts: Detecting two changing inharmonic pitches

texts: I have a recording of a newer type of siren that uses two pitches sliding back and forth in time. I want to be able to detect both of the pitches simultaneously or overlapping at short intervals. Autocorrelation is not yielding good results in this case. Since I know the frequency range of interest for these pitches, is there a frequency-domain method that can be used to detect both pitches as they change?


texts:
can someone explain why the ideal frequency response of a low pass filter cant be implemented using the inverse discrete time fourier transform.

i understand the concept of why it cant be implemented because a digital filter is infinite and non-causal, but i can't explain it using the equation. can someone help?

looking at this equation for an ideal low pass filter

how can i explain using this that the ideal frequency response cannot be implemented in practise?


texts:
I have a video of worm-like objects which move. They can move in a straight line, they can rotate in circles, they can move in a serpentine/winding/sinuous way. I need to track them.

I already have all the necessary code to track them by finding their contours so I have all the "topological" information necessary however there is one last thing I am not able to do so far: finding their center.

What I mean by center is of course not the center of mass or of gravity or of simmetry, but rather the mid-point, the center along the line that goes from head to tail.

I need it because if the worm rotates or steers, the center-of-mass does not move much but the mid-point of the worm is actually moving.

Does abybody have any suggestion?

Here an example of the kind of images we are dealing with:


texts:
I'm developing an application for PC that records microphone data in real-time, and plays it back after applying some effects.

I'd like to apply these effects only when a single known speaker is talking. The environment might include other people's voice and indoor noise (for example, a classroom or a restaurant).

Since that single speaker is also holding the microphone, I tried to simply filter input data based on a (configurable) volume level. This method is working but not very well, since sometimes the environmental noise might go above the threshold, or the speaker's voice might go below it.

Is there a better way to recognize a single speaker? I've read about speaker identification using feature extraction and HMM/GMM, but I'm not sure whether it is an overkill for my case.

I apologize if this it too vague. I'm new to DSP so I'm not really sure what additional information is needed to answer this.
Thanks!

Edit:

Speakers usually speak one after another, but background chatter is possible.
In addition, although the speaker is known, I do need some kind of an initial setup procedure (to adjust the application to that speaker).


texts: How does bandwidth relate to the bitrate?

texts:
This might be a really trivial question, but I can't wrap my head around it.

In almost every textbook, we're told that bandwidth (among power and noise), is the factor for both range and bitrate. I've been struggeling to find out why.

I'm aware of the Shannon-Hartlet theorem, but I cannot understand why.
With this theorem, the capacity is equal for me transmitting data on a channel from 115-120 MHz and 1150-1155 MHz, since the bandwith is both 5MHz. Why? Am I misunderstanding the term bandwith? Is it because I fx. send my bits on relative 1, 2, 3, 4 and 5 MHz of the bandwith?

And why does the frequency not have any influence? Let's assume I can encode 2 bits into every symbol, wouldn't I be able to transmit 10 times the amount of bits per second on the higher frequency rather than the low frequency, since I have 10 times the oscilations?

I hope somebody can help me understand why bandwidth is so important, and frequency is not.


texts:
I am not sure if the question is off topic but I need some input before I can finalize anything.

Actually to do my higher studies (in research) I wanted to make sure that I land my career in Digital Image / Signal Processing only. I have a strong background in Computer Application development. Now the Signal Processing course comes under Electronics And Communication Engineering / domain while Computer Vision & Speech Recognition subjects comes under Computer Science.

I am not sure if these subjects are different or doing Computer Vision / Speech Recognition is nothing but DSP / DIP. Is MATLAB being used for Computer Vision / Speech Recognition software?

Should I opt for Electronics And Communication Engineering course or one from Computer Science? Kindly guide me appropriately


texts: Phase shift problem in Fast Fourier Transform

texts:
I try to make graph/print for magnitudes and phase shifts for impulse response calculated by FFT.
For magnitude everything works perfect, but for phase shift I get some strange curve for higher frequencies. I can't figure out why. Could anyone help me?

I calculate phase shift by that:
atan2(fftOutput.imag(),fftOutput.real()) * 180.0/M_PI;

And for simply impulse, like: impulse[1024] = { 1, 0, 0, 0 ... 0 }

with no processing I expect straight line (phase shift for all freq bin should be zero).

But I get something like that (I drawn it in paint, cause I can't run my app at the moment, but it looks almost exactly the same):

Why is that?


texts: Why two images with same cluster value have different representation?

texts:
k-mean cluster classifies pixel randomly. I wrote this code to repeat clustering until both images meet proper cluster.

 while 1
  idx_fix = kmeans(double(fix(:)),4);
  idx_float = kmeans(double(float(:)),4);
  idx_fix = reshape(idx_fix,size(fix));
  idx_float  = reshape(idx_float,size(float));
  f1 = idx_fix(127,303);
  f2 = idx_float(114,205);
  if (f1 == f2)
      disp(idx_fix(127,303));
      disp(idx_float(114,205));
      if (f1 == f2)%when these pixles same that mean this is my target classification.
          break;
      end;
  end
  end
  mat1 = uint8(255*mat2gray(idx_fix));
  mat2 = uint8(255*mat2gray(idx_float));
  disp(['mat1 = ' num2str(mat1(127,303))]);
  disp(['mat2 = ' num2str(mat2(114,205))]);% the value still correct after coversion.
  imshow(mat1); title('Fix image class');
  hold on
  plot(127,303,'or');
  hold off;
  figure;
  imshow(mat2); title('Float image class');
  hold on
  plot(114,205,'or');
  hold off;

  similarity_chart(idx_fix,idx_float);

The output image is not as expected.
I point the compared pixel by a red circle, however, the area around those circles should have the same color... why this happened?

The original images -> https://1drv.ms/f/s!Al4zZ4gTzuGXhOtUnqo7Oiui1HMpSg


texts:
I am using cftool in Matlab to fit time series values to Fourier model with 8 terms:

 General model Fourier8:
 f(x) =
           a0 + a1*cos(x*w) + b1*sin(x*w) +
           a2*cos(2*x*w) + b2*sin(2*x*w) + a3*cos(3*x*w) + b3*sin(3*x*w) +
           a4*cos(4*x*w) + b4*sin(4*x*w) + a5*cos(5*x*w) + b5*sin(5*x*w) +
           a6*cos(6*x*w) + b6*sin(6*x*w) + a7*cos(7*x*w) + b7*sin(7*x*w) +
           a8*cos(8*x*w) + b8*sin(8*x*w)

But I don't understand how Matlab calculate a and b coefficients. I found in literature that I can use formulas:

ak=2/n * sum ( x(t) cos (2*pikt/n))

bk=2/n * sum ( x(t) sin (2*pikt/n))
 where n is number of terms in time series, k is index of current term k=1,...n, sum is with t,

but I can't get values which Matlab showed me for these coefficients.

Is Matlab General model Fourier8- formula for trigonometric Fourier series? Because in literature the first term in formula is a0/2, here is a0? Also Matlab value for a0 is not mean value. How to calculate this correct?


texts: Why does MATLAB's dualtree3 function not return the lowpass subband of the imaginary tree?

texts: MATLAB has a function named dualtree3 which computes 3-D dual-tree complex wavelet transform. This function only retains the last low-pass coefficients/subband of the real tree. And, it does not save the low-pass subband of the imaginary tree. How can you justify this?


texts: Effect of Hanning Window on phase of FFT

texts: I'm calculating the beat of song through the frequency domain. I have 60 seconds of audio sampled at 48000Hz, multiplied by a Hanning window in the time domain. This gives me a resolution in the frequency domain of 1BPM, and I'm interested in frequencies from ~10 BPM to ~300BPM, which is only the first 300 bins of the 48000*60 bin length FFT. How does the Hanning window affect the phase of the song's beat? Using no window (really a rectangular window) results in a different phase than the Hanning window does.


texts:
I want to calculate vector paths that approximate pen strokes from handwritten documents. My tool needs to run in batch mode, unlike hand tracing or Illustrator's "Image Trace" feature.

The potrace vectorizer will only take black and white input -- but applying a color threshold to the scans destroys the useful detail in their smooth, blended edges.

I had some success with the SUSAN edge detector. It can take greyscale input and its output can be reduced to black and white. Here's a liberal set of edges found around the perimeter of the word "intention":

Now, how can I extrapolate the pen's possible path across the semi-enclosed area? I am aware that there will be ambiguities; potrace has several strategies for resolving them.

More broadly, are there better approaches to this problem?


texts: Dynamic Time warping for voice recognition

texts: I am working on an extremely simple voice recognition project which I plan on implementing DTW for the template matching. Basically, I'll have stored FFT values of a template of some word that I'm trying to match, store incoming data, do FFT, and run the DTW algorithm to see if it matches the template. My question is, and I can't seem to find the answer on any paper I read about DTW, is how do I determine the maximum cost the algorithm can compute and still be labeled as a match? In other words, if the dtw algorithm computes a cost of value X, what criteria do I need to come up with to determine if that is small enough to be a match?


texts: How does `envelope` use the sliding window to determine RMS in MATLAB?

texts:
I am trying to understand how does the sliding window works when using the function envelope in MATLAB to calculate RMS (root mean square). I'm using the following code to reproduce the behavior of envelope:

rng(1);
Array = randn(1000,1);
window = 100;
limit = length(Array)-window;

%Part 2
for i=1:limit
    RMS(i) = rms(Array(i:i+window-1));
end
plot(RMS)
hold

I expect the part 2 in the code above to generate the same results as:

upper = envelope(Array(1:limit), 100, 'rms');
plot(upper)

However the first option (blue line) is displaced about 50 samples compared to the second option (red line):

I would like to understand how envelope determines the first samples.


texts: What word can I use to describe time-varying spectral content?

texts:
I have two devices that generate different classes of signals, one simple and one complex. I would like to find a single word or short phrase that describes the increased richness in one class compared to the other. I'm wondering if such a word or phrase exists.

Class #1 is limited to pure tones and colored noise. These sounds are time-invariant, and they are described as having attributes of "frequency and duration," where frequency is taken to mean any number of frequencies together, so long as they are invariant over time.

Class #2 may be any kind of sound. Typically the sounds used are more complex than those in class #1, with time-varying features. They usually have phase and amplitude changes affecting various frequencies over time. Often they contain semantic content such as recognizable real-world sounds or spoken words. This class of sound has been loosely described as having an attribute of "spectral content" as opposed to an attributes of "frequency and duration," but that description doesn't seem to be very good because people may consider spectral content to mean a distribution of time-invariant frequencies.

Perhaps "time-varying spectral content" gets closer? That might be a problem, because the rich class is a superset of the simple class, so there's no requirement for a signal to vary over time. In any event, I'm not sure having time-varying spectral content rather than a frequency and duration really captures the qualitative difference between white noise and a song fragment. Spectro-temporal variations seem to be part of it, and the temporal envelope is certainly important .

Rich sounds would be things like a child laughing, a dog barking, or a human speaking your name, while simple sounds would be things like an 800 Hz sine wave, or white or pink noise.

Is there a pre-existing word or short phrase that meaningfully describes the kind of sonic richness that distinguishes one from the other?


texts: Can some one explain what is the meaning ( in real life) of anti causal (precursor) part of the channel taps?

texts:
The channel taps are classified into postcursor (causal) and the precursor (anti-causal) parts.

\begin{equation}y_{k}=\sum_{l=-L_{2}}^{l=L_{1}} h_{l} x_{k-l}+n_{k}\end{equation}

here $h_{l}$ is the $l^{t h}$ tap of the channel and $L_{1}$ and $L_{2}$ are the lengths of the causal and anti-causal part of the channel respectively and $L=L_{1}+L_{2}+1$ is the total length of the channel. In addition, $n_{k}$ represents an additive Gaussian white noise with zero mean and variance
$\sigma_{n}^{2} .$ Arranging the equation above into a matrix form we have

\begin{equation}\begin{aligned}
\mathbf{y}_{k} &=\mathbf{H} \mathbf{x}_{k}+\mathbf{n}_{k} \\
\mathbf{y}_{k} &=\left[y_{k-K_{1}} y_{k-K_{1}+1} \cdots y_{k+K_{2}}\right]^{T} \\
\mathbf{x}_{k} &=\left[x_{k-K_{1}-L_{1}} x_{k-K_{1}-L_{1}+1} \cdots x_{k+K_{2}+L 2}\right]^{T} \\
\mathbf{n}_{k} &=\left[n_{k-K_{1}} n_{k-K_{1}+1} \cdots n_{k+K_{2}}\right]^{T} \\
\mathbf{H} &=\left[\begin{array}{cccccc}
h_{L_{1}} & \cdots & h_{-L_{2}} & \cdots & 0 \\
\vdots & \ddots & \ddots & \ddots & \vdots \\
0 & \cdots & h_{L_{1}} & \cdots & h_{-L_{2}}
\end{array}\right]
\end{aligned}\end{equation}
The anti causal part of the channel span means that at a time $k$, the output of the channel depends on previous symbols and future symbols ?
how can this be ?


texts: Dealing with MFCC Feature Vectors of different sizes

texts:
I am working on a project where I am classifying coughs of a patient as either positive or negative for a certain pulmonary illness.

What I have at the moment is multiple cough events, segmented from larger recordings. I have extracted various spectral features for each cough event and want to add all of these to one feature vector to train a Logistic Regression (LR) classifier.

The problem is that each cough event is different in length and this results in my Mel-Frequency Cepstrum Coefficients (MFCC) being different (in length) too, which is an issue when training the LR classifier.

So, I want to know if anyone has some fix for dealing with MFCC feature vectors of different sizes and how to get them in the correct shape to use as a training vector. I feel really stupid, but I can't find anything about this online. Surely this issue has been encountered before (?)


texts: How to detect whether a signal is unimodal or bimodal?

texts: I have to kinds of signals. The first type of signals are such that their histograms are unimodal (one-peaked). The second type of signals are such that their histograms are bimodal (two-peaked). How I can best detect whether a signal is unimodal or bimodal? In some signals there is a lot of noise so the detection is going to be difficult I guess. Any ideas on how to measure "bimodalism"?


texts: Why do we use "error quaternions" for control of attitude?

texts:
I'm working on an attitude control system in terms of quaternions, and i'm basing my approach on the book Space Vehicle Dynamics and Control (2nd ed.).  If we consider a proportionate controller, i.e.
$$\mathbf{u} = -\mathbf{K}_p \mathbf{q}_e $$
it would seem logical to me to define the error quaternions to be the first three elements of
$$\begin{bmatrix}
  q_{1e} \\
  q_{2e} \\
  q_{3e} \\
  q_{4e} \\
\end{bmatrix} = \begin{bmatrix}
  q_{1} \\
  q_{2} \\
  q_{3} \\
  q_{4} \\
\end{bmatrix} - \begin{bmatrix}
  q_{1c} \\
  q_{2c} \\
  q_{3c} \\
  q_{4c} \\
\end{bmatrix}$$
Where $q_i$ are the actual quaternions and $q_c$ are the desired (commanded) quaternions. Yet in the book, they instead define
$$\begin{bmatrix}
  q_{1e} \\
  q_{2e} \\
  q_{3e} \\
  q_{4e} \\
\end{bmatrix} = \begin{bmatrix}
  q_{4c} & q_{3c} & -q_{2c} & -q_{1c}  \\
  -q_{3c} & q_{4c} & q_{1c} & -q_{2c} \\
  q_{2c} & -q_{1c} & q_{4c} & -q_{3c} \\
  q_{1c} & q_{2c} & q_{3c} & q_{4c}\\
\end{bmatrix}\begin{bmatrix}
  q_{1} \\
  q_{2} \\
  q_{3} \\
  q_{4} \\
\end{bmatrix}$$
To me it seems like we do this because there are multiple possible quaternions that correspond to the same orientation, but I have not yet found a clear explanation for this. Can anyone enlighten me?


texts: If I have an Image and i find the DCT and then apply hard thresholding on the coefficients and then IDCT then I have attenuated the noise. Can someone please explain in detail or point me to the answer as to why this works. I understand why a filter blocking high frequency will work in denoising(because we assume that noise consists of high frequency components) but why does magnitude thresholding work?


texts: I have a MATLAB program that uses fft and ifft a lot. Now I want to translate it to C++ for production. I used OpenCV but I noticed that OpenCV's implementation of fft is 5 times slower than MATLAB's. Then I tried armadillo but it was even slower. It was 10 times slower than MATLAB. Now I wonder is there any implementation of fft in C++ that is fast enough to compete with MATLAB?


texts: Least square error channel estimation in the presence of AWGN noise

texts:
I want to implement Least Square (LS) channel estimation method in the presense of AWGN noise in MATLAB.

$y(n) = x(n) * h(n)$

$Y(k) = X(k)H(K)$

Y(k) is the received signal in frequency domain. According to LS algorithm, to estimate the channel

$H_{estimate} = Y(k)/X(k)$

Mean square error (MSE) is used to measure the performance of the estimator. MSE is defined as

MSE = $E(|H(k) - H_{estimate}|^2)$

Question is, how to get the value of $H(k)$ of white noise?

I wrote the following code in matlab, but it doesn't produce constant values in frequency.

 white_noise_time_domain = sqrt(1/2)*(randn(N,1)+1i*randn(n,1));
 white_noise_freq_response = fftshift(fft(white_noise_time_domain));

white_noise_freq_response doesn't give flat response. I guess this is not the right way to calculate the frequency responce of white noise. Could someone explain me how to get frequency response of white noise in MATLAB?


texts: displaying speech data in log scale using Matlab

texts:
I have speech data that I can represent using matlab plot.
however, If i want to display it on log scale(like cooledit or Audition), I can take something like

data = audioread(pth);
for j=1:length(data)
    if data(j) >0
         data(j) = 20*log10(data(j));
    else
         data(j) = 20*log10(abs(data (j)));
    end
end

problem with this is that zero values map to infinity and negative values map to positive side . I need representation where Y axis would run in db like [0 -3 ..-21..-inf.. -21 -3 0](like in Cooledit) and the data is plotted as per this axis.
How do i do this?
sedy


texts: Basic sampling problem - could use some advice

texts:
I have a problem in my DSP class that I could use some advice with.

An analog signal of length 2.5s is sampled with a Nyquist frequency and the sampled sequence has 5001 values. What is the highest frequency contained in the analog signal?

What I've gathered that the sampling frequency is $5001/2.5 = 2000.4 \text{ Hz}$ and thus $T=1/2000.4$

My textbook says that $\Omega_T \geq 2\Omega_m$, where $\Omega_T = 2\pi/T$ and $\Omega_m$ is the Nyquist frequency.

So I've found that $\Omega_T = 2\pi 2000.4$ so I get $2\pi 2000.4 \geq 2\Omega_m$ which leads to the highest frequency being $\Omega_m = 2000.4\pi$ or $f_m = \Omega_m/2\pi = 1000.2 \text{ Hz}$

Am I approaching this correctly?


texts: From Fourier transform to Laplace Transform

texts:
It's well known that you can estimate the Fourier Transform $X(f)$ of a signal $x(t)$ via its Laplace Transform $X(s)$, just by setting $s = j2\pi f$ to the latter, as long as the region of convergence includes the imaginary axis.

However, I do not have a clear view of how (and when) we can obtain the Laplace Transform via the Fourier Transform of a signal (which is the opposite of what I've stated before).

For example, $x(t) = e^{-at}u(t)$ has a Fourier Transform $X(f) = \frac{1}{a+j2\pi f}$ as long as $a > 0$. Its Laplace Transform is $X(s) = \frac{1}{a+s}$, for any value of $a$, as long as $\mathrm{Re}\{s\} > -a$. We can see that if we set $j2\pi f = s$ to the Fourier Transform, we can directly obtain the Laplace Transform. The same holds for any rational function of $j2\pi f$.

Is there a theorem or something that can be clearly stated about it? It looks to me that it has something to do with the convergence of the Fourier integral (if it does converge, then the Laplace Transform converges as well).


texts:
I heard from someone online who said: "Only random signal has PSD, determinate signal does not have. For example, period signal does not have PSD."

I am very astonishing about this statement, but it seems he is quite sure about his idea. In my opinion, both random signal and determinate signal have PSD, and it is the Fourier transform of the autocovariance of the signal. However, only stationary random and period signal have stable PSD. Am I right?


texts: Going from output of D/C to input of D/C

texts:
$$y_c[n] {\longrightarrow} \boxed{\text{D/C}} {\longrightarrow} y(t)$$
If the following equation describes the IDEAL D/C converter:
$$y_c(t) =  \sum \limits_{n=-\infty}^{\infty} y_d[n]~ \text{sinc}\left(\frac{\pi (t - nT)}{T}\right)\tag{1}$$
$$Y_c(\Omega) = \begin{cases} T~ Y_d(\omega) \Big|_{\omega=\Omega T} & |\Omega| < \left(\Omega_r = \frac{\pi}{T_s}\right) \\0 & \text{otherwise}\end{cases}$$
How to prove that we can find $y_c[n]$ from $y(t)$ using this formula:
$$y_d[n] = y_c(nT)\tag{2}$$
It doesn't seem entirely obvious to me by rearrange equation $(1)$, that it equals $(2)$.

conceptually, if function $f$ represents a D/C converter, and function $g$ represents a C/D converter, and $f$ and $g$ are inverse functions of each other. then:
$$y(t) = f\Big( y_n[n]\Big)$$
$$g\Big( y(t) \Big) = g\bigg(f\Big(y_n[n]\Big)\bigg)$$
$$g\Big( y(t) \Big) = y_n[n]$$


texts: SNR of a 16-bit DSP with 12-bit ADC, 40-bit accumulator

texts:
According to the 6dB-per-bit rule, a 16-bit DSP would provide 96 dB of dynamic range, approximately.

If the ADC and DAC are both 12-bit long, the DSP is still considered to have 96 dB, or the dynamic range is now 72 dB?

Also, I would like to know if the guard bits provided by the accumulator (40-bit) increase in some way the dynamic range.

Thank you very much.


texts: Estimate a Transfer Function from ARX Models vs. ARIMAX?

texts:
There is diffrent models which can be used to create a dynamical model by using least squares. Those models are following:

ARX
ARMAX
ARIMAX
OE
BJ

But if my goal with creating a dynamical model is to create a transfer function. It does not matter which one I use, so I might can use the simplest of them all - ARX model?

Or is the "most difficult" model the best choice all the time - ARIMAX model?


texts: Why we take Laplace Transform of functions which converged using Fourier Transform

texts:
There are several functions for which we know that Fourier Transform will exist but still we calculate its Laplace Transform. Can I know the reason why we need to take Laplace transform for which we know its convergence?

Thanks


texts: Using a Passive 1st Order RC filter to Extract DC Component

texts:
I am trying to extract the DC component out of a PWM signal produced by the MCU using a LPF.
I understand that 1st order RC filter is looked upon as being amateurish because the gain in the passband will be still less than 1V/V and because it does not have low enough roll off factor.

However, the PWM frequency of the MCU (Atmega328PB) I will be using can go up to 3.9kHz which means that it is sufficiently far from a designed cut off of lets say 100Hz frequency that the LPF can attenuate it by about -20dB.

Does that justify the use of passive over active filter since I wish not to use the following Sallen-Key filter to reduce cost and area
https://hackaday.com/2017/03/08/dont-fear-the-filter-lowpass-edition/


texts:
I am trying to generate a random signal that represents a gyroscope drift. I know the Allan Variance characteristics of the signal (ARW, RRW, Bias Instability and Cluster Time for for Bias Instability).

I guess I could model this as an addition to two stochastic processes: a white noise process and a drift process. The white noise process is easy to setup since its a random variate of a Normal Distribution. Not quite sure how I go about modeling the drift process? I know its supposed to be a Gauss Markov process but don’t have a clue how to do it.


texts: How to downsample a matrix in columns ? MATLAB

texts:
I am studying wavelets in image processing. I would like to learn how to downsample a matrix in columns using MATLAB. I have used the downsample(x,n) command to downsample the given matrix in rows. But how to do the same in columns?

x =

 1     2     3
 4     5     6
 7     8     9
10    11    12

y = downsample(x,2)

y =

 1     2     3
 7     8     9

But I would like to get the following result.

y=
     1       3
     4       6
     7       9
    10      12

How to do it in MATLAB? Please help.


texts: How to find system function, H(z) in the z-domain, given zero-pole plot of the system?

texts:
I'm given a zero-pole plot (Real/Imaginary Plane) of a system in which poles occur at $\frac{-9}{10}$, $\frac{9}{10}$, and zeros occur at $\frac{10}{9}j$, $\frac{-10}{9}j$. An additional zero occurs at negative infinity.

I'm also given that $H_{F}(f)=1$ for $f=0$, where $H_{F}(f)$ refers to $H(z)$ for when $z=e^{-j 2\pi  f}$. I'm tasked to find $H(z)$.

I know I can express $H(z)$ as $$H(z)=G_0z^{-1}\frac{(z-z_0)(z-z_1)\ldots}{(z-p_0)(z-p_1)\ldots} $$ for zeros $$z_0,z_1,\ldots$$ and poles $$p_0, p_1,\ldots$$

I can find the constant $G_0$ by using the fact  $H_{F}(f)=1$ for $f=0$.

I'm unsure how to express the fact that the system has a zero at negative infinity.