texts: Calculating the Spectral Centroid of a Signal

texts:
Here is the equation:

$$C_i=\frac{\displaystyle \sum_{k=1}^{W_{f_L}}kX_i(k)}{\displaystyle\sum_{k=1}^{W_{f_L}}X_i(k)} $$

The MATLAB code for the equation is:

sum(m.*window) / sum(window);

Let's say length(window) = 882 that contains the first half (abs) of the magnitude spectrum, fs = 44100.

Now calculate m:

m = ( (fs/(2*window)) * [1:window] )';

The length(m) = 882 and increments in 25, which is the sample range (e.g. [25 50 75 100 ... 22050]).

I'm trying to determine a better insight in terms of what is happening when both terms are being divided.  It is clear that each element of m is multiplying each element of window, but what is actually happening?  The book I'm reading just states that the Spectral Centroid is the center of 'gravity' of the spectrum.


texts: Why does fine CFO cause rotation of the constellation?

texts:
Just thinking about it, why does fine CFO cause rotation only? I only see diagrams that show rotation of the constellation.

We assume this is a complex magnitude frequency domain plot
In order for rotation to occur, the complex magnitude would have to stay the same when CFO occurs but the complex argument differ, but clearly, if fine CFO occurs here, it will be sampling a point on the envelope that isn't at the magnitude of one of the points on the constellation after gain equalisation, but inbetween. Especiallly as the magnitudes of the subcarriers can differ if using 16QAM like below.
This does not reflect the typical constellation I see:


texts: Error in power spectral density computation

texts:
I've written a program to compute the power spectral density of a signal. The problem I'm having is that the computed spectrum is quite a bit more noisy than it should be (comparing to the spectrum computed by Matlab), especially at low frequencies.

http://i.imgur.com/fGOGT.png

The red in this plot shows the spectrum computed by Matlab's cpsd command (0 overlap, NFFT=window=8192, 200Hz signal), and the green shows my own. There's a constant offset (in the log domain) between them, but that's okay for now. What I'm more concerned about is that my implementation is noisier, especially in the 0-3Hz range. The algorithm I've implemented is

Zero out a vector of length NFFT/2+1, for averaging.
Until there are no more samples:

Read NFFT samples (0-fill the remainder if there are less than NFFT)
Compute the 1-dimensional real NFFT
Compute the magnitude of each complex result, and divide by NFFT
Add this to the corresponding position in the averaging vector

Divide each sum by the twice the sampling frequency times the number of windows read

Sizing a window different than NFFT, and overlap, aren't included in the algorithm, but when compared to the Matlab output for window=NFFT and no overlap it shouldn't matter.

Can anyone speak as to why this results in low frequency instability?


texts: Correlation between two graphs in Matlab

texts:
I am trying to make a system that detects footsteps. First I filter and decimate the original signal, then I make a convolution between the filtered signal and a single footstep, then I extract the envelope (here I have a threshold of 1 and if the peaks exceed this threshold then it means that those are footsteps). The problem is that the plots (envelope and footsteps) need to be correlated, but the footsteps are right shifted and I really don't know which might be the cause. I hope you can help me. I'll show you an example of two different signals.

Example 1:

Example 2:

Edit:

convolutie=conv(filtrare2,sample);
t=(0:length(convolutie)-1)/Fs;
axes(handles.semnalConv);
plot(t,convolutie);xlabel('Time(s)');

y = hilbert(convolutie);
env = abs(y);
t=(0:length(env)-1)/Fs;
axes(handles.semnalAnvelopa);
plot(t,env);xlabel('Time(s)');

[pks,locs]=findpeaks(env,'MinPeakHeight',1,'MinPeakDistance',100);
axes(handles.semnalPasi);
stem(locs.*10,pks.^(1/2)/4,'r');

The problem was that there was a different number of samples at each plot.


texts: Determine group delay from the frequency response of FIR filter

texts:
I have a issue to find out, is there any way that one can determine a group delay from frequency response of the FIR filter. Let's say I have I type FIR filter with order of 51. Frequency response obtained from freqz MATLAB's function is presented below.

I know group delay is negative derivative of linear (in this example) phase response, but how can one determine that from the picture above.


texts: Looking for a better algorithm for finding the slope of an input signal

texts:
I've got an input signal that while sloping up, approximately bounces off an imaginary line.  I'm looking for the equation to that imaginary line.  I have a method, but is very brute force and it takes too long.  I'm looking for ways to optimize my approach or hopefully learn about a completely different more efficient method.
I've written a script in Octave that will do what I want, but it takes 3-10 seconds (with an input signal of 1800 samples) depending on how many iterations I run.

My brute force algorithm in Octave:

  x = 0:1:1800;
  for i = 1:200
    p = polyfit(x, input, 1);  % p gives the slope and offset
    output= polyval(p, x);
    input = clip(input, output);
  endfor

the clip function clamps the input to the output.  Clamps the input signal to the linear approximation.

  for i = 1:length(input)
    if(input(i) > output(i))
      input(i) = output(i);
    end
  endfor

To better explain what I'm looking for, I've included the rough image below.  Of course, the red signal is the input and I'm looking for the equation of the blue line.

Thanks for taking a look.


texts: I am trying to write a python function that checks whether two lets say sine signals would generate a distinct beat envelope or not. I know that the beat frequency = f1-f2 where f1 and f2 are the frequencies of my input signal. Is there a mathematical measure on when two sine curves generate a beat envelope and when they dont?


texts: How to interpret these filter coefficients?

texts:
I am trying to make sense of the filter coefficients.

The author claims that they are running a 3rd order lowpass Butterworth filter and were willing to give their design. They are not the most communicative type and it is typically weeks until I am able to get any sort of answer from them.

The coefficients are as follows:

1.22293 1.394312 1.994313
-0.3339159 -0.6572268 -0.9943293

They also provided the transfer function:

$$
H_k(z) = \frac{b_{k0}+b_{k1}z^{-1}+b_{k2}z^{-2}}{1-a_{k1}z^{-1}-a_{k2}z^{-2}},\quad k = 1, 2, 3.
$$

Whey I plug in these coefficients into the FDA toolbox in MATLAB, I get the following frequency response (sampling rate was set to $20833\textrm{ Hz}$):

What is the correct way to interpret these numbers? I am somewhat out of my element when it comes to the Digital Filtering and could use some help.


texts:
I'm trying to calculate the loudness of an audio track I have stored in a buffer. The buffer contains PCM data of the signal and I want to get how 'loud' it is by using Root Mean Squared. I assume I can do this in the time-domain instead of having to switch to the frequency domain. What would be the pseudo-code for doing this?

Would I simply sample for one second (audio[0] - audio[44099], audio[44099] - audio[88199] etc..) and calculate the RMS of those values? So, for example, would I do this:

$$RMS = \sqrt{\frac{\text{audio}[0]^2 + \text{audio}[1]^2 + \text{audio}[2]^2.....\text{audio}[44099]^2}{44100}}$$

for each second?


texts: How to compute the channel gain from the path loss model of a wireless channel

texts:
I did my research but I did not get a satisfying answer.
We have a transmitter and a receiver over a wireless communication channel. The channel's path loss is modeled as
$ 128 + 37 \log_{10} (d)$, with a shadowing standard deviation of $10$ dBs.

I am assuming that this path loss equation is expressed with dBs (nothing explicitly says that).

I have read that the combined path loss and the shadowing model is just the addition of the path loss model and a normally distributed random variable with mean $0$ and std. $10$ dBs.

Is this addition of path loss and shadowing is the same as the channel gain ?
If not, how to calculate the channel gain $\vert h \vert$ from the path loss model, combined with the shadowing ?


texts: How do I simulate a purely real signal being received on multiple antennae in an array?

texts: I have a signal created at baseband and then transmitted as $$\Re\{s_{bb}*e^{2\pi f_ct}\}$$ which is then received at a 5 element array for further processing. How do I interpret the real signal at each of the array elements without using complex numbers? Simulink needs a purely real signal as an input to the analog filter I am using.


texts: Why NRZ-L and NRZ-I line coding have DC component?

texts:
I can find the effect of having a DC component in the Internet which is "When the AC waveform has a DC component, the average voltage would be equal to the DC voltage instead".

But in my text book, it says NRZ-L and NRZ-I both have a DC component although NRZ-L and NRZ-I can have the average voltage $0$.

Why is it?


texts: Are there any good open-source (well, free) handwriting OCR programs?

texts:
The title asks it all. I have before me a data entry task that I'm not too enthusiastic about:  50-100 pages of handwritten sign out/sign in logs.

The format of the logs may help. Pages are partitioned into clearly delineated rows and columns (13r x 6c with an extra typed header row). Further helping me out is that three columns are date/time related (date, time out, time in). Also, the data in two of the columns (resource and name) are more or less enumerated, so that, for example, the name "Smith" might appear time and again in the name column, each time with the same handwriting. The last column, "Notes", is free form, but if I could automate the previous 6 columns, I wouldn't mind entering Notes by hand.

Any suggestions? (Besides 'start typing'.)

PS If there's a better SE site to ask this, let me know, I'll ask there.


texts: Kalman Filter | Difference Between Minimizing the Mean Square Error (MMSE) & Maximizing Likelihood Value in Bayesian Estimation

texts:
I am going through data assimilation slides on Multi Sensor Data Fusion by Hugh Durrant Whyte and it mentions:

  The Kalman Filter, and indeed any mean-squared-error estimator, computes an estimate which is the conditional mean; an average, rather than a most likely value. (Q: what is the most likely value ?)

I understand what MSQ is, but what does it mean that Kalman Filter estimates mean-square error rather then most likely value? Isnt mean square estimate, the most likely value?


texts: Obtaining power spectrum from ACF, FFT using Matlab and FFTW

texts:
I am using Matlab R2012b 64-bit on Windows 7 in order to estimate the power spectrum of a simple signal that is:

$$\cos(10t) + \sin(20t) $$defined in the time interval from 0.0 to 10.0

Here is what I did:

1) There was no predefined value of points so I took 1001 points by forming a time array and sampled the function at these points.

2) I calculated the autocorrelation function of the signal with the built-in function "xcorr".

3) I performed FFT directly on the autocorrelation function with no additional options.

4) The resulting data set had imaginary parts(I think this should not be the case since the autocorrelation function is even).

5) I took the absolute value of the FFT of ACF and plotted it as the power spectrum from the ACF after having it shifted with fftshift.

6) I took the FFT of the sinusoidal signal after padding it with 1000 (n-1) zeros.

7) I calculated the power spectrum from the FFT of the signal as the square of the absolute value of the frequency coefficients.

8) I plotted both of them and compared them by assigning an array to difference between them.

9) They turned out to be the same.

Everything seems to be working correctly but my concerns are as follows:

How can this data be interpreted? I expected the sum and difference frequencies of the individual sinusoidal functions in the signal.

-How can I normalize the output and represent negative frequencies properly since they have no physical significance?

-Does Matlab use FFTW libraries? My main task is to achieve the same results in a C program using these libraries.

I have benefitted from the following URL:
Efficiently calculating autocorrelation using FFTs in organizing the post and achieving these results.

