texts:
I'm quite new to DSP and I guess my problem it's quite silly but I can't find a clear answer. Basically I'm writing some python code for a test. The test requires me to write a memory with the I/Q components of a specific waveform.

As far as I know it's quite easy in hardware to get the I/Q samples. I just need to multiply the input signal ( my waveform ) with $sin(w_ct)$ and $cos(w_ct)$ ($w_c$ should be the sampling frequency) and then sample it with an ADC.

In my case I'm able to create the samples of the waveform ( it's a sawtooth but I would like to understand the general case as well ) but then I'm quite stuck because I don't know how to extract the I/Q components from each sample.

Any idea ?

Cheers,
Stefano.


texts:
I have been creating an application in Java that transforms an audio signal and writes it to a midi file.

At first I tried using autocorrelation to find the fundamental frequency. However, I have been having difficulties implementing it. I resorted to finding the index of the peaks of the FFT output, finding their consecutive differences and deriving the fundamental frequency from the mode of the differences. This has given me pretty good accuracy. However, for lower notes, it is not working that great.

I was hoping that reviewing it would have helped, but no avail.
Following is the output from a sample FFT and autocorrelation.

Questions are:

Is the autocorrelation method correct? a) Double the input and pad with zeros. b) Forward FFT. c) Take the absolute square. d) Inverse FFT.
Am I looking for the right peak in the graph? I am assuming it should be the first peak.
Do the indexes of the autocorrelation graph relate to the frequency just as the indexes of the FFT? (see computeFrequency())
Is there any kind of preprocessing that I am missing, etc?
Is autocorrelation dependent on multiple harmonics being present?
Are there any additional techniques that I can apply to better implement autocorrelation? Or preferred fundamental frequency finding algorithms? (I have looked a little at cepstrum and was having similar problems.)

Thanks for any help received!

This is the output of an FFT. The peak is at index 47. I am positive I have implemented the FFT correctly. Index 47 matches up to E4 with a sampling frequency of 16,384 Hz and a padded FFT length of 1024.

I know, in this case, that, choosing the highest peak will suffice. However, there are FFT's that are not this kind.

Here is the output of the Autocorrelation. The first peak is at index 25 and the second at index 50.

Here is the code for the autocorrelation.

/**
 * complexData is overlapped 50%.
 * @param complexData
 * @return
 */
private Double[] autoCorrelation(final Complex[] complexData) {
    Complex[] toFFT = doubleAndPad(complexData);

    Double[] autoCorrelationAbsolute = new Double[toFFT.length];

    FFT.fftForward(toFFT);

    for(int j = 0; j < toFFT.length; j++) {
        //Same as Complex.mult(toFFT[j], toFFT[j].conjugate()) but simpler
        double square = toFFT[j].absoluteSquare();
        toFFT[j] = new Complex(square);
    }

    //Effective inverse FFT
    //forward FFT == inverse FFT for real numbers.
    FFT.fftForward(toFFT);

    for(int i = 0; i < toFFT.length; i++) {
        autoCorrelationAbsolute[i] = toFFT[i].absolute();
    }
    return autoCorrelationAbsolute;
}

Here is the code for doubling and padding

/**
 * Returns a copy of data with the size doubled and the
 * second half set to zero.
 * @param data
 * @return
 */
private Complex[] doubleAndPad(Complex[] data) {
    Complex[] doubledData = Arrays.copyOf(data, data.length * 2);
    //Set the second half to zero
    for(int i = data.length; i < doubledData.length; i++) {
        doubledData[i] = new Complex(0);
    }
    return doubledData;
}

This is what I use to calculate the frequency.

/**
 * Computes the frequency based off of the padded FFT in autoCorrelation
 * @param bin
 * @param data
 * @return
 */
public static double computeFrequency(int bin, AudioData data) {
    return bin * data.getFormat().getSampleRate() / data.getFftLength();
}


texts:
I'm trying to solve this signals homework problem:

So for part a, since multiplication in the time domain is convolution in the frequency domain, I just used a DTFT table, found the DTFT for $\left(\frac12\right)^n$ and $\cos(\pi n/2)$, convolved them, and solved for $H(\Omega)$. I got the same answer they have in part a.

I don't quite understand their solution though, which leads me to believe there is a more intuitive way to think about this.

Anyways...for part b, you would think you'd use the DTFT of $\cos(n \pi/2)$, multiply that by $H(\Omega)$ and take that whole result and Inverse DTFT it back to the time domain, then solve for $y[n]$.

However, I can't get the math to work, and I can't seem to follow their solution.

Can anyone show me mathematically or intuitively how they get that final $\frac43\cos(n\pi/2)$?

Thanks,
Clint


texts: Ultrasonic Interference with Electromagnetic Waves?

texts:
I am currently working on ultrasonic frequencies (20 kHz-60 kHz). According to a news snippet I found:

  The state government has also tried employing ultrasonic guns that can scare monkeys away and create van vatika or small sanctuaries for different troops. The plan to use ultrasonic guns, which cost Rs 20,000 each, was shelved after municipal officials said the ultrasonic frequencies jammed phone and internet services.

stated that the Ultrasonic Guns jammed up phone and internet services.

Aren't Ultrasonic (Mechanical energy) and Phone / Internet transmissions (Electromagnetic energy) completely different in nature and operate on different spectrum? Ultrasonic waves they might have used might go up to 100 kHz, while the Internet (2.4 GHz) and mobile systems (GSM: 900 MHz and above) are in completely different spectrum. Is this possible?


texts: Pulse Width and Duty cycle in Gaussian pulses

texts:
I have a pulse-based radar which transmits frequency-shifted Gaussian pulses. The Gaussian pulse ($p(t)$) is given by:
$$
p(t) = V_\text{TX} e^{\frac{-t^2}{2 \tau ^2}}.
$$
The frequency shifted Gaussian pulse (g(t)) is given by:
\begin{align}
g(t) &= p(t)\cos(\omega_{c}t)\\
&= V_\text{TX} e^{\frac{-t^2}{2 \tau ^2}}\cos(\omega_{c}t).
\end{align}
where $\omega_{c}$ is the carrier frequency in rad/s.
How do we define the pulse width of this specific pulse, and also how is the duty cycle defined in this pulse?


texts: A Delay Between Two Filtered Chaotic Signals

texts: it is a common practice to use a shift of cross-correlation peak to evaluate a group time delay of two signals (chaotic signals are included). Can one synchronously and equally filter these chaotic signals (one is a shifted copy of the other) and then get a cross-correlation between filtered copies of them? What will happen with a group time delay after that filtration? I made a numerical experiment with two simple delta-correlated signals (one is a shifted copy of the other, fft, fft filter and inverse FFT to get a cross-correlation) which indicated that absolutely nothing happens with a delay time after filtration. The same result one can get for correlated signals (I applied a moving average to simple delta-correlated signals and again - nothing happens) The delay time is the same after filtration (with different bandpasses of filters). But when I come to real signals the picture had changed dramatically. The value of the delay time depends on the filter's cut-off limits and the size of the spectral window. Any ideas why? Why do we suppose that we evaluate a delay time correctly when all spectral components are taken into account and can not be sure in the same estimations after filtering?


texts:
Looking for clarification on the notation described in the MUSIC algorithm in Ralph Schmidt's IEEE paper$^{[1]}$. The data model is:
$$X = AF + W$$
Schmidt defines the following:
X = received signal for each array element
A = steering vector
F = received signal
W = noise

M = number of array elements
D = number linear combination of incident wavefronts

X is dimension M x 1
A is dimension M x D
F is dimension D x 1
W is dimension M x 1

Questions

Where is the number of receivers accounted for? A practical system may have a $360^\circ$ element antenna, but only $K$ receivers, where $K \ll M$ (e.g.,$K=8$)
Where is the length of the data incorporated? Assuming $N$ samples for the received signal vector. Intuition leads me to believe that $F$ is of dimension $D\times N$
Does $F$ represent the received signal? If so, what does $X$ represent? Received signal at each element in the array?

$[1]\ $ R. Schmidt, "Multiple emitter location and signal parameter estimation," in IEEE Transactions on Antennas and Propagation, vol. 34, no. 3, pp. 276-280, March 1986


texts: What is the name for a constant-heading Kalman filter model for vehicle tracking?

texts:
When applying Kalman filtering to estimate the position of a car, there are several different vehicle dynamics models that you could use.
One of the simplest is "constant velocity" or CV, which uses the state
$$
\mathbf x = [x, y, v_x, v_y]
$$
A more sophisticated model is "constant turn rate and velocity" or CTRV, which uses the state
$$
\mathbf x = [x, y, \theta, v, \omega]
$$
My coworker has implemented an algorithm that's somewhere in between these two, and I'm wondering what to call it. It uses the state
$$
\mathbf x = [x, y, \theta, v]
$$
I would expect that this model is called "constant heading and velocity" or "constant bearing and velocity" or similar but I haven't found any papers describing it.
Is there a name in the literature for this model?


texts: Is there two Types of Scale Space in SURF algorithm?

texts:
I couldn't figure out below paragraph on SURF paper and hope that someone can help me to understand it.

  Bay H., Ess A., Tuytelaars T. Van Gool L. - Speed-Up Robust Features
  (SURF), page 4, column 2

  The large scale changes, especially between the first filter within these octaves (from 9 to 15 is a change of 1:7),
  renders the sampling of scales quite crude. Therefore, we
  have also implemented a scale space with a finer sampling
  of the scales. This first doubles the size of the image, using
  linear interpolation, and then starts the first octave by filtering with a filter of size 15. Additional filter sizes are 21,
  27, 33, and 39. Then a second octave starts, again using filter which now increase their sizes by 12 pixels, after which
  a third and fourth octave follow. Now the scale change be-
  tween the first two filter is only 1.4 (21/15). The lowest
  scale for the accurate version that can be detected through
  quadratic interpolation is s = (1.2(18/9)/2)=1.2.

is that mean they used two different scale space at same time or they used each one individually and choose the one with better result?


texts:
Perhaps a meta-question, but I'll post it here because some of you are bound to possess gold nuggets about continuing education. It might be closed for being subjective but I don't care because this community is small and this could be valuable info for visitors.

Aside from reading DSP.StackExchange questions and answers, I've been doing the following:

MIT OCW Signals and Systems, but Oppenheim's lectures from the 80's and not the 2004 course, actually doing the problem sets, reviewing
the solutions, and really understanding where a process comes from
Reviewing circuit analysis diagrams
Taking the concepts from Signals and Systems and plotting / manipulating them in MATLAB

Of course, there's no substitute for working on a project and having your *** on the line for not making it work, but things can only get better if your fundamentals are really solid, right?


texts: How to get the 10-5 most dominant frequency in an audio signal

texts:
I have this wav file that I recorded using my laptop, It contains the sound of a G chord of a guitar. Since the guitar have 6 strings the sound should contain different frequencies I want to determine the top 10 most dominant frequency in the signal.

[X, Fs] = wavread('chordG.wav');
freq = fft(X);
plot(abs(freq)):

I don't know how to proceed after that it shows the graph of the frequency but I don't know how can I extract the values in the graph.

Your answer would be very much appreciated :)


texts: how can I calculate pitch deviation in a large collection of audio files?

