texts:
I'm converting the simulink diagram found in this paper to C code.  I'm not familiar with matlab/simulink(too expensive) so need help interpreting the diagram.  The problem I experience is that once a value like $\theta$, or $x_1$ becomes zero, zero is propagated everywhere due to the multiplication.  The paper states that the integrators are initialized to zero, so I don't see how the system works.

Any ideas?

Below is the simulink diagram and my C code:

The block diagram is found in the paper above as Figure 1 and Figure 2 :

typedef struct  { float zeta,gamma;} PARAM_ANFfloat;
typedef struct  { float err,regressor,x1,theta;} STATE_ANFfloat;

typedef struct {PARAM_ANFfloat p;STATE_ANFfloat s;} ANFfloat;

void dspANFfloat_perform(ANFfloat *anf, float y)
{
    anf->s.err = y - anf->s.regressor;

    anf->s.theta = -anf->p.gamma * anf->s.x1 * anf->s.theta * anf->s.err;

    anf->s.x1 = anf->s.theta * anf->s.err * 2 * anf->p.zeta - anf->s.x1 * - anf->s.theta * anf->s.theta;

    anf->s.regressor = anf->s.x1;

}


texts: Morphological Gradient Versus Linear Gradient in Image Processing

texts:
To obtain the gradient from an image, one can use a linear filter that for example is derrived from the derrivative of a gaussian. Then convolving the image with this linear filter gives you the gradient image.
The gradient magnitude can also be approximated by use of (grayscale) morphological gradients, such as: (dilation-erosion), (opening-closing), or ((dilation-erosion)-(opening-closing)).
Why would you resort to using a (grayscale) morphological approximation of the gradient magnitude? Is it any faster or is it different in some cases?
Thanks,
Tom


texts: What is the physical significance of the Fourier coefficients in the DFT of audio signals and how can they be best displayed in a spectrogram?

texts:
I am trying to display the spectrogram of an input audio signal (a newcomer to all things spectral here). The amplitudes of my audio signal can be assumed to be normalized between -1 and +1.

Suppose for the frequency $f$ in the DFT's output, the corresponding coefficient is $c$, in general a complex number. I would like to display the "amplitude" information contained in $c$ as a corresponding colored region on the spectrogram. Ideally to plot the spectrum, I would need a number that ranges from 0 to 1. 0 will represent the lowest amplitude I will record, and 1 the highest. There are a few ways I can think of to achieve this:

Since the $|c| \le N$, where $N$ is the number of samples, I can normalize the magnitude of $c$ with respect to $N$ ($v = |c|/N$) and display the resulting $v$ as a spectral colour.
Same as 1, but normalize $|c|$ wrt to $M$, the maximum magnitude of all Fourier coefficients. But this has the disadvantage of having to scan the entire data before the spectrum can be displayed, and will be a problem for large files. Also, this means that the spectrum display is relative to the intensity levels present in the current audio signal, and not valid in an "objective" sense.
Convert $|c|$ into decibels, say $d = 20 \log_{10}(|c|/b)$, where $b$ is a base magnitude. I will then normalize $d$ from say $l$ (where $l$ is a lowest dB value I will register) to $u = 20 \log_{10}(N/b)$. I can then use $d$ in displaying the spectrum. But in this case, what should $b$ be?

My question: what is the exact physical significance of the magnitudes of the Fourier coefficients in the DFT of audio signals and how can it be best displayed? I have tried all the above approaches, but am wondering which of them is the most proper or if I am missing any others.


texts: Limitations in Backing Out a Transfer Function

texts:
Suppose you have an LTI system for which the (complex) frequency response $H(j\omega)$ has been measured in some frequency window $[\omega_1,\omega_2]$.
Now imagine that you want to provide an input $x(t)$ to this system, such that the output is a specific, known waveform $y(t)$ that has negligible frequency content outside $[\omega_1,\omega_2]$.
My question is:
What are the necessary and sufficient conditions that our measured $H(j\omega)$ values in  $[\omega_1,\omega_2]$ need to satisfy such that the required input $X(j\omega) = Y(j\omega)/H(j\omega)$ exists, and makes practical sense? For example, the system can clearly not have any zeros on the $j\omega$ axis in our frequency window.
I realize that a sufficient condition is for the system to be invertible. However, no such knowledge of the system is available, as we only have access to the frequency response in a specific frequency interval. What can we say about the possibility of backing out the frequency response only with the information at hand?


texts: Proving a cyclostationary processes signal

texts:
Suppose a random signal $x(t)=\sum\limits_{n=-\infty}^\infty Z_n \delta(t-n\tau)$, where $ z_n = Z$ and $Z$ is a random variable with equal probability to be $+-1$,  is passing through a low pass filter $h(t) = sinc(\frac t \tau)$ and the output is $y(t)$. and I want to prove the output signal is cyclostationary process signal.
I know the $\mu_y(t) = \int\limits_{-\infty}^\infty E[X(z)]h(t-z) dz = \sum\limits_{n=-\infty}^\infty \int\limits_{-\infty}^{\infty} E[Z_n] \delta(z-n\tau)h(t-z) dz$
and the autocorrelation of $Y(t)$ is $R_Y(t, t+x)=E[Y(t_1)Y(t_2)]=\int\limits_{-\infty}^\infty\int\limits_{-\infty}^\infty E[X(z)X(u)] h(t-z) h(t+x-u) dz du = \sum\limits_{n=-\infty}^\infty \sum\limits_{m=-\infty}^\infty \int\limits_{-\infty}^\infty\int\limits_{-\infty}^\infty E[Z_n Z_m] \delta (z-n \tau) h(t-z) \delta (u-m \tau) h(t+x-u) dz du$
And this is what I need to prove

Cyclostationary Process
A random process $X(t)$ with mean $\mu(t)$ and auto correlation function $R_x(t+\tau, t)$ is called cyclostationary. if both the mean and the auto correlation are periodic in t with some period $T_0$, i.e. if

$\mu_x (t + T_0) = \mu(t)$

$R_x (t + \tau + T_0, t + T_0) = R_x (t + \tau , t)$

And I think $\mu_y(t)$ is 0 because $E[Z_n]$ is 0 (right?),
But how can I prove the auto-correlation are periodic?
Last thing, I want to thanks all you guys for your comments and intuitive answer that help me so much on my study and get my head straight. Thanks.


texts: What is this sinc doing in my LP-turned-HP filter output?

texts:
I'm trying to HP-filter a signal by LP-filtering it and subtracting the output from the original filter. To obtain the LP-filtered signal, I backward-forward filtered using a third-order Butterworth filter for a 16,000-sample signal. The cutoff frequency was 0.5 Hz @ 250 Hz. No window was used.

In the first 85% or so of samples, the output of this method seems to overlap completely with the actually HP-filtered signal. However, at the end of the output, there is a supsiciously sinc-like phenomenon.

What causes it?
What could I change to make this method feasible?

Here are the two signals overlaid. The blue one is HP-filtered, and the red one obtained by subtraction.

Here is the absolute difference per sample. They are never exactly equal; the minimum difference is 8e-12. 87% of the values are below 0.01.

(If there's a better way to obtain an HP filter from an LP filter's $H(z)$, I'd be happy to learn it.)


texts:
In the framework of the Kalman filter

How can we check errors are Gaussian and independent?
If the processes are not stationary, could that be a problem?
If I have the unobservable variables that are latent. How could I get the transition matrix or the covariance matrix for the equations?


texts:
Currently I'm learning about Nyquist Stability Test and I'm few days stuck on one thing and I don't understand that so I wanted look here for help.

Given is transfer function $K\frac{2s-11}{s(s^2+s+1}$. We take that $K=1$.

Line represens the Nyquist contour for K=1.

Than in my book it's written that
that function is stabil when

$\triangle arg(1+L(Iw))=(max(grad(z_L),grad(n_L)-N_{-}(n_L)+N_{+}(n_L)  )\pi$

than they see from this picture above
$\triangle arg(1+L(Iw))=-\pi$

and

$(max(grad(z_L),grad(n_L)-N_{-}(n_L)+N_{+}(n_L)  )\pi=(max(1,3)-2+0)\pi=\pi$

Not stabil.

What I don't undestand is - $\triangle arg(1+L(Iw))=-\pi$? What this could be? What angle? How do I see that from picture?


texts: Looking for a better way to posterize or normalize the colors of an image

texts:
I have very little experience with image processing or signal processing in general, but I'm willing to learn.

I've been experimenting with a way to, uh... "flatten" the colors of certain kinds of images. For example, I have a photograph of an object that has been painted with few colors, and I want an image with only these colors, removing shadows, textures and other noise.

I've obtained mixed results using the following brute-force technique:

Create a matrix of pixels, starting as "unmapped".
Apply a "fuzzy floodfill" algorithm on the image, starting at a random position, with the modification that, instead of comparing pixels to a single starting color, I compare the colors of neighboring pixels. Also, instead of immediately modifying the image, I mark the filled pixels on a temporary matrix (so as to simulate the floodfill process correctly), and mark these pixels in the main matrix as belonging to this map.
Repeat until there are no "unmapped" pixels in the image.
The matrix will then be filled with many maps, each one representing a single set of similar colors.
Compute the average of the colors of each map, and paint the pixels corresponding to each map to each color.

Results: http://www.lgm.cl/whatisthis/

Hopefully, by seeing the images I've created, you'll be able to understand what I'm trying to achieve. The downside of my algorithm is that it's SLOW and inefficient, so I'm looking for a more efficient way to achieve at least the same results.

Note: I just stumbled upon the knowledge of Gradient Domain Image Processing and the wonderful things it can do. I haven't experimented with it yet, but at first it looks promising. However, I'm asking for further advice before going through another trial-and-error session. :)


texts: I can't make sense of the amplitude spectrum of a signal. Help please

texts:
I have a sinusoidal signal namely:
signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);

so the segment of the code becomes:
freqs = [0.08, 0.2, 0.32, 0.4];
periods = 1./ freqs;
% Let the max value of t be 4 times the largest period
t_max = 4 * periods(1);
% Let us have 500 samples over the interval [0, t_max].
t = linspace(0, t_max, 500);
% The synthesized signal
signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);

Now I wanna view the amplitude spectrum for the first 50 samples.
So I did this:
signal_first_50_samples= signal (1:50);
% Display its magnitude spectrum.
N = 64;
signal_spect = abs (fft(signal_first_50_samples,N));
signal_spect = fftshift(signal_spect);
F = [-N/2:N/2-1]/N;
plot (F, signal_spect)
set(gca, 'XTick',[-0.5:0.1:1])
grid on;

I was expecting spikes at each of the frequencies, however, I got this:

I re-did the sampling part as follows, to include more samples:
%% Synthesizing a sampled signal that consists of 4 sine waves
% We are given 4 different frequencies
freqs = [0.08, 0.2, 0.32, 0.4];
periods = 1./ freqs;
% Let the max value of t be 4 times the largest period
t_max = 4 * periods(1);
% Let us have 500 samples over the interval [0, t_max].
t = linspace(0, t_max, 500);
% The synthesized signal
signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);
% Visualising the synthesized signal
plot(t, signal, 'b-', 'LineWidth', 1.5);
grid on;
title('The Synthesized Signal', 'FontSize', fontSize);
xlabel('t', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
% Display its magnitude spectrum.
% i was expecting spikes at each freq
N = 64;
signal_spect = abs (fft(signal,N));
signal_spect = fftshift(signal_spect);
F = [-N/2:N/2-1]/N;
plot (F, signal_spect)
%set(gca, 'XTick',[-0.5:0.05:1])
grid on;

but i still got approx the same result, not what i expected

another edit:
i did something else i had only 50 samples for the singal and took all of them
%% 50 samples taking 50
clc;
clear;
% We are given 4 different frequencies
freqs = [0.08, 0.2, 0.32, 0.4];
periods = 1./ freqs;
% Let the max value of t be 4 times the largest period
t_max = 4 * periods(1);
% Let us have 50 samples over the interval [0, t_max].
t = linspace(0, t_max, 50);
% The synthesized signal
signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);
% Determine the first 50 samples of this signal
% signal_first_50_samples= signal (1:50);
% Display its magnitude spectrum.
% ??????????????????????????????????????????????????????????????????????
% I was expecting spikes at each freq
N = 64;
signal_spect = abs (fft(signal,N));
signal_spect = fftshift(signal_spect);
F = [-N/2:N/2-1]/N;
figure
plot (F, signal_spect)
%set(gca, 'XTick',[-0.5:0.05:1])
grid on;