I am also confused about the terms power spectrum, power spectral density and energy spectrum. Are they used interchangeably? I would be grateful for an explanation of this phenomenon and normalization procedure.

Thanks in advance

P.S : The code snippet I have used is as follows and it can reproduce my results:

t=transpose(0:0.01:10);
n=size(t,1);
f=cos(10*t)+sin(20*t);
acf=xcorr(f,f);

FFTacf=fft(acf);
PSacf=abs(FFTacf);

FFTp=fft([f;zeros(n-1,1)]);
PSf=FFTp.*conj(FFTp);

figure;
subplot(2,1,1);
plot(fftshift(PSf));
title('PS from FFT');
subplot(2,1,2);
plot(fftshift(PSacf));
title('PS from ACF');

d=PSacf-PSf;
fprintf('Max error = %6.2f \n', max(abs(d)));


texts:
I'm having trouble figuring out how to follow the fast 8x8 DCT algorithm diagrams found in the following two papers:

(1) A Fast Computational Algorithm for the Discrete Cosine Transform by Chen et al.

and

(2) Practical Fast 1-D DCT Algorithms With 11 Multiplications by Loeffler et al.

In particular, the second diagram that shows the algorithm in (2) looks like the following:

The description of the operations in this algorithm are:

There are a few questions I have about this formulation, and I'm not sure where to find the answers:

(2) suggests that this algorithm generates a DCT that is scaled by some value $C = \sqrt{2}$. It mentions that this $C$ was chosen arbitrarily to avoid any multiplications in computing the DC coefficient. Really the only requirement is that $C_{DCT} * C_{IDCT} = \frac{4}{N^2}$. So my question is this: What is the scaling factor of the output coefficients using this algorithm? It seems like they are different than the original definition of the DCT, but I don't know by how much (mostly because I don't actually see any relationship between this diagram and the original formulation of the DCT):
$$ F(k) = \frac{2c(k)}{N}\sum_{n = 0}^{N - 1}f(n)\cos\left(\frac{\left(2n + 1\right)\pi k}{2N}\right)$$
where $c(k) = \frac{1}{\sqrt{2}}$ for $k = 0$ and $c(k) = 1$ for $k \neq 0$.
The paper states that performing the IDCT can be done using the exact same algorithm but transforming outputs to inputs and vice versa. First, should the DCT coefficients be ordered in bit-reverse order prior to running them through the IDCT? Second, for the rotation blocks (the squares in the diagram), shouldn't the inverse operation be:
$$ \begin{align}
O_0 = I_0 \cdot k \cdot \cos\frac{n\pi}{2N} - I_1 \cdot k \cdot \sin\frac{n\pi}{2N} \\
O_1 = I_1 \cdot k \cdot \sin\frac{n\pi}{2N} + I_1 \cdot k \cdot \cos\frac{n\pi}{2N} \\
\end{align}
$$
My reasoning is this: The inverse of a rotation by $\theta$ is a rotation by $-\theta$. Hence, we just replace the angle by its inverse and use the identities $\cos(-\theta) = \cos(\theta)$ and $\sin(-\theta) = -\sin(\theta)$. Third, what is the scaling factor of the transformed values after the IDCT? (2) says $\frac{2}{N^2}$, but empirically, this hasn't produced correct results.
Suppose after I run the algorithm, I have the result of each lane stored in the values d0 ... d7. Which of the following is correct:
output[0] = d0               or               output[0] = d0
output[4] = d1                                output[1] = d4
output[2] = d2                                output[2] = d2
output[6] = d3                                output[3] = d6
output[7] = d4                                output[4] = d7
output[3] = d5                                output[5] = d3
output[5] = d6                                output[6] = d5
output[1] = d7                                output[7] = d1

If there are any ways to improve this question, or if I should ask elsewhere, please let me know.


texts: Normalisation of different length signals

texts:
I have a collection of audio files of subjects sleeping, which have different lengths,  ranging from 8 hours to 10 hours.

I want to detect when a snore occurs in them.  First of all I want to normalise them.  What is the best method to normalise them so they all have similar values.

Currently I'm am using the following code which basically sets the sum of all the values to 1.

recording = recording / norm(recording, 1);

However, for example, the energy value of a snore differs greatly from one recording to another.

Is there any better methods of normalization which will cope with a range of different length recordings?


texts: What kind of analysis might be used on sets of 2D monochrome image matrices or bitmaps to estimate or compare their relative quality of being "in focus"?  Is there an efficient way of computing a scalar metric on something like overall contrast, luminance sparsity, or other artifacts produced from out-of-focus blurring?


texts: Detecting a low frequency cue in audio recording

texts:
I am hoping to find a linux program or library for a language like perl or python (open to any solution though) to detect low frequency cues in an audio recording.

Ideally I would end up with a printout of timestamps in HH:MM:SS format that correspond to where the cues occur.

Here is visual example of the audio cue:

The cue appears to be unique waveform and there is no other sounds at this frequency through out the recording. The frequency is so low that it is in audible. Based on this I assume it must be possible to detect the cues.


texts:
I was reading a DSP book where they had a problem on Z Transform.

Determine the z-transform and ROC for signal $\displaystyle x(n) = a^nu(n)$?

The solution states that
$$
\displaystyle X(z) = \displaystyle\sum_{n=0}^\infty (az{^{-1}})^n
$$
So
$$
\displaystyle X(z) = \frac{ \displaystyle {z} }{z-a}
$$
Hence ROC $|z| > a$

Which I understand that for all values of z > a the series $\frac{ \displaystyle {z} }{z-a} $ has finite values.

But for $|z| < a$ their exists a value : $z = 5$ and $a = 10$ the series has a finite value of -1 and so on. So why -1 is not taken as a set for which ROC exists - or rather my understanding on ROC is wrong?


texts: Is there any processing needed to playback audio?

texts:
I am new to audio processing. I wrote a simple real-time playback program (when you speak on the mic your voice is immediately played on the output), however it is not working. I am using a 8Hz ADC with 128 frame size, and I output these 128 samples directly to audio PWM. It doesn't play the audio even though there's a "reaction" when you tap the mic.

Is there a processing needed before outputing the samples, that would explain why it isn't working ?

Here is my main loop :

while (1) {

while (ADCChannelIsBusy(MyADCHandle)){}
ADCChannelRead  (MyADCHandle, Frame, ADC_BUFFER_SIZE);
while(OCPWMIsBusy(MyDACHandle));
OCPWMWrite  (MyDACHandle,Frame, OCPWM_FRAME_SIZE);

}

I wrote none of these functions, all were found in the dsPic starter Kit. Frame is the array where samples are stored.


texts: Calculating SNR of a complex-valued signal correctly

texts:
I have an array of complex-valued data. I would like to modify the array by injecting an artificial signal at a chosen Signal to Noise ratio.
I have seen the signal to noise ratio for complex-valued data calculated as:
$$ SNR = \frac{<SS^*>}{<NN^*>} $$
Right now, I am assuming my data is all noise and calculating the denominator by taking the mean of the real part of the data multiplied by its imaginary part.
One problem I have with this equation is that it would imply that if I added a constant real signal to all the data (for example just adding $ 0.5 + 0j $) the SNR of the added signal would be zero since its imaginary part is zero and hence $ SS^* $ is zero. Obviously this doesn't make sense. So how do I correctly calculate the SNR of an added signal? I'm looking for a way of determining $a$ and $b$ in a complex number $ a+ib $ added to all the data, such that the resulting data has an artificial signal of $SNR = X$ embedded in it.


texts:
Let $Y$ be a measured (noisy) image $Y= X+ noise$, where $X$ is an image contains $0$(Background) and $200$(object). I need to create a decision rule that determines whether the true pixel value was $0$ or $200$ given the image $Y$.

the noise is Gaussian with mean=0 and standard deviation=sigma

I_true = [zeros(50,140);zeros(60,40),(ones(60,60)*200),zeros(60,40);zeros(50,140)];
[nrows ncolumns] = size(I_true);
sigma = 63.246;
gaussian_noise = sigma*randn(size(I_true));
I_noisy = I_true + gaussian_noise;

After adding the Gaussian noise to the true image the PDF of the intensity of a background pixel will be Gaussian with mean = $0$ and variance= $63.2462^2$ and the PDF of the intensity of an object pixel will be Gaussian with mean = $200$ and variance= $63.2462^2$

I used MAP rule and assumed that $P(Y=0)=P(Y=200)$

Likelihood ratio

$(P(Y=j|X=200))/(P(Y=j|X=0))≥P(X=0)/(P(X=200))=1$

$exp((400Y−(200)^2)/(2σ^2))≥1$

$Y≥100$

so if $Y≥100$ the pixel will be considered as object.

my questions are :.

1) is my solution is right?

2) in the case of two objects with gray levels $150$ and $200$ what will be the steps of Map decision rule?


texts:
I am reading a book for image processing algorithms (Andreas Koschan, Mongi Abidi: Digital Color Image Processing) and for the contrast algorithm it says that I can either go RGB->HSL or RGB->HSI first and than apply a contrast technique for grayscale images, on the lightness component.

Then it gives this formula only, not other formulas for color conversion:

$$L(x,y) = 0.299*R(x,y) + 0.587*G(x,y) + 0.114*B(x,y)$$

This formula is neither for the L in HSL, neither for the I in HSI and that is what confuses me.

Can you explain what this formula stands for, and maybe help with the appropriate conversion formulas?

Thanks


texts: Background Noise Reduction in Audio signal

texts:
I using high pass filter  for reduction or removal of noise of audio signal but still some noise is there in signal.i have MIC,Head Set,Bluetooth and phone are connected to controller,while talking on MIC some background is there.How to reduce the noise and is there any algorithm for it.let me know please.

Im implementing in c code structure.

Any Algorithms ?


texts: What should I do with FFT result array from microphone input?

texts:
I currently want to create a small pitch detector and I have to say that I am very new in this topic of signal processing.
At the moment I implemented the FFt algorithm and I got an array of window size (= 1024) out of it. But what should I do to define for example C4 or other music tones.

I know that FFT is not the best way to do pitch detection, but I think it is a good starting point to detect some single tones.

Is the best approach to sing the wanted tone than to find the peaks in this array and map that to the tone or do I need to do some other calculations first?

I hope you can help me out with some information.

Thank you and best wishes,

MusicMagician

EDIT:
I know that here are many similar posts, but I want to understand what exactly the FFT does with my frequency and how I should work with that result. I think that for some guitar tuners the FFT is used to detect the pitch. So I wanted to start with that simple approach. I hope you can understand me.


texts: Bandpass before EEMD- selecting IMF outside band pass range

texts:
I have a vibration signal of 25.6 kHz where I first perform band pass filtering (7000 Hz, 9000 Hz) and then perform Empirical Mode Decomposition (EEMD).