texts:
I am making a software model of an existing digital synthesiser and I have made audio recordings of single notes with particular parameter settings. I made a program in C++ which sends a MIDI sysex message to change the parameter in question, then triggers a MIDI noteon and noteoff message. The sound is recorded to a wav file. So I have several collections of 100 wav files for each parameter (the parameters in question have 100 steps).

One of the (easier) parameters I am looking at is LFO depth. The LFO is applied to the oscillator pitch. So I have 100 wav files with a square wave LFO modulating the oscillator pitch between a base pitch and another pitch that goes between base pitch (zero modulation) and base pitch+1 octave. I would like to write a script to work out precisely how many semitones/cents modulation occurs in each wav file. So I would like to end up with 100 numbers that I can use to map to modulation depth in my software model.

Can anyone recommend a tool/and or libraries for doing this task?


texts: Golay complementary sequences for channel estimation - MATLAB

texts:
There are set of complementary sequences known as Golay sequences that are used for channel estimation because of the nice property they have which is that the sum of the autocorrelation function of each gives dirac function.

For example, these are two complementary sequences

$$Ga=[+1, +1, +1, −1, +1, +1, −1, +1]$$
$$Gb=[+1, +1, +1, −1, −1, −1, +1, −1]$$

$$R_a(i)+R_b(i) = \delta(i)$$

Due to this nice correlation property, they are used in digital communication for as known pilot sequences for channel estimation of wireless channel. For example assume the channel we want to estimate is $h(t)$ then sending $Ga$ and $Gb$ over channel first and then performing correlation at receiver with Ga and Gb provides a good estimate of channel.

$$(h(t)*Ga)*Ga + (h(t)*Gb)*Gb =h(t)*(R_a+R_b)= h(t) \delta(t)$$

In theory, this is easy to understand. However I am trying to implement a more realistic setup in MATLAB.

If $G_a$ and $G_b$ are 10 chip in length with have a chip time of $T_c=0.57 ns$ and the channel is a 2 tap with delay spread of the channel is $T_{delay}=2.7 ns$. And assume we have Additive White Gaussian noise. My aim to estimate the channel. Below is my code.

channel =[1 0.2]';
Ga=[+1, +1, +1, -1, +1, +1, -1, +1]';
Gb=[+1, +1, +1, -1, -1, -1, +1, -1]';
y1=conv(channel,Ga);
y2=conv(channel,Gb);
r1=awgn(y1,10);
y2=awgn(y2,10);
hac1 = dsp.Autocorrelator;
correlation_output1=step(hac1,Ga);
correlation_output2=step(hac1,Gb);
channel_estimation=correlation_output1+ correlation_output2;

As you can tell, I have not included the delay spread $T_{delay}$ neither the chip rate $T_c$. Can anyone help me understand how I can incorporate such in my MATLAB code?


texts: Isosurfaces from three dimensional column data: methods

texts:
I have just been asked the following question, and   I somehow felt short of smart answers. You are given a series of $N$ triplets of values ($P_1$, $P_2$, $P_3$), pertaining to physical measurements. $N$ is in the order of $100$ to several thousands. My colleague would  like to draw isosurfaces from this dataset.

I have not more (yet) information about the quality of space filling, and the uncertainty around the data.
So I suggested to interpolate the given point cloud to a regular grid and use standard isosurface extraction. But there might be other, more direct methods, dealing with point cloud issues.

Some related papers:

Direct Isosurface Extraction from Scattered Volume Data
Isosurface Generation for Large-Scale Scattered Data Visualization

Would you suggest sounder approaches (references, software implementing them are a plus)


texts:
I have an application that I must use a complex Morlet wavelet function (cmorfb-fc), I can run CWT (continuous wavelet transform) and it's fine, but I want to run DWT(Discrete wavelet transform) with this complex Morlet(cmorfb-fc) function too. then I want to compare the DWT and CWT results.
so Does anyone can help and explain, how can I implement DWT of complex Morlet (with the known Mallat filters)?


texts: How to calculate fisheye distortion error

texts: OpenCV offers a fisheye library for calibrating wide-angle lenses. I have implemented the calibration and want to verify the reprojection error by using a new set of images. So is there a function to take a new set of chessboard corners points, undistort them, then distort them, and then compare the initial points with the set of redistorted points. When using cv2.fisheye.distortPoints and cv2.fisheye.undistortPoints I just get a perfect fit so this is not for error measurement. I want to get the reprojection error with new images. One of the reasons is that I want to be able to tell if the camera becomes uncalibrated after usage.


texts: How to convert time-domain signal to complex envelope?

texts:
Matlab and Simulink Communications Toolbox digital demodulators are defined to only work on the complex envelope representation of a baseband signal.

To obtain the time-domain representation of this signal, I believe one takes the real part of the complex envelope.

Given just this real part, how does one convert the time-domain representation of modulated data back into a complex envelope such that a Matlab demodulator will demodulate it?

Application: I'm trying to simulate a simple audio FSK system in Simulink.


texts: Time resolution of the Short Time Fourier Transform (STFT)

texts:
I'm struggling to figure out how the time points of an STFT are calculated, and I can't find a definitive answer.  Let's say I have a 4Hz stationary signal and I'm going to use a 64 second window with 3 second overlap. So that's a 256 point window and a 12 point overlap.

Assuming I start at time=0, take the first 64 seconds, and perform the FFT/Power Spectrum Density/etc... Can I then say that is the value at t=32? Is the next window, after the 3 second slide localized at t=35, and so on?

If so, and I really wanted to start at t=0, would I then effectively start at t=-32, fill the first 128 points with zeros and take the first 128 points from my signal, thus centering on t=0?


texts: Purpose of image feature detection and matching

texts:
I'm a new guy in image processing and computer vision, so this question might be stupid to you.

I just learned some feature detection and description algorithms, such as Harris, Hessian, SIFT, SURF, they process images to find out those keypoints and then compute a descriptor for each, the descriptor will be used for feature matching.

I've tried SIFT and SURF, found that they are not so robust as I thought, since for 2 images (one is rotated and affined a little), they don't match the features well, among almost 100 feature points, only 10 matches are good.

So I wonder

What can we use these feature detection algorithms for in practice? Is there any more robust algorithms for feature detection and matching? Or SIFT and SURF is already good, I just need to refine it for further use?
Another problem is that I thought these algorithms are not quite for real-time application (without considering multi-core implementation), but there are some commercial products (such as Kinect) which work and response in real-time! I assume these products also detect and match feature from what they see, do they use the algorithms such as SIFT? How could they detect features so well?
With my limited knowledge, I know feature matching can be used to find out same objects in two images, or estimate homographies, but any other purpose for feature matching?


texts: How to Subtract One Signal from Another?

texts:
I am capturing some body internal signals.

I am using 2 identical mics. One captures the in body signal and one open air.

I want to remove/delete/subtract the open air signal (noise for me) from  the main signal.

Please suggest an efficient algorithm.


texts: Inverse Z-transform with complex conjugate poles

texts:
I was computing an inverse z-transform here, and I am facing some problems.

So, the z-transform is:

$$ X(z) = \frac{2+3z^{-1}}{1 - z^{-1} + 0.81z^{-2}} , |z| > 0.9 $$

I found the following poles:

$$ p_1 = 0,5 + j0,7483 $$
$$ p_2 = 0,5 - j0,7483 $$

and then, the following residues:

$$ R_1 = 1 - j2,6727 $$
$$ R_2 = 1 + j2,6727 $$

Rewriting $ X(z) $ with the poles in polar coordinates:

$$ X(z) = \frac{1 - j2,6727}{1 - 0,9 \angle 56,25^{\circ}} + \frac{1 + j2,6727}{1 - 0,9 \angle -56,25^{\circ}}  $$

Through the magnitude of the poles, I can see that they are both inside the ROC, then, I can write $ x(n) $ as:

$$ x(n) = (1 - j2,6727)(0,9 \angle 56,25^{\circ})^{n}u(n) + (1 + j2,6727)(0,9 \angle -56,25^{\circ})^{n}u(n) $$

I know that it is possible to write $ x(n) $ in a form without complex numbers. I know this, because it was asked and I was able to plot the figure in Matlab using the following code:

delta = zeros(30, 1);
delta(1) = 1;

a = [1 -1 0.81];
b = [2 3];

x = filter(b, a, delta);
n = 0:29;

figure
stem(n, x);

My question is, what I did up to now is right? If it is, How can I compute $ x(n) $ without complex numbers? Is there any tips that you can give me to follow?

Thanks in advance.


texts: Separating excitation from filtering for sound sythesis

texts:
From my days at college I rememeber that LPC splits a signal into a series of slowly changing filter coefficents and an audio-rate residual error signal, such that the original signal gets reproduced when you run the residual signal as "excitation" through a time-varying filter which is controlled by those coefficients.

The cool thing is that you can replace the residual signal by another signal (e.g. a pulse train) and many of the characteristics of the original signal will be preserved. The excitation signal simply does not carry much information (except the pitch) and thus can be replaced.

I find this concept absolutlely intriguing.

I was hoping that this method could be used to sythesize real-world instruments. I could e.g. replace the residual signal of a real Guitar, by one which was created by a Karplus-Strong algorithm. I would have full control over that signal and if I feed it through the filter coefficients taken from a real guitar, this should take aways much of the artificial feel of Karplus-Strong.

The same reasoning led me to believe that one could build a fine vocal pitch correction this way. You pitch corect the residual and most of the unwanted artifacts will get filtered away in the filtering stage.

But all my attempts failed somewhat. For one, there does not seem to be much support for LPC in the open-source community(Luckily "lpanal" is still around). I played with csound and supercollider and I am getting the feeling that I am on the wrong track.

Does the above make any sense or where did I go wrong?
Is this idea of separating excitation from filtering widely used in sound synthesis? (I believe there is some audio compression algorithm, which uses LPC)
Are there other methods which separate excitation from filtering?


texts: Is there a name for this smoothing formula?

texts:
Hi: I am reading a book called "lectures on wiener and kalman filtering" by Professor Thomas Kailath. On page 18, it says the following:

  To carry through this approach, let us first note that a smooth random process
  $ \{ Y(\tau), a \le \tau \le b \}$ can be approximately represented as

  $$Y(\tau)  = \sum_{i=0}^{n-1} Y(\tau_{i}) \times \sqrt \triangle \times p(\tau - i \triangle) = \sum_{i=0}^{n-1} Y_{i} \times p(\tau - i \triangle)$$

  where

  $ p(\tau) = \begin{cases}\frac{1}{\sqrt \triangle}, & 0 \le \tau \le \triangle \\  0, & \text{otherwise}\end{cases}$

There is a picture included with the text:

$\triangle$ is the length of the space between the discrete $\tau_{i}$. The $\tau_{i}$ are the discrete versions of the time and are equally spaced.