I got this

which looks about right
but I wonder why it didn't work when i had 500 samples and i took all 500 of them
any ideas?


texts: What is the cut-off frequency for this low pass filter?

texts: I don't have any background in analog lowpass filters; and I am curious how can i decode this circuit.


texts: Can you explain about the following formulas? in Signals and System

texts:
In my textbook, any signals could be expressed like the following formula.

$x(t)=\displaystyle\frac{a_0}{2}+\displaystyle\sum_{n=1}^{\infty}[a_n\cos(2{\pi}nft)+b_n\sin(2{\pi}nft)]$

I understand that any signal could be composed of periodic signals whose frequency is $f$, $2f$, $3f$, $\cdot\cdot\cdot$.

I don't understand the part of "$\displaystyle\frac{a_0}{2}+$".

and the text book said,

$a_n=\displaystyle\frac2T\displaystyle\int_{T_1}^{T_2}x(t)\cos(2{\pi}nft)dt$

$b_n=\displaystyle\frac2T\displaystyle\int_{T_1}^{T_2}x(t)\sin(2{\pi}nft)dt$.

I also don't understand why $a_n$ and $b_n$ are like the formula above.

Thank you for kind answers, and my first language is not English. Please let me read easy English. very Thank you.


texts: Performing classification based on FFT results

texts:
It is perhaps important to start with the fact that I am a complete beginner in DSP.
I have got a number of audio recordings (of sampling rate 22 kHz) - of bird songs - which I have been trying to analyse using FFT (in Matlab/Octave). Particularly, I am trying to show using Machine Learning classification algorithms that different classes of those recordings have prominence of different frequencies (or frequency ranges).
The recordings are of variable length and, due to computation limitations, the largest size FFT that I can do is 2^19 (which I understand is the number of points it takes from each audio file).
So, my first question is: if I break my recordings in parts, each corresponding to the size of FFT that I've chosen - would it be still reasonable to treat those parts as separate data examples (i.e. separate recordings), and what kind of information do I lose when splitting the larger recordings in such way?

The second question is: is there a better way for a beginner to perform this analysis, in a not so computationally expensive way, since I think working with vectors of size 2^18+1 is not really the best thing to do in the current case.


texts: Is there a way to break an analog sound signal up and send it through two radio chips at double the data rate of one?

texts:
Here is a radio chip for audio that sends at a CD-level data rate.  Could you sample an analog signal (for instance from a guitar pick-up or microphone) in such a way that you could transmit using two radio chips (and receive using two radio chips), then recombine the signal on the receiver side into one that has double the data rate of the same basic circuit that uses only one transmitter chip (and one receiver)?

Also can this be done with an analog circuit rather than expensive A/D converters?


texts:
If a sequence of +1 and -1 with chip rate ($\frac{1}{0.57 ns}$) is being used for purpose of estimating channel impulse response with delay spread of 6ns.

We decide to have a new rate change to rate $\frac{1}{0.38 ns} $. Then in the digital domain we upsample by 3 the initial signal, filter than downsample by 2  and we have a new sequence with new chip rate.

My question is, given the fact that the to sequence length should be longer than maximum length of channel impulse response to estimate CIF accurately in this case $6 ns$. What is the number of chips that is required for best estimation?

There are two possible answers:

1) Minimum number of chips * 0.57 $\geq 6 $

2) Minimum number of chips * 0.38 $\geq 6 $

I think the correct answer is 2, what do you think?

Thanks.


texts: I am working on building a reverb. This article explains how to build a reverb pretty well, but I do not understand what the KRT in the main diagram stands for. The article says The term Krt controls reverb time, but what does the actual block do?


texts: Designing complex magnitude compensating FIR filter

texts: I am trying to find a Python replacement for the Matlab function cfirpm (complex FIR Parks-McClellan). I use cfirpm in the design of a complex FIR magnitude and group delay compensation filter for a crystal IF filter. Since the frequency response of the crystal IF filter is not symmetric, the compensating filter isn't either. Therefore, I cannot simply use a lowpass filter design and multiply it by e^(jwft). I have searched for hints on how to do this on this site and many others. I have looked at 23147/design-filter-with-arbitrary-magnitude-and-phase-response-in-matlab where the answer was to find the inverse FFT of the two-sided complex frequency response, etc. but what I have from a frequency sweep using an RF signal generator and processing the I and Q samples is a vector representing the desired magnitude at evenly spaced frequencies and I'm not sure how to represent that as a two-sided complex frequency response. Any ideas on how this type of filter can be designed in Python would be greatly appreciated.


texts: How to get the quaternionic analytic signal of a image?

texts:
The 2D discrete image signal's quaternionic fourier transform can be described as F(u,v), and its 2D analytic signal often be described as:

$$
F_q(u,v) = (1 + \mbox{sgn}(u))(1 + \mbox{sgn}(v)) F(u,v)
$$

$$
\mbox{sgn}(u) \triangleq
\begin{cases}
1&, u>0\\
0&, u=0\\
-1&, u<0
\end{cases}
$$

$F_q(u,v)$: quaternionic analytic signal, F is the fourier trans of f)

$$
QQF(u,v) = (1 + \mbox{sgn}(u))(1 + \mbox{sgn}(v)) F(u,v) H_b(u,v)
$$

$QQF(u,v)$: quaternionic quadrature filter;

$F(u,v)$: quaternionic fourier transform of image $f(x,y)$

$H_b(u,v)$: a band-pass filter, i.e. log-gabor, cauchy, 2d gaussian derivative filter, .etc

in many papers, after the define of quaternionic analytic signal, the author usually gives a specific quaternionic filter (such as quaternionic gabor filter, or quaternionic log-gabor filter) in image processing to demonstrate the useful of this method. (such as use this quaternionic quadrature filter for a image filtering)

Q:

after fourier transform, when will u<0.
what is the meaning of this quaternionic analytic signal
How to implement the code of quaternion gabor filtering(QGF) with matlab?

Note: maybe my understanding of this concept is weak, and welcome to give a specific detailed demonstration.


texts: Spectral decomposition of the DC part of the signal

texts:
The title of the question might be misleading, but it shows how clueless I am about this problem.
I have a time series of some quantity $X(t)$. I can calculate autocorrelation of this quantity $Y(\tau)=\frac{1}{N}\sum_{t_i}X(t_i)X(t_i+\tau)$. I am looking for an integral of the autocorrelation function, which would be DC component of the signal $Y(\tau)$ (it is the zeroth frequency element of the Fourier transform of $Y(\tau)$):
\begin{align*}
I=\frac{1}{N}\sum _{\tau _i}Y(\tau _i)=\frac{1}{N}\sum _{\tau _i}Y(\tau _i)\exp(i\omega \tau _i)\rvert _{\omega=0}.
\end{align*}
I know that my signal $Y(\tau)$ can be represented in a Fourier space, meaning it is a sum of some oscillatory functions. These oscillatory functions are decaying, hence the non-zero $I$. That means that somehow I should be able to decompose $I$ as a contribution of each of the oscillating functions.
Is there a standard way of obtaining $I(\omega _i)$ from my original signal $X(t)$ so it satisfies: $I=\sum _{\omega _i} I(\omega _i)$?


texts: Extracting absolute temperature values from an Infrared video

texts:
Not sure if this is the right place to be asking this, but it's my best bet.

So, I have a video captured from an infrared camera similar to the youtube video here. Can I get temperature information by analyzing the pixel data of any given frame? Also, if this needs prior calibration, how would I go about doing that?


texts:
I have IQ data collected

This is the beginning of the packet that includes preamble and sync sequence. Red is real part, blue is imaginary.
Also constellation diagram for this data

I don't have access to the radio that transmit this data.
I know that this is QPSK modulated data. Preamble and sync sequence should be BPSK modulated, but I cannot demodulate this data, they don't look like a "good" BPSK. I also know that the data have been processed by RRC filter before transmission.
What is this phenomenon, and what I can do with this data?
Thank you,


texts:
I have a notch filter designed for 50Hz. Then I generated the filter design code with Filter Design app:

function Hd = filter_notch
Fs=500; Fnotch=50; BW=1; Apass=1;
[b, a] = iirnotch(Fnotch/(Fs/2), BW/(Fs/2), Apass);
Hd     = dfilt.df2(b, a);

This is its frequency response:

Now, I filter input signal with this filter:

filter_block=filter_notch;
out_signal=filter(filter_block,in_signal);

but to my surprise at notch frequency, it amplifies the signal for about +10dB!! Here is the zoomed version. Blue is output, Red is Input. What is going on here?!


texts: Filtering a noise of F[sig] frequency [Example 20Khz] in measurement system

texts:
I am developing a system where there is inherent noise of F[sig] frequency. This is a DC measurement system and want to get rid of the noise by sampling at F[samp] samples per rate and taking multiple number of samples.
I know that if F[samp] is a multiple of F[sig], then i can filter the noise.
If F[samp] / F[sig] is not an integer , how can i measure the noise reduction which will take F[samp], F[sig] and number of samples [N] into equation?
Sorry if this is a very basic question.


texts: Remove AC component from the mixed signal using an elliptic filter

texts:
I have a signal like this:

$s(t) = C + a \cdot sin(2 \cdot \pi \cdot f \cdot t)$

where $C$ - arbitrary constant, $f$ - frequency of AC component (Hz) and $a$ - amplitude of AC component.

Parameters: $C = 1$, $f = 1$, and $a = 0.1$.

I want to synthesize a filter that will remove AC component with an angular frequency $\omega = 2 \cdot \pi \cdot f$ from this signal, i.e.:

$s(t) = C + a \cdot sin(2 \cdot \pi \cdot f \cdot t) \xrightarrow{After Filtering} s(t) ≈ C$

It is difficult to make this ideal, therefore, an elliptic filter was chosen as a filter, as a good frequency splitter.

After tuning it, I get the following frequency response of the filter:

The model of a computational experiment is as follows:

And the following results are obtained.

AC component has not been deleted.
Signal after the filter repeats the input. In theory, AC components with a frequency above 0.5 Hz (and in my case the frequency is 1 Hz) should be removed, and only the constant $C$ component should remain, i.e. $1$.

Where did I make a mistake?


texts:
I wonder if there are algorithms used to segment images efficiently. The ones I tested by now can not segment hair correctly as on this image:

I just want to know if someone can give me some efficient algorithms to segment the hair on this image for example without cutting it and so on (correct segmentation)

Note that I tested famous algorithms such as watershed, grabcut, mean shift ... but no one of them segments this hair correctly.

Thank you very much in advance.


texts:
In my project I am extracting the lines of an image with openCV2 by firstly creating a skeleton: I convert it to a binary image, invert it (to make it work with morphological operations) and then perform a bunch of morphological operations. Then I apply the canny edge detector on the skeleton and perform a Hough transformation.
Now the important part: In order to remove the gaps I perform a closing operation. My problem now is that there are still some gaps and fragments and I can't apply the closing operation one more time because its idempotent (only applicable once).
I want to refine the lines by closing all gaps and possibly thicken the lines. How may I achieve this?
Here some images to illustrate my problem.
Original image