I then want to select the IMF where the kurtosis value is maximised (I'm looking for fault impulses in a gearbox).

IMFs:

As you can see, the max kurtosis value is in IMF 5 (there are some more IMFs I did not include).

My question:

If I select IMF 5 and perform a FFT, I see that the signals are in the 2000 Hz range. How is this possible, given that I already band passed at (7000 Hz, 9000 Hz)? Is it incorrect to use this IMF for further processing then?

Thanks in advance.

Update:
Filter implementation using butter from SciPy

def butter_bandpass(lowcut, highcut, fs, order=5):
    nyq = 0.5 * fs
    low = lowcut / nyq
    high = highcut / nyq
    b, a = butter(order, [low, high], btype='band')
    return b, a

def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
    b, a = butter_bandpass(lowcut, highcut, fs, order=order)
    y = filtfilt(b, a, data, axis=0)
    return y


texts: Designing an efficient curve-matching algorithm

texts:
I'm currently designing a curve-matching algorithm and as I already explored many ideas I'm requesting your help. So, if you got some advices about how to handle this problem, feel free to answer!

The Context

I got a flash LIDAR spatio-temporal response to one short impulsion. The data acquired is stored in a 3-D matrix:

First and second dimensions are spatial ones. As in a 2-D image they represent azimuth and elevation of a pixel.
Third dimension is the temporal one. For each pixel the illumination is recorded for a fixed duration and stored in this dimension. Typically, the curve observed is a Gaussian and its parameters (variance, max amplitude and delay) are affected by the LIDAR surrounding environment.

To be more specific the laser pulse is distorted by the environment. The multi-path of light impacts the Gaussian variance, the object distance to the RADAR impacts the delay and the amplitude and the reflectivity of the object impacts the amplitude of the Gaussian.

The Aim

As in the real world objects are contiguous and homogeneously distributed in space, neighboring pixels are more likely to have a similar reflectivity and distance to the LIDAR thus neighboring Gaussians are very similar.

What I'm trying to do is to quantify the similarity of a pixel impulse response to its neighborhood (3x3 neighborhood for instance). This is very close to the concept of gradient, I want to detect pixels that are parts of an homogeneous objects and ones at the border of an object where there is a disruption.

For now I've implemented two different algorithms. One that is similar to a an image derivation adapted to the 3-D structure, with a 2-D Laplacian Filter. The second algorithm is based on the measure of similarity using Sum of Absolute Differences, also adapted to the data 3-D structure.

The Problem

These algorithms work somewhat fine but since the signal can be noisy and sometimes very far from a Gaussian shape I think and I hope better algorithms can be implemented.

My research tracks are focused on curve-fitting before comparison (Levenberg–Marquardt algorithm for instance) for now, but this proved very computationally time-consuming!

If you know about other methods or concepts that can help in resolving my problem, feel free to participate :)

Thank you!

EDIT:

Matrix size is 32x128x128


texts: Convolving Room Impulse Response with a Wav File (python)

texts:
I have written the following code which is supposed to put echo over an available sound file. Unfortunately the output is a very noisy result which I don't exactly understand. Can anybody help me with regard to this? Is there any skipped step?

#convolving a room impulse response function with a sound sample both of stereo type
from scipy.io import wavfile
inp = wavfile.read(sound_path + sound_file_name)
IR = wavfile.read(IR_path + IR_file_name)
if inp[0] != IR[0]:
    print "Size mismatch"
    sys.exit(-1)
else:
    rate = inp[0]
print sound_file_name
out_0 = fftconvolve(inp[1][:, 1], IR[1][:, 1])
out_1 = fftconvolve(inp[1][:, 1], IR[1][:, 1])
in_counter += 1
out = np.vstack((out_0, out_1)).T
wavfile.write(sound_path + sound_file_name + '_echoed.wav', rate, out)


texts: Apply FIR filters to Extract Stego from WAV data

texts:
I appreciate anyone that takes a moment to help me with this problem. I've been banging my head against the keyboard for a while, searching forums and DSP tutorials and I can't figure this problem out.

Here's a couple links I found very helpful from this forum on the subject:
http://www.dspguide.com/
http://wiki.scipy.org/Cookbook/ApplyFIRFilter

So I have a WAV file with a 28 sec song/sound that I am trying to convert to frequency range, apply an FIR filter to isolate the 14.5 - 16kHz range. The WAV has a sampling rate of 32 kHz and contains an intermittent buzz that becomes clearer when I drop out all other frequencies besides the 14.5 -16kHz bands.

I have written this sample of python code, and believe I am close to isolating the signal. Its hard to tell.

# read data from file name fn, using low/high for bandpass
# low and high frequency cutoffs, and a
def filter_frequencies(fn,low=0,high=0):
    data = wave.open(fn,'rb'); rate = data.getframerate()
    ntap = (rate / 4) + 1; nyq = rate / 2
    low,high = low/nyq,high/nyq
    chunks = int(data.getnframes()/(rate*4))
    ns = b''
    if low and high == 0: # lowpass
        bp = low; pz = True
    elif high and low == 0: # highpass
        bp = high; pz = False
    else: # bandpass
        bp = [low,high]; pz = False

    b = firwin(ntap, bp, pass_zero=pz, window='blackman', nyq=nyq)
    y = b''
    for num in range(chunks):
        # read 4 secs of frames from wav file
        seg = np.fromstring(data.readframes(rate*4),dtype=np.int8)
        #seg = np.fromstring(data.readframes(data.getnframes()),dtype=np.int8)
        # convert frame amplitudes to their frequency values
        freq = np.fft.rfft(seg)
        # perform lowpass, highpass or bandpass filter
        cr = fftconvolve(freq,b,mode='valid')
        # converts frequencies to binary string
        y += cr.tostring()
    data.close()
    return y

I am a noob to DSP, so again I would really appreciate your help on if I am doing the FFT to inverse FFT correctly.

Below is the code I am using to transform the output from the above function back into WAV bytes format.

def frequency_to_bytes(freq):
    # invert the Fast Fourier Transform
    nf = np.fft.irfft(freq)
    # convert frequencies back to integer values
    bs = np.ravel(nf).astype(np.int8)
    return bs.tostring()

P.s. if you have seen this problem before, or know what challenge I am trying to solve, please no spoilers. I have been working on this for a week solid.

edit: added some background links I have been using as reference.


texts: Using DTW on the MFCC's to match a spoken word to a template

texts:
I am trying to code a simple algorithm in MATLAB that would be used to detect a single word.  The goal would be to have a user record the word one time to act as a template, then make the user repeat the same word to try and detect it. Searching on this website has answered many of my questions, but I still have some interrogations.

So far my algorithm calculates the MFCC's in the following way:

Extract the data from a .wav file (recorded at $8000\textrm{ Hz}$)
Build frames of $64\textrm{ ms}$ with a $50\%$ overlap, applying a Hann window
Calculate the FFT of all these frames
Calculate the Power Spectrum using the FFT results ($P(k) = \lvert X(k)\rvert^2$)
For each frame, extract 26 coefficients by multiplying the Power Spectrums with the 26 Mel filters and summing the results for a given Mel filter
Calculate the $\log_{10}$ of the coefficients
Apply a dct on a frame's 26 coefficients

My goal was to use the MFCC's of the template as well as the MFCC's of the repeated work and compare them using a DWT algorithm. My DWT algorithm is already programmed and functional.

However, my algorithm does not work very well and it seems like certain parameters affect the results quite a lot. Here are my questions:

Are these steps enough to detect a spoken word?
Would it be better to use a large number of fixed templates instead of having the user pre-record a template? Which method should result in better recognition performance?
If the person repeats the word using a different distance from the microphone, the increased/decreased values of the MFCC's are enough to mess up the DTW results. Is there a smart way to normalize the MFCCs to try and cancel the effect of the microphone distance?
Some websites recommend using only the 13 MFCC's with the smallest values.

Why is that?
Also, are they talking about the smallest magnitudes, or the smallest values?
Assuming 13 MFCC's are very big negative numbers, while 13 other MFCC's are small positive numbers, which set would I keep?

EDIT: Also, the first coefficient of each frame is always much bigger than the other coefficients. I would say it's magnitude is bigger my a factor of 100. Obviously, when I caculate the DTW using Euclidian distance, I'd say this coefficient is the only relevant one since it is so much bigger than all the other values. Should it be discarded?


texts: Demodulating unknown signals - unmatched frequency sampling

texts:
My goal is to make an approach to recognize modulation type of unknown signals.
I have energy detector which monitors spectrum and it provides information about center frequency and bandwidth of detected signal. After shifting desired signal to 0 frequency I make a resampling that new frequency sampling equals detected signal bandwidth. Problem is that I don't know exact sampling rate at which desired signal was generated at the transmitter. While analyzing the constellation plot after resampling there is no chance that convolution network will recognize modulation type.
Do you think that problem is unsolvable and this is waste of time?
Are there any techniques to overcome sampling frequency offset?


texts: Proving Nyquist Sampling Theorem for Strictly Band Limited Signals (Whittaker Shannon Interpolation Formula)

texts:
I understand that the Nyquist sampling theorem dictates that the minimum  sampling frequency, $f_s$, be s.t. $f_s > 2B$, where $ B $, is the bandwidth of the signal. I have read the explanation for what happens when the input signal contains an impulse/non zero ferquency spectrum at $f_s = f_m$. But is there any way to do a mathematical proof that sampling at $f_s = 2B$ works when the signal is strictly bandlimited.
A little background : This is a HW problem

The given hint was to use the fact that "one way to interpret Nyquist
Sampling theorem is to note that any bandlimited signal can be represented as a superposition of bandlimited signals that are orthogonal to each other."


texts:
I have a Sine wave at frequency F1. This signal changes and shifts to frequency F2.
In frequency domain I like to find this shift as quickly as possible. (Signal has a lot of random noise and hard to Observe in time domain)
What is the best approach ?
I have tried various FFT chunk sizes and zero padded approaches but they are not fast enough. It takes time for FFT to show decent spectrum.


texts: Upsampling before performing pulse shaping

texts:
I know what an upsampler does. We insert L-1 zeros between the samples. As a result, it creates spectral repetitions. What if we have a symbol impulse stream and then we apply a Root Raised Cosine Filter, this would automatically perform pulse shaping. Why do we need to upsample that symbol stream to cause interpolation? The Pulse shaping filter is doing that.

Please explain intuitively if possible because I have been stuck on this topic for a while. Thank you in advance!


texts: operations valid for predicting new codewords for a Linear block code having linear encoder mapping

texts:
I want to know which operations are valid for predicting/finding a new codeword from a set of known codewords for a linear block code having linear encoder mapping,

for eg.:
Consider a linear Hamming code (having linear encoder mapping) is used to map $4$ - bit messages to $7$ - bit codewords,
if it is known that the message $0001$ is mapped to the codeword $0000111$,
i.e,
$$0001 \, \to \, 0000111 \, \dots (i)$$
$$\& \quad 0011 \, \to \, 1100110 \, \dots (ii)$$
,then we can find out the corresponding codeword for the message $0010$ as follows:
$\because 0010 = (0001) \, \oplus \, (0011)$ , And we know EXOR is a valid operation
$$\therefore \text{codeword for } 0010 \to (0000111) \, \oplus \, (1100110) $$
$$=1100001$$
Now, can we apply any other operations (like AND , OR , EXNOR , ...) to find the corresponding message codeword?


texts:
I'm asking myself what is the best way to low pass a signal which only has a few hundred samples? Or is there a proper way at all?

It must not be a sound signal but I used Audacity to display the samples.
And I applied their low pass effekt (2.img). Problem here, the signal was shiftet to the right. Is their any way to implent an low pass filter without shifting the samples?
Thanks in advance.