I have some questions about this formula but I can send someone the pages from the book if they need them since, without a picture, it may be difficult to understand. ( note that I don't even follow it with the picture !!!!! ).

I don't have any intuition for this smoothing formula.  This seems like some kind of windowing process that uses weights that are smaller for further away values and larger for closer values ? Is there a name for it ?
The second equality in the smoothing relation implies that $Y(\tau_{i}) \times \sqrt  \triangle = Y_{i} $. I don't follow that ?
It looks like the weights are going to be negative and positive depending on the value of $\tau$. Is this correct ?
Like I said, I can send the 3 pages ( what I wrote is a part of a longer derivation of a functional relation for least squares ) to anyone who is interested.  Dr. Kalaith makes this approximation sound trivial but it's not to me.


texts: Phone conversation diarization with LIUM

texts:
I am trying split call-center recording by speakers. LIUM seems to fit great. But results look random to me (green is etalon, gray is what I get):

So I think I am doing something wrong. Maybe features are not extracted correctly? Command I am running is

java -cp lium_spkdiarization-8.4.1.jar fr.lium.spkDiarization.system.Telephone \
     --saveAllStep --doCEClustering \
     --fInputMask sound.wav --sOutputMask=%s.xml \
     --sOutputFormat=seg.xml,UTF8 sound

sound.wav is RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz. One can download it here https://yadi.sk/d/w0doqi7QhcjJj . Please, help!


texts: Fill matlab "ellip" function through transfer function magnitude response

texts:
The matlab "ellip" function can be used to design the unquantised coefficient set.

  From matlab website:

  $ [b,a]=ellip(n,Rp,Rs,Wp) , $

  n: order of filter

  Wp: normalized passband edge frequency

  Rp: ripple in passband (db)

  Rs: db down from he peak value in the passband

If i have an 8th order IIR filter with the following transfer function magnitude response:

\begin{align*}
 0\,\mathrm{db} \pm 1.5 \,\mathrm{db} & \quad \text{for } \quad 0.2<|v|<0.3 \cr
 \lt −60\,\mathrm{db} & \quad\text{for } \quad |v|<0.14\text{ and } |v|>0.36
\end{align*}

how i can fill the matlab function with the suitable values?


texts:
I have a signal sequence where multiple pulses with different amplitude and duration may occur at random times. White noise is present as well. I was searching for a Matlab function which could detect the pulses successfully so I can calculate their duration but couldn't find anything appropriate. I am attaching a snapshot of one pulse. Does anyone know of a function or a way to detect such pulses?

Thank you in advance!

ps: One of the functions I tried was findchangepts with findchangepts(data,'MaxNumChanges',10,'MinDistance',1e3) but the function is very slow for big data and the result was not what I need. MinDistance is set to 1e3 because I expect the pusles to be at least 1e3 samples long. The one shown in the figure is 1e4 samples long.


texts: How to use cross-correlation to verify speech data and determine delay

texts:
I have been experimenting with cross-correlation function to verify the presence of speech in a recorded file wrt a source file. I tried the following in Matlab:
source = '/home/skrowten-hermit/Programs/male_8k.wav'
silenced = '/home/skrowten-hermit/Programs/male_8k_silence.wav'
halved = '/home/skrowten-hermit/Programs/male_8k_half.wav'
attenuated = '/home/skrowten-hermit/Programs/male_8k_attenuated.wav'
[y1, fs1] = audioread(source)
[y2, fs2] = audioread(halved)
[y3, fs3] = audioread(silenced)
[y4, fs4] = audioread(attenuated)
plot(y1)
plot(y2)
plot(y3)
plot(y4)

%% autocorrelation function wrt source

% calculate autocorrelation
[Rx1, lags1] = xcorr(y1, 'coeff')
tau1 = lags1/fs1

% plot the signal autocorrelation function
figure(6)
plot(tau1, Rx1, 'r')

%% crosscorrelation function wrt source

% calculate correlation and time axis
[Rx2, lags2] = xcorr(y1, y2, 'none')
tau2 = lags2/fs2
[Rx3, lags3] = xcorr(y1, y3, 'none')
tau3 = lags3/fs3
[Rx4, lags4] = xcorr(y1, y4, 'none')
tau4 = lags4/fs4

% plot the signal correlation function
figure(6)
plot(tau2, Rx2, 'r')
figure(6)
plot(tau3, Rx3, 'r')
figure(6)
plot(tau4, Rx4, 'r')

[pRx1, idx1] = max(Rx1)
[pRx2, idx2] = max(Rx2)
[pRx3, idx3] = max(Rx3)
[pRx4, idx4] = max(Rx4)

fprintf('Peak value of Rx1 is %f at %f', pRx1, lags(idx1))
fprintf('Peak value of Rx2 is %f at %f', pRx2, lags(idx2))
fprintf('Peak value of Rx3 is %f at %f', pRx3, lags(idx3))
fprintf('Peak value of Rx4 is %f at %f', pRx4, lags(idx4))

The following are the waveforms of my input files as generated by Matlab (male_8k.wav is my source from which others are generated or recorded):

The auto-correlation generates the following output:

The cross-correlation of the source with the other targets generates the following outputs:

The output of peak value and the indices (location) of the peaks are as follows:
Peak value of Rx1 is 1.000000 at 0.000000
Peak value of Rx2 is 10.634055 at 0.000000
Peak value of Rx3 is 0.000905 at -21325.000000
Peak value of Rx4 is 48.637631 at 7516.000000

Since I intend to use the above with recorded files over a network by playing the source file (male_8k.wav) at the transmitter (Tx) end and record at a reciever (Rx) in order to verify if there is some speech detected at Rx and calculate the delay (in ms), I would like to quantify them as success or failure for verification and convert the indices (i.e., the time sample) into a value in ms. I understand that the result (i.e., the peak value) could never be 1 as in ACF, but is it possible to fix a threshold for peak and convert sample number index in such a way that:

I could distinguish between silence and some speech data (attenuated is fine - just need to check if data samples exist at Rx).
I could determine there is a delay of d ms at Rx.

The output values of peaks reading 10.634055 for half the speech data samples and 48.637631 for attenuated speech data samples left me a bit confused. How can I do this effectively/efficiently?


texts: What is the correct block diagram of CDMA communication system?

texts:
I was reading someone's thesis and now i am more confused about CDMA system. From what i understood is CDMA is multiplexing which allows multiple signals to transmit over single channel. so general structure of CDMA communication system should be like shown below:
Binary Data --> Multiply PN Code --> XOR(spreading) -->BPSK/QPSK Modulation --> RF End
                                                                                |
                                                                                Channel
                                                                                |
Restore Data <-- Despreading <-- Aquistion and lock <-- RF Demodulation <--    RF Reception

And Now I had come across block diagram in the thesis, Pg.27 which basically modulate and they do spreading.

From my understanding it should be spreaded before doing modulation. This is my understanding, please correct me if i am wrong.

But can someone please confirm which one is right ? It would be great if you explain a little bit.


texts:
I find this image :

Does it mean that at 0ns there is one path, 10ns second path, ... and approximately at 130 ns, there is a power path?


texts: Power Spectral Density of discrete White Gaussian Noise defined with variance and sampling interval

texts:
From Creighton and Anderson Chapter 7 on Gravitational Wave data analysis:

Please explain where the delta t and the limit came from in this derivation.


texts: why does my integrator perform noise shaping?

texts:
I am designing (in matlab) a simple system with a DC signal at 0 Hz and some added noise.
I am performing a differentiation of the signal (by simply subtracting the last values from each other), next i am applying rolling average algorithm, to filter the high frequencies, and then i simply integrate over a number of samples. Using the pwelch() function on the output i noticed that there is some noise shaping going on, and i don't really now where it is coming from...

I am aware of delta-sigma modulators, but this is not a thing i am doing here: for my integrator i am using a very simple algorithm that adds $n$ last samples together. I would expect a simple integrator behaviour here (with frequency response falling 20db/dec).

Why does the noise shaping take place?
https://i.stack.imgur.com/dTfLl.png

I am posting the code for the signal generation, differentiator and integrator below.

clear
home
close all

%generate the signal
    fs = 1;
    T = 1/fs;
    t = 0:T:(2^14);
    pos = 3 * t;
    noise = 2 * randn(1, length(t));
    pos = pos+noise;

    %differentiate the signal
    diff_time = 1;
    diff_out = [];
    len = length(pos);
    for j = 1+diff_time : len
        diff_out(j-diff_time) = pos(j)-pos(j-diff_time);
    end

    %filter the hf with MA filter with 16 taps
    MA_avg = zeros(1,16);
    for i = 1 : length(diff_out)-16
       avg_val = MA_avg(end);
       old_val = diff_out(i);
       current_val = diff_out(i+16);
       MA_avg(end+1) = current_val-old_val+avg_val;
    end

    %integrate
    pos_intgr = integrate(MA_avg, 16);

    %get the spectral power
    NFFT = length(pos_intgr);
    [P, F] = pwelch(pos_intgr,ones(NFFT,1),0,NFFT,fs,'power');
    PdBW = 10*log10(P);
    plot(F,PdBW)
    title("pwelch")
    xlabel('Frequency')
    ylabel('Power spectrum (dbW)')

    function [acu_down] = integrate(signal, taps)
       len = length(signal);
       acu_down = [0];
       i = 1;
       k = 1;
       while i <= len-taps
          sum = 0; %reset the sum
          for j = 0 : taps-1
               sum = sum + signal(i+j);
          end
          i = i+taps;
          acu_down(k) = sum;
          k = k+1;
      end
      %cut out the LSB
      acu_down = acu_down ./ taps;
   end


texts: Calibration (intrinsic) parameters of a virtual camera with some known information

texts:
I need the calibration matrix of my simulated camera, I am trying to fully comprehend and follow the steps from Step by Step Camera Pose Estimation for Visual Tracking and Planar Markers as well as Estimating Plane Pose Without Knowledge of Intrinsic Camera Parameters, but I still don't "get it". Ultimately, I want to use K to find the essential matrix and compute the transformation between two images.

The information available to me are:

The images.
Images are planar scenes, camera is perpendicular to the ground. Transformation between them includes rotation (around ground-perpendicular axes), scaling and translation.
Known distance from image (altitude), FOV, pixel width.

Assuming square pixels and no skew, this is what I am after:

$$
K = \left[\begin{matrix} \alpha_u&0&u_0\\0&\alpha_v&v_0\\0&0&1 \end{matrix}\right]
$$

$\alpha_u$ and $\alpha_v$  are the scale factor in the $u$ and $v$ coordinate directions, and are proportional to the focal length $f$ of the camera: $\alpha_u = k_u f$ and $\alpha_v = k_v f$. $k_u$ and $k_v$ are the number of pixels per unit distance in $u$ and $v$ directions.
$c=[u_0,v_0]^T$ is called the principal point, usually the coordinates of the image center.

Is there an "easy" approach to computing these variables, given the assumptions and the available info about the images?

Going through dsp, I am overwhelmed by the amount of links and information on the matter, usually very technical papers that are hard to follow for beginners in the field, and I am unable to understand what corresponds to my case.


texts: Difference Between Contrast Enhancement and Texture Enhancement in Images

texts: I have a very basic question. I understand that contrast enhancement is exaggerating the difference between the intensity of the adjacent structures and texture in an image is the repeating geometric patterns in an image. But what is exactly texture enhancement? Does enhancing contrast in an image automatically enhance texture also? Can someone explain this with an example. By looking at an image, how can one identify if the image needs contrast enhancement or texture enhancement? Or how does one identify, if an algorithm has done contrast enhancement or texture enhancement?


texts: FFT seems more accurate than MUSIC algorithm?

texts:
I created a signal with two sinusoids and added increasing amounts of random noise to it. The results of running the FFT and MUSIC on this signal are shown in the image below.
Ignoring the fact that the scaling is wrong on the x-axes of the FFT plots, in what way are the results for the MUSIC algorithm better than the FFT? For me the MUSIC results look worse as the graphs seem overly smooth and thus fail to resolve the two spectral peaks when the noise is increased, whereas they are clearly visible in the FFT plots. And this is despite the fact that we have to tell the MUSIC algorithm that we expect two spectral peaks (the 4 in pmusic(x_1,4)), whereas the FFT doesn't need this information.
I thought the whole point of the MUSIC algorithm is that it is supposed to give more accurate results than the FFT. So what am I missing here, am I not interpreting the plots correctly? Is there a problem with the code? Ultimately, what does the MUSIC algorithm give us that the FFT doesn't?
Here is the code I used to generate the image.
clc
clear all
close all

N = 400;
n = 0:N;
x = cos(0.22*pi*n) + sin(0.2*pi*n);
x_1 = x + 0.02*randn(size(n));
x_2 = x + 0.05*randn(size(n));
x_3 = x + 0.1*randn(size(n));

fft_x_1 = abs(fft(x_1)); fft_x_1 = fft_x_1(1:N/2);
fft_x_2 = abs(fft(x_2)); fft_x_2 = fft_x_2(1:N/2);
fft_x_3 = abs(fft(x_3)); fft_x_3 = fft_x_3(1:N/2);

music_x_1 = pmusic(x_1,4);
music_x_2 = pmusic(x_2,4);
music_x_3 = pmusic(x_3,4);

figure
subplot(3,2,1);
plot(fft_x_1)
 title('FFT')
subplot(3,2,2)
pmusic(x_1,4)

subplot(3,2,3)
plot(fft_x_2)
title('FFT')
subplot(3,2,4)
pmusic(x_2,4)

subplot(3,2,5)
plot(fft_x_3)
 title('FFT')
subplot(3,2,6)
pmusic(x_3,4)


texts: What is the difference of each frequency response of partial filters in a polyphase method

texts:
I try to understand how works polyphase method in term of frequency response of partial filters.

Of course, the common is that the filters operate at low frequency, but what differency between them. How it works?


texts:
I want to up-sample my input signal by a factor of $2$. I saw zero padding followed by low pass filter method being used in few cases. But still I need some help in this.

Say I have $10$ input samples and my interpolating factor is $2$, then if I am doing interpolation using above method, will I get $20$ samples at the output?
Also how to increase the pass-band gain of the low pass filter to $6.02\textrm{ dB}$?


texts: Frequency of a single sample in a digital signal and aliasing

texts: I'm involved with digital audio synthesis. I know that if I create a raw non band-limited waveform it would contain frequencies above Nyquist thus violating the Nyquist Shannon theorem and the signal will contain aliased components. So I wonder if I can also create aliasing by other means, like a "click" from a fast envelope or a single sample in a digital stream. So what is the frequency of a single sample (is it sample rate/1 ?) and does such clicks alias in the frequency domain?


texts:
I have a complex signal generated by an impedance analyzer.

What is the best approach for designing a low pass FIR filter for this?
Is a real filter applied separately to the real and imaginary streams optimal for this or do I need a specialized algorithm for complex filter design?


texts: Calculating a filter's attenuation at a certain frequency from the Q-factor

texts:
I'm using the Web Audio API to make a graphic EQ with four BiQuad filters; a highpass, two bandpass and a low pass:

You can see each node representing each filter's frequency. It's working nicely but I'd like to draw the shape of the filter's roll-off you'd usually find in other graphic EQ's.
I have the Q-factor of each filter and the central frequency. What I would like to do is get a formula that allows me to get the frequency of the roll-off at a specific db value. For example what is the frequency of the roll-off at -200db?
It's been a while since I've done any heavy mathematical stuff and so any help would be greatly appreciated.


texts: Direct path and reflections of ultrasound transmission

texts:
I am using the following system:
Ultrasonic chirp signals with central frequency 100kHz are being transmitted using ultrasonic sensor. After the transmission through the medium(air/solid/liquid/combination) they are being received with hydrophone. The system is being controled by DSP and signal generation and acquisition is obtained via DAC and ADC. Our aim is to detect the time of arrival between transmission and reception.
My mentor suggested that I could use something with FFT to observe reflections, but I am struggling to find information on the internet about it. Does anyone have a suggestion how that could be done using FFT, or any other method?


texts: Determining optimal binary decision rule threshold from observations with unknown priors?

texts:
Given only observations of a binary signal perturbed by Gaussian noise with unknown prior information, how can I estimate the optimal decision threshold?

( No, this is not a homework question)

Specifically, I am think about the following model: $Y$ is a two-state $(H_0,H_1)$ Random variable :

$P(Y|H_0) \sim \mathcal N(\mu_0,\sigma)$
$P(Y|H_1) \sim \mathcal N(\mu_1,\sigma),\quad \mu_0 < \mu_1$
$P(H_0) = \pi_0$
$P(H_1) = 1-\pi_0$

with unknown parameters: $\mu_0, \mu_1, \sigma, \pi_0$.

The Maximum a Posteriori Log-likelihood threshold could be computed from those parameters if I knew them. I was originally thinking about how to estimate the parameters first in order to get to the threshold $Y_t$. But I'm thinking it may be more robust to directly estimate $Y_t$.

Thoughts:
Normalizing the observations (subtracting the sample mean and dividing by standard deviation) reduces the parameter space into 2 dimensions: $\pi_0$ and $\frac \sigma{\mu_1-\mu_0}$.


texts: What is a "Hampel Filter" and how does it work?

texts:
One of the new functions in the MATLAB Signal Processing toolbox for R2015b is the Hampel Filter.  It appears to be used for outlier removal and from the examples, it looks like it might do a better job than a median filter.

Unfortunately, as of yet there appears to be no readily available digestible description of the filter (such as a Wikipedia page).

So, what is a Hampel Filter?  How does it work?  How computationally expensive is it?  When does it work well? When does it not work so well?


texts: expression for the FT of the frequency response of a system

texts:
I am trying to find an expression for the Fourier Transform of the frequency response of the cascade system seen here:
Here is my approach:
$(-1)^n = (-1)^{-n}$
$v[n] = x[n]e^{j\pi n}$
$V(e^{jw}) = X(e^{j(w + \pi)})$
$w[n] = v[n] * h_1[n]$
$W(e^{jw}) = X(e^{j(w + \pi)}).H_1(e^{jw})\,\,...... (1)$
$y[n] = w[n]e^{j\pi n}$
$Y(e^{jw}) = W(e^{j(w + \pi)})\,\,...... (2)$
With equations 1 and 2, I can find $\frac{Y(e^{jw})}{X(e^{jw})}$ where I get $H(e^{jw})$ as $H_1(e^{j(w + 2\pi)})$.
Now, looking at the official solution from the book, I see:

I don't see how $Y(e^{jw}) = W(e^{j(w-\pi)})$ here. Have I made a mistake above?


texts: What acoustic properties of sounds enable us to distinguish the owner of the voice?

texts:
Different people reading the same sentences, we can know from the voice who is speaking.

What makes the voice distinguishable?


texts:
I have to calculate the periodicity of a audio signal like this:

You can see by eye, that the volume rises the highest every second "blob".
The spectogram (that is visualized logarithmically) shows this periodicity quite good.
The first idea to calculate this was with autocorrelation. But when doing this with the volume in dB I didn't get any clear results:

Should I use the fast fourier transform to do the auto correlation with the frequency?
Is there any preprocessing that is important with audio signals?
I'm fairly new to audio processing and data science in general.
My second thought was to use a convolutional neural network and use the volume and frequency to train the model. But that requires more training data to configure the system.
Here is the FFT of the ACF:


texts: How does BRIEF produce consistent keypoints with random sampling?

texts:
I'm reading through BRIEF and one point isn't clear to me. If we are randomly sampling the pixel-vs-pixel tests, how is it that we obtain a reproducible descriptor?
EDIT
This is a duplicate. Find question with answer here


texts: Designing a root-locus compensator to attain design requirements

texts:
I am working with Matlab to design a compensator capable to make a system attain the design requirements ($\omega_n\geq 0.3$ rad/s & $\xi\geq 0.5$).

In order to do so I have a discrete-time transfer function with a sampling time of 1 second, which is the following:

$$G(z)=\dfrac{0.5z+0.5}{z^2-2z+1} $$

The functions has already a zero = -1 and a double pole = 1.

I am also using Matlab SISOtool to see where is the feasible region in which I should have the root-locus to fulfill the design requirements. Such region is the following (the white one):

The image shows the root-locus of the plant, G(z). Now I want to add a controller, C(z), that allows me to move the root locus into the white region (at least a part of it).

The controller should be in the form:

$$C(z)=\dfrac{(z-z_1)(z-z_2)...(z-z_n)}{(z-p_1)(z-p_2)...(z-p_m)}$$

And therefore, $C(z)G(z)$ should be evaluated to see that part of the root locus is located into the white area.

I want to find the value of the poles and zeros of the controller $C(z)$ that allow me to have part of the root locus into the white region provided in the image, and then being able to fulfill the design requirements.

This is driving me crazy because I have tried all the possible ways of adding poles and zeros and I am unable to obtain a region of the root-locus inside of the white area. I only need some idea on where to place the zeros/poles or if it is even feasible to attain this design requirements (it should be).

Matlab code:

n=[0.5 0.5];
d=[1 -2 1];
G=tf(n,d,1);

After that, to run SISOtool just type sisotool('rlocus',G) in Matlab console.


texts: A Practical Method for Correcting Phase Errors in a Transceiver System Comprising of OFDM + DUC and DDC

texts:
I am back with a question related to my OFDM Transceiver System that I am designing where I use DUC and DDC. I could get rid of the high BER problem. I realized that the problem was due to the phase error occuring between the transmitter and the receiver side as I saw the constellation diagram at the receiver rotating constantly. So to get rid of this, I obtained the phase difference between the transmitter and the receiver and I rotated the complex signal with the obtained phase error. However, I feel this is only an ideal method to get rid of the phase error. I read about the phase error compensation techniques but those are mostly when there is a noise in the channel. But in my case, I still haven't added any noise in the channel. I suspect the phase error is either because of the DUC and the DDC, or because of the pulse shaping filters that I used after OFDM modulator.

So I was wondering if anyone could tell me why is this phase error occuring even without a noisy channel, and what can I do to mitigate the phase error with some estimation.

I have attached the screenshot of my system along with the waveforms obtained. Below are the specs -

Random Integer Generator Specs

Set Size - 2

Initial Seed - 37

Sample Time - 1/1e6

Samples per frame - 20

OFDM Modulator Specs

FFT length - 32

Number of guard bands - [6;5]

Insert DC Null - Checked

Cyclic Prefix Length - 16

Number of OFDM symbols - 1

Number of transmitted antennas - 1

Raised Cosine Transmit Filter Specs

Rolloff factor - 0.2

Filter span in symbols - 8

Output samplers per symbol - 4

Linear amplitude filter gain - 1

DIgital Up- Converter Specs

Interpolation factor - [2 8]

Minimum order filter design - Yes

Two-sided bandwitdth - 2.4 e6

Passband ripple - 0.05 dB

Stopband ripple - 90 dB

Center Frequency  - 30e6

Input sample rate - 9.6e6

Digital Down-Converter Specs

Decimation factor - [8 2]

Minimum order filter design - Yes

Two-sided bandwitdth - 2.4 e6

Passband ripple - 0.05 dB

Stopband ripple - 90 dB

Center Frequency  - 30e6

Input sample rate - 153.6e6

Thank you in advance!


texts: What's the difference between quantization and coding?

texts: From what I understand quantization takes an analog signal and assigns numerical values to it as convert it to a discrete signal. However coding converts a signal into binary. It seems like coding is a part of quantization--if you're assigning a value to an analog signal, and you're using a computer, you'd necessarily need to use binary. Nonetheless I see diagrams with coders as separate blocks compared to quantizers. What's the difference between them?


texts:
I need to identify two systems. Those are their Unit Step responses:

I don't know, what order of the system that is. It could be second order system with zero in 0. Lecturer told me it was third order system, but then told me to solve it as second order system, so I'm a bit confused. More over we don't have materials for those systems, which would show us how to idnetify them. Lecturer told me to search it on the internet.

So I wonder whether anyone could give me some hint or better, if anyone could explain how to solve this or what kind of system those systems are.

I would welcome some good materials for this task.


texts: How have common PRBS polynomials been chosen, and what are they?

texts:
Why are most common or standard (is there actually a standard?) PRBS uneven in their number of state bits, e.g. PRBS7, PRBS15, PRBS23, if there are plenty of generator polynomials that have even, byte-multiple numbers of bits, like 8, 16 and 24?

More generally, how have the common sequences, denoted with the aforementioned names, actually been chosen? Do they have any favorable properties compared to other LFSR maximum length sequences, or was it arbitrary?

Finally, where can I actually find what common polynomials are used? There are precomputed lists of maximum length sequences, but no mention of what the common/standard ones are. If I instead search for "PRBS63" in Google, I can find mentions of that sequence, but not the actually used generator polynomials.


texts:
I am interested in calculating the autocorrelation function of a linear map with some noise (model given below) but am slightly confused in doing so.

At first, I did not realize there were two definitions of the autocorrelation function: one where you subtract the mean of the time series data (often used in statistics), and one where you do not.

Let $x(n) = \frac{1}{2}\left(a x(n) + b + \xi\right)$ where $\xi$ is some Gaussian noise with mean zero and standard deviation $\sigma$. One can analytically calculate the autocorrelation function as follows:

$$
\langle x(n+1)x(n)\rangle = \langle \frac{1}{2} (a x(n) + b + \xi_n)x(n)\rangle\\
= \frac{a}{2}\sigma_x^2 + \frac{b}{2}\mu_x
$$

Where we have used that the noise is uncorrelated with the time series data by assumption.

Similarly,

$$
\langle x(n+2)x(n) \rangle = \frac{a}{2}\langle x(n+1)x(n) \rangle + \frac{b}{2}\langle x(n) \rangle \\
= \left(\frac{a}{2}\right)^2 \sigma_x^2 + \frac{a}{2}\frac{b}{2}\mu_x + \frac{b}{2}\mu_x
$$

And then generalizing,

$$
\langle x(n+\tau)x(n) \rangle = \left(\frac{a}{2}\right)^\tau\sigma_x^2 + \frac{b}{2}\mu_x\sum_{l=0}^{\tau-1}\left(\frac{a}{2}\right)^l\\
= \left(\frac{a}{2}\right)^\tau\sigma_x^2 + \frac{b}{2}\mu_x\frac{1 - \left(\frac{a}{2}\right)^\tau}{1-\frac{a}{2}}
$$

Where I've summed the geometric series to arrive at the final result.

Autocorrelations are computed using NumPy's fftconvolve function as acf = fftconvolve(x, x[::-1]) (i.e., convolve the time series data with itself reversed, for anyone not familiar with Python).

When I subtract the mean, I get an exponentially decaying autocorrelation function, as depicted in the plot below. This makes sense, given the first term in the analytically derived expression above. Clearly $\mu_x = 0$ after we have subtracted off the mean.

However, originally, I did not realize I was supposed to subtract the mean, and I found a linearly decaying plot as depicted below. By increasing the duration of the simulation, the line extends seemingly to infinity. Is there a simple explanation for this? It does not fall out of the analytical calculation, so I assume there must be something going on because it is a discrete time series? I am new to this, but I assume there is a simple explanation for this phenomenon.


texts: Machine learning for denoising MRI images

texts:
I'm currently a sophomore in college and pretty new to the field of research. I'm currently working on an existing algorithm for MRI de-noising and the results are nothing that great. I can't see how I can improve the results.

I've tried a few different tweaks and played with the code and parameters for sometime now. I also saw some papers on using neural networks for image de-noising as well.

I'm thinking of trying the same but I don't know if it makes sense to use neural networks on an already existing algorithm. Won't the neural network overpower my algorithm and all the results be based on it only? So if I use a pre-existing MatLab filter and use neural networks in it, will it differ much if I first use my algorithm and then use neural networks in it?

I have little experience with machine learning and hope that I made sense in my question. Any kind of help will be appreciated. Thanks.


texts: Denoise EEG signal by using Daubechies function

texts:
I have an EEG signal and it contains eye blink artifacts. I read some references and know that it is possible to detect eye blinks and remove them by using wavelet transforms, but I don't know that how do it.

How do I detect eye blinks? After transforming the EEG signal into wavelet coefficients, what should I do and which level of Daubechies can be used to do that?


texts: Calculating an output of a system (Z- transform question)

texts:
I have a following question to answer:

An LTI system is described by its impulse response h[n].  For input x[n] it gives output y[n].

$$h[n] = u(n) - u(n-N) $$
$$x[n] = u(n) - u(n-M)$$

I want to calculate it's output function. I have used the Z-transform property of convolution in time being multiplication in Z-domain to calculate Y(z) which looks like this $$Y(z) = \frac{1-z^{-M}}{1-z^{-N}} $$
However I have trouble to apply inverse Z-transform to it. Is there some nice way I can transform this resulting function to time(sample) domain?


texts: Instantaneous Phase Synchrony with Multiple Signals

texts:
I've recently been looking at phase synchrony to measure the Phase Synchronization between signals (following tutorial at jinhyuncheong signal processing tutorial). I.e. for two signals, retrieve the instantaneous phase angle using Hilbert transform and subtract the difference from 1.
What I'm wondering is if there is a clean way of doing something similar with multiple signals? At the moment, for multiple time series, I am taking the Phase Synchrony for the different pairs and then computing an average. In the image attached, there are 4 raw signals in the top panel, the phase angle of each in the middle panel, and the phase synchrony calculated between the different pairs (6 pairs) in the bottom panel.
Is there a more obvious way to compare all the signals together? Or perhaps someone has a suggestion for an alternative approach? Comparing pairs of signals in this case feels quite computationally expensive (especially as the number of signals increases).


texts: Advantage of complex filtering in multirate applications

texts:
I've seen it mentioned in passing in various papers on signal processing and filter design that complex FOR filters can be more efficient when it comes to multirate applications. However I cannot think of a scenario where this is applies. Of the systems I've seen, the baseband is complex which means generally the baseband for interpolation (for example) filters makes most sense with real coefficients so +ve and -ve frequencies are both passed.

Can anyone give examples where a complex bandpass filter makes sense, and specifically to areas like decimation and interpolation.


texts:
For communication systems, there is usually a target minimum rate $R$ bits per second. An outage occurs if the actual rate ever falls below $R$. Since $\frac{1}{2}\text{log}_2(1+\text{SNR})$, sometimes outage is also talked about in terms of $\text{SNR}$ and received signal power needing to be greater than some threshold $P$.

My question is: Say I have a very small packet of five symbols, and during the second symbol I experience an outage. The other four symbols received power was all greater than $P$. Does this mean that my entire packet was unable to be decoded?

EDIT:

For example, if I use the encoding scheme where: 0 = 00000, 1 = 11111, then I have 1 bit per 5 channel uses. So I can use the formula: $\frac{1}{2}\text{log}_2(1+\text{SNR})=\frac{1}{5}$ bits per channel use, and can solve for the required $\text{SNR}=0.3195$. Does this mean that all five symbols should have $\text{SNR}\geq0.3195$ in order to successfully receive the single bit?


texts: Performing root-music, how do i retrieve frequency and phase data of a signal?

texts:
I'm trying an alternative method to the classical fft to do signal analysis. I perform root-MUSIC on a certain known signal + noise in matlab with the function 'rootmusic'. This gives gives the signal in radians/sample. This can then be converted to a frequency of a signal and at first sight it looks promising.
My question is wether I also am able to retrieve the phase of the signal from this function or use the frequency output to in turn obtain the phase of the signal at that particular frequency? I'm not an expert at what perfectly goes on inside this function but having looked into it, it seems that this methed solely provides a frequency and no phase data. Anyone care to explain further details of what or what is not possible with root-MUSIC or if there is a better/higher resolution alternative method to fft? At first glance I tried root-MUSIC as it is suggested as a quite popular substitute.


texts: autocorrelation A to K conversion for LPC speech analysis?


texts: How to get Harris corners that are present in watershed segmented Bitwise image(road part)?

texts:
This is Harris corner image of test image:

This is Bitwise watershed segmented image:

I want to get that Harris corners which will be in segmented part of image(road part).


texts: Measuring typical seperation between patches using 2D Fourier Transform

texts:
I need to extract information about the typical distance between the black patches in an image like the one I attached here. Typical distance would be the the most frequent separation between two patches. For example, if the photo was parallel black stripes, the algorithm would give me the typical width of the white stripes between the black stripes.

I tried to perform 2D FFT on it (using OpenCF fdt function in Python), but I am not sure if this is the best way to do this job. Anyone has an idea what is the method that I need to use to perform this job? I have read about two-point correlation function in astronomy, but I wonder if it can be used also in this case..

This is an example of the image on which I need to do this analysis -


texts: How to calculate the magnitude while calculating Blur in an image using using OpenCv based on Fast Fourier Transformation

texts:
I am working on image blur detection and found 3 methods for it. One is Laplacian Method but it works good with Gaussian, average, median and other distribution blurs but works poorly with Motion Blurs. then another is Wavelet Transformation and went over my head as I'm poor with the signal processing part. So I found another method FFT based blur detection which is relatively simpler to execute and understand. This is the code
def has_blur_fft(image:[np.ndarray,str], size=60, thresh=10,):
    '''
    Detect Blurs based of Fast Fourier Transformation
    args:
        image: Image path or array
        size: Radius around the centerpoint of the image for which we will zero out the FFT shift
        thresh: Threshold for determining if the image is blurry or not
    '''
    if isinstance(image,str): # If it is a string, Open the image using function
            image = cv2.imread(image) # read image

    if len(image.shape) !=2: # If it is not Grayscale Image then convert
        image = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)

    (h, w) = image.shape
    (cX, cY) = (int(w / 2.0), int(h / 2.0)) #center of image

    fft = np.fft.fft2(image) # Find 2D FFT of the Image
    fftShift = np.fft.fftshift(fft) # Shift the 0 frequency elements (Top left elements) to the center

    fftShift[cY - size:cY + size, cX - size:cX + size] = 0 # make the center elemet as Zero which are low frequency components
    fftShift = np.fft.ifftshift(fftShift) # perform first inverse FFT so that the centeer goes to Top left again
    recon = np.fft.ifft2(fftShift) # Reconstruct the image by applying 2D Inverse FFT

    magnitude = 20 * np.log(np.abs(recon))
    mean = np.mean(magnitude)
    return mean <= thresh # If mean is less than equal to threshold, return True (has_blur)