Processed image

See those tiny lines which protrude from the edges? Or the interruptions in a straight line?
For the gaps in the lines I thought about looping through the matrix and if the points left and right of a pixel are 1 (drawn), then that particular pixel should also be set to 1. Would that be a good solution?


texts: How to obtain the exact value of wavelength from a 2D FFT amplitude vs wavenumber plot like it is obtainable from 1D FFT amplitude vs wavenumber plot?

texts:
I have a two dimensional multi modal spatial signal generated from a MATLAB code using sinusoidal functions of different wave numbers, amplitudes and phases. What I want to know is that if I have the amplitude vs wave number plot of that signal, how can I extract the wavelength of the different spatial structures. For 1D signal and 1D FFT I know that it is possible to extract the wavelength from the amplitude vs wavenumber plot by simply taking the reciprocals of the wave numbers with non zero amplitudes. But how can it be done for 2D signal and 2D FFT? I am attaching my code below.
Ws=160; % Sampling wavenumber @ 160 Hz
L=10; % Length of domain = 10cm
N = L*Ws; % Length of signal
x = (0:N-1)*(1/Ws); % Space vector
y = [(0:N-1)*(1/Ws)]'; % Space vector
x = repmat(x,1600,1); % Space matrix
y = repmat(y,1,1600); % Space matrix
V = sin((4pix)/L)+sin((4piy)/L); % Function in the spatial domain
`
fx = linspace((-Ws/2),Ws/2,N); % computing wavenumber vector fx
fy = [linspace((-Ws/2),Ws/2,N)]'; % computing wavenumber vector fy
fx = repmat(fx,1600,1); % computing wavenumber matrix fx
fy = repmat(fy,1,1600); % computing wavenumber matrix fy
T = fft2(V); % 2D FFT
subplot(1,2,1)
pcolor(x,y,V) %%%% Contour plot in spatial domain
ax = gca;
ax.LineWidth = 2;
colormap jet
colorbar
shading interp
pbaspect([1 1 1])
xlabel('X(cm)-->.')
ylabel('Y(cm)-->.')
title('V = sin((4pix)/L)+sin((4piy)/L)')
subplot(1,2,2)
pcolor(fx,fy,abs(fftshift(T))) % Contour plot of FFT amplitude vs wavenumber
lin = zeros(1,N);
hold on
plot(lin,fy(1:1600),'b') % Vertical line passing through (0,0) in fft amplitude plot
hold on
plot(fx(1:1,1:1600),lin,'k') % Horizontal line passing through (0,0) in fft amplitude plot
colormap jet
colorbar
shading interp
pbaspect([1 1 1])
xlabel('Wx(cm^{-1})')
ylabel('Wy(cm^{-1})')
title('FFT amplitude')
I am attaching the plot which I got as well. Any help would be greatly appreciated.


texts: Why do we observe band when recording CRT monitors or Flouroscent lamp via video recorder?

texts:
I understand that this has something to do with difference between refresh rate of monitor (or line frequency used by the ballast in case of Fluoroscent lamp) and frame capture rate of video recorder.

When learning about DSP in the past, I vaguely remember that a certain difference in frame capture rates of video recorder against the refresh rate of screen will cause the movement of bands upwards or downwards (assuming screen drawn left to right, top to bottom) ?

Please help me understand the phenomenon (the name, if there is one for this) or direct me to appropriate text on this.

Thank you.


texts:
Both BPSK and 2-VSB transmit one bit of information per smybol and both modulate the real part of the signal.
The difference is, as far as I understand, that BPSK does not modulate the imaginary part of the complex signal at all, while 2-VSB uses hilbert transformation to suppress the lower sideband of the transmitted signal.

Are there any advantages of doing this or is it just adding complexity without any advantages?


texts:
Why is a combination of R, L, C linear time-invariant system? But not diode, or transistor?

I looked over V-I equation for R, L, C, but still don't know how to prove it.


texts: Double check z-transform ROC of $a^nu[n]$

texts:
For the z-transform ROC of signal $a^nu[n]$, it has been computed to be $|z|>a$. For example (as I have found on Wikipedia), the signal $(\frac{1}{2})^nu[n]$'s ROC will be $|z|>\frac{1}{2}$, as
$$\sum_{n=0}^{\infty}(\frac{1}{2})^nz^{-n}=\sum_{n=0}^{\infty}(\frac{0.5}{z})^n=\frac{1}{1-0.5(z)^{-1}}$$
To this point, it said for such equality to hold, $|z|>0.5$. But I am thinking is it possible that $|z|$ can also be less than $0.5$, as long as $z\neq1$ and so the denominator won't go to $0$. However, I then realize that if $|z|$ is less than $0.5$, this term $\sum_{n=0}^{\infty}|(\frac{0.5}{z})|^n$ will go to $\infty$. Could I know if my "realization" is correct: $|z|$ cannot be less than $a$ simply because the term $\sum_{n=0}^{\infty}|(\frac{a}{z})|^n$ will go to $\infty$. Thanks in advance.


texts: Find the transfer function of the difference between IIR and FIR filter

texts:
I am using a filter following equations from papers.
It is basically the difference between exponential moving average and simple moving average.

$$L[n]=\frac{1}{\alpha_L}f[n]+\left(1-\frac{1}{\alpha_L}\right)L[n-1]$$

$$ S[n]=\frac{1}{\alpha_S}\sum_{k=0}^{\alpha_S}f[n-k]$$

$$ g[n]=S[n]-L[n]$$

$f[n]$ - original signal
$g[n]$ - filtered signal
$\alpha$ - window size

I can find their transfer function separately for $L$ and $S$, but I have no idea how to get transfer function of $g[n]$. Anyone please guide me, I would really appreciate it.


texts:
I am analyzing the spectral components of a time series using the continuous wavelet transform following Torrence and Compo (1998). I would like to partition the signal variability or spectral power across different scales (e.g. 50% of the variability is in the scales X to Y).

As pointed out here the global wavelet spectrum is a biased estimator of the power spectrum, so is there a way to plot the power spectrum in a normalized way, where I can compare the power at different frequencies?

Would it be correct to just reconstruct each scale range I am interested in and calculate the variance over time?


texts: What is the difference between phase noise and frequency noise?

texts:
I'm reading Audoin and Guinot's The Measurement of Time: Time, Frequency and the Atomic Clock, and ran across a confusing an interesting passage (Section 5.2.5, pp 72-73):

  The physical origins of white phase and frequency noise are
  understood. They are associated with thermal noise in the radio region
  or shot noise from a particle flux.

There is also a chart that explicitly lists out phase noise and frequency noise as different components that lead to time and frequency instability.

I have always understood phase noise to be what is described in the Wikipedia article:

$$v(t) = A\cos(2\pi f_0t + \varphi(t))$$

where the $\varphi(t)$ portion is the phase noise of the sinusoidal signal.

I can't determine from the context of this book what frequency noise means, nor do any of my books mention frequency noise, just phase noise.

So, what is the difference between phase noise and frequency noise?


texts: I am beginner in Image processing.I am studying the importance of phase in signal.Can anybody explain what is phase congruency ?


texts:
This is primarily a question about how to name my filter.  Suppose that I have a photon detector, and that I want to measure the rate at which photons arrive, with a simple gated counter (because this is the only hardware I have).  The photon rate is just the counter value divided by the gate interval.

It seems to me that the counter is an integrator: so by opening the gate for, say, 1 second, I have made a first-order low pass filter (LPF).

Now, suppose that I take the mean of, say, 10 such measurements.  Have I now built a second-order LPF? Or merely a first-order LPF with a longer time-constant?  Does the answer change if the measurements are not consecutive?


texts: Control of a nonlinear static MIMO System

texts:
I am currently writing my master thesis and trying to design a controller for my system. However, the system is somewhat unconventional.

It has a large number of inputs and outputs, is static, non-linear, and time-invariant. The goal is to control the disturbance. Because it is static, conventional controllers for MIMO systems (NMPC etc.) are only of limited use. By static, I mean that the sampling time is so high that all dynamics are faded during that time.

At the moment I am looking for a similar system in another area. Does anyone have an idea in which area such a system exist?

Formally, the system is

$$ F_{x,y}^{(h)} = a^{(h)} e^{- \frac{(x-x_{a})^{2} + (y-y_{a})^{2}} {b^{(h)}} } $$
The state space representation of the system is

$$\dot F_{x,y}^{(h)} = 2\frac{a^{(h)}}{b^{(h)}} \left[(x-x_{a}) \dot x_{a} + (y-y_{a}) \dot y_{a}\right] e^{     \frac{(x-x_{a})^{2} + (y-y_{a})^{2}}     {b^{(h)}} }$$

with

\begin{align}
\dot x_{a} &= u_{1}^{(h)}\\
\dot y_{a} &= u_{2}^{(h)}\\
\text{output}_{1} &= \sum_{h=1}^{h_\text{end}} F^{(h)}\text.
\end{align}

Where $x_{a}$ and $y_{a}$ is my input for one $h$ (I have ~1000 of $h$). $(x,y)$ is my measurement point (where I have ~1000 as well). I would have one ouput for every measurement point. $a$ and $b$ are just parameters. I could reduce the problem though to a size of 100x100. One disturbance is rather static. The other is dynamic and I am not even sure how to model it.


texts: What is the theoretical upperbound of information that could be transmitted by a device per second?

texts:
Suppose I would like to stream data from a device in a single second. What would be the theoretical upperbound of the amount of information (in bits, bytes, pixels...) that could be sent during this period?

What determines this upper bound?


texts: Apply Kalman filter to remove process noise, given zero measurement error

texts: I have a recording, corrupted by environment noise. The measurement noise is zero. How can I use Kalman filter to remove environment noise? I tried this Matlab code here but if the measurement error covariance is set to zero, the Kalman values are always the same as the measurements. The process noise is not removed at all.


texts:
Currently I'm writing my master thesis and I'm having troubles with coherence definition. My question is similar to https://stats.stackexchange.com/questions/92412/clear-steps-to-calculate-coherence-between-two-time-series

Mathematically it's defined as

$$C_{xy}(\omega) = \displaystyle{\frac{|S_{xy}(\omega)|^2}{S_{xx}(\omega) S_{yy}(\omega)}} $$

where $S_{xy}$ is the cross-spectrum between $X$, $Y$ and $S_{xx} \text{ and } S_{yy}$ the corresponding power spectra and $|*|$ operator corresponding to complex numbers magnitude. However, when doing the math using the periodogram estimation

$$\hat{S}_{xy}(\omega) = \frac{1}{N} x(\omega) y^{*}(\omega)$$

(being $x(\omega)$ the DFT of $X$ and $y^{*}(\omega)$ the conjugated DFT of $Y$) everything cancels out and $C_{xy}$ turn to be $1$ for all $\omega$. Let $x(\omega)= a+bi$ and $y(\omega)=c+di$, using periodogram estimation we get:

$\hat{S}_{xx}(\omega) = \frac{1}{N} x(\omega)x^*(\omega) = \frac{1}{N}|x(\omega)|^2 = \frac{1}{N} (a^2+b^2)$
$\hat{S}_{yy}(\omega) = \frac{1}{N} y(\omega)y^*(\omega) = \frac{1}{N}|y(\omega)|^2 = \frac{1}{N} (c^2+d^2)$
$|\hat{S}_{yy}(\omega)|^2 = |\frac{1}{N} x(\omega)y^*(\omega)|^2 = \frac{1}{N^2} |(a+bi)(c+di)|^2 = \frac{1}{N^2} |(ac-bd)+(ad+bc)i|^2 = \frac{1}{N^2} ((ac-bd)^2+(ad+bc)^2) = \frac{1}{N^2} (a^2c^2+b^2d^2+a^2d^2+b^2c^2) = \hat{S}_{xx}(\omega)\hat{S}_{yy}(\omega)$

so when computing $C_{xy}(\omega)$ it turns to be 1 for all $\omega$. This is where my question arises:

I'm using seewave::coh function from R to compute coherence, which calls spec.pgram function in this part of the source code:

Y <- spec.pgram(cbind(wave1, wave2), fast = FALSE, taper = FALSE,
        spans = c(3, 3), plot = FALSE)$coh

I get that spans argument allows to avoid the "always 1 problem", but I don't get the "how". I would really appreciate if some of you could explain $\text{how}$ this works in the definition given above. Thank you so much.


texts: The exact definition of dominant frequency?

texts:
What is the exact definition of dominant frequency? I have googled and cannot find it.

For example, does this figure shows "two" dominant frequencies? Is dominant frequency a single maximum value? or do we call it dominant frequency because it has a distinguishable peak observed by human?

Edit: another example,


texts:
I have a DFT bank analyzer with N channels, but the the bandwidth of the signal occupies only the first 2 channels, therefore I'll reconstruct only these and not entire full bandwidth. I'd like to know if is mandatory to use an FFT with N points all polyphase components in the synthesis bank and . I would to use only FFT 2 points and only 2 polyphase components(8 taps each) in the synthesis bank. Is it possible?

Thanks to all
Stefano


texts: remove spatial sinusoid noise from 2d image

texts:
Given a 2D image where each row of pixels is shifted by some amount horizontally in a sinusoid fashion, is it possible to recover the original image?

Imagine a camera that can capture one row at a time, and is moved vertically to capture the whole image. While it is moved, the camera vibrates, resulting in noise similar to above picture.

If there is a known reference object that spans the entire height of the picture, such as a vertical bar, this is simple enough to solve.
But can you detect and correct this sort of noise if there is no fixed object in the picture?

If that is not possible, what if you assume some limits for the noise: the approximate amplitude and frequency can be known, but not the phase. Is there a solution under these constraints?


texts:
I'm reading a blog about extracting MFCCs features for Machine Learning applications, but I didn't understand the following points about the mean normalization:

  To balance the spectrum and improve the Signal-to-Noise (SNR), we can simply subtract the mean of each coefficient from all frames.

mfcc -= (numpy.mean(mfcc, axis=0) + 1e-8)

What does he mean by "balance the spectrum and improve the Signal-to-Noise (SNR)"?
Before feeding the MFCCs features to my neural network, I'm doing min-max normalization for the whole features in the dataset instead of normalizing each file alone (like what the author does above), and I'm not sure which method gives more accurate results.
Why did he add the epsilon value 1e-8, and didn't divide by the standard deviation?


texts:
FOR CONSISTENT ESTIMATION OF PSD

Let, $x_i(n)$ be a sequence of random variables for $i=1,2, ... , K$ uncorrelated realizations and $\widehat{P}_{(i)}^{per}(e^{jω})$ is their corresponding periodograms. Then, the average of these periodograms is -

$$\widehat{P}_x(e^{jω})=\frac{1}{K}\sum_{i=1}^K\widehat{P}_{(i)}^{per}(e^{jω})$$

Let, $x_i(n)$ be a WSS process also.

Question:

Are the following relations correct?

$E\left\{\widehat{P}_x(e^{jω})\right\}=E\left\{\widehat{P}_{(i)}^{per}(e^{jω})\right\}$
 and $Var\left\{\widehat{P}_x(e^{jω})\right\}=\frac{1}{K}Var\left\{\widehat{P}_{(i)}^{per}(e^{jω})\right\}$

I found these two equations in my textbook (Statistical Digital Signal Processing and Modeling, Monson H. Hayes, Page 412).

I am failing to understand these relations (meaning I don't get how you derive them). Can someone please explain them for me?


texts: why is the z transform transfer function 1/(z-1) called an integrator?

texts: I am reading up on delta sigma modulators and there this term $\frac{1}{z-1}$ that appears repeatedly and is referred to as an "integrator".  Why is this so ?


texts: If exponentials are eigenfunctions, where does the transient term come from?

texts:
Here you can see that the transfer function applied to a cosine input will give you a sinusoid and a transient term:

$$
x(t) = \underbrace{(x(0) + x'(0))(2 e^{-t} - e^{-2t}) + \frac{2}{5} e^{-t}  - \frac{1}{2}e^{-t}}_{{\rm goes\ to\ } 0 {\rm\ as\ } t \rightarrow \infty }\ \ \  + \frac{1}{10} \cos(t) + \frac{3}{10} \sin(t)
$$

However, I don't understand how this can be, aren't exponentials eigenfunctions of LTI systems? so how come it can give an extra (transient) term?

At the same time it makes sense that it has a transient term from the CF of the function. How do I reconcile this?


texts: EOG artifacts turn up in several ICA source signals

texts:
I try to remove EOG artifacts from my EEG signals (I am using a EPOC+ for recording and MNE Python for processing).

Therefore I've recorded test data with blinks every 5 seconds. The blinks can be seen clearly in the EEG data. The data have been recorded with 128Hz, bandpass filtered (1-30Hz) and resampled (64Hz).

After running the ICA ('fastica') the blinks clearly show up in 3 source signals (IC #0, #1 and #2). I have the same behavior for different amounts of ICs.

I think the blinks are to strong and that's why they spread in more than one source signal.

I wonder if there is a way to let the blinks only show up in 1 source signal?


texts:
I'm currently working in a project as apart of a student team.
Setup
A platform is attached (placed over and screwed) two 1 Kg load cells in order to measure the weight of the system. A vibration motor is also a part of the above mentioned system.
Problem
The load cells, coupled with the entire setup causes noise while the vibration motor is switched on, preventing me to take real time data from the load cells, which is something I require.
What I think
The mechanical stresses get amplified by the vibration motor, giving me erroneous readings. (because the load cells itself don't cause too much problems when tested separately)
Are there any filtering techniques I could use in order to be able to get better real time data from the load cells?


texts: Understanding the Bilateral Filter - Neighbors and Sigma

texts:
I have been reading about the Bilateral Filter in - Fast Bilateral Filtering
for the Display of High Dynamic- Range Images and have felt crippled and confused while understanding its working and the parameters.

In the equation for Bilateral Filter given as

How to determine the number of neighboring pixels?
Are all adjacent pixels the neighboring pixels? (top, right, bottom, left, diagonal)
What does it really mean when people say the following (underlined):

Please help me understand this. I feel lost as I try to understand and gain an intuition of the Bilateral Filter.

I plotted a graph of the Gaussian function (y-axis represents the value of Gaussian function;) with three-sigma values 0.2, 0.5 and 0.9 to help me understand but got nothing.

(blue = 0.2, green = 0.9)


texts: Effectively extracting “real” data from a noisy dataset

texts:
This question was originally posed to Math SE. It was suggested that DSP SE would be more suitable.

Background & Motivation:
I have three lists of timestamps (UNIX timestamps, plus a subsecond part (e.g. 1451606400.9475839201)). They are not necessarily of the same size, however they are ordered. Each such list corresponds to a real-life instrument, of which there are three. The instruments in question record a time stamp each time they observe an "event". We may assume that their clocks are synchronized.
The issue is that the instruments are so sensitive, they record timestamps very frequently (on the order of 10 Hz), and only a small portion correspond to actual events. It is difficult to put a number on precisely how many timestamps are real events (perhaps a handful per year).
Further, the instruments are close in proximity, so if one instrument "sees" and event, the other two almost certainly do as well. The clocks are precise enough to record the difference in observation time, even over miniscule differences.
The data is for one year, the same year for each of the three lists. We may assume that the "random" timestamps are uniformly distributed. There are, however, gaps in the data (e.g. maybe all three instruments were off for the months of March, April, May). The gaps will be the same for all three lists.

Goal:
Using only the timestamps, I want to attempt to find those which are "likely" to correspond to a "real" event, such that further analysis can be conducted. The "events" in question are light signals, so I can restrict my search to only those for which the difference in observation for some triplet of timestamps is less than the transit time between two observers.
My first inclination was to, from the three lists, produce a list of triplets, one timestamp contributed by each list, such that $max(A,B,C) - min(A,B,C)$ was minimized. Unfortunately, this found very few "triplets" which a) fell in the restriction mentioned previously and b) corresponded to "real" events. I mentioned previously that there are very few events, however I expect there to be far more than what this found.
I then tried doing the above, but minimizing the $\chi^2$ error, which I defined for some triplet $A,B,C$ (one from each list/instrument) as $(A-B)^2 + (A-C)^2 + (B-C)^2$. This found even fewer "triplets", and no real events.

Problem:
What techniques can be used to extract "coincidences" (the "real events") from a set of more-or-less uniformly distributed data, where there is far more random than "real" data? Here, we assume that I have access only to the timestamps.


texts:
Compute the IDTFT of the following signal:

  $$X(\Omega)=\sum_{k=-\infty}^{+\infty}\left(u(\Omega+\pi)+u\left(\Omega+\frac{\pi}{4}\right)-u\left(\Omega-\frac{\pi}{4}\right)-u(\Omega-\pi)\right)\star \delta(\Omega-2k\pi)$$

Using the IDTFT definition, I obtain:

$$x[n]=\frac{1}{2\pi}\int_{-\pi}^\pi X(\Omega) e^{j\Omega n}d\Omega = \frac{1}{2\pi}\left(\int_{-\pi}^{-\frac{\pi}{4}} e^{j\Omega n}d\Omega + 2\int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} e^{j\Omega n}d\Omega + \int_{\frac{\pi}{4}}^{\pi} e^{j\Omega n}d\Omega\right) = \frac{1}{2\pi jn}\left( e^{-j\pi n/4} -e^{-j\pi n} +2e^{j\pi n/4} -2e^{-j\pi n/4} + e^{j\pi n} -e^{j\pi n/4} \right) = \frac{\sin(\pi n/4)}{\pi n}$$

However, from the transformation table we know that this $x[n]$ has a different transform:

$$X_d(\Omega)=\sum_{k=-\infty}^{+\infty}\left(u\left(\Omega+\frac{\pi}{4}\right)-u\left(\Omega-\frac{\pi}{4}\right)\right)\star \delta(\Omega-2k\pi)$$

which is clearly different from $X(\Omega)$. So, I am asking: what have I done wrong here in this IDTFT definition application?


texts: Question regarding sampling rate of sine wave

texts:
I am trying to determine my sampling rate, or the delay between each sample, but I am a little unsure if my math is correct.
I have generated a sine wave
f = 1000 Hz
which gives me T = 1 ms
I am sampling the sine wave and imported the data into matlab.
From the graph I can see that I have 51 samples per period.
I then calculated the time between the samples to:
T / 51 = 19.6 us
But I am wondering whether this is the correct way to do so?
Thank you in advance.


texts: Merge ECG with EMG data to form one signal using FFT

texts:
I was thinking of merging two signals, each with different units (one with BPM, other with mv), to form one single signal. For this, I thought of converting both the signals to frequency domain via FFT to take care of the difference in units, and once converted to frequency domain merge them together by some stacking algorithm. My final goal is to identify pockets of energy concentration by viewing the time and frequency together in a single spectogram (formed by merging the two signals).
Please bear with my ignorance, I am really new to signal processing and still trying to make sense of the basic things. My question is - is the method I described above an acceptable way to merge  two signals with different units of measurements? I can imagine that there could be some fundamental issues in trying to merge signals from different sources, with different units.But I am not sure what these could be.
Please share your thoughts and links to papers/codes, if you are aware of methods for solving my requirements. Thanks in advance for reading this note.
Regards,
Jira


texts: FMCW radar: Linear phase change determination with sinusoidal decomposition

texts:
I am struggling to understand how linear phase shift can be determined with a transform whose main purpose is to determine frequencies rather than rate of change of a function.

In FMCW radar, received signal corresponding to a chirp is passed through a mixer and the resulting beat frequency is sampled by means of ADC. The samples are stored in a row of a matrix. Similarly, samples from  other chirps are stacked up in corresponding rows. Different objects at different locations produce different frequencies (thanks to Doppler). So a FFT of each row yields dominant frequency bins. The frequency bins directly relate to object range. Absolutely fine so far.

Assuming that these objects move (and slowly), they must continue to appear in the same frequency bin (column)for all of the chirps. But since they are moving, the phase of the frequency component must change. For simplicity, we assume that the magnitude of all frequency components in a column is constant.

Thanks to Shift Theorem, a signal delayed/advanced in time results in a phase shift of the frequency components of the time domain signal.

Question-1: Am I right in assuming that a constant velocity results in a LINEAR phase shift of the frequency component across chirps?

Question-2: If the phase shift is linear, how can FFT along a column determine the same? FT/DFT essentially performs decompositions in terms of basis sinusoids. But in our case, we are interested in calculating the slope of the line (or rate of change or derivative) representing the phase-shift change across chirps. Derivative is not same as frequency. I think we need a Non-sinusoidal decomposition hich can yield various slopes. But second-stage FFT along the column seems to work.

What have I misunderstood?


texts: relationship between energy and sampling rate

texts: Excuse my silly question, but i really want to know does changing the sampling rate affects the energy (bandwidth) of a signal? therefore improves cross correlation output?


texts: Frequency Domain Equivalent to Zero-Phase Filtering (`filtfilt`)

texts: Related to this question by @Molem7b5, what would be the frequency domain equivalent (filter implementation through overlap-add of DFT's) for a zero-phase filter as implemented with MATLAB/Octave/Python scipy.signal filtfilt command?


texts: what is the theory behind matlab butter function?

texts: I would like to know the theory behind matlab butter function. Is there any book which gives clear idea on how it works. In future I would like to calculate the coefficients manually.


texts: Are there any computer vision algorithms specifically targeting depth images?

texts:
I've been looking into marker detection algorithms to use with a kinect based application, and the majority of the work I've been able to find is obviously focused on feature detection in 'normal' images.

However, the kinect hardware provides (essentially, once you've adjusted) an 11-bit depth value per pixel.

This depth image also has various visual artifacts in it from the shadows cast around the edges of objects (see for example the strong black border in this video http://www.youtube.com/watch?v=-q8rRk8Iqww&feature=related).

While some traditional machine vision techniques (eg. edge detection) work well with this, others don't, and it seems like there's little information on the net discussing this.

As a simple example, using the depth value makes it trivial to detect the orientation of a marker block once you've located it.

So, has anyone seen any discussions / papers / etc. that cover processing a depth image for feature detection?

Can anyone recommend a good algorithm for detecting "depth" markers (effectively origami blocks instead of printed b/w markers)?

What I've done so far has been adhoc experimentation using opencv to process the images, but  that's no where near stable or fast enough.

If you link to a commercial machine vision product without some kind of trial, please mention in your answer why you think it's appropriate.


texts: Synthesize Digital Filter with Arbitrary Frequency-Response

texts:
fdesign.arbmagnphase is a MATLAB built-in function that will create a filter that best fits the frequency-response that it is given.

I'd like to implement a similar function in Python. What algorithms are used to synthesize filters based on an arbitrary frequency response?


texts: Where can I find information about how to implement IIR filters on micro-controllers?

texts:
I am trying to implement an IIR filter on a LPC1769 (I don't know if it's relevant). I already have the H(z) so all the design part is prety much solved. What I am looking for is information about:

How to select an appropiate word lenght for the coefficients, acummulator, etc.
How to select the most appropiate structure (parallel,cascade, direct forms, indirect forms....) (or some guidance at least)
Some understanding on how to avoid overflow (scalling the coefficients or signal)
A deeper explanation of the fdatool parameters than the one given in real-time digital signal processing.
etc....

I've been using the fdatool of matlab to play around with the quatization of the filter. But I don't know the implications of these or what they actually mean.

I've also been reading a few chapters of this book: real-time digital signal processing : implementations and applications sen m. kuo, but I am looking for more detail in these implementation aspects. So could you tell me of some book, application note, paper or whatever that explains these issues?

I am triying to implement an A-weighting filter (the transfer function is in the link). The application is mainly taking data from the adc, perform the A-weighting and taking the RMS value of this signal.


texts: A 10-seconds digital reverb with very few memory (64KB)

texts:
I'm currently thinking about the design of a low-cost digital reverb guitar pedal, using a Teensy or Arduino.

My goal is to achieve big 10-seconds long reverb.

If I implement reverb with a mix of many delay lines, this will require to store in RAM at least 10*44100*2bytes ~ 0.8 MB of audio data (44.1Khz, 16bits, mono), so it seems to be impossible to achieve with a 64KB RAM board (am I wrong?).

My question: Is there a more clever way (using FFT ? overlap-add stuff, or anything else?) to implement 10 seconds reverb with very little RAM (64KB)?


texts: texture matching between patches of an image

texts:
I have an image A which I have divided into 4 x 4 subband images. For a given patch P1 in image A, I need to find another patch P2  in the same image A which is most similar: have same texture.

Till now my appraoch is to create feature vectors Fi for all i patches and using Euclid's distance formula find out which patch's feature vector is closest to given patch P1's feature vector.

Currently I have added following features:

  Mean & Standard Deviation of brightness (using L channel of LAB colorspace)
  Mean & Standard Deviation of color values in A channel of LAB colorspace
  Mean & Standard Deviation of color values in B channel of LAB colorspace

Although I am getting similar patches but I still think the matching can be improved if I incorporate more prominent features (which I'm unaware of).

Following are my queries:

  I have a doubt whether this is a good way to compare color between two patches.
  Please suggest some more good features which can be helpful to get a proper differentiation.
  Although most of my images are proper but are there any restrictions/drawbacks with the approach if image is dark and/or noisy? If yes, is there a good alternative approach or
  feature(s)?

Please help!


texts:
Let's say I have an audio sample, whose pitch is known to be C4 (don't wanna go in detail here, let's say I just sampled a tuned piano playing the C4 key).

The rules of the game are: I can only change the sample playback rate by any ratio. No pitchshifter module, no frequency analysis. If I set the playbackrate to 2.0, for example, the sample is played back at twice its speed. If I set it to 0.5, the sample is played back at half its speed, and so on. This changes the playback time as well as the sample pitch.

If I wanted to generate any arbitrary "note" from this sample, what is the relation between the playback rate and the sample pitch? For example, I know that C4 fundamental frequency is 261.63 Hz. What playback rate should I set to make the sample "sound like" a C#4/Db4 (277.18 Hz) or a D4 (293.66 Hz)? What is the general, formulaic, relationship?


texts:
i applyed hough transform in my image and this is the result of hough table,  i must get the maxima of rho in two basic angles of theta , the one is around -65 : -60 and the other is round 30:35

How can i get them?
I tried the below code about hough but the houghpeaks function returns all the maxima peaks in the hough table. I want to detect the two basic angles as you can see

[hough,theta,rho] = hough(negfillHoles,'Theta',-90:1:89,'RhoResolution',2);
lenHough=length(hough(:));
maxpeaks=lenHough; %10000;
peaks = houghpeaks(hough,maxpeaks,'threshold',20); %50
x=theta(peaks(:,2));
y=rho(peaks(:,1));
plot(x,y,'o','color','r');

I will really appreciate your help, it is a matter of life or death to find this answer for my home work


texts:
I am facing a problem which I could not find any robust solution for . Assume we have a signal, $x$, composed of sum of a few sinusoidal.  e.g. $$x=A_1\sin(\omega_1t+\phi_1)+A_2\sin(\omega_2t+\phi_2)+A_3\sin(\omega_3t+\phi_3)+\ldots +A_n\sin(\omega_nt+\phi_n)$$
We have sampled the signal,  ($30\%$) of samples are high resolution 10-Bits and the other $70\%$ are low resolution 3-4 Bits samples.

Also,assume a sub-set of frequencies are known(for example $\omega_1, \omega_5$ and  $\omega_{10}$ out of $\omega_1,\ldots , \omega_5$ are known).

How can we reconstruct the original signal?
Is there any method which can reconstruct the signal from these samples?

Moreover, we have these assumptions:

The sinusoidals have unknown amplitudes ($A_n$)
of course, we know when the high resolution samples occur
We know maximum number of possible independent frequencies in the
summation
and spacing of sampling of high resolution sampling is reconfiguration
and can be programmed to be regular or random (whichever is
suitable?)

For examples, the below is a signal sampled uniformly at Nyquist rate($50\textrm{ Hz}$), with two components of $25\textrm{ Hz}$ and $12\textrm{ Hz}$. Green samples are high resolution samples, red samples are samples with considerable error (low resolution) and the blue curve is the original signal.

Following code provides an example of mentioned data:

Fs=1000; %sampling frequency
t=(0:800).*(1/Fs);
x=0.5*sin(2*pi*300*t)+0.6*cos(2*pi*460*t)+0.2*cos(2*pi*60*t)+0.8*cos(2*pi*40*t)+1.6*cos(2*pi*12*t); %Original Signal
NoisySample=x+0.1*randn(size(x));           %Uniform Noisy Samples
ClearSamples=x(1:10:end); %Clear Samples

I would appreciate any hint and direction.


texts:
I am simulating an impulse signal of a resonant bearing fault with this formula:
$$
y(k)=\sum_r A_r \sin\left(\displaystyle \frac{2\pi f \left(k - rF/f_m\right)}{F}\right)\cdot e^{\displaystyle-\beta(k−rF/f_m)/F}
$$

where:

Amplitude signal $A_r =1.5$
Resonant frequency $f =2000$
Sampling frequency $F=10\cdot 10\cdot 3$
Characteristic fault frequency $f_m =50$
Decay factor $\beta =500$

What I can't figure out is the interpretation of $r$ in this equation and why is the sum of this term. If someone understands it please help and also what value of this $r$ should I consider.

The signal should look like:

EDIT:

I am adding the Python code for the function, it goes right for value of r=0 also I'm not adding any r. I cant understand the interpretation of this.

#Parameters:
Ar= 1.5   #Amplitude
f = 2000    #Resonant Frequency in Hz
b=500       #Exponential decay factor
fm=50      #Fault characteristic frequency
F=10*10**3  #Freq. Sampling
Tot_samples=20000
r=0

def y(k):
    t=(k-r*F/fm)/F
    exp=np.exp(-b*t)
    sin=np.sin(2*pi*f*t)
    return (Ar*sin*exp)
#Create the summatory of r
_y=[]
y_signal=[]
for j in np.linspace(0,200,200,endpoint=False):  #only first 200 points of
the impulse
    _y.append(y(j))
plt.plot(_y)
plt.show()


texts: A signal $g(t)$ is passed through a squaring device and then through an LPF such that bandwidth of the LPF tends to 0

texts:
I am solving a question, where a signal g(t) is passed through a squaring device and then through an LPF such that bandwidth of the LPF tends to 0.

I understand that since for this filter the bandwidth, $ \Delta f \to 0$ , the transfer function is practically an impulse. I also understand that the width of the impulse should be $ 2 * 2 \pi \Delta f = 4 \pi \Delta f $. But I don't understand why the transfer function is expressed as $ 4 \pi \Delta f \delta(f) $, that is, why is it expressed as an impulse function of area $4 \pi \Delta f $

Here is the question and the official solution to the question:

  Solution:


texts: What is the filter with the less phase shift?

texts:
I have to analyze a dynamic signal but there is too much noise so I applied low pass filter but then there is too much phase shift.So what is the most reactive filter I can apply to my signal ?

Best regards


texts: Effect of One Sample Latency in Audio Application

texts:
I am dealing with a customized processor that has a processing latency of one sample (20.8 microseconds) at 48kHz Sampling rate .
What I would like to know is ...does this latency of one sample have any effect on audio application in any way ..
If yes I would like to reproduce this and see for a real time scenario.


texts: Question about linear combination of non-stationary signals

texts:
Suppose $f_1,\ f_2,\ ...\ f_{n-1},\ f_n$ are $n$ non-stationary discrete signals of same length and linearly independent. Each $f_i$ is an intrinsic mode function (IMF) of a seismic signal evaluated by empirical mode decomposition (EMD). That is, they are amplitude-modulated, frequency-modulated signals. Linear combination of these signals can be expressed as follow:

$$F(t) = \sum_{j=1}^{j=n} \alpha _j f_j(t)$$

where, $\alpha_js$ are real numbers and they are to be selected such that $\sum_{j=0}^{j=n} \alpha_j\ne0$. Is it true to claim that $F(t)$ is also a non-stationary signal?


texts:
I'm trying to find out what kind of modulation and encoding is used by my window cover remote control, aiming to implement the same on a Raspberry Pi to add a bit of home automation.

A colleague helped me sample the signal with an USRP and gave me the data files. I have examined them with Inspectrum.

I'm afraid the samples have been recorded centered very close to the frequency of the signal. I've later read that this might not be a good idea, and I think this is what causes the permanent noise you can see in the pictures. Should I center the sampling a few kHz below in the future?

Single press of the "open window" signal

Symbol rate, or rather what I guessed was the symbol rate, seems consistent at this level (around 42 bauds).

This shows frequency energy. X axis is time, Y axis is frequency (baseband). Colors have been tuned to show only the interesting power.

Detail of one of the "blocks"

Here, the last picture shows, frop to bottom: frequency, IQ (red/blue), and phase. I don't quite know what the frequency chart represents here.

Zoom on the transition between sparse to dense

The "symbol rate" doesn't seem constant here.

I have no idea what kind of modulation, encoding, bit rate, or protocol this remote uses, and right now my only option would be to blindly try all the demod blocks in gnuradio.

It'd be extra helpful if the answer could include some guidance as to how to demodulate this signal in gnuradio in order to get bits out. I think I can take it from there.

The controller is for a Velux window cover, but I haven't found any information on the web. I ultimately need to find out what chip to buy for the Arduino/rPi.

I can tell the chip has some text inscribed, but I cannot read it, seems it's worn off, but I don't have a magnifier... :/

Raw data uploaded to: https://www.dropbox.com/s/rh2k7ho68dvoxhd/data_mando3.dat?dl=0 . Sample rate is 3MHz. Data format is GNU Radio Companion default, which is IQ, each component expressed as a 32 bit float.

Update

After some more investigation this seems to be io-homecontrol protocol. It seems it hasn't been reverse engineered, it's ciphered, and no information is available. It's a two way protocol so I'll need to grab samples from full conversations (the current samples are taken with only the remote available).

This chip in theory is able to work with this protocol: http://www.analog.com/media/en/technical-documentation/data-sheets/ADF7022_2page.pdf

The consortium will not provide specs. I'm still interested in sniffing a few conversations with GNURadio and see if I can work from them. Given this, I can only recommend against io-homecontrol and Velux products.

Thank you!


texts: Which information do we get from magnitude and phase spectrum?

texts:
I am learning image processing. I want to ask very basic question related to FFT topic

  Which information do we actually get from "phase spectrum" and "magnitude spectrum" about an image?


texts: Questions on Weighted Least Square Estimation

texts:
This is a page from the book linear algebra,geodesy and gps by Gilbert Strang....
the page explains about the justification of the inverse of the of the co variance matrix of measurement vector $b$ in the over determined system $Ax = b$ as the best weight matrix for best estimate of x.

what does the line errors contained in the matrix mean?(underlined in blue color..)
how does that substitution take place marked with a blue curve...
is E{$rr^T$} = E{$bb^T$} ??

any explanation is welcome...


texts: Notch filter: differences between IIR and FIR filters

texts:
I'm trying to understand this great answer from Matt L. . It's said that "One advantage of IIR filters is that steep filters with high stopband attenuation can be realized with much fewer coefficients (and delays) than in the FIR case, i.e. they are computationally more efficient." First of all why this is true? Is this because of poles? Actually this comes from my previous question on removing 400Hz noise. There are two filters for that purpose. The first one is a FIR filter with following frequency response and pole-zero plot:

And the second one is a IIR filter:

Removing noise using the IIR filter was far better. Why this happens? According to the frequency responses, attenuation in the case of FIR filter is greater in the magnitude relative to IIR filter. Also I don't understand why zeros in the FIR filter are placed so that and how this positioning corresponds to that frequency response. I understand well the relation between pole-zero plot and frequency response for the IIR filter.


texts: How do I keep a value between known bounds in an open system?

texts:
I detect points in images with an algorithm. The only parameter is a threshold T that I can modify at each image. Such images are from a continuous video, so each one is only slightly different from the previous one. I don't know a priori how many points I get for a determined threshold, as it also depends on the content of the processed image. The whole system needs at least 20 points to continue running, but the more points I have, the more complex the process is, therefore the slower the application. I have made a scheme to represent this:

I need to maintain nb over 20 and if possible under 50 to avoid over-computation. I determined an "ideal" value at 40. I begin with T = 30, but it's only empirical. Usually, T = 10 gets too many points and T = 60 too little.

My question: How do I filter T depending on past values nb, in order to keep nb around 40 for each new image?

I precise I'm really not an expert in filtering, as you may have guessed. I'm not even sure it's a filter I need here.

EDIT: as requested in comments, here is a plot of nb for five different thresholds. Content is always the same (fixed camera), therefore variations are mostly due to camera noise.


texts:
Hello I'm trying to ocr on a special image.

I've done adaptive threshold , polartocartesian transformation.

this is my original image

this is adaptive threshold

this is polartocartesian transformation

what do you think is this image good enough for OCR or do I have to optimize my preprocessing steps ?


texts: Finding the Correlation Matrix of Wiener Filter using Matlab

texts:
I have the problem below and need to solve it using Matlab. I not a big expert in Matlab and just don't know how to implement it.
Basically, it says that
\begin{equation}
R\:=\:\left[X\left(n\right)X^T\left(n\right)\right]
\end{equation}
but just don't know how to do that in Matlab. I searched a lot on the internet and didn't find anything relevant to what am looking for.
Can somebody please help me implement this. I would really appreciate it.


texts: "Wandering" Whine in Converted VHS tapes

texts:
I am attempting to clean up the audio from several VHS tapes that were dubbed to DVDs and then ripped. My tool of choice has been audacity, but I am open to other options. I have two questions:

In some of the tapes, there is a "whine" at ~2770 Hz, again at about twice that, and again at ~3 times that (not shown in spectrogram). These I can remove with notch filters, but I am curious about their source. The exact frequency of this peak varies slightly from tape to tape, but it is consistent within a tape.
There is also a second type of whine that typically starts ~7k and gradually "droops" as the video goes on. I have been removing this with a lo-pass filter, but I want to know if there is a better way.


texts: Fourier transform of a rect*half triangle

texts:
I have to calculate the analytic expression of  Fourier transform  $$ x(t) = t{\rm rect} ( t- \frac{1}{2} ).$$ First I made the graph of these two signals and I obtained the graph I posted.

Now I wrote the analytic form of this graph that is $$ x(t) = t $$ for t from 0 to 1 and $$ x(t)=0 $$ for the rest. Now I should calculate the Fourier transform of $$ x(t) = t $$ but this should be $X(f)$ (?). My theory it’s completely wrong because my book obtained $$ X(f) = { \frac{1}{2} {\rm sinc} (f) + \frac{1}{i2\pi f}\left[({\rm sinc} (f )- \cos (\pi f ) \right]} e^{-i \pi f }. $$


texts:
I have the following code in Matlab:

fs = 1e6;

y = randn(1,100);
y = upsample(y,8);
windowSize = 8;
b = (1/windowSize)*ones(1,windowSize);
a = 1;
y = filter(b,a,y);

fft1 = fft(y);
fft1 = fft1(1:length(y)/2+1);
psd = (1/(fs*length(y)))*abs(fft1).^2;
psd(2:end-1) = 2*psd(2:end-1);
f = 0:fs/(length(y)):fs/2;
figure(1);
plot(f,10*log10(psd))

y = resample(y,7,4);
fft1 = fft(y);
fft1 = fft1(1:length(y)/2+1);
psd = (1/(fs*length(y)))*abs(fft1).^2;
psd(2:end-1) = 2*psd(2:end-1);
f = 0:7*fs/(4*length(y)):7*fs/8;
figure(2);
plot(f,10*log10(psd))

In this code I have a random noise signal and I am upsampling it and passing it through a zero order hold filter then plotting its Power spectral Density (PSD) in figure 1.
After resampling the signal to a new rate when I check its PSD in figure 2 I get some different result.
Could someone explain why is the spectrum of the resampled data different from the original one and what can I do to get the same PSD as the original signal?


texts:
Is there a definite relation between the kernel size and shape of a morphology change and the amount of pixels added or removed?

I have a case where I have a segmented image, and I need to remove x number of pixels all around the boundary of specific segmentations. I have therefore thought that a circular kernel with radius of x should be used. Then would one iteration of eroding remove x pixels, i.e., can I assume that the radius will correspond to the amount of pixels removed all around the segmentation?


texts: Why does the inverse fourier transform of a lowpass filter have complex components in matlab?

texts:
I am quite confused whether the following numerical differences i find are just severe round off errors made by matlab, or something i am doing wrong. The following happened when trying to see what a low pass filter looks like in the spatial domain.
By mathematics, the inverse fourier transform of a real symmetric image ($I(x,y) = I(-x,-y)$, where $I$ gives the value of the image at the given pixel) should again be real-valued.
However, when starting out with a low pass filter I defined as a disc of ones centered around the origin, surrounded by zeroes, the matlab command ifft2(ifftshift(I)) gave an image with pretty nontrivial complex component.
When explicitly telling Matlab to utilize the symmetry, the command ifft2(ifftshift(I),'symmetric') did indeed give a matrix with only real entries. However, the numerical difference between the two commands was pretty big compared to what i expected: Letting $I$ be our symmetric image in the frequency domain, i entered the following commands:

J = ifft2( ifftshift(I) );
K = ifft2( ifftshift(I), 'symmetric' );
mean(mean(abs(real(J) - K)))
ans =
3.2851e-04
mean(mean(abs(K)))
ans =
7.4830e-04

as you see, the difference between the real part of J and K is not that big per se, but it is big compared to the mean values of K. So it is quite nontrivial.
Questions: 1. Why do these complex components show up in J? Are they really round off errors made by Matlab?
2. Where does this numerical difference come from when i use this 'symmetric' command? Again just round of errors?
3. In practice, when dealing with symmetric real matrices (or more generally conjugate symmetric matrices), is it advisable to use the 'symmetric' command?
Thanks a lot!


texts: Curved noise floor and ugly unexplained peaks after FFT

texts:
It has been so long since I studied this at University, so I'll better ask here if I'm doing something really wrong here.

I'm using a USRP frontend for L1 band surveillance. I want a 20MHz bandwidth, but I found through testing that it's better to use a sampling frequency slightly higher than twice that bandwidth (I'm using 41MHz), so I can use a local oscillator to move the DC out of the spectrum. Probably there is some additional error of concept here, but this isn't the problem I'm facing now.

First thing to note: I'm using an FFT over a big chunk of data. Depending on the configuration this size may vary, but for example I'm currently using 8192 samples per FFT. Maybe this is too much and I should compose the whole FFT using many smaller ones, somehow?

In order to reduce noise, I'm performing 100 of these FFTs, summing their outputs and dividing by 100. Probably there's a better method, but so far ok.

After I apply the FFT (with FFTW library), I convert the output to dBW/Hz with the following formula (I'm assuming I have Vpeak):

10 * log10(psd_output / (2 * 50 Ohm)) - 60

Now, if I plot this vector, I get something like this:

The noise floor is getting some curvation (up to 5 dBs). I tried applying a hamming or a blackman-harris window to the FFT output with the hope or removing this effect, but it didn't work.

If I test with a jammer, I can see the peak, but I also see some other minor peaks which are unwanted (and that are not seen in an spectrum analyzer with the same configuration):

What am I missing? These should be simple operations, but I'm out of ideas at this point.

EDIT: Adding other plot


texts: Hidden Markov Model for Speech Rcognition. HMM Number of States

texts:
This is a question that came to mind as a result of a previous question Hidden Markov Models - Distinct Observation Symbols and subsequent answer from @pichenettes.

One approach to speech recognition is to use Hidden Markov Models (HMM) to identify patterns in speech.  Both discrete HMM models and continuous HMM models have been used, but the continuous HMM approach seems to produce better results.

In continuous approach, the “input” to the HMM models is a series of vectors constructed from frames of processed speech.  So speech as processed in blocks of some time length resulting in vectors of some fixed dimension say N, with the size of N being directly related to the frame length.

My question is this:

Is there a relationship between the frame length (or alternatively the dimension of the vectors, N) and the number of states resulting in the HMM models used for recognition?

Also  is there a relationshiop between the number of HMM models required to predic speech and the size of N?


texts: Palmprint Identification - Why do we align the images before we use the Fourier Transform?

texts:
I was reading the paper PALMPRINT IDENTIFICATION BY FOURIER TRANSFORM by WENXIN LI, DAVID ZHANG and ZHUOQUN XU about identifying persons based on an image of their palm.

The first step in their identification algorithm consists of aligning and pre-processing the image since they spent a few pages on that front, this gave me the impression, that this step is kinda important.
What I didn't understand however: Why do we do this? The essential part in my opinion is the Fourier Transform afterwards, that is used to extract/generate the feature. But from my understanding, this should even work without this aligning/pre-processing step.
I have found a property of the DFT that states that rotating the spatial domain contents rotates the frequency domain contents, can be read here.
In order to extract features, some rotation might be necessary, at some point. In my opinion however, this does not justify to think up such an elaborate method of aligning/preprocessing the image, there has to be more behind that.
Therefore, I am most likely overlooking/missing something. Thanks in advance.


texts: Grayscale/Brightness Resolution vs Contrast

texts:
A bit of noob question, but can't find a definite answer anywhere:

What is the difference between Gray-scale resolution of an image and the Image contrast.
Are they different terminology for the same thing?


texts: What Are Different Approaches to Realize a Gaussian Blur (Smoothing) Step on an Image?

texts: Could some review some methods to apply Gaussian Filter (Blur) on an image besides the direct one using Truncated FIR (classic convolution with Truncated Kernel) approximation?


texts:
How viable would it be to classify the texture of an image using features from a discrete cosine transform? Googling "texture classification dct" only finds a single academic paper on this topic, using a neural network.

For my application, I have a large corpus of labeled images, in which the entire image is a consistent texture (e.g. close-up shots of a blanket, tree bark, a grassy field, etc).

Inspired by a response to a previous question, I was considering the following approach:

split up each image into NxN blocks of pixels
take the DCT of each block
flatten each DCT into a 1xM array and feed it to a K-Means clustering algorithm, and get the cluster label for each DCT
calculate a histogram of clustering labels for each image by counting each label per image from #3
train a SVM classifier by feeding it a set of [(histogram,image label)]

How well would this work? I implemented a similar system, using features extracted via the SIFT/SURF algorithms, but I was only able to get about 60% accuracy.

In what other ways could I use the DCT to classify textures?


texts: Removal the DC Component of Gabor Filters

texts:
I recently was studying gabor filters and came to know that they have a shortcoming that they do have a minimum but some reasonable dc component.
now my question is why is it necessary to remove the dc component (using log gabor).

If there are any other limitation of gabor filters then please do tell me.
thanks..


texts: What is the correct gain of an RRC Filter?

texts:
Breaking my brain all morning with this reading previous questions and googling ...
I have made an RRC filter from the equation on wikipedia. It works fine and I compared it to commpy library in python.
But what I dont understand is the frequency amplitudes.

Should the RRC filter have normalised gain, i.e. 0 dB by dividing the
impulse response by sum(impulse response)?
Or should I be dividing
the FFT result by fftsize?
Or should I infact be doing neither of
these two?

I browse the internet and many images have lots of different gains, none of which I can recreate ... but I can recreate the impulse and general frequency shape. The frequency response is just not shifted vertically correct (in dB scale) to show same gain as other images. What am I missing :(
#Define all parameters needed for RRC
alpha = 0.35
Fs = Fs
span = 10
sps = 10
num_taps = span*sps
Rs = Fs / sps

#taps must be odd for impulse to be symmetrical on time zero
if not num_taps % 2: num_taps += 1

#time vector
t = np.arange(-((num_taps-1)/2) , (((num_taps-1)/2)+1) , 1) * (1/Fs)

#Root Raised Cosine and deal with special cases
h = np.zeros(len(t))
for element in enumerate(t):
    i,x = element #i holds array index, x holds value of t
    if x == 0:
        h[i] =  (1 - alpha + (4 * alpha / np.pi))

    elif (alpha != 0 and x == (1 / Rs) / (4 * alpha)) or (alpha != 0 and x == -(1 / Rs) / (4 * alpha)) :
        h[i] = alpha / np.sqrt(2) * ( ((1 + 2 / np.pi) * np.sin(np.pi / (4 * alpha))) + ((1 - 2 / np.pi) * np.cos(np.pi / (4 * alpha))))

    else: #not special cases
        h[i] = (np.sin(np.pi * x * Rs * (1 - alpha) ) + \
                4 * alpha * x * Rs  * np.cos(np.pi * x * Rs * (1 + alpha))) / \
                (np.pi * x * Rs * (1 - (4 * alpha * x *Rs) ** 2 ))

h = h # / np.sum(h) #Should I divide to normalise gain?

#Fourier Transform
fftsize = 4096
f = np.linspace(-Fs / 2, Fs / 2, fftsize)

H = np.fft.fft(h,fftsize)  #Should I divide by fftsize here?!
H = 10*np.log10( np.abs(H)**2)
H = np.fft.fftshift(H)

#Make the plots
fig = plt.figure()
ax = fig.add_subplot(211)
ax.title.set_text('Raised Cosine Impulse Response')
ax.plot(t,h)
ax.grid(True)

ax = fig.add_subplot(212)
ax.title.set_text('Raised Cosine Frequency Response')
ax.plot(f,H)
ax.grid(True)


texts: How to reliably detect the state (opened or closed) of sliding doors from a statically-positioned video stream

texts:
I have a mounted (static) camera that has a view of a set of sliding doors.  Since doors are rectangular in nature, and they don't have many degrees of freedom, this seems like a problem that should be relatively easy to solve reliably.  Here are some sample views (the door outlines in red I drew for illustration purposes, they are not detected by an algorithm):

First, here is a view of the sliding doors being closed:

Next, here is a view of the sliding doors being opened:

Finally, here is a view of the sliding doors opened but with occlusions:

My original thought was something around a hough transform, but I feel like there is likely a better solution to be had, given the knowledge that the doors can really only slide along one axis.

Reiterating my question, how can one reliably detect whether sliding doors are opened or closed from a video stream like the one in my images?


texts:
Let's say I have a $\mathcal Z$-transform that represents some transfer function and its has some ROC.

My question is how do I know if this system is causal?

I know that if the ROC contains the unit circle in the complex plane the system is stable and it has DTFT but I don't know how I can evaluate the causality. This also applies to the continuous domain, I believe the system is causal if the ROC is right sided, for example, $\Re(\sigma)>1$ but I also don't know why.
(All of this for LTI systems)


texts: Filter image in Fourier space imaginary components after ifft (R)

texts:
I want to high-pass filter an image in Fourier space. It works but the retransformed image has an imaginary part, what shouldn't be the case http://math.stackexchange.com/questions/867337/how-to-interpret-the-imaginary-part-of-an-inverse-fourier-transform. I have two questions:

Is that a problem?
How can I fix it?

Here is my code:
I work with the IMAGER-Package for loading the image and for the Fourier transform

The original image imLenaGr has dim 512/512 (Image plotted at the end).

Transforming the image to Fourier space

lenaFFT <- FFT(imLenaGr)

Transform to matrix and rotate the image so that low frequencies are in the middle

lenaFFTMa <- matrix(complex(real = lenaFFT$real,imaginary = lenaFFT$imag), nrow = 512, ncol = 512)

lenaRot <- fftshift(lenaFFTMa)

Calculating the amplitude for plotting purposes

ampLena <- lenaRot %>% Mod() %>% log()

Creating the filter

heigthM <- height(lenaRot)
widthM <- width(lenaRot)

# Creat empty filter matrix
filMa <- matrix(nrow = heigthM, ncol = widthM)

# Create matrix with values indicating distance from the midpoint of the matrix
distMa <- filMa

for(x in 1:widthM){
  for(y in 1:heigthM){
distMa[x,y] <-  sqrt((x - (widthM/2 + 0.5))^2 + (y - (heigthM/2 + 0.5))^2)
  }
}
# I also tried it with sqrt((x - (widthM/2))^2 + (y - (heigthM/2))^2) but it didn't work

# finding the cut-off-distance
cutOff <- max(distMa) * 0.03 #0.03 cut off value

# Creating a butterworth filter
for(x in 1:widthM){
  for(y in 1: heigthM){
filMa[x,y] <-  1 - (1/(1 + (distMa[x,y]/cutOff)^11))
  }
}

Then I multiplicated the Fourier image with the Filter

lenaFilFftRot <-lenaRot * filMa

Afterwards, I rotated and transformed the image back.

# low freq to the edge
lenaFilFft <- ifftshift(lenaFilFftRot)

# transforming back
lenaFil <- FFT(im.real = Re(lenaFilFft) %>% as.cimg(), im.imag = Im(lenaFilFft) %>% as.cimg(), inverse = TRUE)

My problem is now that I have a not insignificant imaginary part

range(lenaFil$imag)

1 -0.02229874  0.02248397

I tried it without filtering and then there was no problem. So the problem must be the filter. I read that the filtered fft has to be complex conjugate. But as I am not from a technical or mathematical field, I don't know why applying my filter violates this assumption.

Images:

Thank you for your help.


texts: Hidden Markov Models - Identifying Phonemes

texts:
I'm developing a project that identifies Phonemes to be able to identify whether someone is saying either "Yes" or "No".

So far in the project, I have used Zero-crossings to identify what the person is saying, this works really well and seems simple enough to understand. The project, however, needs a few enhancements and has to be developed using a Hidden Markov Model.

My question is this:

I want to develop a Hidden Markov Model, without erasing the work that I have already completed. I.e. I strip the data that do not warrant consideration by counting the number of zero-crossings as well as the summation of the blocks.

I do not understand what data I would need to train the HMM in order to be able to identify these Phonemes. E.g.

With Zero-crossings I have identifies that:

Yes - Zero-crossings start low and then the value increases

No - Zero-crossings start low and then do not increase with value.

Could I train my HMM algorithm so that it interprets these values?

Or could anyone suggest a method of which I can train the HMM to be able to identify the word that is inputted in the sample?

Hope someone can help :)!


texts: Having trouble calculating the correct Gaussian Kernel values from the Gaussian function formula


texts:
I'm having a hard time wrapping my head around doppler and how it affects a digital communications signal's baud rate.  The examples that I've seen explain that the center frequency of a signal is shifted when either the receiver and/or transmitter are moving relative to each other.  What I don't understand is the why doppler also affects baud rate?  Can someone point me to some tutorials on this topic or explain?  What I'd like to understand clearly is:

Intuitively understand why this happens?
Mathematically understand why this happens?
I'd like to be able to calculate when this is something that a communications receiver has to take into account?  My guess is that based on the doppler shift that will be experienced by the receiver, in combination with the signal's baud rate, but I guess I need some hints or help to get me along with this.

This is a follow-up to this question already posted: How to estimate and compensate for doppler shift in wireless signals?


texts:
Apologies in advance for asking something so basic, this is not my field at all so I'm a bit lost where else to find this info. I'm trying to understand this piece of code that detects sudden drops in a signal, it goes something like this:
filter = [ones(1,10)*-0.05 ones(1,10)*0.05];

filterResponse = conv(exampleSignal, filter, "same");

Can anyone tell me what type of filter this is and why does it centers the signal at 0? Just anything to get me started onto more googling would be really helpful. Thanks in advance.


texts: Trying to do frequency analysis of an accelerometer output

texts:
I am new to signal processing. I have a 3 axis MEMS accelerometer. I have read its output into $\mbox{Matlab}^{\tt TM}$.
My problem is that the signal I am trying to isolate has a frequency of about 0.2Hz, but in the frequency spectrum there are no peaks in this region, there are only peaks in the region <0.1Hz.
The ODR of the sensor is set to 12.5Hz. I'm not sure if there is something wrong with my code (maybe I'm scaling the frequency axis incorrectly).
This is the code I'm using:
%% Sort Data
X=RawData{1,1}
Y=RawData{1,2};
Z=RawData{1,3};
%% Remove DC aspect of signal
X_Mean=mean(X);
Y_Mean=mean(Y);
Z_Mean=mean(Z);
XData=X-X_Mean;
YData=Y-Y_Mean;
ZData=Z-Z_Mean;
%% Sort out time and frequency scales
Fs=12.5; %sampling frequency
Ts=1/Fs; %time period
dt=0:Ts:Ts*19718-Ts; %time duration
%% Create frequency axis for plotting of Fourier transform
nfft=length(XData); %time duration of signal;
nfft2=2^nextpow2(nfft);
Nf=Fs*(0:nfft2-1)/nfft2
%% Do fourier transform
X_fft=fft(XData,nfft2);
Y_fft=fft(YData,nfft2);
Z_fft=fft(ZData,nfft2);
%% Plot Frequency spectrum
figure
plot(Nf,abs(X_fft));
title('Mag of Xfft vs freq');


texts: How i can a 1 Hz resolution fft, from a limited data (between 0 to 100 msec)?

texts:
How i can have a 1 Hz resolution fft, from a limited data (between 0 to 100 msec)?
sampling frequency is about 20 kHz or step time is 0.05 msec.
i try it by using zero padding but the resolution not satisfy me.


texts: Maximum likelihood estimator for multiplicative Gaussian noise

texts:
So I'm trying to derive an analytical solution for a MLE that should estimate a static value polluted by multiplicative Gaussian noise.

The vector of measurements $\tilde{\boldsymbol{d}}$ is given as $a[n]x_u$ where $a[n]$ is the $n$-th realization of the random variable $A \propto \mathcal{N}(\mu_A, \sigma_A)$ and $x_u$ is an unknown constant that should be estimated from $\tilde{\boldsymbol{d}}$.

I got as far as the log-likelihood function, which I now need to maximize with regard to $x$. To do this, I need to take the derivative of the log-likelihood , set it to zero and solve for $x$. However, the summation term at the end is giving me a headache as I can't figure out its derivative.

$\ell(x, \tilde{\boldsymbol{d}}) = -N \cdot \log x - N\cdot \log\sigma_A - \frac{N}{2} \log 2\pi - \frac{1}{2\sigma^2_A}\sum\limits_{n=1}^N\bigg(\frac{\tilde{d}[n]}{x}-\mu_A\bigg)^2$


texts: Component of one signal along the another

texts: Whenever we need to find component of one signal along another signal we can do so by the help of dot product. I want to as if this method is valid for all kind of signals. Are there any restrictions upon either of the signals?


texts:
Assume my reference is 1 ppm so if my transmit frequency is 400 MHz and
symbolrate is 100 kHz.

Then, my carrier will have +/- 400 Hz offset  and then my symbol will have +/-0.001 Hz offset. Similarly, the reciever carrier has +/- 300 Hz offset
and symbol  has +/- 0.002 Hz offset.

So is the carrier recovery is to track 400 + 300 Hz
and timing recovery is 0.001 +0.002 Hz ?


texts:
Some methods

#1

YData = YData / max(abs(YData));

#2

maxYdataAbs = abs(max(YData));
minYdataAbs = abs(min(YData));
YData = YData / (0.5*(maxYdataAbs + minYdataAbs));

I am not happy with neither one.

Assume that you have the following data.

Only one or two sharp peaks.
I am not happy with #1 or #2.

I am not sure anymore if the best way is to normalise to the range $[-1,1]$.

How should you normalise such a data?


texts: Noise removal from audio using FFT/Spectral editing

texts: I have a noisy recording with some letters spoken out loud. I've noticed that the noise is easily recognizable when looking at a spectrogram of the audio. Is there anyway to set a power/frequency threshold for the spectrogram, and muting the parts which do not reach that threshold? (The noise doesn't have enough power in higher frequencies, as you can see in the spectrogram)


texts: Allan variance vs power spectrum density for noise estimation

texts:
I know than we can estimate noise level (and noise colors) from power spectrum density function OR from Allan variance. Why do we need Allan variance at all for such estimation?
In my opinion PSD analysis looks much more straightforward.
More over, Allan variance can be calculated from PSD by integrating, that imply we loose some information.
Question: what are the advantages?


texts: How to predict the spectrum of an aliased/folded signal without looking at the FFT?

texts:
This seems like a trivial concept but I just can't get the hold of it. I have a signal with two complex sinusoids having frequencies -25MHz and 17MHz. Currently it is being sampled at 64MHz so I get two peaks of fft at -25MHz and 17 MHz. If I throw every other sample away the component at 17MHz shifts to -30MHz and the one at -25MHz to 14 MHz.

I know it is due to the aliasing/folding but why exactly are these frequency components present in the aliased signal? Is there any way to predict the frequency content of the aliased signal without looking at the fft? What spectrum should I get if every fourth sample is dropped (i.e. sampling frequency now becomes 16MHz)?


texts: Continuous time-domain electrical signal that only has a finite number of possible values

texts:
I have recently started learning DSP and the book that I am reading challenges the readers to find a:

  continuous time-domain electrical signal that only has a finite number
  of amplitude values

I obviously could not think of an example and hence I am here.

Please suggest an example of continuous electrical signal that takes only finite number of discrete values ?


texts: What features to use for multilayer perceptron model of an EEG signal?

texts: I have an EEG signal that I want to extract features to apply multilayer perceptron (MLP). What I should use, Fourier or wavelet coefficients?


texts: Interpreting the cross correlation results

texts:
I am new to this forum. I am just trying to understand how to calculate delay (in terms of samples) between two signals using cross-correlation function. I wrote a small Matlab code in order to understand this. But I am finding difficulty in understanding the results.
 clc;

 fm = 1000; //message signal
 fs = 10 * fm; //sampling frequency
 ts = 1 /fs;
 t = 0:ts:1-ts;

 x=sin(2*pi*fm*t);
 y=cos(2*pi*fm*t);

 [r,s] = xcorr(x,y);

 subplot(2,1,1);
 plot(r);
 subplot(2,1,2);
 plot(s);

The results obtained using this code are as follows.

From the figure, we can observe that the peak is occurring at around 10,000 sample. So, can 10,000 samples be considered as a delay (in samples) between two signals? And does the corresponding time delay is 10000 * 1/10000 = 1 sec in this case?


texts:
1. I'm generating a power signal:

Fs = 1000;            % Sampling frequency
T = 1/Fs;             % Sampling period
N = 1000;           % Length of signal
t = (0:N-1)*T;        % Time vector

X = sin(2*pi*(10)*t);

The aplitude spectrum of this signal:

Y = 1/N * fft(S); % power signal, scaling 1/N
Y1 =  abs(Y);
Y2 = Y1(1:N/2+1);
Y2(2:end-1) = 2*Y2(2:end-1);
plot(f,Y2)

If I increase the signal length to 10000, amplitude stays the same (at 1)

2. Now an energy signal:

X = ((1./(t+1).^20)).*sin(2*pi*(10)*t);

The aplitude spectrum of this signal:

Y = fft(S); % energy signal, scaling 1
...

Again: if I increase the signal length to 10000, amplitude stays the same (around 50)

3. Now a random signal:

X = randn(size(t));

If I increase the signal length to 10000, amplitude spectrum stays the same only with

Y = 1/sqrt(N) * fft(S); % scaling 1/sqrt(N)
...

It seems that noise signal is something between power and energy signal, but in literature it is called a power signal.


texts: Generating a timeseries with an arbitrary power spectrum

texts:
I need to generate random numbers with a given PSD. To do so, I found this recipe. In case it's behind a paywall, here's now it works:

Given your power spectrum $P_k$ with $0\leq k<N$ points generated using a timeseries with timestep $h$, you define

$$A_k=\sqrt{\frac{P_k}{2Nh}}\exp{(ia_k)}$$

where $a_k$ are uniformly randomly chosen in $[0,2\pi)$. The desired timeseries is then the Fourier transform of $A_k$. The idea here is that since the PSD throws away the phase information, we simply have to generate random phases for the transform to get a possible realization of the timeseries that generated our PSD.

However, to ensure that all of the resulting time points are real, the author gives the condition that $A_{N-k}=A^*_k$, or equivalently $a_{N-k}=-a_k$.

When I implement this, however, I don't get a real signal, so I seem to be doing something wrong. I see one problem right away: for $k=0$, the FFT assumes a periodic signal, so the only way to satisfy the condition is if $a_0=0$. Then you can generate the rest of the phases as follows (in python):

def gen_phase(N):
    phase = np.zeros(N)
    randoms = np.random.random(size=N/2)*2*np.pi
    phase[1:N/2+1] = randoms
    phase[N/2+1:] = np.flipud(-randoms)
    return phase

The other problem is that it is not possible to satisfy the given condition is $N$ is even, as far as I can tell. This is a pain practically, because the fft is very slow for odd numbers (particularly ones of the form $2^n+1$...)

Can someone suggest what I might be doing wrong? The signal I get looks more or less right ion terms of the amplitude, but it has roughly equivalent real and imaginary parts, so something is wrong. The rest of the code is too simple to be the culprit, I think:

def main():
    psd = read_psd()
    N = len(psd)
    phase = gen_phase(N)
    h = 0.24e-6
    A = np.sqrt(psd/(2*N*h)) * np.exp(1j*phase)
    timeseries = np.fft.fft(A)
    pl.plot(np.real(timeseries))
    pl.show()

if __name__=='__main__':
    main()

EDIT: I misinterepreted. Because $A_k$ depends on $P_k$, I don't have the freedom to choose $A_{N-k}=A^*_k$ in the first place, because I don't have control over the amplitude. Any ideas?