Edit:
Now a bit more detailed.
First of all I start with a spectrogram(3.Img) where I try to follow one of those maxima. That gives me the blue line. But my algorithm is not perfect, thats why I dont get a very smooth blue line. And I need this blue line to be a smooth curve. Therefore I thought, let's pretend that this blue line is a sound signal and try to smooth it through lowpass filtering.

What do I mean with short:

In this example it is less than 200 samples but it depends on the soundfiles length.
What do I mean with low:
I need this blue line to be smooth. And since I thought it would be possible to pretend like it is a sound signal I could use lowpass filtering. But I cant tell u a discrete value and I cant say anything about samplerate, since it is no real sound signal.

I hope it is more clear now.
And thanks for your answers so far.


texts: How does a rectangular window affect the signal?

texts:
If i am not mistaken a rectangular window of length 10 gives us an array of 10x1:

1 1 1 1 1 1 1 1 1 1

And if we apply this to a signal we are left with exactly what we started with as:

x = x*1

So how does a rectangular window improve or do anything at all to our signal? What is the point of the function?


texts: Pattern recognition and Machine Learning reference

texts: My main reference for machine learning and pattern recognition is Pattern Recognition and Machine Learning by Bishop. But I want a complementary reference to this which has more exercises and explains the mathematical stuff in more details, e.g. formulas and proofs.


texts: Step response of third-order continuous-time transfer function

texts:
I have a transfer function of the form:

$$H(s) = \frac{b\omega_n s^2 + a\omega_n^2 s + \omega_n^3}{s^3 +     b\omega_n s^2 + a\omega_n^2 s + \omega_n^3}$$

If it matters, $a=b=2$.  Is anyone aware of a simple explicit form of the step response for this transfer function (i.e. something directly in terms of $\omega_n$, $a$, and $b$)?


texts: MFCC - Significance of number of features

texts: I have been doing some readings on the computation of Mel-Frequency Cepstral Coefficients (MFCC) and further use of Vector Quantizers (VQ) for recognition purposes. I am however stumped by the method of computation for those MFCCs regarding the number of suggested frequency bands. For example, why is the recommended number of mel filterbank filters 20 -40? Why do we eventually end up with 13 coefficients and not 40 as will have been found from the 40 log energies we shall calculate?


texts: Adding "realistic" noise to signals of different amplitudes

texts:
I have a question regarding basic signal processing, which I have to start using since I have started studying fault isolation. The thing is, I have three computed signals, which are gathered in the matrix $\mathbf X \in \Re^{p \times n}$, where $p$ is the signal length and $n=3$ is the number of signals. The three signals should emulate some real measurements in different sensors, for instance,

$$\mathbf x_i = A_i \sin(\omega t), \quad \text{with } A_1 \neq A_2 \neq A_3.$$

Now, I want to add some white Gaussian noise to these signals, but then I started thinking; how can I do this somewhat "realistically" when the three signals have different amplitudes? My basic understanding is that the amplitude of the noise in real measurements is independent of the amplitudes of the signals, hence implying that my signal-to-noise ratio will not be the same for the three signals (since the variance of the noise is taken as constant). Is this correct?

What I have done at the moment is simply to form $\mathbf Y = \text{vec}\left(\mathbf X\right) \in \Re^{pn \times 1}$ (with $\text{vec}$ being the vectorization operator), calculated the variance of $\mathbf Y$, and then added noise as a fraction of this variance (with zero mean). The reason for this is that I often come across the phrase "we added this percentage of noise to the signals", and I don't suspect that one adds this to each signal seperately according to the variance of each signal.

Sorry for the long post. I hope you get my point and can answer my questions.

James


texts:
To generate I & Q samples from data samples S
I = S(1:2:length(S)-1) * cos(2*pi*f*t) ;
Q = S(2:2:length(S)  ) * sin(2*pi*f*t) ;

I & Q to integer arithmetic
I = I * (2^16) ;
Q = Q * (2^16) ;

I Q combined
y = bitshiftleft(Q, 16) ;
y = bitor(y, I);

and mixed with carrier fc
y = y * cos(2*pi*fc*t) ;

To recover the I & Q, we do:
after mixing y with the carrier fc to get baseband y, we do
Q = bitand(y, 0xFFFF0000) ;
Q = bitshiftright(Q, 16) ;
I = bitand(y, 0x0000FFFF) ;

I am assuming dividing is the reverse of the above multiplication
I = I / cos(2*pi*f*t) ;
Q = Q / sin(2*pi*f*t) ;

My question is the above  correct especially dividing by cos and sin?
I am not sure how to calculate t in all the above.
Please help.


texts: Comparison of results with Direct form1 and Direct form2 implementation of IIR filters

texts:
The results obtained from Direct form1 and Direct form2 implementations (in C language) of IIR (BiQuad) filters are a little different. In the implementation, i have made the b0 coefficient as 1. So, I am just using 4 coefficients (a2,a1,b2,b1) in the implementation. The maximum error between the obtained outputs from these two implementations is in the range of 0.01 for the ITU-T standard audio test signal. So, I just want to know whether this error is because of the implementation, or any other reasons? Will the Outputs of both implementations be the same, always (i.e. error is almost 0)?

In the implementation, I am using around 8 stages of filtering. (i.e. Cascaded Biquad filters)

The referred structure forms as attached below.
enter image description here


texts: amplitude at exact frequency in wide band signal

texts:
Could anyone suggest the most computationaly efficient method for finding amplitude of exact frequency having a noisy wide band signal.

To be more specific about a task. I have some physical dynamical system. I'm introducing sinusoidal input with exact frequency and amplitude. And looking for the amplitude at the same frequency on the output signal. While output signal is subject to noise and affected by other physical inputs at the same time.

This is required to detect some aspects of physical model. Experiments shows that this kind of test is sensitive to physical changes I want to detect.

Also I quite limited in recources. I only have small 32 bit MCU that is capable only of fixed point arithmetics. Or very slow emulated floating point. Thats why I'm asking about most effective solutions to the task.

Thanks in advance!


texts: How to design a a filter and how to determine the poles and zeros on the basis of following informations?

texts: A sinusoidal signal of 300Hz frequency,3V amplitude is contaminated with line frequency (50Hz,1V). Design a digital filter including poles and zeros to remove the interference component. Consider the sampling rate at 8KHz.


texts: Is system $h(t) = u(t)-u(t-1)$ LTI or not?

texts:
$$y(t) = \int_{0}^{\infty} x(\tau)h(t-\tau) \ \mathrm{d}\tau$$
where $h(t) = u(t)-u(t-1)$.

I have some problem with understanding whether system LTI or LTV just looking the impulse response of the system. Is there any short-cut to identify the system time-variance looking the impulse function?


texts: What are the 'phases' in this 2D scaler filter

texts:
I am pretty new to DSP and have been looking at how image scaling is done in hardware. I and came across a 2D scaler core for an FPGA here. I have read up a bit about polyphase filters, but am confused about what the "16 phases" referred to on page 3 with the following diagram are.

I have not come across this elsewhere and was hoping for some insight as to what is going on here.
My best guess is that they limit the available interpolation points to 16 discreet points in $x$ and the same for $y$, and so any fractional scaling where a sample point falls between $2$ of these $1/16^{\rm th}$ sampling points, will just use the closest point to it?
Any insight would be much appreciated.


texts:
I have implemented QPSK but I have to make changes to OQPSK.
On the transmit path I am clear, as I have to delay Q channel by 1/2 symbol.

My receiver costas carrier recovery will not be the same. I have not found much info about this.
What changes are required?

Gardner timing recovery will be same as qpsk except the Q channel has to be delayed by 1/2 symbol.

After timing recovery does the constellation look like QPSK? ie. the phase ambiguity block will be like the QPSK


texts: Confusion in Normalised Bandwidth of a signal

texts:
I know normalised bandwidth can be found from FFT plot of the signal. But I'm confused that at what stage I have to take the FFT.

I mean first binary data is input to a convolutional encoder, then to NRZ encoder, Then GMSK modulation (sampling frequency till now is 100KHz), then upsampling to 30MHz sampling frequency and then the quadrature modulation.

At what stage I'm supposed to take the FFT to find normalised bandwidth?


texts: Estimating signal strength from PCM-encoded signal

texts:
I am processing rtl_fm output (in time domain), extracting Manchester encoded bits. I can detect preamble and, therefore, decode the message which follows the preamble.
This is how my signal looks like (here I have 2 messages, the rest is noise):

And this one of the messages zoomed in:

Now I want to know how strong was the signal that I've just decoded. I know what is the average amplitude for my symbols: "1" is 2900 and "0" is 1500 (for the amplitude range of -32768 .. 32767). Is it possible to know the signal strength in dB in this case?


texts: Why the formula below are critically-damped second-order linear systems?

texts:
This is part formula of command-response model (Fujisaki Model)：

Analysis and synthesis of fundamental frequency contours of Standard Chinese using the command–response model

http://www.sciencedirect.com/science/article/pii/S0167639305001706
 Why they are critically-damped second-order linear systems?


texts:
I'm currently implementing rotation-invariant phase correlation algorithm, which is a variant of phase correlation algorithm (https://en.wikipedia.org/wiki/Phase_correlation) to estimate relative shift and angle between images. Due to the application requirement, I'm seeking a way to compute RIPOC of image size 256*256 in 1 millisecond.
Partly because it heavily uses Fourier transformation, it seems to be challenging for my current PC to compute RIPOC fast enough to satisfy such requirements. So I'm planning to build a new workstation for this purpose, but I'm not sure which hardware (CPU, RAM, maybe GPU) best suits this situation.