The problem is that while computing the  magnitude = 20 * np.log(np.abs(recon)), there is a constant 20. I want to know if this has to be here or this is a hyperparameter based on the type of image?


texts: Refinement equation and orthogonal wavelets basis

texts:
I have a wavelet function space defined by,

$ \phi(x) = \sqrt(2) \sum_n h_{\phi}(n) \phi(2x-n) $ .

given the Fourier transform of the function is:

$\hat{\phi}(\omega) = \frac{1}{\sqrt(2)} \hat{h}_{\phi}(\omega) \cdot \hat{\phi}(\frac{\omega}{2})$

why does the sum of the dc component in jumps of $2\pi$ equals to 1, i.e.:

$\sum_{l=-\infty}^{\infty} |\hat{\phi}(\omega +2\pi l)|^2 = 1$

or even its necessarily constant. Either I am missing something trivial, or whatever, but I can't seem to agree with it.

thanks.


texts: Apply the Discrete Fourier Transform as a Matrix Multiplication in MATLAB

texts:
0
I have a vector x of length N x 1, I need to perform the iDCT operation for it using MATALB. I performed that using the below method:
x = [1+i;1-i;-1+i;1+i];    %Assume N = 4
y = sqrt(4)*idct(x);

Then I performed it using the other way such that:
x = [1+i;1-i;-1+i;1+i];    %Assume N = 4
D= dctmtx(4)/sqrt(4);
y = D'*x;

