texts: Fourier transform of function division in time domain

texts:
$F_1(\omega)$ is the Fourier Transform of $f_1(t)$. $F_2(\omega)$ is the Fourier TRansform of $f_2(t)$. Can I obtain the Fourier Transform ($F_3(\omega)$) of

$$ f_3(t) = \frac{f_1(t)}{f_2(t)} $$

directly from $F_1(\omega)$ and $F_2(\omega)$? I mean, is there anything similar to the equivalence between Multiplication in the Time Domain to Convolution in the Frequency Domain but for the Division operation?


texts:
How does the signal look when we don't use the Nyquist rate to remove aliasing from a signal during sampling?

Let's suppose the signal is sinusoidal, with a frequency of 500 Hz and an amplitude of 2.

signal = 2*cos(2*pi*500*t)

If I sample it, (replacing t=nTs , Ts = sampling period and n represent number of samples) and plotting the sampled signals with a different sampling period using the subplot command in MATLAB, how could I identify the aliasing in a sampled signal?

Here is the example code that plotted two signals, one at the Nyquist rate while the other less than the Nyquist rate:

A = 2;
Fmax = 10;
Fs = 2*Fmax;
n = 0:1/Fs:1;
Cont = A*sin(2*pi*(Fmax/Fs)*n);
Cont1 = A*sin(2*pi*(Fmax/18)*n);
subplot(2,1,1)
stem(n,Cont)
hold on
stem(n,Cont1)

and here is the waveform:

I wasn't able to identify the aliasing. How did it affect the signal when Nyquist rate didn't use?


texts: Excluding points too close to a set of coordinates

texts:
I was wondering if anyone can help me. My ultimate aim is to take an image like the one shown and draw line between the white and black blobs that show a direction and output the coordinates in the image. However, blobs should only be connected if they are on the adjacent vertex and blobs on the same vertex should not be connected i.e. a white blob should only connect to a black blob on its nearest neighbour.

Currently, I have been able to draw lines between blobs and give them a colour depending on their direction. I have also been able to exclude diagonal lines.

My current problem is my code is still drawing vertical and horizontal lines across the same vertex. I cannot use a distance limit as some of the nearest neighbour blobs are the same distance away as the ones on the same vertex.

I have managed to map the coordinates of the vertices using mouse clicks and store those in a list and I also have a list for the centre point between two blobs so I was hoping I'd be able to say - if the centre point of the line is too close to the vertex coordinate then don't draw a line.

for dark in keypoints_dark:
    xd = int(dark.pt[0]) #assigns x and y values and puts them as a coordinate
    yd = int(dark.pt[1])
    cd = (xd,yd)
      for light in keypoints_light:
        xl = int(light.pt[0])
        yl = int(light.pt[1])
        cl = (xl,yl)
        xa, ya = (xd+xl)/2, (yd+yl)/2
          for vertices in C:
            point_1 = geometry.Point(xa,ya)
            vertex = geometry.Point(vertices[0],vertices[1])

In the code, light and dark are the lists for all the light and dark blobs, C is a list with all of the vertex coordinates so I'm running through all of the dark and light coordinate pairs, calculating the centre point between the two and I'm then trying to compare the centre coordinates to all of the vertex coordinates however I can't seem to figure out a way to say if the centre matches any one of the vertex, then end the loop.

Thanks in advance for any help!

Edit:

Here is an example of a before and after that is hand done.

Currently what I'm getting for the first image is this. Some of the blobs arent being recognised but I can sort that. The issue is, for example, on the left vertical edge there are two blue lines going over two of the vertices which I don't want.


texts: Maximum dB SPL from a digital microphone

texts:
Basic sanity-check question: if I have a digital microphone with a sensitivity of -26 dBFS (say, this one), does this mean that the max dB SPL it can handle is 120 dB SPL?

My thinking is that if the sensitivity is measured at 94 dB SPL and the max output is presumably 0 dBFS, then that 26 dBFS sensitivity would bring us up to 120 dB SPL. Is that right?


texts: compute a difference( dB) between two BER curves

texts:
For example, given these 4 curves and I would like to compute a loss/difference between BER of BPSK and BER 8PSk in dB.
How to do that? let say for BER 10^-2


texts: Question about Hilbert transform of a cosine signal

texts:
In the paper entitled "On instantaneous frequency", it is claimed that the Hilbert transform of a signal in the form of $A(t)cos(\phi(t))$ would result in $A(t)sin(\phi(t))$, where $A(t)$ is instantaneous amplitude and $\phi(t)$ is the phase function.
As an example, consider the following:
$$t = [0, 20],\;\textrm{time interval in seconds, sampled each 0.01 sec}$$
$$A(t) = e^{-0.1(t - 10)^2},\;\textrm{instantaneous  amplitude}$$
$$\omega = [0.1,\ 0.5,\ 1.0,\ 1.5],\;\textrm{angular  frequency  in rad/sec}$$
$$f(t) = A(t)\cos(\omega t)$$
$$g(t) = A(t)\sin(\omega t)$$
$$h(t) = \frac{1}{\pi}P\int_{-\infty}^{+\infty}\frac{f(\tau)}{t - \tau}dt,\;\textrm{Hilbert  transform  of } f(t)\textrm{,  where } P  \textrm{ is the   Cauchy  principal  value}$$
It is expected that $g(t)$ and $h(t)$ be the same according to the fact claimed in mentioned paper. I used function "hilbert" of MATLAB to compute Hilbert transform of $f(t)$ for aforementioned $\omega$ values. Results show that for $\omega$ close to zero, $g(t)$ and $h(t)$ are different and as $\omega$ gets higher, the difference decreases. I was wondering if I am making a mistake or something is wrong with function "hilbert" of MATLAB?
The following figure shows the results:


texts: How to segment object when it has similar histogram with background

texts: I am working in image segmentation and I would like to ask you something about my problem. I have a image such as bellow. I want to segment leopard from background. However, intensity information is not useful for my case because the bough (background) whose intensity distribution is similar with leopard's. Could you suggest to me some method to segment leopard? I attacted one example using active contour.Thank you in advance


texts: Check work: Expression for 3dB bandwidth for frequency response of high - pass filter having just one pole

texts:
The input output relationship is given:

$y[n]=ay[n-1]+bx[n]$

$-1<a<0$

I applied z-transform to get the transfer function :

$$H(z)=\frac{b}{1-az^{-1}}$$

Since $-1<a<0$, the maximum power will occur when $w=\pi$ where $w$ is frequency.

So max $|H(z)|^2=\frac{b^2}{(1+a)^2}$

At the 3dB frequency, the power will be half of this. So if the 3dB frequency is $w$, then:

$$\frac{b^2}{1+a^2-2acosw}=\frac{b^2}{2(1+a)^2}$$

$$1+a^2-2acosw=2(1+a)^2$$

Solving this I got

$$w=cos^{-1}(\frac{-1-a^2-4a}{2a})$$

Is this correct? If not, which step is wrong?


texts:
I have scoured my entire library and I can't find where I read about a method of using symbol energy intentionally smeared across multiple bit times in such a way that the symbols can be recovered correctly. Can someone point to any of the classic digital modulation books I am likely to have in my library where I would have read about this technique? I seem to recall it was a part of minimum shift keying techniques. It is frustrating that I can remember one or two of the figures but can't place where I read it.

Thanks.

Ray


texts:
it is a couple of weeks that I am thinking about the following: I have a tool which is able to simulate the dynamic behavior a steel tower exhibites due to the coupled action of wind and waves. Currently, to damp the oscillations, I am controlling the acceleration of the tower top by means of a standard feedback loop.

By the way, this procedure is rather cumbersome and suboptimal: I damp the tower oscillation even when it's not needed, since the mentioned oscillation cannot jeopardize the system. Therefore, I am thinking of a triggering method: this trigger should be based on online FFT analysis of the tower oscillations: if the FFT amplitude is above a certain risk-threshold, the control loop must be activated.

Now the question is: I am used to post-process full time series by means of FFT, but in my case the FFT should be performed on the simulated signal while the simulation is running.
Do you know any way I could perform kind of step-by-step FFT analysis?


texts:
I understand that mathematical motivation  behind Bayesian Information Criterion (BIC), Minimum description length (MDL), Akaike information criterion (AIC) are different but I am assuming that there are several applications where all three are equally applicable. I am interested to know the applications of  these algorithm in as many areas as possible. I can only guess that it is used in estimation of number of targets in radar. But I can also imagine that such a general concepts can be applied in many other problems.

May I request to users of these algorithms to write a few lines on how they are using and are they using it in some products?

Any comments would be appreciated.


texts:
Hi does anyone know how to solve this. Im really struggling to figuring this one out.
I am unclear of how the backpropagation part would work in this network and how to calculate it for each weight. Also, how you would incorporate 2 epochs.
Consider the following network:

Write the updated value of
(i) W1
(ii) W2
(iii) W3
(iv) W4
(v) W5


texts: Are SURF descriptors normalized with respect to orientation?

texts:
I know that both SIFT and SURF descriptor vectors are normalized with (unit vectors) to deal with illumination changes, but as far as I can see, the SIFT descriptors are also normalized with the major orientation of the keypoint.

Does anyone know if the SURF descriptor does this, as I cant find anything about this in the SURF paper by Herbet et al?

I would appreciate any help with this!
I am currently using SURF descriptor as included with matlab computer vision toolbox.


texts:
If an All Pass system has poles at $0.8\exp\left(-j \dfrac{\pi}{4}\right)$ and $0.8\exp\left(j \dfrac{\pi}{4}\right)$, There would be $2\pi$ jumps in the phase (principal value) at angular frequency $\omega= \dfrac{\pi}{4}$ and $\omega= \dfrac{7\pi}{4}$, but why would there be $2\pi$ jumps also at $\omega= \dfrac{3\pi}{4}$ and $\omega= \dfrac{5\pi}{4}$ (Figure 5.24 in Oppenheim Schafer and Buck "Discrete Time Signal Processing 2nd Edition)?

I understand that in all pass systems with real coefficient frequency response, a pole at $z= z_1$ would mean a pole at $z=z_1^*$ and zeros at $z=\dfrac{1}{z_1^*}$, $z= \dfrac{1}{z_1}$. With this reasoning a pole at $0.8\exp\left(-j \dfrac{\pi}{4}\right)$ would mean zeros at  $1.25\exp\left(j \dfrac{\pi}{4}\right)$ and $1.25\exp\left(-j \dfrac{\pi}{4}\right)$. But this still does not explain the $2\pi$ jumps in phase at $\dfrac{3\pi}{4}$ and $\dfrac{3\pi}{4}$.

Please Help. Thank you very much in advance.


texts:
I am trying to make a minimum phase filter (in wxMaxima) according to these steps:

first create a "normal" FIR (a simple sinc, wc=0.4, random example, but in the pictures a remez with Octave)
calculate the zeroes (allroots() function)
delete the zeroes outside the unit circle (anything>1/0.98, tolerances&co)
delete half of the zeroes on the unit circle (the conjugate pairs, 0.98 < x < 1/0.98)
reconstruct the polynomial => coefficients.

As I understand it, these are the correct steps to follow, but this is what I'm getting:

and this only if I don't delete half the zeroes. If I do, no matter how I sort, choose, etc, I get bogus results. Is this the right way to achieve a minimum phase? I can provide the wxMaxima approach if needed (I tested it first to see if I can reconstruct the original impulse and I could do it, so obtaining the coefficients is not the problem, but the how to).

I wanted to add this later that day but got busy. Here's a graph showing the frequency response of the four filters, ignore the blatant uglyness in attenuation, it's meant to be an example. The 2nd is by zero inversion (and doubling), the 3rd is by spectral factorization and the 4th is like the 3rd only done by geometric mean between adjacent zeroes, to avoid the manual tweaking of adding the DC offset to h[M/2]:

Here are the zeroes:

The idea with the geometric mean came after realizing that the response of the equiripple wasn't quite equiripple, so adding $\delta_2$ to h[M/2] was tricky (you can see the green zeroes aren't quite overlapping). This also gave me the idea that I can use it with non-equiripple, too (that pdf implies the method can only be applied there). Sure enough, here's the result:

Of course, windowing with a Kaiser (Dolph-Chebyshev, or exponential, or cosh) window(s) should be necessary to compensate for the stop-band. Here's a quick example with a Hamming window:

I think the geometric mean ($\sqrt{z_1 \cdot z_2}$) comes as a good alternative, as long as the zeroes are fairly evenly-spaced, otherwise choosing between non-overlapping zeroes (see the green ones) results in going away from their center.

After this I reached the conclusion that if you need a minimum-phase FIR then it's safe to go for an inverse Chebyshev IIR for the sake of less computation power. The half-order minimum phase might be worth it in terms of delay, but it's a pain matching the amplitude. Here are some results with LTspice, showing two FIRs with N=64, linear and nimimum phase, and an inverse Chebyshev IIR (not Cauer, chosen for flatness and similarity in response) with N=11 and matching attenuation:

And, for the sake of comparison, here are the phases of the min.-ph. FIR and the inv. Cheb. IIR:

...and the step responses of all three:


texts: How to convert Third Octave data into single SPL quantity

texts:
I have a data vector which consists of calibrated pressure at each sampled point in time. I have also taken this signal, applied a filter bank to it using a butterworth filter with passbands according to third octave (i.e. band center frequency at 25, 31.5, 40,...,20,000), and for each band calculated $20\log(p_{rms}/p_{ref})$ where $p_{rms}$ is the root mean squared pressure for the resulting filtered signal in each band, and $p_{ref} =2\times10^{-5}$ Pa. This should give me the third octave "spectrum".

I now wish to calculate the total sound pressure level (SPL). I thought first I could say that $SPL = 20\log(p/p_{ref})$ where $p$ is just the root mean squared value of the entire data vector.

To compare I thought I would then calculate the same quantity but this time starting from my third octave data. I would then hope to get the same answer by adding logarithmically (i.e. adding the rms values from each band and then converting to dB) the dB values from each third octave band. However this did not give matching results.

I therefore suspect I am not converting from third octave to a single SPL quantity correctly, since my first calculation of SPL seems very straightforward. Am I missing something here? For instance does each third octave band need to be scaled by the frequency bin? This would imply I have some sort of density in third octave, but im not sure.


texts: How to average MFCCs from different speakers saying the same word?

texts:
I am trying to create a simple recognition system. i have recordings of several speakers saying the same word, let's say "west". I compute the MFCC feature vectors of word "west" from each speaker. If i have 10 speakers, i then have 10 matrices, each of them of dimensions N_frames * 13 (13 coeff and N_frames varies from speaker to speaker). I would now like to store a final matrix of dimension
M * 13 which will serve as a reference pattern for word "west". My question is, how to "average" or combine MFCCs from different speakers? (i call this process some kind of training)


texts: GPS C/A Code Time Delay Using Ultrasound

texts:
I am undertaking a project which requires to measure a distance from source to receiver. I am doing this using two ultrasonic transducers operating at 40kHz and using FFT search to determine the time delay and from that the distance. These are the following steps I'm taking to achieve this. All the processing is done in MATLAB.

Transmitting a C/A code at 1kHz using a carrier frequency of 40kHz
At the receiving end I sample the incoming signal at 160kHz
Generate a C/A code locally with a sampling frequency (fs) of 160kHz
Multiply the received signal with the one generated in step (3)
Multiply the signal from step (4) with sin(2*pifct) and
cos(2*pifct), where fc=40kHz and t=0:1/fs:1.023-(1/fs) to obtain the
I and Q components down-mixed to 40khz.
Then, compute the fft down-mixed signal, using fft(I+iQ), where
i=imaginary
Compute the fft of the localy generated C/A code and then take the
conjugate of that: conj(fft(C/A))
Compute the ifft,square and take the absolute magnitude of the result,
as so: abs(ifft(step7*step6)).ˆ2 to get the time delat

Are the above steps correct? Is there anything else I have to do or am I missing something? It works fine in matlab but when I use 'real' data the correlation is much weaker. I haven't actually used the ultrasonic yet I'm simply using one microcontroller to generate and send signal and another to sample it (connected with a wire). When I do the processing in matlab the results aren't as good as the pure simulation.
Note: DSP is very new to me, I'm just stuck with this project and learning as I go along.
C/A Code generator
[taken from][1]

tap=[2 6; 3 7; 4 8; 5 9; 1 9; 2 10; 1 8; 2 9; 3 10; 2 3; 3 4;
 5 6; 6 7; 7 8; 8 9; 9 10; 1 4; 2 5; 3 6; 4 7; 5 8; 6 9; 1 3;
 4 6; 5 7; 6 8; 7 9; 8 10; 1 6; 2 7; 3 8; 4 9; 5 10;4 10;
 1 7; 2 8; 4 10];

G1 = -1*ones(1,10);
G2 = G1;

s1 = tap(n,1);
s2 = tap(n,2);

tmp = 0;

for i = 1:1023
    G(i) = G2(s1)*G2(s2)*G1(10);
    tmp = G1(1);
    G1(1) = G1(3)*G1(10);
    G1(2:10) = [tmp G1(2:9)];

    tmp = G2(1);
    G2(1) = G2(2)*G2(3)*G2(6)*G2(8)*G2(9)*G2(10);
    G2(2:10) = [tmp G2(2:9)];
end

%resample
x=1:n_samples
CAa(x) = G(ceil(x*chiprate/fs));
end

Signal received from the "ADC"

  function send = s()
clear all;
%        CAa = ca(n,chiprate,fs,n_samples)
CAtest = CAa(1,1e3,160e3,(160e3*1.023)); %generate the outgoing signal
Fs=160e3;
n_data = 160e3*1.023;
t =(0:(n_data-1))/Fs
carrier = cos(2*pi*40e3*t); %carrier @40khz.
send = carrier.*CAtest %modulate

end

Code for xcorrr

close all;
modulated =  send();                          %generate incoming signal
%modulated = circshift(modulated,80000,2);    %simulate a time delay
fc = 40e3;                                    %carrier frequency
Fs = 160e3;
Ts = 1/(Fs);
n_samples = Fs*1.023;                         %sampling period
t = (0:(n_samples-1))/Fs;                     %generate time vector

b = CAa(1,1e3,160e3,(160e3*1.023));           %generate a C/A code locally

rx = modulated .* exp(-j*2*pi*fc.*t);            %downconvert to baseband

corrOut = abs(ifft(fft(rx).*conj(fft(b)))).^2;
figure
plot(corrOut);


texts: Fusing or combining signals from multiple sensors

texts:
I've become very interested in the problem of fusing multiple low-cost sensors' outputs and trying to combine these outputs in such a way as to rival or exceed the output of a single high-quality / expensive sensor.

Applications could range from cubesats to antenna or microphone areays.

Specifically, it seems intuitively that one should be able to do better than simple "averaging" to, say, increase SNR for detecting faint signals or perhaps even increasing effective receiver bandwidth (i.e. combining multiple 3 MHz receiver outputs and achieving significantly greater BW without increasing sample rate).

I'm really not that smart on DSP, though, and would very much appreciate any pointers, theoretical limitations, suggested algorithms, resources, or online courses that could help me out.


texts:
I have a question regarding Discrete Fourier Transform and Discrete Time Fourier Transform.

Suppose that we have a sequence $x(n)= \{1,2,3,3,2,1\}$.

So is it possible to reconstruct the Discrete Time Fourier Transform $X(e^{j\omega})$ from the Discrete Fourier Transform $X(k)$ ? And how?

In my opinion , it is possible, although I am not sure if something like this would be any good. But in order to reconstruct it we probably need as much Discrete Fourier Transform samples as possible, right?

What do you people think on this matter?


texts: Finding lag times for multiple time series

texts:
I have $N$ time series which have unknown time offsets relative to each other. I want to estimate the $(N - 1)$ time offsets, $\tau_{i,i+1}$, which maximise the sum of the cross-correlations between the time series. How should I do this?

Notes:

The MathWorks documentation provides an example of this. However, this example aligns the time series one-by-one, and does not make use of the redundant information from the $N(N - 1)/2$ cross-correlations, so it is not the best possible solution.


texts: Is it theoretically possible to perfectly quantize a continuous signal?

texts: So, I'm completely new to digital signal processing, but while reading a piece this morning about quantization it got me daydreaming: could a machine ever be fast enough to sample the position and amplitude of each particle that makes up a wave?


texts:
I'm doing an exercise in which I need to show that the DCT of $\tilde{x} = (x_{N-1}, x_{N-2}, ..., x_1, x_0) $, with $\tilde x_m = x_{N-m-1}$, is equal to $ \tilde{X}_k = (-1)^{k}X_{k}$, but I have difficulty with the indices in the cosine manipulation and $\tilde x$:

\begin{eqnarray*}
  \tilde X_k &=& \sqrt{\frac{2}{N}}\sum_{m=0}^{N-1}\tilde x_{m}\cos\bigg(\frac{\pi k(N-m-1+\frac{1}{2})}{N}\bigg) \\
  &=& \sqrt{\frac{2}{N}}\sum_{m=0}^{N-1}\tilde x_{m} \cos\bigg(\frac{\pi k(N-m-\frac{1}{2})}{N}\bigg) \\
 &=& \sqrt{\frac{2}{N}}\sum_{m=0}^{N-1}\tilde x_m \cos\bigg(\frac{\pi k(-m-\frac{1}{2})}{N} + \pi k \bigg) \\
 &=&\sqrt{\frac{2}{N}}\sum_{m=0}^{N-1}\tilde x_m \cos\bigg(\pi k - \frac{\pi k(m + \frac{1}{2})}{N} \bigg) \\
&=&\sqrt{\frac{2}{N}}\sum_{m=0}^{N-1} x_m (-1)^{k}\cos\bigg(\frac{\pi k(m + \frac{1}{2})}{N} \bigg) \\
  &=&(-1)^{k}\sqrt{\frac{2}{N}}\sum_{m=0}^{N-1} x_m \cos\bigg(\frac{\pi k(m + \frac{1}{2})}{N} \bigg) \\
  &=& (-1)^k X_k
\end{eqnarray*}


texts:
I want to find the partial derivative of an image with respect to its X coordinate. I read that it can be done by convolution of the image with a mask like:

             fx = conv2(im1, 0.25 * [-1 1; -1 1])