So the question is what should I care about PC configuration that achieves fast computation time. It's appreciated what should I consider in choosing CPU, RAM and so on.
(I'm also wondering whether Intel Xeon processor for servers (e.g. Intel Xeon Gold) helps.)

GPU or co-processors (Intel Xeon Phi) are not so preferable to CPU in my situation due to application requirement, except for extraordinary speed-up by them.

Thanks in advance.


texts: How to recognize colors from the color chart?

texts:
I am developing a vision application that is using the color chart below and camera to extract color of each patch in the chart. In order to do that, I have to first detect the chart area in an image and match the area with existing template which contains locations of patches.

My question: I need to detect the color patch area by recognizing four corners of the chart. You can see the corners that the small inset rectangles indicate in the image below. I know one way to go about it is to let user to select those corners by clicking it. But is there any way to automatically detect four corners from the image.


texts: Processing and combining binary masks of multiple sources for the same image to use in machine learning

texts:
(I'm not entirely sure this is the right site to ask this question on. If not please point me to the right one.)
Context
I'm working on a convolutional neural network (CNN; called Mask RCNN) that I want to train to recognize and segment nuclei in images of human tissue under a microscope. The CNN generates binary masks of where it thinks a nucleus is. I've used an already available dataset (from here) to train it and it yields decent but not good enough results as the dataset and my own images differ quite a bit. So the plan is to modify and then reuse the current results on my own images of the CNN for its own training.
Pictures
One key aspect is that for every section of tissue I have two images, each in a different chemical stain (which makes some types of nuclei easier to recognize).  For one section of tissue I also have three distinct sets of masks that all try to highlight the same nuclei (two sets from the CNN itself on each of the chemical stains and one set from a non-machine learning algorithm).
To hopefully clarify things I've included two pictures of the same example tissue area but in the two different chemical staining methods. Each has the same masks overlaid and a description added by me for a few masks (the overlay and the masks are identical in both pictures). The color of a mask represents which algorithm generated it:

Green / bright green is generated by the CNN with the first image
Blue is generated by the CNN with the second image
Red/orange is generated by the non-machine learning algorithm on the second image.

Question
My question is, in what ways can I combine/process these three sets of masks optimally into one set that I can use to retrain the CNN?
I think it's important to note that I will handpick the images that will be used for training, meaning it's not so important that every nucleus is well annotated but much rather that I can find a few small sections that contain only very well annotated nuclei.
A few approaches I've thought of so far are:

Excluding a mask if its area is either too small or too large,
Only consider the overlap area of masks,
Exclude a mask if it's not approximately elliptical.


texts: What are the basic categories of operations performed on audio signals to create interesting sounds?

texts:
I don't know if this question will make sense as I'm very new to dsp.

In my limited foray into audio dsp I've come across:

Frequency Modulation
Amplitude Modulation
Additive Synthesis
Subtractive Synthesis

My question is: are these the main fundamental categories of signal manipulation (specifically for audio)?

In other words can all the effects and fancy things that FL Studio with a full suite of plugins can do, be broken down into a series and combination of the above 4 operations? Or are there a whole bunch more? Can a modern DAW with plugins theoretically be broken down into any categories in this manner? Do the above 4 categories even make sense in themselves?!

A bit of background: Essentially I'm trying to make a very basic (but very flexible) audio synthesizer/editor as a project to learn both programming and audio dsp. Using java I started by mimicking basic real world synthersizer-ish classes, calling things like Oscillator and LFO and the like, but every time I learn something new, I find myself having to rewrite everything to fit the new concept into the program.

I'm trying to start again now and come up with the basic objects and structure of the program. In order to that properly I need to know how I should allow these objects to interact etc...

Thanks!

EDIT***

Thanks for the useful comments and answers. I realise I've probably been underestimating the dsp side of stuff and I won't be able to just create a basic template & structure for a simple synthesizer and then just expand it/build on it. I will probably have to repeatedly rebuild again & again as I learn new stuff & the "proper" way to do things... It will take longer, but maybe I'll learn more? Also sorry I don't seem to have enough rep to upvote anyone yet... as soon as I can, I will.

EDIT*EDIT***

I should add that a bit of googling revealed this basic guide to "types of synthesis" which I found relevant and interesting.


texts:
I am working in a fingerprint recognition project using C code running on embedded system. After processing the fingerprint image, I have the minutiae now. I tried to matching two sets of minutiae by calculate the distance between each pair of minutiae and check if it is less than a threshold. But it seems not accurate.
So, is there another way/algorithm to match fingerprint minutiae? Please give me some document or source code. I dig around Google but there are theories, formulas and private matlab code ... I read them many times but I don't know how to implement them. I need something more clearly and easy to understand. Thank you.


texts: I'm trying to work out how to estimate camera movement between 2 equirectangular photos (static scenes indoor). Both photos are taken with the same camera (Ricoh Theta S) on the tripod. Height of the camera from the floor is known and same for both photos. Pitch and yaw is known as well. There is a line of sight between both placements of the camera. Is what I'm after even possible? Cheers. Kuba.


texts: How to extract pixel-specific time-stream from mp4 video

texts: I am interested in extracting specific timechange information from an mp4 1900x1200 20fps video.The only pixels I want to process can be found in its borders. Therefore I only need to process approximately 6200 pixels/frame. I am using Matlab and VideoReader function, which is terribly slow. Is there a way to extract only one pixel from each frame of the video throughout its duration, in order to speed up the process? Or am I obliged to load the whole frame? To rephrase the question, if the video is considered to be a mxnxt complex array and the frames are mxn size, can I get a 1x1xt stream instead of mxnx1? I tried to bruteforce by finding information considering the way mp4 is encoded, with no success. If I changed the video encoding or used any other program would that be possible?


texts: Why if I place the zero of the lead compensator at lower frequencies, do I obtain a resonance peak?

texts:
I am studying control systems, and I am studying the lead and lag compensator. I have seen than if I use a lead compensator for the closed loop transfer function,
$T(s)=\frac{s+2}{(s+1)(s+8)},$
with the designed lead compensator,
$lead(s) = \frac{3s+1}{0.1s+1}$
and I use it as a pre-compensator, so that the lead compensator is outside the loop,
$lead(s)\cdot T(s),$
and plot the frequency response, I see that I have a frequency response in which there is a resonance peak, which increases as I decrease the frequency at which the zero is present.

In this case, the red line is a lead compensator defined as,
$\frac{3s+1}{0.1s+1},$
and the green line is the system in which I have used the following compensator,
$\frac{6s+1}{0.1s+1}.$
Can somebody explain to me why?


texts: What are thoughts on best modulation to use for underwater acoustic communications at low frequencies?

texts:
I wanted to ping the DSP hivemind for general thoughts on what would be the best modulation type to use for low frequency underwater communications. I have chosen this project since I can learn a lot from it.

Some context:

Low frequency as in < 500 Hz (for both carrier and modulated data obviously)
BPS of say, 200 Hz would be good.
Will certainly have multipath.
Frequencies can be smeared due to doppler by a maximum factor of about 0.3% of the original frequency.

What I have found thus far:

I was thinking about OFDM, but I have learnt that while channel estimation is much easier, it is much more sensitive to doppler effects.
I was also thinking about chirp modulation, has anyone ever done something like that?

What are your thoughts?

Edit: I have attached some of what I believe are 'worst case' scenarios of the (multipath channel, for a bps = 200 Hz). The channel is in terms of number of bits in the time domain so you can more easily see how many bits pass before the next reflection arrives.

Case 1:
Case 2:
Case 3:
Case 4:

Notes:

As we can see, I almost always have a second path of nearly equal magnitude but opposite phase ready to stick it to my main path.
For a packet of 1000 bits @ 200 bps, (5 seconds), I suppose the channel could change significantly... but at the same time, we have total control over the packet length and content.
We may assume that frequency offsets due to doppler is relatively 'well behaved', ie, no sudden 'jerks'. Frequency offsets due to carrier mismatches can also be thought of as well behaved.


texts: 3-tap FIR filter: simple expression for $H(e^{j\omega})$ using trigonometric identities

texts:
We have a linear time-invariant system described by the input-output relation

$$y[n] = x[n] + 2x[n - 1] + x[n - 2]$$

Below is my approach to analyze this system.

The impulse response of this system $h[n]$ can be found if we input $δ[n]$ in $x[n]$'s position.

So
$$h[n] = δ[n] + 2δ[n-1] + δ[n-2]$$

From above, I can get an expression for $H(e^{j\omega})$ using the Fourier transform.
$$H(e^{j\omega}) = (1 + 2e^{-j\omega} + e^{-j2\omega})
= (1+e^{-j\omega})^2$$

My question is how to simplify this expression using trigonometric identities.

It would be pleasure if I can get some help.


texts: Evaluating discrete spectral density at only a few frequencies

texts:
I'm trying to obtain the spectral density at three particular frequencies for a computational chemistry problem that I'm working on (if you are curious, it has to do with the estimation of Nuclear Overhauser Effects from molecular simulations). Three is a small enough number, especially given the length of the signals being sampled, that it seemed helpful to use a pruned DFT to do this (a Goertzel-like algorithm). Now I'm wondering if I can get away with that, or am somehow thinking about the problem incorrectly. I'm not a signal processing expert by any stretch of the imagination, so I am worried about missing something obvious.

In the chemistry literature, these effects are always functions of the spectral density of the autocorrelation function of some order parameter (in this case, if it matters, the dipole interaction tensor between an internuclear vector and the laboratory magnetic field, which I'm just going to be treating as 'the signal' below). From wikipedia's article on autocorrelation, for a signal $X(t)$:
$$
\begin{align}
F_R(f) &= \mathrm{DFT}[X(t)] \\
S(f) &= F_R(f)F_R^*(f) \\
R(\tau) &= \mathrm{IDFT}[S(f)]
\end{align}
$$

Since the spectral densities are given as the $\mathrm{DFT}[R(\tau)]$ in the textbooks/papers I've found discussing this physical effect, and since I only need the spectral density at three frequencies (0, 600, and 1200 MHz, if that matters) I thought the most straightforward solution was to use a Goertzel-like algorithm (this especially because much computation and disk IO not related to the DFT needs to be done to obtain each sample, so the single pass character of Goertzel-like algorithms is nice for this application).

$$
\begin{align}
S(f) &= \mathrm{DFT}[R(\tau)] \\
F_R(f_0) &= \mathrm{Goertzel}_{f_0}[X(t)] \\
S(f_0) &= F_R(f_0)F_R^*(f_0)
\end{align}
$$

To reiterate the question, is the above reasoning valid? I've gotten funny results that have been hard to troubleshoot so I'm going back to questioning my underlying assumptions. It's also quite possible that all this works, but I'm applying it incorrectly, so if there are restrictions on which frequencies can be monitored in this way (or other things that would be obvious to someone in the field) that'd be helpful to hear.

The algorithm I'm using is sourced from Clay Turner's 'Oscillator Theory' approach to single frequency DFTs: here's C-like sample code he provided for it on a comp.dsp post from a while back:

// The input data is in x[], the data has N samples. And the bin number is w.

y1=0;
y2=0;
k=2*sin(pi*w/N);             // not 2 pi !!

for (j=0;j<N;j++) {
      y2=y2-k*y1+x[j];
      y1=y1+k*y2;
    }

// And the energy is simply

E = y1*y1 + y2*y2 - k*y1*y2;

Note that I chose this after doing some looking when I read Gentleman's 1969 paper suggesting that Goertzel's algorithm performs poorly for low frequencies (I need zero, so that seemed bad). I am working in C++, but because my 'signal' is matrix-valued my code does not look exactly like this. (Yes I can post it, but it might be TMI so I won't unless someone feels that might help).


texts: High error due to resample function in MATLAB

texts:
I am working on training the output of the wavelet transform of a signal using a neural network in MATLAB. So I decided to use 3 layer db4 wave filter for its wavelet transform. I have used an array of 240 elements and after wavelet transform, I get an array l

l = [36;36;65;123;240]

Now, since I have to train my neural network, I have to resample the wavelet transforms of length 36, 36, 65, 123 to an array of 240 elements.

So what I did was, I did wavelet transform of the signal. I resampled each wavelet transform to 240 points, and then resampled the wavelet to 36, 36, 65, 123 points respectively. I got an error of 20.2668. What can be done to reduce error?

I used the following command to resample using MATLAB:

[c1, l] = wavedec(signal, 3, 'db4');

c1a = c1(1:l(1));
c1a = resample(c1a, length(signal), length(c1a));

c1b = c1(1+l(1):l(1)+l(2));
c1b = resample(c1b, length(signal), length(c1b));

c1c = c1(1+l(1)+l(2):l(1)+l(2)+l(3));
c1c = resample(c1c, length(signal), length(c1c));

c1d = c1(1+l(1)+l(2)+l(3):l(1)+l(2)+l(3)+l(4));
c1d = resample(c1d, length(signal), length(c1d));

c2a = resample(c1a, l(1), length(c1a));
c2b = resample(c1b, l(2), length(c1b));
c2c = resample(c1c, l(3), length(c1c));
c2d = resample(c1d, l(4), length(c1d));

X = waverec([c2a; c2b; c2c; c2d], l, 'db4');
err = norm(X-signal)

Now, the error err is reported as

err = 20.26688

What can I do to reduce this error?
Please help :)


texts: Why do we use Difference RGB to grayscale function?

texts:
I found this function for RGB to Gray scale converter at this kind:

  RGB to grayscale

  This example converts an image with RGB channels into an image with a
  single grayscale channel.

  The value of each grayscale pixel is calculated as the weighted sum of
  the corresponding red, green and blue pixels as:

  Y = 0.2125 R + 0.7154 G + 0.0721 B

  Copy to clipboard

  These weights are used by CRT phosphors as they better represent human
  perception of red, green and blue than equal weights. 1

Also at Matlab site said about :

  Algorithms

  rgb2gray converts RGB values to grayscale values by forming a weighted
  sum of the R, G, and B components:

  0.2989 * R + 0.5870 * G + 0.1140 * B

  These are the same weights used by the rgb2ntsc function to compute
  the Y component.

  The coefficients used to calculate grayscale values in rgb2gray are
  identical to those used to calculate luminance (E'y) in Rec.ITU-R
  BT.601-7 after rounding to 3 decimal places.

  Rec.ITU-R BT.601-7 calculates E'y using the following formula:

  0.299 * R + 0.587 * G + 0.114 * B

So, i like to know why difference value and how many standard exist in this function type?

Thanks.


texts: How to proceed for BOW creation From sift features

texts:
I extracted sift feature to construct a bag-of-words model. I did the following to extract the feature vector:

Extracted features from the key frames.
After the feature extraction I tried using Principle Component Analysis to reduce the size of my features.

Query: What further pre-processing steps should I take before creating a codebook out of the set of features extracted ?


texts: Authoritative DSP book/reference material on Psychoacoustics

texts:
I am an auto didactic Electrical Engineer currently pursuing a goal to design a custom application targeted at deeply embedded linux(think BBB or even Raspberrypi-2) type device. My DSP background is mostly theoretical and dates back to my college days. I am currently referring to Understanding Digital Signal Processing- Richard Lyons. A tome it definitely is, but is a very basic reference at the best. I want more concrete book/reference material that helps me understand the various algorithms, their trade-offs and implementation details(pseudo code or Matlab code would definitely help me save time). For a beginner such as me who has no industry bearings, terms such as YIN,YAPPT,HPS,Cepstrum,ASDF,AMDF and many more TLAs are mere jargons. I want to do a deep dive with whatever DSP basics i have and complement that with the said reference book.

My plan is to investigate several algorithms, simulate them in Matlab to verify results and after selecting one based on the results of my experiments move on to actual implementation. My end requirement is that the Algorithm
 has to be real-time. I basically want to hook up a Beaglebone black to my son's piano and be able to detect Pitch and onset in real-time. I have been reading some interesting questions posted here and elsewhere.But I need a strong footing on Psychoacoustics  before any of it starts making sense to me.


texts: Relation between bandwidth and data rate

texts:
I have trouble understanding the following from wikipedia - Bandwidth (Signal Processing)

  A key characteristic of bandwidth is that any band of a given width can carry the same amount of information, regardless of where that band is located in the frequency spectrum

The higher the frequency the more the cycles and therefore shouldn't there be more information passing in a second?


texts: window function between program and math

texts:
I'm newbie on signal processing.
I know when we program python with window function. (just signal multiply with window)
According to Harris paper

I know we change w with different window(blackman).
However in python fft(signal*window(blackman)).
Is there still window(rectangular) function when we do signal capture(fft) in programming?
I mean that dft(signal * blackman * rectangular).


texts: New to this signals stuff and i'm confused about the frequency representation of the square wave. Correct me if i'm wrong, a periodic square wave is composed of odd harmonics sine waves which are multiples of the fundamental frequency, In the frequency domain this just represents decreasing impulses at every odd multiple of the fundamental frequency . What relation does the sinc function have with the square wave? and which is the correct spectral representation of the square wave? Thanks!


texts: How do we distinguish between Image Recognition,Detection and Segmentation?

texts: I am reading image processing book.while reading i am getting terms like image detection,image recognition and image segmentation. it seems that all above terms are one and the same.i am totally confused amongst them.so can anybody help me to understand or distinguish between the above?


texts:
I have a question about simulating Rayleigh Fading channel.

I know theory behind the Rayleigh channel and it is sum of two Gaussian random variable where the amplitude is Rayleigh distributed and the phase is uniform. Also if the symbol time is greater than the delay spread then it is flat fading and symbol time is less than delay spread then it is frequency selective channel.

However I got confused after reviewing different posts in this site and other websites in the internet about actually simulating the flat fading and frequency selective channel and I will appreciate any help.

Lets assume I have one tap filter then

N= 1000;
h=(1/sqrt(2))*(randn(N,1)+1i*randn(N,1));

will generate Rayleigh fading channel.

M=4
N= 1000;
h=(1/sqrt(2))*(randn(N,M)+1i*randn(N,M));

Question 1

Does this create a frequency selective channel solely because I have more taps?

Question 2

In non-of these definitions we are taking into account the delay and magnitude of each path and this means a little strange way to create Rayleigh fading channel. Assume for example I have A=[1 0.5 0.5 1] for gain
and T=[2 3  4 5] for delay. Then how may I incorporate this into my simulation? Above definition does not seem to be working.

I will appreciate any help given regarding the correct way to simulate the channel.


texts: I have a pressure signal and want to do SPL analysis on it

texts:
Signal

I have an acoustic signal from a Ffowcs Williams Hawkings CFD analysis and would like to convert it to the frequency domain and see the SPL and OASPL. I know I need to use fft() but I am unsure why my plot differs so much from the one from FLUENT.

time = data{1};
p = data{2};

Fs = 1/(time(end)-time(end-1));
L = 0.887*Fs+1;
N = 2^9;
Y = fft(p,N);

for k = 1:N/2
   f(k) = (k-1)*Fs/N;
end
spl=20*log10(abs(Y(1:length(Y)/2)));
semilogx(f,spl,'k','Linewidth',2)


texts: Adding measuruments noises to kalman filter

texts:
I'm implementing navigation system for my robot. There are two ways to get data from it: odometry(encoders from motors) and camera. Both of information sources can give me estimate of robot's position. But camera has very big noise. I've found that it is useful to use Kalman filter. After some literature looking I have a questions:

How to use kalman filter with adding measurement noise $v(k)$?
$$x(k+1) = F(k)x(k-1)+B(k)u(k)+w(k)$$
$$   z(k) = H(k)x(k)+v(k)$$
How to make "coefficient of trust" for camera measurements in Kalman gain very low (because     of very very high camera noise)? (Probably is it needed to make specific Q or R matrix?)

I would appreciate any help. Thanks.


texts: Is Z-transform of $\sin(\omega_0n)$ same as that of $\sin(\omega_0n)u[n]$

texts:
The Z-transform tables only mention the transform of $\sin(\omega_0n)u[n]$, e.g. #21 at this link: https://en.wikipedia.org/wiki/Z-transform#Table_of_common_Z-transform_pairs
But how can I find of Z-transform of a signal that is simply $\sin(\omega_0n)$? This signal is an input to a causal system. Should I assume its transform is same as $\sin(\omega_0n)u[n]$?


texts: What are the advantages and disadvantages separability of Gaussian 2D filter?

texts: I know separability of a Gaussian filter enhances the computational complexity from $\mathcal{O}(L^2*N*M) \to \mathcal{O}((L*N*M)$. How this really reflect on my program? I suppose the number of for loops that I need for the convolution less compare to nonseparable case? What real disadvantages ?


texts: General tips for PID tuning of super low-friction actuator?

texts:
I realize this question is not directly related to signal processing, however, it's relevant to system analysis which is relevant to most signal processing engineers. There's also no good alternative stack exchange for me to post this question to (please let me know if there is though).

I'm currently struggling to tune an air-bearing actuator. Because this actuator has such low friction, most of the energy put into it will not dampen itself out naturally. Instead, I'm relying on the derivative gain of my PID controller to do that.

However, I'm struggling to achieve a stiff system (high proportional gain) without it going unstable. I'm using a high powered amp with this stage which is plenty capable of creating stiff control, however, when ever I increase the proportional gain the stage goes unstable. My hope was that I could increase the derivative gain in response to this, yet even doing this it doesn't seem to make the system stable.

What I'm running into is a system that is "squishy" controlled that then goes unstable when I try to increase the proportional gain.

What exactly am I doing wrong?


texts: Refining accelerometer noise using Kalman filter

texts:
I have read that one of the uses of the Kaman filter is to refine the noisy sensor  measurements.
I am using an accelerometer to get the position by integration and want to use Kaman filter to refine the readings.
I know that the Kalman filter can be used in sensor fusion, but what are the steps when only one sensor is available and the physical model of the moving object is not available (the force or u vector is unpredictable).


texts: Choosing samples per symbol for modem pulse

texts:
One of the parameters in my DSP library for pulse design is "samples per symbol", and I would like to get some advice about choosing this parameter when designing a modem.

The smaller the pulse width, the more pulses you can transmit per second, and so the higher the data rate. Therefore, to maximise data rate I should minimise the pulse width. But just how small can I make the pulse?

The closest I came to finding an answer to this is this, but does not directly address the choice of pulse width in samples.


texts: Practical wideband digital beamforming for large arrays in radar applications

texts:
I do understand the mathematics behind digital beamforming but I am not sure how such systems are practically implemented. For example, in a typical wideband FMCW radar operating in S-band, the (baseband) pulse bandwidth can be as large as 500MHz. To digitize this signal, you need high-speed ADCs, typically 1GHz sampling frequency. As far as I know, these ADCs are not cheap.

Now, if you have let's say a Uniform Rectangular Array (URA) with 20 antenna elements, you need to replicate your RF frontend 20 times! This RF frontend typically will include an LNA, a mixer and the high-speed ADC.

In addition, the sheer amount of data produced by the above system is huge requiring large memory and processing power.

My questions are thus:

Does the above scenario reflect how practical beamforming systems are implemented or is it too naive? am I missing something fundamental here?
Are there any hardware/signal processing tricks that can help reduce the hardware or processing requirements in such systems?

Thanks


texts: Suggestions for creating 3D Bounding Boxes of Books on a Shelf from RGB-D Images

texts:
I am new to image processing, so I beg your pardon if this is a trivial question. I am trying to use an RGB-D camera to detect 3D bounding boxes of books on a shelf.
Here are some examples of possible scenarios: books on a shelf 1 or books on a shelf 2. I would like to infer the dimensions (length, width and height) and the pose of each book and of the shelf. So approximate each of the element in the scene with a 3D bounding box.
I would like to get suggestions on which computer vision or image processing techniques are best suited to implement a solution to my problem. I am thinking of YOLO 5 or the following paper:

Deng, Z. and Jan Latecki, L., 2017. Amodal detection of 3d objects: Inferring 3d bounding boxes from 2d ones in rgb-depth images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (pp. 5762-5770).

Are there any better or easier alternatives or already implemented packages?
Thank you all very much!


texts: Phaser effect with feedback control IIR filter calculation

texts:
This question is possibly relevant to this one, but it's not duplicate as far as I'm aware.

I'm trying to make phaser with feedback control as shown in the picture below: (Got it from here)

First problem for me was that feedback loop here doesn't have any delay, so at time $n$ I should pass allpass cascade output $y_n$ to its input at this exact time which seemed impossible to me. However, thanks to this comment I was able to figure out how to transform IIR filter cascade to incorporate this feedback into it in terms of its coefficients:

Recursive equation for $k$-th order IIR filter:
$$y_n = b_0x_n + b_1x_{n-1} + ... + b_kx_{n-k} - a_1y_{n-1} - a_2y_{n-2} - ... - a_ky_{n-k}$$
As we pass system output through explicit feedback loop our input sequence $x_n$ is defined as follows:
$$x_n = d_n + fy_n$$ where $d_n$ is system "dry" input and $f$ is feedback coefficient such as $|f| < 1$

If we plug this into the first equation we'll get
$$y_n = b_0(d_n + fy_n) + b_1(d_{n-1} + fy_{n-1}) + ... + b_k(d_{n-k} + fy_{n-k}) - a_1y_{n-1} - a_2y_{n-2} - ... - a_ky_{n-k}=\\
=b_0d_n + b_0fy_n+...+b_kd_{n-k}+b_kfy_{n-k}-a_1y_{n-1}-...-a_ky_{n-k}=\\
= b_0fy_n+b_0d_n+...+b_kd_{n-k}-(a_1-b_1f)y_{n-1}-...-(a_k-b_kf)y_{n-k}$$

Moving all $y_n$ terms to the left and grouping them we'll finally get our desired system coefficients:
$$(1-b_0f)y_n = b_0d_n+b_1d_{n-1}+...+b_kd_{n-k}-(a_1-b_1f)y_{n-1}-(a_2-b_2)y_{n-2} -...-(a_k-b_k)y_{n-k}$$

Now, the problem is: we all know we cannot directly use filters with order $k > 2$ without stumbling upon various stability problems. Say, I want to implement phaser with four notches, meaning I'll have allpass cascade of overall order $k = 8$ In that case I would probably want to find poles/zeros of my system analytically (instead of coefficients) and split it to second order sections afterwards or something like that, but I cannot figure out how to find poles/zeros instead of coefficients or is it even possible to do so?

All I've got is that using the fact that for allpass of order $k$ and having poles $[p_1, p_2, ..., p_k]$ its zeros will be always equal to $[1/p_1, 1/p_2, ..., 1/p_k]$ and knowing that all poles of initial system (without feedback) are equal I can write down my problem as follows:

$(x - p)^8 + a(x-1/p)^8= 0$

$p,a \in ℝ$

$|p| < 1$

$|a| < 1$

Also, below you can find matlab code which calculates filter coefficients for the whole phaser, you can see unstable case on
[bf, af] = notch_reso2(100, 48000, 0.5, 0.5);

function [ b, a ] = notch_reso2(  fc, fs, feedback, depth  )
order = 8;
w = pi * fc / fs;
a1 = (1 - cot(w)) / (1 + cot(w));
k = a1 ^ order;
p = -a1;
z = 1/p;

zs = repmat(z, 1, order);
ps = repmat(p, 1, order);

b = poly(zs) .* k;
a = poly(ps);

f = feedback;

af = a - b .* f;
bf = b ./ af(1);
af = af ./ af(1);

bf = bf .* depth + af * (1 - depth);
b = bf;
a = af;
end


texts: Unilateral Laplace Transform's Differentiation Property

texts:
I've read in numerous places that the unilateral laplace transform is extermely useful in solving differential equations with initial conditions based on the differentiation property of the unilateral transform:
$\mathscr{L}{f′(t)}=sF(s)−f(0_−)$
What i don't understand is why this is possible to do in Laplace but not in the Fourier Transform?
Is this related to the dacaying exponential added by the Laplace transform?
I would be grateful for an in-depth answer involving intuition.


texts: Detecting trough widths and locations in 1d signal

texts:
I have the following function obtained from averaging 2d camera image over one axis, where detection of aligned objects is desired:

I need to detect (roughly speaking) locations and widths of the troughs -- sometimes and object will be missing, thus the trough will be much wider. The approach should have some resilience WRT possible lighting variations and other noise; this, and also a desire to use something new and useful) prevents me from going the naive way of thresholding and clustering or something similar.

I was looking at using wavelets: using ideal trough (Haar?) as the mother wavelet function, and the analysis would give its translation and scale at troughs in the signal.

I have no prior experience with wavelets. My background is numerics (variational analysis/FEM, particle systems programming), c++ and python, but I am quite new to signal processing (and its terminology).

What would be the most suitable thing to do? Suggestions, pointers to articles, books, or, best, code examples are much appreciated.

EDIT:

I finally used continuous wavelet transform (as implemented in scipy) where the result local maxima (in yellow) show both location (x-axis) and width (y-axis) of the trough.

import numpy as np
from scipy import signal
# scale the ricker (mexican hat) function to 10-60px width
widths=np.arange(10,60,.2)
cwtout=signal.cwt(vscan,signal.ricker,widths)
plt.imshow(cwtout,extent=[0,len(vscan),60,10],aspect='auto',vmax=abs(cwtout).max(),vmin=abs(cwtout).min())


texts: linear-expansion filter for image (2D array)

texts:
I am working in python analyzing 2D arrays and I am looking for a filter or some other routine that would provide a linear expansion of an region boundaries in a 2D array with binary regions (i.e. a black/white image).  For example given this star image:

I would like to apply a filter that expands a region's borders with a  radial, linear decrease from a maximal value (i.e. black) to the surrounding value.   Graphically represented as:

So that the resulting image/array is something like:


texts: How can I cluster signales by their different noise patterns?

texts:
Given be a set of signals (e.g. images) coming from one or more sources (e.g. different types of cameras) is it possible to find out, which signals come from which source?

I consider this question very relevant for the pre processing step of data, for example medical data. Assuming a data set was generated by only one machine is very naive and may ultimately used in the pratice.

Therefore I am looking for material to work through, that would allow me to tackle this problem, for example by finding an above described clustering algorithm.

Thus far I found a method identifiying camera models, namly here: K-unknown models detection through clustering in blind source camera identification.

However, I am more interested in the medical use cases of sources like x-ray, ultrasound etc., thus I would be very thankful for someone pointing me into the right direction.


texts: Subsampling property of wavelet transform

texts:
One of the properties I have seen for isotropic tight wavelet frames is

$$\sum_{i\in\mathbb{Z}} \left|h(2^i\omega)\right|^2 = 1$$

where $h(\omega)$ is the frequency spectrum of the original wavelet. See page 8 in A unifying parametric framework for steerable wavelet transforms.

I have always assumed that this enables the downsampling often seen in wavelet decompositions, which start off with a wavelet satisfying $h(\omega) = 1\, \forall \omega > \pi/2$, meaning that the top half of the spectrum is covered and thus subsampling of the low pass remainder is possible because there are no longer any frequencies above $\pi/2$.

Is this correct?
Or can you perform downsampling still having frequencies above $\pi/2$?
If one does not need downsampling or wants to have different partitions, is the following condition sufficient,
$$\sum_{i=1}^{I} \left|h_i(\omega)\right|^2 = 1$$
where $\{h_i(\omega)\}$ are the frequency responses of the wavelets in the frame?


texts: estimating peak frequency close to bin zero

texts:
Given a half complex spectrum (positive frequency bins from DC to Nyquist) as the result of a real FFT, to estimate the true (non integer) peak frequency I usually rely on Eric Jacobsen's estimator:
$$f=Re\bigg[\frac{Z_p-Z_n}{2Z-Z_p-Z_n}\bigg]$$
where $Z$ is the complex bin value at local maximum and $Z_p$, $Z_n$ are the previous and next bin values, and $f$ is the obtained fractional position.
The problem is when a frequency peak is very close to frequency 0, then we have two cases:

When the peak is at bin 1, the estimator starts losing precision.

.When the peak is at bin 0 as in case of, say, a frequency peak of 0.2 in bin units, the estimator cannot be used because there is not any previous bin $Z_p$. This of course happens because the left portion of the peak body gets reflected back as conjugate, and the closer you get to bin zero, the more radical is the influence of the reflected portion tricking the estimator, which would otherwise work well with an analytic spectrum devoid of reflections.

How can I reliably estimate the peak frequency when the peak is at bin 1 or worst at bin zero ?


texts: Finding the Harmonics contained in an Image?

texts:
I am beginer in image processing. Any signal whether it is 1D,2D or any multidimensional signal can be represented using combination of number of sine and cosine wavesforms (harmonics). Similerly any image can be termed as a function of sinusoidal signals.

I want to see individual pattern for the number of waveforms/harmonics present in an image.for example the following  link contains few of them http://www.cs.toronto.edu/~rfm/factored/filters_out.png . So is there any code in Matlab/ OpenCV  or results to understand easily these components(sine and cosine functions(harmonics)) present in any image?


texts: Delaunay triangulation and Voronoi diagram in image processing

texts:
I am reading about image processing and it was mentioned in a couple of articles "Delaunay triangulation" and "Voronoi diagram".

I read on what the two things mean and how they are acquired, but why are they important in image processing? After searching on the DSP stackexchange and overall the Internet, I did not seem to find an explanation about this, so if I have missed a thread, with an explanation, I am apologizing in advanced.


texts: Division of complex signal by frequency response

texts:
I have a measured signal (time domain) which I take the FFT of. I have a measured frequency dependent sensitivity (magnitude and phase (radians) as a function of frequency) which I need to apply to the measured signal. In effect perform a frequency dependent weighting to the measured signal's FFT.
I calculate the complex signal for the sensitivity magnitude and phase before dividing this into the FFT of the original signal.
I then take the IFFT of this which should give me something like the original signal shape but it does not.

Is my method correct?


texts: OFDM pilot allocation block type and comb type

texts:
As known, the pilot insertion in OFDM can be either bock type or comb type, I think comb type is appropriate for double-selective channel while block type is for frequency selective channel:

In the above figure, it means that we perform the iFFt in Vertical direction and then send the data horizontally. Suppose we have the size frame is $M$ x $N$ which means we perform $M-$point iFFT for each column before transmitting the whole frame through the channel.

At receiver side, we receive the frame  as follows, in figure $(b)$ pilot location index is 1:4:end, and in figure $(a)$ pilot location index is $x$:4:end, and $x = 1 : N$. is that right?

The received frame is of length $MN$x$1$, how can we deal with it to estimate and equalize the channel? suppose we use the LS for estimation? ...  I think in figure $(b)$ it's possible to reshape the received frame into $M$x$N$ after that  perform $M$-point FFT and then get the estimated channel $h_{est}$ as $h_{est} = P_r./P_o$  such that $P_r$ and  $P_o$ denote received and original pilot, respectively. finally we interpolate to get the estimated channel. Is that Right?

If so, What's about the channel estimation in figure $(a)$ ? how can we deal with it ?


texts: How to extract vocal part from stereo audio signal?

texts:
I'm now processing MP3 file and encounter this problem. My MP3 is stereo encoded. What I want to do is extract vocal part for further processing(whatever mode of output signals, mono or stereo are both OK).

As far as I know, audio is encoded into different dis-joint sub frequency bands in MP3. I think I can limit the signals to the vocal range through high-pass/low-pass filter with cutting-off frequency proper set. However, result must contain parts of pure music signal in this case.
Or after googling, I think I may calculate the background signals first(by inverting one channel adding with signals from the other channel assuming vocal part is centered in the stereo audio called phase cancellation). After this transformation, the signal is mono. Then I should merge the original stereo into mono from which extracting the background signal.

Given the effectiveness, which one is preferred(or any other solutions:)? If the 2nd one, let two channels A and B, will (B-A) or (A-B) used when compute the background? As with merging two channels, does the arithmetic mean accurate enough? Or I can downsample each channel by a factor of two and interleave the downsampled signals as mono result?

Thanks and best regards.


texts: How to get translation and roation data using 6DOF MPU6150

texts:
I am trying to get the position data from an IMU 6 Degrees of Freedom (MPU-6150) board using an Arduino Uno. I am trying Jeff Rowberg’s example MPU6050_DMP6.ino that may be found here.

This is the first time I am working with an IMU. I have no idea whether it's possible to get the position data using the using quaternions and yaw, pitch and roll data? It would be great if someone can explain how to find the position of the sensor (translation in cm or mm and rotation in degrees) using that sketch.


texts: How to Determine if FIR has a Linear_Phase Response w/o Matlab

texts:
Given the FIR transfer function:

h(z) = $ .36 + .384z^{-1}  + .1608z^{-2} +.9712z^{-3}  + .352z^{-4} + .18z^{-5} - .2z^{-6} $

How do you determine if this transfer function has a linear - phase response.


texts: I have tried to read different articles but still confused in difference between continuous time Fourier transform and discrete time Fourier transform?


texts: Obtaining signal energy modulation for voice activity detection

texts: Im currently working on VAD (voice activity detection) topic. Since I'm beginner in digital signal processing, I've started to wonder if calculating single frame energy (after aplying FFT to it) and looking for values around 4Hz and bandwith (for example) from 200Hz to 600Hz would be as effective as checking for 4Hz modulation energy after finding MFCC coefficients?


texts:
I wrote octave code to find transmittance based on zeros and poles:

sps = 44100;     % sample rate [samples/s]

function [b, a] = dbtf(sps, z, p)
  b = [ 1 ];
  a = [ 1 ];
  for i = 1:size(z)(1)
    f = z(i, 1);
    g = z(i, 2);
    b = conv(b, [1, -2*g*cos(2*pi*f/sps), g^2]);
  endfor

  for i = 1:size(p)(1)
    f = p(i, 1);
    g = p(i, 2);
    a = conv(a, [1, -2*g*cos(2*pi*f/sps), g^2]);
  endfor
endfunction

z = [ 0 1; 30 1;            45.8 1;          66 1; ];
p = [           41.7 0.9999;       60 0.9999;     95.2 0.9999; ];
[b, a] = dbtf(sps, z, p);
[h,w] = freqz(b, a, 128000);
semilogx(w/pi+0.00001, abs(h));

It just calculates conjugate zeros and poles of numerator and denominator. Next zeros and poles are added by polynomial multiplying using conv function. Z and p vectors holds frequency/radius pairs.

For such defined zeros and poles I have strange result:

z = [ 0 1; 30 1;            45.8 1;          66 1; ];
p = [           41.7 0.9999;       60 0.9999;     95.2 0.9999; ];

but if I remove zero at 30Hz, the result is as expected:

z = [ 0 1;                  45.8 1;          66 1; ];
p = [           41.7 0.9999;       60 0.9999;     95.2 0.9999; ];

The question: Is it just matter of number precision in octave or my calculating method is wrong ?
Alternative question: Could somebody try it on matlab (not octave) and say if results are the same ?

I of course expect notches at frequences of zeros and resonances at frequences of poles. Only second result shows 3 resonances and 3 notches as expected. In the first example frequency response looks completly random (nothing resembles expected notches and resonances).


texts: How to visualize the autocorrelation matrix and it's properties

texts: Having a hard time wrapping my head around autocorrelation matrix as it applies to a spectral estimation problem like MUSIC or ESPRIT. If the signal vector contains a summation of sinusoids in noise, how does building the autocorrelation matrix help decipher this information? Seems like a bit of magic that the toeplitz matrix of the autocorrelation sequence can help break out the signal subspace and the noise subspace.


texts:
I have 10 cosine waves of the form $\cos(2\pi(x f_n+\varphi_n))$, where $f_n$, the frequency, is an integer from 1 to 10 and $\varphi_i$, the phase, is a number from 0 to 1:

$$s(x) = \sum\limits_{n=1}^{10} \cos\left(2\pi (x n+ \varphi_n)\right),
\quad \varphi_i \in [0,1]$$

If I set all the phases to 0, $m = \max\limits_x \lvert s(x)\rvert$ peaks as high as 10. All phases at 0.25 peaks at 7.596. Setting the phase to any linear function of freq just moves the waveform, keeping the peak the same. But making the phases random can sometimes get the peaks below 5!

Is there a more systematic way (other than picking random phases and hoping for the best) to minimize the peak of these cosines?

Edit:
I think the peak has to be bigger than $\sqrt{5}$ (amplitude of square wave with same RMS as signal above). Also, after 3 million attempts of brute force guessing, the lowest peak was 3.576. The phases still don't have any sort of pattern to them, though.


texts: Polyphonic detection/Mulit-pitch detection/Chord recognition

texts:
I build application witch will be transform piano sound to musical notes. I found some pitch detection algorithms with implementations (mainly based on autocorrelation or fft), but chord recognition, of course is  not working.
What is best method for instrument as piano(both hands + chords)?
Is there any implementation of this problem?


texts: How to derive stability of analogue and digital systems

texts:
I'm trying to find out why digital systems are stable iff poles oh their transfer function are inside the unit circle (or are there any others conditions?).

I understand analogous systems are stable iff all poles of their transfer function are negative 'cause of inverse Laplace transform, where $\mathcal{L}^{-1} \left \{ \frac {1}{s+a} \right \} = e^{-at} \cdot \mathcal{1} (t) $. (by the $\mathcal{1} (t)$ i mean heaviside function). Is that right?

But how to derive conditions for stability of discrete system?

What others ways for derivating stability of discrete and continuous systems exist?


texts:
I'm trying to make a specific image filter, processing a picture to cartoonize and change the colors.

Here you can see the original and the expected result: http://codingfocus.com/ieffect.jpg

I'm not sure which will be a good approach, I started with a grayscale, posterize and color replacement ranges based on how dark is every pixel, but the result is pretty pixelated and not near to what I would like to obtain. http://codingfocus.com/test3.jpg


texts: Edge linking using local processing - why is this criterion imposed

texts:
I'm reading Digital Image Processing by R. Woods and R. Gonzalez. In it, a section on edge linking using local processing in an image details a simplified algorithm, that imposes a criterion on the gradient direction of edge pixels. I don't understand this. The algorithm is at the end of the first image, and an example is shown on the next page which shows the results of applying the algorithm. Can someone explain why this algorithm works? Specifically, I want to know why the such a criterion is imposed on the gradient direction, and what the author means by TA being a "band" of acceptable directions.

I've understood that the algorithm is a simplification of the method discussed above it. I've also understood the two criteria imposed on the gradient magnitude and directions in that discussion. But I don't understand why TA has to be a band, why the criterion for the direction is an equation and not an inequality, and why the algorithm worked for the example image, where the equation works out to be alpha(x, y) = 90 + 45 = 135 (since A = 90 and TA = 45).

I don't have enough rep to post the last image, so I'll write the last part : "A=90, TA and filling in all gaps of 25 or fewer pixels (approx 5% of the image width. Use of a large range of allowable directions was required to detect the rounded corners of the license plate enclosure, as well as the rear windows of the vehicle. Fig E is the result of forming the logical OR of the preceding two images, and fig F was obtained by thinning dig E by a thinning procedure. As fig F shows, the rectangle corresponding to the license plate was clearly detected."


texts: Question about path loss exponent estimation from measurment

texts:
I have a simple question that confuses me.

Assume that we have the following results of a measurement campaign, distance (km) and the corresponding path loss $L_{e}$ (dB). I want to estimate the path loss exponent of the simplified path loss model

$$L_{m,\text{dB}} = K_\text{dB} - 10 n \log_{10}\left(\frac{d}{d_0}\right)\text ,$$

where $K$ is a constant that depends on antenna characteristics and average channel attenuation at reference distance $d_0$ and is given by $K_\text{dB} = 20 \log_{10}\left(\frac{\lambda}{4 \pi d_0}\right)$ or $K_\text{dB} = 20 \log_{10}\left(\frac{\lambda \sqrt{G_t G_r}}{4 \pi d_0}\right)$, where $G_t$ and $G_r$ are the transmit and receive antenna gains, respectively, and $\lambda$ is the wavelength.

To estimate the path loss exponent $n$, I am finding $n$ that minimizes the MMSE error for the dB power measurement

$$\begin{align}
\text{MMSE}(n) &= \sum_i^N \left[L_e(d_i) - L_m(d_i)\right]^2\\
 &= \sum_i^N{ \left[L_e(d_i) - K + 10 n \log_{10}\left(\frac{d_i}{d_0}\right)\right]^2}\text ,
\end{align}$$

where $N$ is the total number of measurements.

It seems the exact value of $n$ depends on the reference distance $d_0$ and the antenna gains $G_t$ and $G_r$, right?
In other words, for different $d_0, G_t, G_r$, I will have different value for $n$.  Is this in conflict with the fact that on a log-log scale, the path loss is represented by a straight line with a slope of $10 n$ per decade?


texts: Playing sound in left and right speaker alternatively and storing output in array in matlab

texts:
I have a play function that is called twice, each plays a channel (a column of the two dimensional array) in both speakers. What I am trying to do  is to play both channel at the same time. How do I silence a channel and set the  the elements in the corresponding column to 0. I also need an output array that im trying to make look like this when the data is output into it. The code is in the link below.
1     0
2     0
1     0
0     4
0     1
0     1

Fs = 44100;
N = 400
t = (1:N)*(1/Fs);
freq = 600;

sound_array = zeros(N,2);
%starts N x 2 matrix
sound_array(:,1) = sin(2*pi*freq*t);
sound_array(:,2) = sin(2*pi*freq*t);

%Sound 1
sound(sound_array(:,1), Fs);
%Sound 2
sound(sound_array(:,2), Fs);
%Play Consecutive
sound(sound_array, Fs);


texts: Is the sum of white noise and shifted white noise white noise again?

texts:
Let $W[k]$ be a stationary white noise with variance = 1

Question: Is $X[k] = W[k] + c \cdot W[k-1]$ white noise?

$c$ is a real number.