I don't find the value of y equals in the two ways ?? However for the case of of FFT operations, that gives the same results!
Is there a special case for DCT operation?


texts: Audio Activity Detection and Classification

texts:
I am starting a new project. Actually, my real intention is to learn speech recognition but for warming up I want to improve in audio signal processing.
In my project, I aim to record sounds except for human speech in my house when I go out. I am planning to divide my project two sections: Audio Activity Detection and Audio Classification. However, some questions appear in my mind.

What is the best techniques for audio classification? Could you supply some informative articles for me? I saw that MFCC and CNN are generally used for speech recognition. They are also valid for audio classification? Or, should I seek another methods? My classification includes baby cry, door knocks, door opening, door bell, ringing home phone, smoke detector etc. Even though their frequencies, in contrast to frequency of human speech, cannot be limited in a specific range, should I study on frequency for classification?

When I say Audio Detection Activity, I imply that sound recording starts if silence is broken, i.e. there is a sound. For preprocessing, I will filter out the noises. Therefore, noise will be part of the silence.:)  I searched few articles and I encountered the topic of Voice Activity Detection (VAD) but it is used to understand whether human speech is present or not in the environment. I am not interested in voices. Instead, I want to collect sounds mentioned before. Is Audio Detection Activity a valid term?

I am waiting for your advices and sources.