I do not understand how is it calculating the partial derivative - can anyone explain?


texts: Algorithms for detection of fingertips or nails

texts:
Can you give me some advices on what could be the best algorithm(s) to use for detection of fingertips/nails in image. First thing that crossed my mind was Viola - Jones. After rethinking I concluded that maybe it would be possible to use just Hugh transformation after applying edge detection. But I'd like some more advices. Also, as this is going to be a student's project with a purpose of learning, I'am not allowed to use OpenCV or similar frameworks. Below is typical image that will be processed. (note it's not top-down view). There is no need for thumb detection.

typical image http://www.deviantpics.com/images/BwgPX.jpg


texts: What are the proper pre-processing steps to perform Independent Component Analysis?

texts: What are the proper steps for preprocessing my waveforms in order to perform an independent component analysis (ICA) later? I understand the how, though further explanation of that doesn't hurt, but I'm more interested in the why.


texts:
I'm reading this book "Applied Optimal Estimation" by A. Gelb. In the example 1.0-1, there are two measurements $z_{1}$ and $z_{2}$ with some noise for measuring $x$ as following
$$
z_{1} = x + v_{1} \\
z_{2} = x + v_{2}
$$
Now to design estimator for $x$, we need the estimated and the actual value of $x$, so we define the estimating error $\tilde{x}$ to be
$$
\tilde{x} = \hat{x} - x
$$
where $\hat{x} = k_{1}z_{1} + k_{2}z_{2}$. My question is that why $\hat{x}$ is the summation of the two measurements? Shouldn't it be one of the measurements or at least the summation divided by 2 so that we can make the subtraction between the ideal $x$ and observed $\hat{x}$ measurements.


texts: Is a cubic Lagrange interpolation tensor product the same as bicubic interpolation?

texts:
I just implemented some interpolated texture sampling by sampling the 4x4 nearest pixels then doing Lagrange interpolation across the x axis to get four values to use Lagrange interpolation on across the y axis.

Is this the same as bicubic interpolation or is it different?

Webgl implementation here:
https://www.shadertoy.com/view/MllSzX


texts: Model-based Kalman filtering a noisy signal

texts:
In a healthcare application, I need to calculate urine flow by differentiating the mass of urine emitted by a person over time. The measuring instrument consists of a load-cell under a fluid container, with its signal being sampled at 2kHz.

My original dataset is here.

The signals are noisy due to the load cell, and drippings over the fluid container, with an FFT showing an exponential-like decay in the magnitude of higher frequencies. Due to this noise, when I try to differentiate the volume signal to obtain the flow signal, I get a very rough signal.

I have already tried smoothing the volume signal in many ways (savatski-golay, gaussian convolution, butterworth low-pass), but by differentiating the smoothed signal I get either a still very wavy signal, or one that is so smooth that it no longer contains the expected characteristics of the flow profile.

I studied a bit about differentiation of noisy signals so as to estimate, say, velocity and acceleration directly from the position signal, and the main suggestion is to use a Kalman filter, which I never got to the point of making work, or even understanding conceptually.

There are some factors influencing on the signal characteristics, some of them due to the physiological model being represented, others not:

Physiological component: the flow is expected to be determined by muscle contractility (mostly involuntary bladder muscles) and urethral shape (affected by static structures like prosthate, and active structures like pelvic floor muscles);
Principle of measurement component: the fluid mechanics of the urine falling into the container, especially "turbulent" elements like drippings;
Instrumentation component: The load-cell/strain-gauge noise, with a much higher frequency than the two previous factors.