Thank you.


texts:
I've been given an image from Berkeley dataset to segmentate. I am an undergrad student and so far I threw everything i know to this thing. But the colors are extremely close. I tried;

Clustering
Edge Detection
Histogram Thresholding

I need suggestions. Which path should I take? I need to segmentate the animals from this picture but I was only able to remove the green leafs.


texts: One more inverse z transform ... a bit more complicated

texts:
Thank you for all the help teaching me. I am looking at one more inverse z transform and not understanding what to do with it.

$F(t) = m \cdot a(t)$ (i.e. Force = mass $\times$ acceleration)

$F(s) = m \cdot d(s) \cdot s^2 $ (i.e. Where d(s) is displacement and initial position is 0)

Using $s = \frac{1-z^{-1}}T$:

$F(z) = m \cdot d(z) \cdot \frac{1-z^{-1}}{T}^2 $

$F(z) = m \cdot d(z) \cdot \frac{z^{-2} - 2z^{-1} + 1}{T^2} $

I have displacement calculated per sample already from another equation, so I can just substitute that in for $d(z)$. But what on earth do I do with that to get $f[n]$?

Thanks and sorry for all the questions. I unfortunately have zero education on this and it's hard to find simple to understand resources explaining how to do these things.


texts: Determine sequence's value from equally null circular convolution DFT

texts:
Can anyone help with this exercise from my Signal Processing exam? The text is:

  Given two sequences $x$ and $y$ whose supports are respectively $[0,1]$
  and $[0,3]$ and their circular convolution's DFT is equally null, if
  the first value of $x$ sequence is $x(0)=2$ and the first value of $y$
  sequence is $y(0)=1$ then obtain $x(1), y(1), y(2), y(3)$

I have tried to solve that supposing respectively that $X(k)=0$ for a first case, $Y(k)=0$ for a second case and then both equal to zero, and I have found two solution for each case. The problem is that my professor tell me that it has just one solution and it can be solve using DFT properties in, more or less, 1 minute, without solving linear system or doing hypothesis on the DFTs but I really don't understand what is referring to because I don't find anything on my notes or on my book.

Is there anyone that have 1-minute solution? :S


texts: For an LTI system, the zeos and poles are defined in the z plane. How to add additional poles and zeroes so LTI system is real valued?

texts:
The question already has a zero and a pole in the complex plane. It is asking to add additional zero and pole so LTI becomes zero valued.
zeros=-1/2 + 1/2 i , poles = -1/3 -1/3 i .
What I understand from it is that we have to make sure that in the end transfer function, there are no complex parts (there is no iota).. that would be real valued... but then why are these zeros and poles not in conjugate pairs?  If they are in conjugate then it is already real valued .... so is the question there to confuse us or what?
If I am missing something very basic please mention it so I can learn it.
Thank you. !


texts:
I am trying to extract R peak from raw ECG data and some samples are seemed to be interfered by EMG.
I used the lib provided by biosppy with python, biosppy.signal.ecg, it seems that the lib does,

Default filter is firwin with filtfilt, mode is bandpass with 3-45Hz, the filter order is 0.3 * sample_rate, in my case, sample_rate is 500Hz, and order is 150
The R peak extract algorithm is P.S. Hamilton, "Open Source ECG Analysis Software Documentation", E.P.Limited, 2002

The result seems not stable when handling some samples interfered by EMG,

Between 2 and 8, the R peaks seem to be not correct.
I'm not familiar with DSP and what can I do to get the raw ECG from the composed signal?

What I tried(I read some papers for ECG filtering) and the issue encountered,

Baseline Wander, some papers suggest to use firwin with highpass filter to remove this kind of noisy, and the frequency can be 0.5Hz, I tried this both with firwin and butter, the filtered signal was more smooth than before, but the EMG interfered still exists
Powerline Interference, the bandstop frequency is 50Hz or 60Hz in most cases, since the firwin using frequency from 0.5Hz to 45Hz, this kind of noisy also filtered
EMG Noisy, some paper mention to use moving average to remove this kind of noisy since this noisy is complex and may overlap with the raw ECG, some suggest to use a 8 window moving average. But in my case, the noisy last a long time with many samples, even the window set to 150, the EMG also exists

What I want is to get the stale R peaks without the interference? if the EMG is not easy to remove, can I remove the invalid R peaks and do interpolation after R peaks detected, such as,

If the R peaks detected is,

[439, 433, 433, 245, 193, 150, 414, 307, 135, 300, 432, 430, 429]

The first 3 and last 3 indices seem to be correct with the correct raw PQRST wave, but other indices are the invalid ones interfered by EMG, remove these indices, and insert 3 new indices with the value 433?

Thanks for your kindly help.


texts: Triangulation from set of points from left camera

texts:
in my program there are stereo cameras. The cameras were stereo calibrated. I have a set of 2D-Points from left image (for example, it could be some Harris Corners from left images). And the task is to estimate 3D position of this points with the reference to left camera. I started first with the estimation of corresponding points in image from right camera. I used OpticalFlow. Than this points were put in cvTriangulatePoints() function. But the estimated points in right camera image are not correct. My question is, is there some other method to get 3D position if I just know coordinates 2D points from left camera image?
Thank you


texts: How do optical illusions work (photo mosaic) from a signal processing perspective?

texts:
Hello fellow investigators

I have two question about optical illusions

1) A photo mosaic is something like this:

What are the signal processing principles behind our eye merging the many tiny images into a large coherent one?

2) Are there etiological explanations of optical illusions in general - by this I mean can it be explained why image inputs get parsed in 'wrong' ways by the eye/brain, why does the human parser get confused; what transfer function is in play?

Thanks for your time


texts: Does downsampling increase the resolution of frequencies?

texts:
I am currently working in MATLAB and had to downsample a .WAV file (I used the downsample function in MATLAB) to 44.1 kHz.
However, when I compared the two spectrograms of the original signal vs the downsampled signal, the resolution of the downsampled signal looks like it has more resolution at frequencies 0-22 kHz than the original signal.
Is there a relationship between downsampling and the resolution of frequencies? I would think that decreasing the sampling rate would decrease the resolution but this does not seem like it is the case.


texts: Equalizer design for spectral gain flatness

texts:
I'm trying to design an equalizer for spectral flatness over a 100MHz signal for an LTE channel emulator. A channel emulator simply multiples channel coefficients with an external signal from a signal generator in baseband and converts it to RF frequency.

The following figure shows the frequency response of the system measured with single tones(0dB power) at 100 KHz intervals over 120 MHz range with a center frequency of 3.8 GHz, measured at the RF end of the channel emulator.

Our region of interest is the central 100 MHz which is shown in the following figure.

In the above case, the channel is bypassed i.e. the channel coefficients simply represents unit gain and no frequency/phase translation.  The unevenness in the frequency response is due to gain roll-off in the D/A converter and other RF components in the channel emulator. My questions are as follows,

Say I design an N tap LMS equalizer and obtain the filter coefficients. How to apply the coefficients from frequency domain equalizer to the time domain signal?
Does the frequency response have to be measured at a finer granularity than 100 KHz for constructing an equalizer with a smooth frequency response?


texts: Estimating Damping Factor (Q) from Noisy Measurements

texts:
I have a damped, tuned circuit and want to measure its Q factor. The hardware sends an impulse 'ping' and samples the output as it rings down.

Is there an efficient way to fit an equation of the form $A e^{t(i\omega  + b)} $ to a series of samples? I know $\omega$ up front, and $A$ isn't relevant. I am primarily interested in the value of $b$.

For my system the Q factors I want to measure are in the range 2-5, and the amplitude of the noise is about 10% of the signal.

My current solution uses a Goertzel filter to measure the energy at the frequency of interest for each of the successive cycles, then looks for the point where the magnitude drops by a quarter. With some interpolation between the cycles before and after the quarter point, this gives reasonable but not great results. It is especially bad for the low end of the Q range.


texts: Where and how do an Image and a complex number meet?

texts:
I am trying to implement a Gabor Filter bank. Gabor Filter uses a complex function. How do the filters like Gabor Filter operate on an Image?

Does a complex number represent an entire Image or only a pixel?

Is an image a 2D array of complex numbers?


texts:
I want to compute the following derivative with respect to $n\times1$ vector $\mathbf x$.
$$g = \left\lVert \mathbf x - A \mathbf x  \right\rVert_1 $$

My work:

$$g = \left\lVert \mathbf x - A \mathbf x  \right\rVert_1  = \sum_{i=1}^{n} \lvert x_i - (A\mathbf x)_i\rvert = \sum_{i=1}^{n} \lvert x_i - A_i \cdot \mathbf x \rvert = \sum_{i=1}^{n} \lvert x_i - \sum_{j=1}^n a_{ij} x_j\rvert$$
So the $k$th element of derivative is:

$$\frac{\partial g}{\partial x_k} = \frac{\partial }{\partial x_k}\sum_{i=1}^n \lvert x_i - \sum_{j=1}^n a_{ij} x_j\rvert $$
$$= \frac{\partial }{\partial x_k}\bigg(\lvert x_1 - \sum_{j=1}^n a_{1j} x_j\rvert +\cdots+ \lvert x_k - \sum_{j=1}^n a_{kj} x_j\rvert + \cdots\lvert x_n - \sum_{j=1}^n a_{nj} x_j\rvert  \bigg)$$
$$ =-a_{1k}sign(x_1 - \sum_{j=1}^n a_{1j} x_j)-\cdots+(1-a_{kk})sign(x_k - \sum_{j=1}^n a_{kj} x_j)-\cdots -a_{nk}sign(x_n - \sum_{j=1}^n a_{nj} x_j)$$

And my questions:

Is this derivation correct?
How I can represent the answer compactly?
Can you introduce me a source to master this material?


texts: Find Difference Equation From Frequency Response

texts: Given the frequency response $H (jω) = csc(ω)$ how would I go about finding the difference equation?  I know I can find $h[n]$ from here but after that I feel like I'm missing something.


texts: Filter H(z) manipulation frequency response changes

texts:
I'm trying to understand how altering the frequency response of a H(z) low pass filter, will visually alter it's frequency response plot.
For example: by doing H(z^2), would the frequency response represent the filter's cut out frequency happening much later than H(z)?
If I multiply H(z) for something like 0.5(1-z^(-1)) as I have zeros in 0 and 0.5 a sort of band-pass will show up between 0 and 0.5?
Thank you


texts: FFT error when number of samples growth - Matlab/octave

texts:
I see when I increase number of samples, the imaginary error part of the FFT growth due to the error of sin(n*pi)!=0 where n is the index of the sample in Matlab or octave.
Is there anyway to force Matlab/Octave to perform FFT without these type of errors?
for example I know if you have sin (sym(pi)*n) =0 in Matlab or octave. Why default FFT in matlab/octave does not use sym(pi) instead of pi?

How could I perform FFT that take care of such PI approximation error?
Thanks


texts: what does it mean to have a decorrelated colour space?

texts: I'm working on the problem of colour transfer between images. In the literature there's a common practice that consists in performing the transformations on images in what is called a decorrelated colour space, such as CIE L* a * b* or YUV. The argument that's given most of the time is that a decorrelated colour space allows us to transform each one of the 3 channels of the image without affecting the other 2 channels, but I don't quite see how so. What is a decorrelated colour space in the first place?. As I conceive it, CIE Lab is decorrelated means that there's an independance between channels, if for example the value of l* grows bigger, this doesn't necessarly imply that the values of a* or b* increase too, but so is the case in rgb I guess. So, what am I missing?


texts: Is there an exact solution for this re-sampling problem?

texts:
I want to know if there is an exact solution for the following problem and how to approach solving it:

I have a discrete-time signal where the Nyquist theorem is satisfied:

$r_k = \sum_i a_i^{(1)}h^{(1)}(kT-iT-\tau_i^{(1)}) +\sum_i a_i^{(2)}h^{(2)}(kT-iT-\tau_i^{(2)})$,
where $a_i^{(1)}$ and $a_i^{(2)}$ are two independent random streams of ${\pm 1}$ and $h^{(1)}(t)$ and $h^{(2)}(t)$ are their corresponding pulses, and $T$ is the bit period, and $\tau_i^{(1)}$ and $\tau_i^{(2)}$ are timing errors.

The problem is that I want to calculate another set of samples while all the parameters of the above equation are known. I want to obtain:

$s_k = \sum_i a_i^{(1)}h^{(1)}(kT-iT) +\sum_i a_i^{(2)}h^{(2)}(kT-iT)$, which looks exactly like the original samples except for that the timing errors do not exist anymore. I know that I cannot achieve this just by resampling. How do I approach this?

Please share your thoughts.


texts: why if we pad any signal with enough zeros we can get the same result

texts:
if we pad any signal with enough zeros we can get the same result as linear
convolution whilst using the fft function we compute circular convolution.
Why?


texts:
I have a sinusoidal signal that is sampled at $f_s=10$ Hz.
I am asked to find the absolute value of the DFT for different data lengths (1 sec., 2 sec. etc.)

I do not understand where will I use the information about the data lengths.

Does the question want me to change the time vector for each attempt?
as such:

** original time vector **

f=10;         % sampling freq
t=0:1/f:5;

rendering

x = cos(2*pi*3*t)

** time vector for each attempt **

t1=0:1/f:f*1; % data length = 1 sec
t2=0:1/f:f*2; % data length = 2 sec

thus rendering

x1 = cos(2*pi*3*t1);
x2 = cos(2*pi*3*t2);

and the rest would be how we usually get the FFT.

Did I understand the request correctly or not?

----Edit ------

The question is specifically for matlab simulation:


texts: Interpretation of minimum discernible signal (MDS) in sonar equation

texts:
I am working on modelling and simulations of synthetic aperture sonar at component/subsystem level. I have started with standard sonar equations for calculating detection ranges for different environmental conditions. One parameter I calculated is Minimum Discernible Signal (MDS) which is difference between detection threshold (DT) and array gain/directivity index (AG/DI) (beam forming). According to book definition, MDS is SNR at array's hydrophone face required for detection at some preassigned level of correctness.

After hydrophones, there are of course pre-amplifiers (PA) and ADCs before beam former stage (DI/AG). My confusion is how to interpret this MDS/SNR in terms of PA and ADC specifications?. I have defined and fixed receiving sensitivity of hydrophones, however I need to drive PA and ADCs specifications from calculated MDS especially in terms of noise levels so that same MDS/SNR appearing at array's hydrophones face can appear at beam former input without distortion.

NOTE:

Suppose my MDS/SNR (in terms of acoustic/sound pressure) for certain conditions came out to be $-20\textrm{ dB}$. Using hydrophone sensitivity, I think same SNR (in terms of voltage) will appear at each hydrophone output (if I am not wrong). Does it mean that even if echo level at input of PA /ADC of each hydrophone in array is 20 dB below PA/ADC noise floor, beam former and post processing will still be able to detect this echo???


texts: Doing audio processing with DFT on a microcontroller

texts:
I have written an audio processing application in C++ which runs on a desktop windows computer.

My next step is to implement this on an embedded system using a microcontroller, preferably arm-based.

As my application uses fft libraries which does floating point calculations, do I need a microcontroller with a floating point unit, or is there still a way to do this on a microcontroller without floating point hardware?

What type of ARM CPU would be recommended for processing audio with FFT like this? Thanks in advance


texts: defining the frequency range with fast fourier transform

texts:
In the following example I have used various examples found on the web to understand fft and detecting signals with matlab.

fs = 1000;
t = 0:1/fs:1.5-1/fs;

x = 3*cos(2*pi*20*t + 0.2) + 1*cos(2*pi*30*t + 0.3) + 2*cos(2*pi*40*t + 2.4);
N = length(x);

% define the frequency components of the series
freq = 0:N-1;
freq = freq*fs/N;

% normalise the data and compute the fourier transform
X = fft(x)./N;
cutOff = ceil(N/2);
X = X(1:cutOff);
freq = freq(1:cutOff);

figure;
stem(freq,abs(X));
xlabel('frequency');
ylabel('amplitude');

Resulting in:

Why is it that the amplitude of the final plot are 1.5, 0.5, and 1 respectively? The initial amplitudes were 3, 1, and 2 so why is the amplitude of the signal half of that?

Also, could someone explain the section

% define the frequency components of the series
freq = 0:N-1;
freq = freq*fs/N;

I don't quite understand how this works.


texts: Orthogonal Codes for Band Limited Channel

texts:
In this question orthogonal family and pulse shaping filter the user asked about possible loss of orthogonality of orthogonal codes due to the use of raised cosine pulse shaping and I showed as an answer how a correlation between codes can occur due to pulse shaping.

This leads me to the question of orthogonal codes for use in band limited channels. Are there such codes that exist that both provide band limiting (similar to what raised-cosine pulse shaping provides) and guarantee complete orthogonality between the band limited waveforms themselves? Here orthogonal means the inner product (dot product) between the waveforms is zero.

In particular as a matter of technical interest I am interested in solutions that mathematically result in 0 (such as Walsh codes prior to any pulse shaping when properly synchronized). If this does not exist then the solution that provides a complete family of codes and has the lowest relative cross correlation (relative to other solutions of the same code size) will be selected as the best answer. As I found in the linked question, testing just two samples of the complete code family are not sufficient to conclude.


texts: Apply window taper for selected window or to full data block in algebraic problem with known frequencies?

texts:
First, I'd like to introduce a problem. I try to solve a set of linear equations in LS (Least Squares) sense, i.e. Ax=y (LS) => A^TA x = A^T y.
x is a vector I'm looking for, but y is a measured signal. This signal contains almost sinusoidal contributions with know frequencies, but as always in the nature, is contaminated with some noise. It's uniformly sampled (1hr). Matrix A contains the sinusoidal contributions that I know add to the signal, but I don't know how much each.
Prior to solving LS, I filter the data with Finite Impulse Response (FIR) lowpass filter, which is causal. Filtering is a convolution in time domain, no DFT is needed. Filter length (1/2) is excluded from the ends of time series.
The next step is the one that puzzles me. To avoid spectral leakage, I'd like to taper that data. Most people recommend that after taking the actual data set for analysis, taper them. For example, I want to investigate 6 months of data. Let's say my data is 5 years. I'd say, that okay, I have longer data set, so I use window taper (e.g. Hann) for this data block, and I select only some data for analysis afterwards. The others would taper 6-month block only.
Which one is correct and why? I actually quite don't understand this while in fact the problem boils down to algebraic set of equations (frequencies are known). Is it related to the noise level in LS setup? I've read tutorials about taper, but vast majority corresponds to DFT properties.


texts:
If a time-domain signal has sharp corners, its frequency spectrum will contain high-frequency components. Truncating the spectrum results in Gibbs' phenomenon. So if you're trying to design an FIR, you really want the target frequency response to be nice and smooth so that windowing the impulse response down to a finite length doesn't distort the frequency response too much.

Currently I'm contemplating trying to design a very strange filter: One that has unit gain at all frequencies, but non-zero phase. I'm wondering whether or not a similar phenomenon occurs: If the filter has unit gain at all frequencies, then what does truncating the impulse response do to the phase alignment?


texts: Recommended device for testing my own SDR?

texts: I'm trying to implement my own SDR using Matlab. I was wondering what kind of device I could buy in order to test it. I know I can use my own soundcard but I was thinking of EM waves, not sound. Is there a device capable of functioning as transmitter and receiver and be compatible with Matlab? Just wondering, I have found very cheaps ones (like RTL-SDR) but they only work as receivers and I'm not sure if they're Matlab-compatible. Thanks!


texts: Nyquist Theorem - Why unique frequencies upto Fs/2 and not Fs? f+Fs is start of Aliasing

texts:
If any frequency, f, displays an alias at f + Fs, This shows that unique frequencies have a range of Fs. Why does Nyquist theorem say that actually there is only half of this with unique frequencies below Fs/2?

Has it got something to do with negative frequencies?

No clear answer yet only confused :( please help


texts: Detecting moved and dirty areas between two snapshots/images

texts:
I'm new to image processing and trying to figure out best way to identify 'moved' and 'dirty' rectangles between two desktop screenshots.Basically, lets say there is a round circle moving on a screen, there is a text that is changing e.g. millisecond counter, and there is a image that is being updated. All this is happening at 60fps.
The algorithm should identify the moving circle as 'moved' region (and provide bounding rectangle of the moved object in source/initial and second/final image). Anything that changed in-place e.g. color/image change, text change etc should be identified as a 'dirty' region (with associated bounding rectangle). There could be a multiple of dirty & moved regions so the technique should be very fast on typical computer hardware (i5 processor) and be able to hit 60+ fps.
I'm open to using GPU/iGPU for speeding up the process, but at this point not sure about the right image processing algorithm.


texts: Laplace Transform of $f(t+a), a>0$ where $f(t)$ is not periodic

texts:
For $a > 0$, is there any known representation of the Laplace transform of $f(t+a)$ in terms of the Laplace Transform of $f(t) $

Note: In my application, $f(t)$ is not a periodic function and the functional form of $f(t)$ is not actually known a-priori, because I have to couple it to another set of equations.


texts: Best digital noise reduction in optical spectra measurement

texts:
I am using an optical spectrometer to measure the reflectance of some surfaces; the output is essentially a set of photodiodes' signals: for each photodiode I have a discrete time signal every $T$. The exposure time and the frame rate of the sensor can be changed: I tuned them so to have the highest number of measurements per second (i.e. highest framerate possible) and the corresponding longest integration window possible (there is no saturation problem).

Given as a degree of freedom the number of measurements that can be acquired, what would be the best digital method to reduce the noise of the measurement and to maximize the SNR?

The simplest solution seems to be averaging, which enhances the SNR of $\sqrt N$ under hypothesis of white uncorrelated noise, but is that the best that can be done in case of unknown noise spectral power distribution? In particular, I was wondering if there was a technique that exploits in an optimal way the information gathered on the noise during the acquisition of $M$ repeated samples.


texts: IIR implementation - RuntimeWarning: overflow encountered in double_scalars

texts:
I have implemented a butter filter in python using this function:
def butter_lowpass(cutoff, fs, order=5):
    nyq = 0.5 * fs
    normal_cutoff = cutoff / nyq
    b, a = butter(order, normal_cutoff, btype='low', analog=False)
    return b, a

b and a:
array([1.53324552e-09, 6.13298208e-09, 9.19947312e-09, 6.13298208e-09, 1.53324552e-09])
array([ 1.        , -3.9671626 ,  5.90202586, -3.90255878,  0.96769554])

Now I have to do an implementation. When testing different algorithms, I have the following problem:
RuntimeWarning: overflow encountered in double_scalars

How to avoid this problem? Perform scaling? The problem, in my opinion, is the b coefficients.
When I call the function lfilter everything is OK
The code and data: https://github.com/Rariusz/IIR-implementation.git
The actual IIR implementation:
N = order1
L = len(data)
x = np.zeros(L,dtype=np.float64)
u = np.zeros(L,dtype=np.float64)
y = np.zeros(L,dtype=np.float64)
a = a1
b = b1

for n in range(L):

  for i in range(N,1,-1):
    x[n-i-1] = x[n-i]
  x[n] = data[n]

  y[n] = 0
  for i in range(N):
    y[n] = y[n] + b[i]*x[n-i]

  for i in range(1,N):
    y[n] = y[n] + a[i]*y[n-i]

Solution:
y = np.zeros(len(data))
x = data
for n in range(4,len(data)):
  y[n] = -(a[1]*y[n-1] + a[2]*y[n-2] + a[3]*y[n-3] + a[4]*y[n-4]) + \
         b[0]*x[n] + b[1]*x[n-1] + b[2]*x[n-2] + b[3]*x[n-3] + b[4]*x[n-4]


texts: What are some python packages I can use to cut audio files

texts: I have a project in which I have a batch of audio files and I need to remove the audio in it from say time 2secs to 5secs i.e. I have a set duration to be removed. How can I do this in python?


texts:
Inspired by the talk "You and Your Research" by Richard Hamming, I started wondering what are the important research topics on signal processing nowadays. Certainly an extensive list of topics would not be easy to find. I do not know the trending topics, for example, on Circuits and Systems, but I could imagine it for biomedical engineering.

So, in your opinion, what are some interesting research topics nowadays on signal processing? I could start with compressive sensing and tensor models.


texts: How to recognise partial text on mechanical indicators

texts: I would like to know is there any possible approach to recognise digits of the first (and second as well, as you can see in the example figure) order of magnitude. I've thought of neural network with full, half and possibly quarter training samples of the digits I want to recognise, but I don't think this is the best approach. You see, I am new to computer vision and I'd like to see what path should I take to study if there are any for this problem.


texts:
Pardon my layperson understanding. My application is audio design.

What is the correct operation / algorithm to compose two impulse responses (IRa, IRb) into a third impulse response IRc such that it equals the response of running a signal through IRa then IRb?

Am I correct that since IRs represent the response to the delta function, that I can simply convolve IRa by IRb directly? i.e:

IRc[n] = IRa[n] * IRb[n]

Without needing to worry about deconvolving the output of the first IR convolution?

Thank you.


texts:
What's the intuition behind a ''Graph fourier transform'' ? I'm not so much interested in mathematical details or technical applications. I'm trying to grasp what a graph fourier transform actually represents,and what aspects of a graph it makes accessible.

To clarify the issue:
Graph-structured data appears in many modern applications like social networks, sensor networks,
transportation networks and computer graphics. These applications are defined by an underlying
graph (e.g. a social graph) with associated nodal attributes (e.g. number of ad-clicks by an individual).
A simple model for such data is that of a graph signal—a function mapping every node to a scalar real value

The classical Fourier transform is the expansion of a function fin terms of the eigenfunctions of the Laplace operator;  i.e.,
$$ \hat{f} = \langle f, e^{2\pi i \xi t } \rangle$$
Analogously, the graph Fourier transform  $\hat{f}$ a function $f \in \mathbb{R}^{N}$ the vertices of graph $G$ the expansion of $f$ in terms of the eigenfunctions of the graph Laplacian. It is defined by

$$\hat{f}( \lambda_{l}) = \langle f , \chi_{l}\rangle = \sum_{n=1}^{N} f(n) \chi_{l}^* (n) .$$

It should be mentioned

the following article claims that,"we generalize one of the most important signal processing tools – windowed Fourier analysis – to the graph setting and When we apply this transform to a signal with frequency components that vary along a path graph, the resulting spectrogram matches our intuition from classical discrete-time signal processing. Yet, our construction is fully generalized and can be applied to analyze signals on any undirected, connected, weighted graph."

(https://arxiv.org/abs/1307.5708)

I am looking for some simple concrete examples of the ways in which real problems go through  graph signal processing and how  graph Fourier transforms are obtained.


texts: How can I take a fixed number of bins after N-point DFT when N is unknown?

texts:
I am working with machine learning for time series classification. I am trying to extract features from the amplitude spectrum.

My current concern is that I cannot tell the length of the signal in advance. Here's one example signal with $N=192$ observations, corresponding to approximately 2 seconds of data collection:

I do not have an upper bound on the length of the signal, although more than 1,000 observations usually indicate I have an outlier.

My approach has been to take the input signal $x=(x_1,x_2,\ldots,x_N)$ and then find the one-sided amplitude spectrum from its N-point DFT:

$\mathcal{F}(x) = (X_1, X_2, \ldots, X_N)$
$A(X)=(|X_1|, |X_2|, \ldots, |X_{\frac{N}{2}+1}|$)

Given that my sampling rate is approximately $f_s=100\,\text{Hz}$, I figured I would interpolate the one-sided amplitude spectrum to 51 points. (PS: I made a mistake here; please see clarification below.)

This procedure gives me a 192-point DFT and a one-sided amplitude spectrum with 97 coefficients, which I interpolate to 51 (linear interpolation). For comparison, here's the original amplitude spectrum and its interpolation. The horizontal axis is given in Hz.

They don't look very different. However, the features I take from the spectrum are such as short-term energy, variance, standard deviation, number of peaks, and location of the first peak, as well as the magnitude of specific coefficients (am I right in saying that's the energy at those bins?). So different approaches in finding those 51 coefficients can lead to quite different results.

Also, I have the impression that interpolating the amplitude spectrum is just plain wrong. Looking at the figure, it seems obvious that the interpolation made me lose a lot of energy content in the range near 0-5 Hz.

For disclosure, I did check each related question suggested by Stack Overflow as I wrote mine. The most similar question to mine seems to be "How to combine bins of my DFT", however I believe I have several additional doubts---to start with, I'm eager for criticism on whether I am doing the right approach in taking the absolute value of the Fourier coefficients and then trying to reduce the number of bins, or whether I should zero-pad my signal to a number of observations that is a multiple of 50 (and thus hopefully avoid leakage? I don't know, I'm really struggling to understand the subject and I might be working with several misconceptions here; any corrections will be appreaciated)

PS: I made a mistake in my assumptions. I incorrectly assumed Matlab's interp1 function interpolates over a set of query points and averages the values in-between. What it is in fact doing is downsampling.

PPS: here's the code for coefficient reduction:

qp = (0:50) * (numel(X) - 1) / (50) + 1;
X50 = interp1(X, qp);


texts: Compensation for Irregular Time Step for DFT (FFT)

texts:
I want to run a clustering algorithm (svm, knn) on the ferquency spectrum data of a temperature sensor that published at irregular times.
Here is the temperature data to take the FFT:

I got the mean frequency for this temperature data as well as every temp sensor in the dataframe the average is every 18mins, longest distance between 2 points is 3hrs:

# group by short id
groups = df.groupby('id')
time_diff = groups.apply(lambda df: df.published_at.diff().mean())

Isolated the graphed temp data in a series:

signal = df.loc[df['_id'] == 'A1']['temperature']

Stored size of signal and mean sampling frequency as variables:

# sampling frequency:
Fs = time_diff[:1]
Fs
Out[217]: 00:18:54.085526

# size
S = signal.size
Then took the fft and calculated dBs

X = np.fft.fft(signal)
X_db = 20*np.log10(2*np.abs(X)/S)
And plotted the results:

plt.plot(X)
plt.show()

plt.plot(X_db)
plt.show()

These graphs intuitively do not look like they correspond to the original data. The objective with the fft is to then classify the data using SVM, however, I am not sure which variant fft is appropriate, nor if using the mean time frequency is either.


texts: Measure scalloping loss of window function

texts:
Is there an easy/general way to calculate this? For instance, the rectangular window has a maximum scalloping loss of 0.3634, which can be derived in frequency domain from a normalized sinc(0.5).

The only way, given a precomputed window function, I can think of, is to apply the window function to a signal whose period is 2pi*(k + 0.5)/N and amplitude A, calculate a N FFT and measure the bin k. Bin k should have a magnitude of A * N * f, where f is a factor giving the worst-case scalloping loss, irrespective of N/sampling size, right?