So my goal would be to implement a Kalman filter algorithm (I can use Python or C#) that gives me estimates for both Volume and Flow, based on the measured Volume, and that models the physiological component while "removing" the turbulence of the impact on the container (e.g. drippings) and the instrumentation noise.

I don't expect to get a ready answer, but since this is a bit beyond my skill level, I'm quite lost regarding where to start.


texts: How to match two signals that have similar shape but are scaled and expanded?

texts:
I have two signals A and B in time domain as follows:

Visually both signals look very similar; however the X and Y axis range are different for both the signals. Signal B is basically a "stretched" version of signal A. The minimas, maximas occur at different x and y values; but relative distance between successive peaks of the signals have somewhat an uniform proportion.
I'm looking for a similarity metric that would give high similarity value for such pairs. Note dimensions of both signals are different. Due to the domain constraint, I cannot pad values to any of them. I tried cross correlation, circular correlation, and other common similarity measure but they didn't give satisfactory results.


texts: Should I (and if yes, how can I) assure channel-dependant temporal accuracy in a filterbank?

texts:
Imagine a filterbank with N channels. A possible implementation is a sliding short-time FFT. If you want to capture frequencies as low as 100 Hz, the length of your sliding window should be at least 10 ms. However, because of this long window length (or in general filter length), you cannot track fast temporal fluctuations in the energy at high frequencies.

Is this ever considered as a problem? How would it be adressed? A possible solution would be to different filter lengths for different channels (i.e. shorter filters for longer channels). However,

I guess that in this case you lose the efficiency of the FFT algorithm?
Does it even make sense to consider fast energy fluctuations at higher frequencies, while assuming that the energy in lower frequencies keeps constant?

Thanks in advance!


texts: I do not understand this simple bandstop filter example

texts:
I have a periodic signal like this one with period $T=120$:

I would like to apply a bandstop filter to the signal, the stop band should go from 90% of $\frac{1}{T}$ to 110% of $\frac{1}{T}$.

So I run this code in Octave

A=-ones(1,35);
B=ones(1,45);
C=-ones(1,20);
D=ones(1,20);
E=[A B C D];
x=repmat(E,[1 6]);

figure
plot(x,'b');
axis([1 numel(x) -1.5 1.5]);
title('Input signal');
print -dpng input.png

figure
plot(x,'b');
axis([1 numel(x) -1.5 1.5]);

signal_period=numel(E);
signal_frequency=1/signal_period;

sampling_period=1;
sampling_frequency=1/sampling_period;

% "The Nyquist frequency is half the sample rate",
% from http://it.mathworks.com/help/signal/ref/fir1.html#inputarg_Wn
Nyquist_frequency=sampling_frequency/2;

signal_normalized_frequency = signal_frequency/Nyquist_frequency;

b = fir1(40,[0.9*signal_normalized_frequency 1.1*signal_normalized_frequency],'stop');
y = filter(b,1,x);

hold on
plot(y,'r');
title('Input (blue), output (red)');

print -dpng filter_response.png

and I get this filtered signal:

I would expect an attenuation of the signal but I only get a slightly "delayed" signal with some "ringing".

What am I missing?

My ideas:

I made a mistake in fir1 with the definition of the lower and
upper cutoff frequencies, perhaps I do not understand the normalized
frequency concept?
Maybe the cutoff frequencies are too low? The frequency response of the filter is the following: and I cannot see the classical "deep" stop band of a notch filter in the magnitude graph.


texts: Getting error in PSNR calculation using Matlab

texts:
I want to find out PSNR and SNR values of two images A and B of same dimension in Matlab.I used the following code

[peaksnr, snr] = psnr(A,B)

and getting an error

Undefined function 'psnr' for input arguments of type 'uint8'.

Then I converted both the images into double as follows

A = double(A);
B = double(B);

and again PSNR is calculated.Now I'm getting an error

Undefined function 'psnr' for input arguments of type 'double'.

Why this is happening?Please help me to troubleshoot the error.


texts: Convolution of discrete signals using convolution sum

texts:
I want to perform the convolution of the following discrete signals: $$h[n]=u[n-2] $$ and $$x[n] = (0.5)^nu[n+2]$$.
That's what I've done so far: $$\sum_{k=-\infty}^{\infty} (0.5)^ku[k+2]*u[n-2-k]$$
So: $$\sum_{k=0}^{\infty} (0.5)^ku[k+2]*u[n-2-k]$$
I know that the upper limit does not go to infinity, however, I cannot determine the correct upper limit. Any thoughts?


texts: Transfer function of an Exponential system in Z domain

texts:
Hi,
I am really confused with the system in the diagram.

The input-output relation of the system is given by $y[n]=\exp(x^2[n])$

I need to find the transfer function of this system $Y(z)$ in $z$-domain. My question is: is it really the simple exponential system I am missing out or something complex. If otherwise what would be the system transfer function.


texts:
This question follows from Designing a sound that localises well

I am developing an experimental system for pitch training.  I am giving each of the 12 pitch-classes {C CD D DE E F FG G GA A AB B } an associated consonant phoneme: {d b r ng m v sh z h l k t }

So I could sing a chromatic scale 'da ba ra nga ... etc'

My question is:  could I decouple the consonant from the vowel? So that the computer just gives the consonant as a cue?

'k', for example, would be easy: I can just 'k' into a microphone,  but others like 'ma' would be harder as it is a half vowel.

So, would there be any way to communicate "m" without suggesting pitch?

And for the less tricky consonants, like 'b',  how to separate the 'b'-ness from the 'a'-ness?  maybe I could sing 'ba' at 440Hz, and look at it on the frequency domain and just remove spectral components at 440, 880, 1320, ... ?

Or even better, I could take a slice half a second into the track which consist of pure 'aaa', convert it to the frequency domain,  and then take the beginning of the track and just subtract on the frequency domain.

Maybe I could even do this on the time domain?

Would this work with 'maaaa'?  I don't think so, I think for half-vowels I might need to follow Hilmar's answer to the linked question, and construct my own set of transients.

Maybe I could use a speech synthesiser to get my biphones 'da' 'ba' 'ra', and then work with that?

π


texts: Matched filter for variable time scaling?

texts:
Lets say I have some arbitrary waveform shape I want to look for. We'll use this as an example:

If my input is some mildly noisy signal, and I see something like this:

I can run that through a normalized matched filter and I should be able to easily identify this signal as my target waveform. However, lets say I see something like this:

Same general shape, but its at 1/2 the timescale. But I want to be able to detect this signal as well, and any other with the same shape but some unknown time scale(within some discrete limit).

I would like to be able to do this in real time, so simply decimating or interpolating the sampled date at different rates to see if that produces a match wouldn't be feasible. Is there any algorithm that could be used to quickly determine if any subset of my vector of samples contains a matching waveform to this target profile?


texts: Help in understanding MFCC (Mel-Frequency Cepstral Coefficients)

texts:
I've been trying to wrap my head around MFCC for a while now, and I have some questions.
My understanding is that MFCC is basically windowing, framing, and Fourier Transforming (STFT) the sound signal, and applying Mel filter bank to it, and log to it and doing Discrete Cosine Transform to get the MFCCs. I think these coefficients are supposed to help learn stuff about the sound, but I'm unclear on how it does that. They help us learn about the formants or something, but I'd like a more detailed answer. I have several questions. I guess questions 2 and 3 are sort of the same.

I know there will be orders of the coefficient, so what do lower coefficients tell us? What do higher coefficients tell us?
Why do we even use MFCC in the first place? What does it provide that a normal spectrogram couldn't?
How do you even use a cepstrum? I know the x-axis is quefrency, and I saw somewhere that used (sampling rate)/quefrency to find the frequency, but what does this tell us?
What does the Discrete Cosine Transform do? Why do we need it?

Please be detailed in answering me, because I've been to many websites trying to learn, but I'm still confused. Thank you.


texts: I am looking for a treatment of fundamental DSP theory where only discrete/finite signal models are used. To make a concrete example, every time standard textbooks write a convolution as a continuous integral, I would like to see instead a product between a Toeplitz matrix and a vector. It seems to me that developing such a theory from linear algebra would make implementing concrete DSP algorithm much easier. Think also of multirate/filter banks, etc... Except maybe for the book of Strang on Wavelets I have not seen any other book based this approach. Any book titles I have missed?


texts:
With zeros padding the FFT radix2 has different input size than output. How to deal with that? I see two solutions but not sure which one is better/appropriate. Maybe you know some other and better solutions?

Let me explain:

let’s sey I have signal buffer size 400, and I want to perform radix2 fft with zeros padding.
So the nearest $2^L$ is 512. So I need to add 112 zeros for each buffer.
Then in the fact the output buffer is 512. But I need 400, the same as input.

So first solution I see is to provide some FIFO algirithm for output signal.

And the second solution I see is to shrink my output from 512 to 400, and spread all 512 bins evenly on 400 bins. But then adjacent bins will partly overlap each other. So I need to avarage them in some way. HOW? And is it at all solution that would give me nice results, for example for pitch shifting?

For any help thanks in advance.


texts: Get problem to understand "Topological Structural Analysis of Digitized Binary Images by Border Following" Suzuki Abe

texts: I'm confuse with their explanation about definition 1 notation of 4- (8-) and 8- (4-) in Suzuki Abe paper "Topological Structural Analysis of Digitized Binary Images by Border Following" pg 34, and what they mean about NBD and LNBD in pg 35? Is NBD=neighborhood?


texts:
How can I design an all pass filter to have a constant phase shift over a bandwidth centered around a carrier?
I don't care about phase shift outside the band.
I would like to have the filter in time domain. This is not a straightforward job right?
Any keywords, design methods, external links are appreciated.

Edit: i need it to be causal. Data comes in real time in time frames.
thanks


texts: How to find the time instant where my sent signal and received signal can synchronize?

texts:
I am having two .wav files, one is modulated wave that is made into a .wav file and another is a recieved .wav file which is recorded from microphone while playing first modulated .wav file. So now that I have two .wav files, one sent and one received. I am trying to synchronize the two files so that I can find the exact time instant where my received file gets in sync with sent file.

I am using, received_wave = thinkdsp.read_wave(filename = '.wav')
to read the wave from file and modulated_wave.write(filename = '.wav') to write the wave into file. I am using Think DSP module in python for doing these.

So this received_wave and modulated_wave has two attributes ys and ts where ys is amplitude and ts is time stamps. I want to find the ts such that both wave will synchronize.

for this right now iam using crosscorrealtion of modulated wave(with sync bits) and recieved wave(having both sync bits and data that iam sending such a way that start sync bits then data bits then again end sync bits) so when i crosscorrelate start sync modulated wave(modulated wave using start sync bits only)and recieved wave i can find the value in crosscorrelation matrix where it is almost equal to the auto correlation of sync_wave.

is this approach correct? or shud i check for maximum value of crosscorrelated matrix then find the index ?


texts: Dimension of Matrix in MIMO with multi-path

texts:
In a MIMO system, the received signal is supposed to be $y = Hx + n$, where $H$ is the channel of dimension $N_t \times N_r$, $x$ is the transmitted signal with dimension of $N_t\times 1$ , and $n$ is the noise, finally the resulted signal $y$ represents the received signal of dimension of $N_r\times1$.

Assuming that I need to use channel $H$ as multi-path channel whose number of taps is $e.g.$ 5 .. The question is:

Will the dimension of channel $H$ will be $5N_t\times N_r$?
If so, how can we perform the matrix multiplication of $Hx$ in  $y = Hx + n$, so the received signal $y$ will be of dimension $5N_r\times1$?


texts:
I am new to signal processing, so I did a fourier transform on a frame of 200 samples with NFFT = 512 and then I took the absolute value :

I am trying to understand these values on the output, are these frequencies ?
I tried to plot them, here is the result :

Does it mean that my frame contains 60khz frequencies, I am a little confused about this output.


texts: What is leakage in frequency domain adaptive filters?

texts:
What does it mean by leakage in case of digital filters? My specific question is about the frequency domain adaptive filter function provided in the Matlab DSP toolkit, accessed as adaptfilt.fdaf. It has a parameter called LEAKAGE, but I am not sure what exactly does it represent or how it affects the filter response.
The filter created as h = adaptfilt.fdaf can be used as
[y, e] = filter(h, x, d)
which filters the data in x. Studying the source code of the filter function provided shows how leakage has been used, but the theory on which this filter function is based does not include the leakage component. What does it do and why is it there, if the paper on which this function is based does not have it?


texts:
I have this triangle wave as input:

and I want to derive a sine wave out of it. How do I go about it?

PS: I am doing this in Lua, so any piece of code close to that language would be appreciated.


texts: Argument of Dirac delta function is quadratic with complex roots

texts:
For example, we write $$\delta(at + b) = \frac{1}{|a|}\delta\left(t+\frac{b}{a}\right)$$
In a similar way, $$\delta(t^2 + t + 1)=\underline{\hspace{1cm}}$$

Thanks for the help.

Purna.


texts:
I suspect this is rather obvious once explained; I must be misunderstanding something.

From reading various answers here (such as this one), I understand that an LTI system must have zero output for zero input, which I think is equivalent to zero initial conditions or initial rest.  To quote @MattL from the answer I referenced,

  "This explains why a system with non-zero initial conditions can
  neither be linear nor time-invariant. A linear system must have a zero
  output for zero input"

In the textbook I am working through, one of the problems states "Find the response for the system described by the following difference equation with the initial conditions given", and the difference equation is as follows:

$$y[n]-0.7y[n-1]=u[n], y[-1]=-3$$

Here the input starts at $n=0$ yet $y[-1]=-3$.  The textbook is asking the question in the context of LTI systems.

At first I thought there was a mistake in the question, but I have seen similar setups in answers here on stackexchange as well.

How is the above scenario compatible with zero initial conditions?


texts: How does a matched filter know about input signal beforehand?

texts: I know that a matched filter at time t0 is just the input signal reversed in time about that time. But how does the filter know about input signal. Received signal is transmitted signal plus the noise and if filter already has knowledge about input signal then why is there any need of filtering? You already know the input signal!


texts:
I’m looking to use an FFT to generate a frequency spectrum in 1/3 octave bands. After reading many posts on this site as well as others, I believe the appropriate approach is set out below. I’ve dry-run the calculations in Excel and the results look reasonable, but reasonable is not necessarily correct.
To ask a specific question, is the method I’m using valid? In particular, I question if the method applied in Step 2 is correct.
Background.
I’m sampling the electric signal on the output of a pre-amp and my goal is a frequency spectrum in dB. My reference (denominator in the dB calc) is arbitrary and chosen to set an appropriate scale for the spectrum output display. I’m not attempting to take measurements from the output and don’t need to calibrate it against an objective reference. My project will be implemented in C++.
Step 1.
Start with a 1024 sample FFT at 48,000 Hz (513 bins at 46.9 Hz each). Result is the DFT, Fn for n = 0 – 512. Units are in V.
Note, normally, I’d normalize the FFT output by multiplying each bin by 2/N (N is number of samples, i.e. 1024). However, because we eventually plot the spectra in dB relative to an arbitrary amplitude, any normalizing I do here will be washed away when I compute the results in dB so I don’t bother with it in my project.
Step 2.
Convert the DFT into 1/3 octave bands.
I obtained the following formulas from here:
https://www.ap.com/technical-library/deriving-fractional-octave-spectra-from-the-fft-with-apx/
The amplitude in V for each 1/3 octave band is:

Where Lb is the amplitude for each 1/3 octave band in V, for b = 1 to 32, and gn,b is the gain multiplier for FFT bin n and 1/3 octave band b:

Where fn is the frequency of bin n and fb is the center frequency of band b. k is the octave bandwidth designator, 1 for full octave and 3 for 1/3 octave.
Result is Lb for b = 1 to 32 in V.
Step 3.
Disregard lower bands.
Below about 250 Hz, for an FFT of length 1024, there are not enough FFT bins within each band to make the results meaningful. Therefore, we disregard the lower bands and keep only the 1/3 octave bands starting with b13 = 251 Hz.
Step 4.
Convert the amplitude data in each band to dB.
For this computation, I’m computing the dB value relative to the approximate maximum amplitude likely to appear in any frequency band. This will be Lref.
Final value in dB for each 1/3 octave frequency band above 250 Hz is:

Below is a sample of individual gn,b terms (FFT bins down the left, 1/3 octave bands across the top):

Assistance, input, corrections and comments appreciated.
Thanks!


texts: OFDM synchronization using training symbols

texts:
In OFDM receivers, special OFDM training symbols for which the data content is known, can be used to perform the synchronization process. A correlation operation is performed between the received signal and the training symbols. From the correlation peaks, both symbol timing and frequency offset can be determined. I have two equestions.

Practically, how these OFDM symbols are generated at the receiver?
If these reference symbols are sufficient for both symbol tiiming and frequency offset determination, why differential detection is often employed?
The information bits are modulatedon the subcarriers by differential QPSK. The reference phase and amplitude of each subcarrier have to be known in order to estimate the bits correctly. For this purpose differential detection is used.


texts:
I was studying an article about optical music recognition. Somewhere in segmentation section is mentioned that

  The final step consists of isolating the note heads. This is performed by using a double threshold mechanism to obtain the results shown in Figure.

I couldn't find anything on the internet that explain what does "double threshold mechanism" means. I guess it is a very basic question. I hope someone guides me.


texts: Derivative with respect to complex conjugate

texts:
I have a real function $C$ of a complex vector $x$. While taking the gradient of the function $C$ for minimising the same, why do we take the derivatives with respect to the complex conjugate of $x$, i.e. $\bar{x}$ and not the actual vector $x$?

I have tried looking up for help but I am directed again and again to  Cauchy–Riemann equations, which I know is not pertinent here.


texts: I designed an algorithm for MRI data denoising which has good properties under heavy Rician noise (sigma is greater than 80). The method was tested on some phantoms and Rician noise generators. Now I want to test the algorithm on real MRI data. In the MRI data, which I have, the noise level is low. Is it methodologically correct adding noise to a real MR image to increase its level based on Rician noise generator?


texts:
I have read the paper A Fast Power Grid Frequency Estimation Approach Using Frequency Shift Filtering.
I want to prove it using a numerical example, I have problem how to calculate the hp(n) values,
Let's suppose that I have a sample signal which I have sampled with an ADC and for simplicity I will use Matlab to make the signal. (the signal has a 50.1HZ frequency) and I want to estimate it with this paper approach,
fs = 12800;                    % Sampling frequency (samples per second)
dt = 1/fs;                   % seconds per sample
StopTime = 0.02;             % 20 mili seconds or a 1 full cycle of 50Hz AC
t = (0:dt:StopTime-dt)';     % seconds
F = 50.1;                    % Sine wave frequency (hertz)
X = sin(2*pi*F*t);           % Generate sine wave

Now How should I calculate the hp(n) values using MATLAB?
Finally I should convolve the result with this sample sin wave to get 50.1 Hz estimation.


texts:
I would like to resample (downsample) a signal using python in order to get an even spacing and fill gaps.
About the signal:

It consists of a vector for y (amplitude) and x (timestamps)
Very slow; $F_s$ is probably >100 times higher than needed (for the desired content; steps and noise are present)
The samples aren't exactly equally spaced
The signal has gaps with missing samples
The signal is not periodic (FFT resampling should be fine though, I can trim off beginning and end)
It doesn't really matter how the gaps are filled, a linear interpolation would do

In matlab could likely just use y = resample(x,tx,fs) , however, scipy.signal.resample() can take a vector for x but still doesn't work for signals with non-uniform spacing.
It is probably a bad idea to use scipy.interpolate.interp1d() for filling gaps and downsampling in one step because of aliasing. Filtering before interpolating is likely not a good idea either, since the discrete filters wouldn't work with a non-uniform spacing of the samples.
Should I first interpolate() to the approximate sample frequency and then downsample using resample()?


texts: In OQAM modulation, why does the up-sampling process be seperated into two parts?

texts: The OQAM modulation is implemented by up-sampling the symbols by two and delaying the imaginary part of each sub-channel by half a symbol. The signals are up-sampled by M/2 and convolved with the impulse response of the pulse shaping filter u[n].Why should this process being separated into two parts?


texts: Image Restoration by Solving Constrained Least squares in Frequency Domain (Frequency Domain Filtering)

texts:
I am trying to implement the constrained least squares filtering as described in Rafael C. Gonzalez, Richard E. Woods - Digital Image Processing 3rd Edition Section 5.9. The equation (5.9-4) says that $ P \left( u, v \right) $ is the Fourier transformation of the Laplacian filter ($ 3 x 3 $). But the coordinates $u$, $v$ are the coordinates of the image which is much greater than 3x3.
How can I implement this 2D Filter in Frequency Domain?


texts:
I understand that the question I am asking seem the be somewhat related to another question which has been asked already.

But I feel that this is an entirely different question.

I have a huge (over 100K data points) time series data of the position (x, y coordinates) of an element in space. This element is vibrating randomly, and both amplitude and the frequency of vibration is random. I want to look at the vibrations which are similar and see if there is any pattern in those vibrations, are they periodic or related somehow.

I am working on a biological problem and have very little knowledge about signal processing. I can provide more details Any help would be really appreciated.

Thanks in advance!!


texts: Benefits of oversampling in a realtime noise-cancellation system

texts:
When sampling a signal, it is standard practice to use a sampling rate that is greater than two times the bandwidth of the signal in order to avoid aliasing. The result is then low-pass filtered (and sometimes upsampled prior to this) in order to get rid of the harmonics.

Unfortunately, in control systems applications preventing aliasing in not enough. The system also needs to respond quickly enough to the input (as determined by a spec), and a low sampling rate will limit this performance. Specifically, if the system samples a signal at time t, then any event that occurs immediately afterwards will be ignored until one sampling period later.  Thus, there are clear performance advantages to having a sampling rate much greater than two times the signal bandwidth. I'm looking to quantify this performance improvement.

Consider an open-loop control system that attempts to cancel out an incoming signal by outputting an inverted version of this same signal. In other words, active compensation through destructive interference. If the system has infinite magnitude resolution (both the ADC and DAC have infinite bits) and an infinite sampling time, then the inverted output signal will be a perfect inverse of the original and the signals will cancel out completely. But if the system has a finite sampling rate, then the output signal will not be a perfect inverse of the original and the two will not cancel completely. The lower the sampling rate, the worse the cancellation will be (even if no aliasing occurs).

Q: Assuming the following:

The input signal is a  sinusoid of frequency $f_0$ and magnitude $A$
The system has an ADC with a sampling rate of $f_s$ where $f_s > 2 f_0$
The system uses sample-and-hold (ZOH) interpolation to output an inverted sinusoid and add it to the original signal
The system has zero time delay between an ADC sample and the corresponding DAC output (ADC settling time, DSP calculations, etc. are instantaneous)

How do I calculate the frequency and magnitude of the resulting frequency components?


texts: 3 Band Crossover with Linkwitz Riley Filter

texts:
I would like to write a 3 Band "EQ" with BiQuad Filters but for some reason, I get some phase distortion.

The problem already got discussed here.

I found out that I need to work with Allpass filters in order to compensate the phase response of my filters. Btw, the filters are Linkwitz-Riley 2nd order filters.

But when I try to copy the idea to my project, I still have some distortion.

// low pass calcuation for linkwitz riley filters

float lowCutoff; // the lower cutoff frequency
float highCutoff; // the higher cutoff frequency

double omega = M_PI * cutoffFrequency;
double theta = omega / sampleRate;
double kappa = omega / tan(theta);
double delta = kappa * kappa + omega * omega + 2.0 * kappa * omega;

double a0 = (omega * omega) / delta;
double a1 = 2.0 * a0;
double a2 = a0;

double b1 = (-2.0 * kappa * kappa + 2.0 * omega * omega) / delta;
double b2 = (-2.0 * kappa * omega + kappa * kappa + omega * omega) / delta;

// high pass, only the calculation of a0 to b2 changes
// the intermediate values stay the same

double a0 = (kappa * kappa) / delta;
double a1 = -2.0 * a0;
double a2 = a0;

double b1 = (-2.0 * kappa * kappa + 2.0 * omega * omega) / delta;
double b2 = (-2.0 * kappa * omega + kappa * kappa + omega * omega) / delta;

// allpass filter to compensate phase response:

double q = 0.5;
double alpha = (tan(M_PI*q/sampleRate) - 1) / (tan(M_PI*0.5/sampleRate) + 1);
double beta =   -cos(lowCutoff  * M_PI / sampleRate);

double a0 = -alpha;
double a1 = beta*(1.0 - alpha);
double a2 = 1.0;
double b1 = beta*(1.0 - alpha);;
double b2 = -alpha;;

Since I use 2nd order filters, I also have to use a 2nd order all pass filter, right?
I've read that for those filters and with this calculation, I hav to use q. So q should be the same as the q in the Linkwitz-Riley filter, which should be 0.5 right? (I've read this somewhere, not sure about it.)

Then, my actual processing looks something like this:

// filter names:
// loAPF, lowHPF, ... low: lower cutoffhigh: higher cutoff
// APF: allpass, HPF: highpass, LPF: lowpass

highSample =  lowAPF->tick(highHPF->tick(sample));
midSample =   lowHPF->tick(highLPF->tick(sample));
lowSample =   lowLPF->tick(highLPF->tick(sample));

Does somebody have any idea, why I might have problems with the phase response?

Thanks in advance!


texts: What is the use of quasi logarithmic frequency distribution in multisine frequency signal in finding FFT

texts:
I'm using multisine but recommended to use quasi log frequency distribution to find out FFT.
What is the advantage of using this?


texts: Detecting Central Axis (petiole/rachis) of a Pinnated Palm

texts:
I'm new in StackExchange and I'd appreciate some help. I'm working in an algorithm for detecting "aguajes", a particular kind of palm. So far, I got good results using a texture feature extractor and other characteristics, but the main problem is that I can't difference between an "aguaje" and other palms (mainly pinnated palms) because the texture is very similar.

1.AGUAJE

2.Pinnated Palm

I see that the main difference in the second one is the presence of a Central Axis (also called Petiole or Rachis). The question is "How to detect it?". I mean, if I'm able to detect the presence of a Petiole, I'd be able to distinguish between this two types of palm. I think color is not an important issue because even when there's no color (gray image), we can discern where is located that Axis.

Thanks in advance.


texts: How to understand the de-correlation property of DCT? What does de-correlation mean?

texts:
Here are three problems that I can't understand:

Usually what does de-correlation mean in image-processing?
What's the benefit of de-correlation when it comes to image splicing?
Is there some relationship among neighbouring coefficients? And I read a paper which says coefficients difference matrix(got by coefficients subtracting its neighbor) can eliminate the relationship of the coefficients，How to understand this?

I would really appreciate if someone can help me!


texts: I would like to implement Lattice IIR filter in c, i can't defined the value of gN, i know that x(n) = fN(n), but how to initialize gN ?. you can find the algorithm here : n


texts: How do impulse response guitar amp simulators work?

texts:
I am wondering how impulse response guitar amp simulators/modelers work. I thought it was a matter of convolving a signal of recorded impulse response in time-space with a guitar sample.

I tried to do this with Matlab using conv function. I loaded an example impulse response and recording of a guitar sample and the result was just a badly distorted sound.

I read that using normal convolution will not work and the response of the amp is dynamic and differs based on the input signal amplitude.

I have found this question: Dynamic convolution vs Volterra series, but I do not quite understand how I would apply this to my case and if this even is the right direction.

I am EE student and know a bit about DSP, but we only dealt with basic signal convolutions so I am quite lost on what to try, but I am really curious on how all this works.


texts:
This was a past year paper question. Not sure how to answer it.

Question: The 1-D discrete cosine transform(DCT) of a sequence f(x), x =0,1,...,N-1 is

F(u) = c(u)* Summation of f(x) cos ( (2x+1)u*pi/2N)

show that 1-D DCT of the sequence

g(x) = f(N-1-x), x = 0,1,...,N-1

can be expressed as G(u) = (-1)*F(u), u=0,1..., N-1

My solution (If wrong please correct me)

G(u) = c(u)* Summation of f(N-1-x) cos ((2(N-1-x)+1)u*pi/2N)
     = c(u)* Summation of f(N-1-x) cos (2N-2x-1)u*pi/2N)


texts: How to estimate noise by eigendecomposition of the variance covariance matrix?

texts:
I'm new here so I will try to be as clear as possible.
I am trying to apply some techniques from signal processing framework to denoise financial time series.

I would like to know if what I am trying to do makes sense or if I am committing some theoretical mistake;

I have a time series that I assume to be composed by two sources (non observable), one a genuine signal while the other is just white noise.
$$Y(t)=X(t)+e(t)$$

I also assume that the white noise is additive and is uncorrelated with the signal. From here what I am planning to do is to apply the STFT to the observable data.

For every frequency I construct a Hankel matrix (a sort of trajectory matrix for the Fourier coefficients).
Then I obtain the variance-covariance matrix by multiplying the Hankel matrix by its hermitanian.

Here is where things become confusing:
I want to make the eigenvector decomposition of this matrix, such that I'll get something like:

$$U(\Lambda+\sigma^2I)U'\,\text,$$
assuming that the error term is white noise, and there is no overlap between windows, and $\Lambda$ being the diagonal matrix containing the eigenvalues of $X$ on its diagonal.

If I further assume that the signal $X$ has a smaller dimension, i.e. has some 0 eigenvalues I could estimate $\sigma^2$ (PSD of the noise term) for this given frequency.

Is there any way to obtain the signal $X$ from here?

I don't really know if what I'm doing is ok or not, and I would really appreciate if you could give me some insights.


texts: Difficulty regarding grasping concept of fft butterfly?

texts:
The  term "butterfly " is often used in association with fft texts
But what exactly is a butterfly
?a matrix/group of i/o's is known as butterfly? Such as 2 input 2 output butterflies in stage 1 of attached photo
How we can differentiate between butterflies of stage 1 and stage 2?other than number of i/o's?


texts: How can I test an implementation of DFT for correctness?

texts:
A friend of mine implemented a DFT algorithm for a project we're working on, and we're not quite sure how to test whether or not its correct. We're only in the eleventh grade, so we have very little experience in Fourier Analysis.

I remembered reading somewhere that the Fourier transform of the square wave function was the sinc function, so we thought that if the output of the program was the sinc function then the implementation was correct, but we quickly realized it wouldn't be that simple. Below is a picture of what the program outputs (blue is DFT scaled logarithmically to be in decibels):

!

Below is essentially the same as above only with lines instead of a solid fill:

!

Hmm, well that doesn't look anything like the sinc function. After looking at the code, I realized it was actually a plot of $\sqrt{r^2 + i^2}$ where $r$ and $i$ are the real and imaginary parts of the DFT respectively. So now I'm out of ideas as to how to test the validity of this program.

Does the output look correct? What other tests can we perform to verify the implementation?


texts: Problem with implementing DC offset for streaming data

texts:
I am new to the DSP world. I'm trying to run a raw input signal through a LPF, remove any DC offset, amplify the signal, and then decode the signal. The problem with my code seems to be the implementation of my DC offset technique. I believe it's best to remove any DC values before amp'ing a signal, but after I run my code, I get chunks of data that are 'stitched' together poorly.
Here is my original input signal:

I receive this signal in windows/chunks of streaming data. I then run each chunk through a LPF. To keep the LPF output near zero on the x-axis (for amplification purposes) I perform a DC offset by taking the mean value of each chunk of data and subtracting that value from each sample in that particular chunk. Below you can see the result of this. The blue line is the output from the LPF; the orange line is the output from the LPF and after the DC offset has been performed.

During very large amplitude transitions, like the portion of the LPF output signal (blue line) that has the large negative slope to it, you'd expect the DC offset to skew the continuity of the signal greatly (as seen in the large saw-tooth portion of the orange signal). After the input signal amplitude seems to level out, though, the hope would be that the DC offset would not introduce such drastic transitions, even at small values/levels. But when you zoom in on the orange line, you see that abrupt transitions (circled below) occur between chunks of data still. These are perfectly vertical lines connecting the chunks of data. These abrupt changes make it basically impossible to decode any information from the signal once this signal is amplified.

Assuming that the only way to decode this signal is to get rid of these abrupt changes or at least smooth them out, how do I properly implement a DC offset? I've seen a few solutions but I'm not sure if they are correct or proper. Is my solution the best, or should I perform the offset based off of a buffer of old data chunk mean values, or should I run the data over a high-pass filter, or should I find a best fit line over several sample chunks and detrend the signal based off of the best fit line? What is the de facto/professional way of doing this?
Thanks for any help. My (cleaned up) code is below for reference.
import numpy as np

class <generic>:

    def handle_new_data(self, floatdata):

        # Turn into a numpy array
        self.audio_buf_data = np.array(floatdata[0, :][:])

        # Create timestamps for data samples
        t = np.arange(self.audio_buf_data.size) / SAMPLING_RATE  # time axis

        # Convert data to 16-bit
        int16_data = self.audio_buf_data * 32768

        ########## ENVELOPE DETECTION / AM Demod ###########

        # Cut signal in half (analog diode equivalent)
        abs_signal = np.abs(int16_data[:])

        # LPF
        amplitude_envelope = self.butter_worth(abs_signal)

        # Remove DC offset from LPF signal (Keep signal around x-axis so that amplifying signal gives max effect)
        amplitude_envelope = amplitude_envelope - (amplitude_envelope.max() - ((amplitude_envelope.max() - amplitude_envelope.min()) / 2))

        # Amplify LPF output without clipping signal
        amplified_signal = amplitude_envelope * (32768 * 0.99 / amplitude_envelope.max())

        # decode signal to get data
        decode_func(amplified_signal)


texts: Possibility of temporal super resolution

texts: I've been reading some papers in the context of super resolution in imaging and video (for example works by Michal Irani [1], [2] and so forth), and was wondering if a similar idea can be applied with improving the temporal resolution of waveforms. In other words, if there are multiple recorders that are deterministically delayed from one another, will I be able to super-resolve in time a waveform? was this done?


texts: The asymptotic phase behavior of an RHP zero is from 0 degrees to -90°, the mirror of an LHP zero. Graphically, I'm confused about why this is the case and the phase is not from +180° to +90°. See the below image for my reasoning/confusion. Is the angle definition not consistent?


texts:
Suppose we have this signal from this wiki page

$a(t)=\sin(\varphi_o + f_0t + (f_1-f_0)t^2/T)$

The article tells that T is a period of chirp modulation in which frequency changes. So my question is how to create signal with constant $f_1$ frequency after T?


texts: How to show the time history of a signal down-sampled ? under the rate of 25Hz & 40Hz and find its DFT analysis?

texts:
How to show the time history of a signal down-sampled under the rates of 25Hz & 40Hz and find its DFT analysis using Matlab ? The sample signal is in a data file (sensor_data.mat) its sampling rate is 1000Hz.

I can get the time history and the DFT analysis of the signal.

Fs = 1000; % sampling rate
T=1/Fs; % sample time
L= 20000; % lenght of signal
t=(0:L-1)*T; % time vector
figure(1)
plot(t,u)
grid;
title('Time History of the Signal')
% dft analysis
yf=fft(u);
w=[0:2*pi/L:(L-1)*2*pi/L];
figure(2)
plot(w/(2*pi*T),abs(yf))
grid
title('DFT analysis of the signal sampled at 1000Hz')

But how do I down-sample it ? I know Matlab has a function for it (downsample), but I'm not getting any correct answers.

Also how do I find the signals frequency range and amplitude over its frequency range from the DFT analysis ?

Thanks in advance, Please help !!


texts: Do filters work on a "per sample basis"?

texts:
I'm confused because of filter length, whether (such) filters can be used to filter audio on a "per sample basis"?

By per sample basis I mean that I would like to filter audio one sample at a time, but vary the filter parameters even one sample at a time.

What then confuses me is, can the filter have any effect if only one sample is input to it? Or whether the filter needs a longer sample (e.g. that matches the filter length)?

Since the filter type seems crucial, I'm specifically interested in the Parks-Mccellan FIR and the context is dynamic equalization (in which it seems like the parameters such as gain would need to be varied on a close to per sample basis). I.e. I'm interested in whether the PM algorithm can be utilized for dynamic equalization in such way that one recomputes the PM between some samples and then filters those samples, i.e. in a block-like fashion.


texts: Is the decimation process time invariant?

texts:
I'm stuck at exercise 1.18 in Understanding Digital Signal Processing by Richard G. Lyons:

  There is an often-used process in DSP called decimation, and in that process we retain some samples of an $x(n)$ input sequence and discard other $x(n)$ samples. Decimation by a factor of two can be described algebraically by
  $$y(m) = x(2n) \tag{P1-3}$$
  where index $m = 0,1,2,3,. . .$ The decimation defined by Eq.
  (P1-3) means that $y(m)$ is equal to alternate samples (every other
  sample) of $x(n)$. For example: $y(0) = x(0)$, $y(1) = x(2)$, $y(2) = x(4)$,
  $y(3) = x(6)$, $. . .$ and so on. Here is the question: Is that decimation
  process time invariant?

  Illustrate your answer by decimating a simple sinusoidal $x(n)$ time-domain sequence by a factor of two to obtain
  $y(m)$. Next,create a shifted-by-one-sample version of $x(n)$ and call it
  $x_{shift}(n)$. That new sequence is defined by (P1-4):

  $$x_{shift}(n) = x(n+1) \tag{P1-4}$$
  Finally, decimate $x_{shift}(n)$ according to Eq. (P1-3) to obtain $y_{shift}(m)$. The decimation process is
  time invariant if $y_{shift}(m)$ is equal to a time-shifted version of $y(m)$. That is, decimation is time invariant if
  $$y_{shift}(m) = y(m+1)$$

I'm somewhat confused by the notation $y(m) = x(2n)$--according to the definition of the decimation, I would hve written $y(n) = x(2n)$. Anyway, if I try to resolve the problem as it is stated:

"Illustrate your answer by decimating a simple sinusoidal () time-domain sequence by a factor of two to obtain ()"

Let say $x(n)=sin(\omega n) \text{ with } \omega=2\pi f_0 t_s$
$\implies y(m) = x(2n)=sin(2\omega n)$
"create a shifted-by-one-sample version of $x(n)$ and call it $x_{shift}(n)$"

$x_{shift}(n) = x(n+1) = sin(\omega n+\omega)$
"decimate $x_{shift}(n)$ according to Eq. (P1-3) to obtain $y_{shift}(m)$"

$y_{shift}(m) = x_{shift}(2n) = x(2n+1) = sin(2\omega n +\omega)$
"That is, decimation is time invariant if $y_{shift}(m) = y(m+1)$"

$y(m+1) = x(\text{???})$

Eq (P1-3) doesn't really give a relation between $m$ and $n$. So what is $m+1$? According to the decimation definition given in the exercice, I would be tempted to say that $m+1=2n+2$. But that leads to $y(m+1)=sin(2\omega n +
2\omega) \neq y_{shift}(m)$

Could you pinpoint my mistake or clarify my misunderstanding in this exercise?


texts: Why does Pre-warping work with a notch filter but not a low pass filter?

texts:
Hey guys a little bit of a continuation from a previous post I made here, I found the solution as why the pre-warping was not working at the time,
However I was just playing around and found out pre warpings were working with notch filters pretty good oppose to the low pass filters, now I am more then confused. I wonder if anyone can explain this to me?
Ill give two case sceneries where the Critical frequency is close to and not close to the Nyquist frequencies.
Diagrams
Test 1:

Critical Frequency = 40kHz
Sampling Frequency = 96kHz
Ratio = 40kHz/48kHz = 83.33% pretty close.

Test 2:

Critical Frequency = 20kHz
Sampling Frequency = 96kHz
Ratio = 20kHz/48kHz = 42% halfish close.

Test 3:

Critical Frequency = 10kHz
Sampling Frequency = 96kHz
Ratio = 10kHz/48kHz = 21% closeish.

What the heck is going on, Why is it working for notch and not a low pass?!


texts: Beginner level confusion regarding symbols used in modulation

texts:
For 4-QAM symbol sequence, each symbol can be represented by $k=\log_2(4) = 2$ bits. 4-QAM constellation can be generated using s = round(rand(1,T)*2 -1)
For 16-QAM, the symbol sequence takes 4 amplitude levels viz. $\{-3,-1,+1,+3\}$. Each symbol is represented by  $k=\log_2(16) = 4$ bits.
For 64-QAM, the symbol sequence takes 8 amplitude levels viz. $\{-7,-5,-3,-1,+1,+3,+5,+7\}$. Each symbol is represented by  $k=\log_2(64) = 6$ bits. 64-QAM constellation can be generated using : s = randi(8,1,T)*2 -9) +j*randi(8,1,T)*2 -9)) / sqrt(42)

Question: In general, for M-QAM modulation, what is the relation between $M$ and the type of symbols and the number of symbols. For ex: 64-QAM, why do we need 8 amplitude levels and why these symbols?

Please correct me where wrong.


texts: Intuition behind commutativity of convolution in LTI systems

texts:
Why is convolution commutative, as it seems to treat two signals in a different way in an LTI system?

If you imagine $y[n] = x[n] \star h[n]$ with $x[n]$ being an input signal and $h[n]$ being the impulse response of an LTI system A, how does it make sense that LTI system B with input $h[n]$ and impulse response $x[n]$ generates the exact same output $y[n]$ ?


texts: How to choose pilot symbols count in OFDM?

texts:
I am from an Instrumentation background and recently have been working on an OFDM project. With my research, I was unable to find the solution to the below question.

How to choose the Pilot Carriers/pilot symbols? Suppose from one example which I am referring they have chosen pilot carriers as 8 counts for the  Subcarrier count of 64 and with Cyclic prefix is 16. and in the second example pilot carriers = 346 for the subcarrier count = 224 with CP = 16. I am really confused about how to choose the pilot count?


texts:
I am a junior high school student who has a general fascination for electronics, programming, and the like. Recently, I have been learning about signal processing.

Unfortunately, I haven't done much calculus yet (forgive me), so I am a little fuzzy on things.

If you were to compute the DTFT of a signal, what would be the difference between a $\sin$ or $\cos$ representation of that signal?
With the DTFT I understand that the signal you input would be discrete in time, but how in the world can you achieve a continuous signal in the frequency domain?
This leads to my second question, which is: how is the DTFT useful? Where has it been used with most applications and why?

I would appreciate any help.


texts:
I was reading the chapter on discrete Fourier transforms in Lyons' book -- Understanding Digital Signal Processing -- and could not understand the last paragraph about symmetry.

  There’s an additional symmetry property of the DFT that deserves mention at this point. In practice, we’re occasionally required to determine the DFT of real input functions where the input index $n$ is defined over both positive and negative values. If that real input function is even, then $X(m)$ is always real and even; that is, if the real $x(n) = x(−n)$, then, $X_{\textrm{real}}(m)$ is in general nonzero and $X_{\textrm{imag}}(m)$ is zero. Conversely, if the real input function is odd, $x(n) = −x(−n)$, then $X_{\textrm{real}}(m)$ is always zero and $X_{\textrm{imag}}(m)$ is, in general, nonzero.

Note: $X(m) = X_{\textrm{real}}(m) + jX_{\textrm{imag}}(m)$

Firstly, what is meant by "odd" and "even"? I suspect it's the number of samples in the input signal, but that leads me to my second question,
Why is $X_{\textrm{imag}}(m)$ zero with real input functions that are even, and why, with real input functions that are odd, is $X_{\textrm{real}}(m)$ zero and $X_{\textrm{imag}}(m)$ generally non-zero?


texts: How to produce pencil-like images by pure image processing methods?

texts:
Is it possible to reproduce the following pencil-like image by pure image processing?

Notes:

The original image: Fig 10 in paper http://www.cs.columbia.edu/cg/aircode/aircode-uist-2017-li-et-al.pdf
The pencil image: https://youtu.be/AeO4ydc8yqY?t=1m16s


texts: Clarification on eigenfunction property from Oppenheim's Discrete-time signal processing, 3rd ed

texts:
Could anybody explain what is meant  by the following statement on page 50 of Oppenheim and Schafer's book Discrete-Time Signal Processing (third edition)?

The eigenfunction property of complex exponentials depends on stability
of the system, since at finite $n$, the transient response must have become zero, so that we only see the steady-state response $H(e^{j\omega})e^{j\omega n}$ for all finite $n$.


texts:
When we implement the 1D-short time fourier transform, the formula is as such:

$$
Sf[m,l]=\sum_{n=0}^{N-1}f[n]g[n-m]\exp\left(\frac{-i2\pi l n}{N}\right).
$$

the window $g$ used is normally symmetric, why is this so? (Hint: Use the phase of Short time fourier transform.


texts: how much of DSP (digital signal processing) is related VLSI?

texts:
Although,this question may not be very much related to the topic of discussion, but i just wanted to know how much of DSP (digital signal processing) is used in VLSI. Like in the industry or for the sake of knowledge, which all topics share common between the two Domains?
PS:I know this may be off topic, but still thought that I could get answers from knowledegeable people on this platform.


texts: Matlab video processing of Contracting tissues. how to analyze movement?

texts:
I'm trying to write a code The helps me in my biology work.
Concept of code is to analyze a video file of contracting cells in a tissue

Example 1

Example 2: youtube.com/watch?v=uG_WOdGw6Rk

And plot out the following:

Count of beats per min.
Strenght of Beat
Regularity of beating

And so i wrote a Matlab code that would loop through a video and compare each frame vs the one that follow it, and see if there was any changes in frames and plot these changes on a curve.

Example of My code Results

Core of Current code i wrote:

for i=2:totalframes
        compared=read(vidObj,i);
        ref=rgb2gray(compared);%% convert to gray
        level=graythresh(ref);%% calculate threshold
        compared=im2bw(compared,level);%% convert to binary
        differ=sum(sum(imabsdiff(vid,compared))); %% get sum of difference between 2 frames
        if (differ ~=0) && (any(amp==differ)==0) %%0 is = no change happened so i dont wana record that !
            amp(end+1)=differ;  % save difference to array amp wi
            time(end+1)=i/framerate; %save to time array with sec's, used another array so i can filter both later.
            vid=compared; %% save current frame as refrence to compare the next frame against.
        end
end
figure,plot(amp,time);

=====================

So thats my code, but is there a way i can improve it so i can get better results ?

because i get fealing that imabsdiff is not exactly what i should use because my video contain alot of noise and that affect my results alot, and i think all my amp data is actually faked !

Also i actually can only extract beating rate out of this, by counting peaks, but how can i improve my code to be able to get all required data out of it ??

thanks also really appreciate your help, this is a small portion of code, if u need more info please let me know.
thanks


texts: Is it possible to use MRC with DS-CDMA-MIMO

texts:
I'm wondering how to use the Maximum Ratio Combining with MIMO-DS-CDMA, I have used the MIMO with DS-CDMA using Walsh code, then at receiver I couldn't recover the transmit signal using the MRC.  here what what I did:

x = [0.7+0.7i; 0.7-0.7i; 0.7i+0.7i; -0.7+0.7i];    %generate signal x size 4x1
h = (randn(4,4) + 1j.*randn(4,4))/sqrt(2);      %Generate 4x4 channel
code = hadamard(4)                                  %generate walsh code
x_s = kron(x,cod(:,1))                              %spread the signal x with one walsh code
r = reshape(h*reshape(x_s,4,[]),[],1);              % the received signal with AWGN

suppose I have perfect knowledge channel at receiver side, it means h is known.  how can I use MRC for r in order to recover the transmitted signal? Is that possible?

thank you


texts:
I was given a WSS ergodic process $x(t)$ with power spectrum :

$$
\begin{array}{rcl}
       G_x(f) &=&1−\left|\frac{f}{B}\right| &\mbox{for } |f|<B\\
       G_x(f) &=& 0 & \mbox{ elsewhere}
\end{array}
$$
and first order probability density function is uniform in the range $[−A, A]$.
How do I evaluate $A$?

It's not a home work but it was a question asked in my exam which I failed.
Any help will be appreciated.


texts: SineWave generation and BandPass filter : Audio

texts: Can any one suggest me a Bandpass filter in java which I would like to apply on generated sine wave of a particular frequency


texts:
I am having some trouble understanding the sampling time and frequency used in the computing of the FFT, and I was wondering if someone could make it clear for me :

The Sampling time: the time in which I took my sample for example 5 minutes, its the difference between the time at which i started taking measures and the time when I was done.
The sampling rate: how many samples do I save per second, which means if I took $N$ sample within $13\textrm{ s}$, my Sampling rate will be $f_s=N/13$.

Is this sampling rate the same as the frequency used when calculating the FFT when creating the frequency axis of the FFT?


texts: Signal processing for undersampled signal

texts:
I have got a set of pressure data from a boiler which has been sampled at 45Hz and I need to extract a frequency component of 250Hz from the signal. Using a standard FFT method doesn't display anything apart from frequency components between 0 and 10Hz.

I have read similar questions posted on the forum with no success in solving my problem.

%Matlab code

filename = 'boilerp.xlsx';
columnA = xlsread(filename,'A:A');

Fs =45;

L=length(columnA);

nfft = 2^nextpow2(L);

XT = fft(columnA, nfft)/L;

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

plot(f, 2*abs(XT(1:nfft/2+1)))

Many thanks,

Khel


texts: Do all real-time filters introduce phase lag, or can there be such a thing as "lag-less" or "zero lag" real time filters?

texts:
Do all real-time filters introduce phase lag? I once heard of "lagless filters", but I don't think they can be used real-time (ie: on live data streaming in for a control system, for example, operating on incoming data), correct?

Obviously even though this question could be simply answered in a binary "yes/no" fashion, expounding upon the answer will be very helpful.

Update:

I just added some links in the comments below this question.

Also, here's some brief comments from a couple controls experts I know:

Kenny Jensen:
"Forward-backward filters, aka smoothers, have no lag. You can't run them online though."

Ed Lim: "Hence they are not "real-time" filters. So I believe the answer is yes regarding real-time filters."


texts:
I have signal, periodic with amplitude 10 with frequency about 10 kHz. It is hidden in Gaussian noise with standard deviation 100. Some idea how to extract periodic signal?
Thanks in advance.


texts: PSD (Power spectral density) explanation

texts:
I'm trying to understand how the PSD is calculated.  I've looked in a few of my Communication Engineering textbooks but to no avail.  I've also looked online.  Wikipedia seems to have the best explanation; however, I get lost at the part where they decide to make the CDF (Cumulative Distrubution Function) and then for some reason decide to related that to the autocorrelation function.

I guess what I don't understand is, how does autocorrelation having anything to do with calculating the PSD?  I would've thought that the PSD simple be the Fourier Transform of $P(t)$ (where $P(t)$ is the power of the signal with respect to time).


texts: Intuitive explanation of cross-correlation in frequency domain

texts:
According to the cross-correlation theorem : the cross-correlation between two signals is equal to the product of fourier transform of one signal multiplied by complex conjugate of fourier transform of another signal. After doing this, when we take the ifft of the product signal, we get a peak which indicates the shift between two signals.

I am not able to understand how this works? Why would i get a peak which indicates the shift between two signals. I got the math from : http://mathworld.wolfram.com/Cross-CorrelationTheorem.html
but i am not able to understand as to what this means intuitatively. Can somebody please provide some explanation or point me to the right documents?

Thanks!


texts:
In ~2006 the FAST corner detector was introduced. One of it characteristics is that you have to train a decision tree from some test image in order to learn the types of corners present and relevant in the test image. One of the consequences is that the images in which you will be applying the detector have to be somewhat similar in relation to the pose (perspective), global illumination, etc. to the test image used in the training phase.

Feature descriptors such as BRIEF and ORB make use of FAST or a modified version of FAST in their reference papers.

Then, in ~2010 the AGAST corner detection was proposed to address this issue. According to the authors, you should not have to retrain the detector on a test image (but you may if you really want to or think this is really necessary).

Then feature descriptors such as BRISK and FREAK showed up, using a modified version of AGAST in their reference papers.

My question is: Since AGAST is an evolution of FAST aimed at solving some of its issues, should someone simply use AGAST from now on when building a detection application? (I am not speaking of doing pure research on the topic of detectors)

Is there some paper proving or at least showing convincingly that you should now use AGAST? I know I could simply test them both every time I build a detection application, but honestly, if there is a relatively good point I should use AGAST, it would be time saving.


texts: Fourier transform of discrete time unit step function

texts:
To obtain fourier transform of u[n],
u[n] - u[n-1] = delta[n] , taking fourier transform of both sides of the equation results in :
U(w) - exp(-jw) U(w) = 1 , hence :
U(w) = 1/(1-exp(-jw)) which is wrong and the right answer has an extra term.
Which step is wrong in this possible solution?
I know the right proof of fourier transform of u[n], my question is regarding the wrong part of this solution.


texts: Autocorrelation - Stochastic vs deterministic processes

texts:
On one hand, there is the statistical definition:

$R_x(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} - \mu)]}{\sigma^2}$

and on the other hand, there is this other definition (e.g. see Dilip's comment here):

$R_x (\tau) = \int_{-\infty}^{\infty} x(t) x(t+\tau) {\rm d}t$

Why are these two definitions different? Is the first one defined for stochastic processes, while the second one defined for deterministic signals?

If so, does the Wiener-Khinichin theorem hold for the deterministic variant? (the Wikipedia article only discusses it in the context of a stochastic process)


texts: Removing noisy lines from image - opencv - python

texts:
I want to process different type of  image to extract actual text from noisy image .I am using open cv to do this job it is working fine but the problem is I need to set different lower threshold to convert noisy image to readable text.Is it possible to set single threshold which removes noise from all images by doing some pre processing ?

Main goal : I am trying to remove that wavy horizontal line and make the character clear to read

Code used:

import cv2

# Load an color image in grayscale
img = cv2.imread('it_captcha3.jpg',0)
ret, thresh_img = cv2.threshold(img, 180, 255, cv2.THRESH_BINARY_INV)
cv2.imshow('grey image',thresh_img)
cv2.imwrite("result11.jpg", thresh_img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Captcha1 :

Processed image : threshold used -> low: 180 high ->255,

CAPTCHA : 2

PROCESSED IMAGE: threshold used -> low: 200 high ->255

captcha : 3

processed : low -> 165 high : 255


texts: position of null carriers in N=256 subcarier OFDM

texts: can anyone tell me the position of null subcarrier in $N=256$ subcarrier OFDM. since edges re assigned null to prevent interference from an adjacent symbol, i assuming that the subcarrier $-127$ to $-100$ then $0$ and then $100$-$128$ are null, is that correct assumption, please respond!


texts: Using Principal Component Analysis for corner feature extraction

texts:
I am on a project of vehicle type Identification (MUV,jeep,Sedan,etc) from images and Here is what I have done up-to now on matlab.

I am working only on the sideview of images.

Input Image :  Masked image

Then I detected the corners easily

Now I got a matrix C with 40 corner coordinates thus I got a matrix of C=[40x2]

I converted it to a linear form using C=C(:); so I got C=[1x80] (as Neural Network destroys coordinates information itself) for 1 image
But I have about 9 image for each class(MUV,Jeep,Sedan) so I made a matrix using C matrix to form a new matrix say MAT=[9x80]

Now I have a corner feature of MAT=[9x80]

1. What Other features could I use or the corner feature would itself be fine enough.(may be SURF features)

2. The Input Format of NN is inMAT=[nxm] where n=number of features and m=total images and target Format is tgMAT=[cxm] where c=number of classes (MUV,Sedan,jeep) and 'm=total images'. Am I right here?


texts: Question on Levinson's proposed discrete form of Wiener filter

texts:
The whole foundation of Levinson's discrete version of Wiener filter is based on the assumption of stationarity of a time series, and aims to predict a value based on the past observed values. Now, if I try to use the theory to interpolate/predict values in a time series comprising financial data or other practical time series like the GDP of a country over some years, is it justified, since the financial data series is not necessarily stationary? Does the whole theory crumble due to this when applied for financial data, or do I still get adequate results, depending on certain properties of the data?

Any insight in this regard would be helpful.


texts: MatLab-Finding error in hough line transform

texts:
Can I calculate the number of error in Hough Line Transform using MatLab? I did Hough Line Transform process from Canny Edge Detection, but it is unable to detect all the lines.
Thanks.


texts: Determine the haar wavelet function is linear or nonlinear

texts:
I'm looking for analytical justification of linearity or non linearity of the wavelet transform with the real Haar mother wavelet function.

I have googling already. But I can't find and understand the meaning


texts: What is the difference in between the different STFT implementations? (Overlap-shift with zero-padding, overlap-add, overlap-save, etc)

texts:
I'm trying to understand STFT overlapping, why segments are concatenated and what are the consequences of this.

My implementation (from other questions and repositories found) of the STFT in Python is:

def stft(x, L, overlap, window): # Linear Spectrum (LS) [V]
opoints = int(L*overlap)
hopsize = L - opoints
X = np.array([(2 * np.abs(np.fft.fft(window*x[i:i+L])[:L//2])) / np.sum(window)
             for i in range(0,len(x)-L,hopsize)])
return X

where, x is the time-domain signal sampled at 44.1kHz, L is the FFT window size (4096), overlap is the overlapping factor [0, 1), and window is the window funtion used (Hanning). The absolute value of half the complex dft is scaled by 2/sum(win) so that the units of the linear spectrum are the same as for the input signal (V).

I used to understand the frequency resolution is fs/L and the width of the time slices or time resolution is L/fs, so that the number of time windows is N/L. However, if using overlapping (overlap!=0), the number of time windows increases ~(N/hopsize)-1.

Why are overlapped segments concatenated instead of added and what are the consequences of this regarding the time axis? (See picture below)
Is compressing the concatenated segments into the original duration of the signal correct? (i.e 3 segments of 1 second into 2 seconds, see picture below)

EDIT1:

Now, I do understand:

Overlap-shift and compression of the time axis of the overlapped segment into the original duration is one way to make a smoother spectrograph image
Overlap is needed in order to avoid lossy signals caused by the window

However, from @user31990 comment I still need to clarify:

What's the difference between the different methods/implementations?

Implementations I've found/understood:

Overlap and concatenate side-by-side the overlapped blocks (increasing the number of time windows and compressing the x time axis to the original duration)
Overlap adding the segments of the block that are overlapped together (the number of time windows doesn't increase = N/L)
Overlap save (zero-pad the beginning of the block and discard the transformed segment, the number of time windows doesn't increase)
Overlap shift with zero-pad

I don't totally understand the overlap shift with zero-pad, what is it doing?

My implementation is an example of the overlap and concatenate method.

Are This and Google's pytfd stft implementations examples of the overlap shift with zero-pad method?

EDIT2:

I was confused about the methods, question is answered/solved.

Zero-padding is a method that can be used: 1. To obtain an FFT of size N of a window whose size is smaller 2. To increment the size of the FFT, interpolating values in the frequency axis and obtaining smoother data.

Overlap-add and overlap-save are methods for the synthesis of an IFFT output in order to recover the original signal x.


texts: Are IIR filters (and specifically Butterworth filter) causal?

texts:
I am new to signal processing. I am learning now about filtering and I am trying to implement high pass filter (HPF),and later band-pass filter (BPF). I implement the filters in Python 3.8 with NumPy and SciPy.
For the offline case (filtering a pre-recorded time) I designed a Butterworth high-pass filter, and applied on the signal at the time domain using signal.filtfilt function. However, as the documentation shows, this approach is good only for offline cases and not for real-time, since the filter scans the signal forward and then backwards. I can recover the frequency response from the filter using signal.freqz function.
Now I want that this filter will work also in real-time (so it needs to be causal, and I ask if this possible for this type of filters. Here are my questions:

If I understand correctly, Butterworth filters are IIR (infinite impulse response) filters. Is it true?
Are IIR filter causal? It may be that all IIR filters are not causal and it may be that some are and some are not. What are the cases in which IIR filters are causal?
Are Butterworth filters causal? If not always, in which case they are causal?
If the answer to 3 is true, how to implement a causal Butterworth filter, both at the time domain and the frequency domain? (I can use SciPy functions such as signal.butter, signal.freqz etc.)

Relevant links:

Help designing Butterworth filter
filtfilt: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html

Thank you.


texts: Taking the Moving Average of STFT Results

texts:
I realize that this seems redundant, but I'm getting consistently better results when performing machine learning techniques that use spectral features extracted using the moving average process below, rather than using STFT results alone.  I'm a machine learning guy by trade, and I don't have a background in signal processing.  I'm hoping you guys might be able to guide me in the right direction here.

STFT process:
I use a 10 second STFT window with 9 second overlap. The result is 1 second spaced observations that contain 10 seconds of information.

STFT Moving Average process:
I use a 2.5 second STFT window with a 1/480 second increment (480Hz sample rate), then take a 10 second moving average with a 1 second increment.  The result is 1 second spaced observations that contain 12.5 seconds of information.

My reasoning for using the moving average process was that I get a smoother signal to work with, but I'm not sure that it makes sense to signal processing folks. Is there anything fundamentally wrong with doing things this way besides having to deal with the additional computational cost?

edit: It seems like the reason for the improved results is related to the theory behind using Welch's method for power estimation. Maybe?


texts: what is OQAM (Offset QAM) and why it is required?

texts:
Currently I am studying about a modulation technique FBMC (Filter Bank Multicarrier) which is a predecessor of OFDM. The difference with OFDM is that, FBMC does not have a CP (Cyclic Prefix) which is a better use of spectrum. On the other hand, it is susceptible to ISI (Inter Symbol Interference) due to the absence of GI (Guard Interval) when transmitted over wireless channel.1. FBMC uses prototype filters to shape the out of band emission to lower the interference.
There is a concept of FBMC-OQAM (sometimes referred as staggered multitone or SMT), where the input signal is first converted to QAM symbols and further processed into OQAM symbols[2].
Can anyone explain to me in very simple words / general context:
#. What is the purpose of OQAM (ref.2 has a figure) and how it is making the signal orthogonal?

1https://ieeexplore.ieee.org/document/5753092
[2]https://ieeexplore.ieee.org/abstract/document/8255374


texts:
I would like to detect a curve in a grid. Example (hand-drawn):

https://imgur.com/a/WsE85

I would like to detect the intersects of the curve with the vertical gridlines marked with the "x" symbols. I already managed to get a decent solution when the curve and the grid have different colors (purely based on color separation and an explicit declaration of the horizontal coordinates to measure at).

What I am struggling with is doing the same when grid and curve have the same color (and mostly same color intensity/thickness of lines).

What methods could I look into to solve this? Is there a proven approach for this type of problem?

NB: So far I have worked with OpenCV and Python.

TIA
Matt