Representing stereo signal with complex numbers as input to DFT

For your first claim. Yes it's true. You should keep the full N-DFT complex frequency samples as opposed to half, N/2, for the real input case. And also yes, you will retain back the original stereo signal perfectly by an inverse DFT.

Whether this artificially produced complex signal adds any new information that cannot be obtained from individual channels is not very clear, however. At least from the linearity of DFT we can guess that the resultant DFT of the complexed-stereo pair will be exactly given by those individual left/right channel DFTs, and this suggests to me that, you wont be obtaining some interesting benefit here.

Keep in mind that, the (geometric) spatial relationship between a pair of stereo microphones can be investigated by a joint processing of those channels. However, a DFT alone does not care for any spatial relationship between real and imaginary part of its time domain complex input. Hence I suspect any good use of that for spatial processing.

Yet, in some cases, there may be a computational benefit due to performing a single complex input DFT instead of two real input DFTS. In such cases you are favored to do so.


You defined to compute an RMS. I don't know why you choose it, but OK. How can we probe it as a contrast measure?  If you are considering images with positive pixel values, and consider that multiplying them by a scale factor $a>1$, you extend the range, hence the contrast, or if  $a>1$, you shrink the range, hence the contrast again. How does the RMS behave? A quick computation should give you an answer.

Indeed, those are hypotheses. Honestly, I would not consider RMS as a proper measure, as it does change with a value offset, which to be is substantially iso-constrast.


Multi-channel audio upsampling interpolation

Does cubic interpolation (or any other) have any advantages over linear for the specific case of audio?

You'd use neither for audio. The reason is simple: The signal models you typically assume for audio signals are very "Fourier-y", to say, they assume that sound is composed of weighted harmonic oscillations, and bandlimited in its nature.

Neither linear interpolation nor cubic interpolation respect that.

Instead, you'd use a resampler with a anti-imaging / anti-aliasing filter that is a good low-pass filter.

Let's take a step back:

When we have a signal that is discrete in time, i.e. has been sampled at a regular lattice of time instants, its spectrum is periodic – it repeats every $f_s$ (sampling freq.).

Now, of course, we rarely look at it this way, because we know that our sampling can only represent a bandwidth of $f_s/2$, we typically only draw the spectrum from 0 to $f_s/2$, for example:

S(f)
^
|---
|   \
|    \   ---
|     --/   \
|            \------\
+----------------------'---> f
0                    f_s/2

Now, the reality of it is that in fact, we know that for real-valued signals, the spectrum is symmetrical to $f=0$:

                     S(f)
                          ^
                       ---|---
                      /   |   \
               ---   /    |    \   ---
              /   \--     |     --/   \
      /------/            |            \------\
---'----------------------+----------------------'--->
-f_s2/2                   0                    f_s/2

But, due to the periodic nature of the spectrum of something that got multiplied with a "sampling instance impulse train", that thing repeats to both sides infinitely, but we only typically "see" the 1. Nyquist zone (marked by :)

       :                    S(f)                     :
       :                      ^                      :
       :                   ---|---                   :                   -------
  …    :                  /   |   \                  :                  /       \                      …
       :           ---   /    |    \   ---           :           ---   /         \   ---
       :          /   \--     |     --/   \          :          /   \--           --/   \
       :  /------/            |            \------\  :  /------/                         \------\
-------'----------------------+----------------------'---------------------------------------------'-->
     -f_s/2                   0                    f_s/2                                          f_s

When we increase the sample rate, we "just" increase the observational width. Just a random example:

                            S(f)
                              ^
                           ---|---                                       :------
  …                       /   |   \                                     /:      \                      …
                   ---   /    |    \   ---                       ---   / :       \   ---
                  /   \--     |     --/   \                     /   \--  :        --/   \
          /------/            |            \------\     /------/         :               \------\
-------'----------------------+----------------------'---------------------------------------------'-->
     -f_s/2                   0                    f_s/2              new f_s/2                   f_s

Try that! Take an audio file, let the tool of your liking show you its spectrum. Then, just insert a $0$ after every sample, save as a new audio file (python works very well for such experiments), and display its spectrum. You'll see the original audio (positive half of the) spectrum on the left side, and its mirror image on the right!

Now, to get rid of these images, you'd just low-pass filter to your original Nyquist bandwidth.

And that's really all a resampler does: change the sampling rate, and make sure repetitions and foldovers (aliases) don't appear in the output signal.

If you're upsampling by an integer factor $N$ (say, 48 kHz -> 192 kHz), then you just insert $N-1$ zeros after every input sample and then low-pass filter; it's really that simple.

In the ideal case, that filter would be a rectangle: Let through the original bandwidth unaltered, suppress everything not from there. A filter with a rectangular spectral shape has (infinite!) sinc shape in time domain, so that's what sinc interpolation is (and why it's pretty much as perfect as it gets).

Since that sinc is infinitely long, and your signal isn't, well, that's not really realizable. You can have a truncated sinc interpolation, however.

As a matter of fact, even that would be overkill: your original audio has low-pass characteristics, anyway! (simply because of the anti-aliasing filters that you invariably need before sampling the analog audio source; not to mention that high frequencies are inaudible, anyways.)

So, you'd simply go with a "good enough" low pass filter after inserting these zeros. That keeps the computational effort at bay, and also might be even better than the truncation of the sinc.

Now, what if your problem is decidedly not an integer interpolation? For example, 240000 / 44800 is definitely not an integer. So, what to do?

In this relatively benign case, I'd go for a rational resampler: First, we go up by an integer factor $N$, so that the resulting sampling rate is a multiple of the target sampling rate. We'd do the low-pass filtering as explained above, limiting the resulting signal to its original 44.8 kHz/2 bandwidth, and then apply a downsampling by $M$, i.e. anti-aliasing filtering it to the target 240 kHz/2 bandwidth, and then throwing out $M-1$ of $M$ samples.

It's really that easy!

In fact, we can simplify further: since the anti-imaging filter cuts off at 22.4 kHz, and the anti-aliasing filter only after 120 kHz, the latter is redundant, and can be eliminated, so that the overall structure of a rational resampler becomes:

Upsampling -> core filter -> downsampling

(in fact, we can even apply multirate processing and flip the order, greatly reducing effort, but that'd lead too far here.)

So, what are your rates here? For 44800 Hz in, 240000 Hz out, the least common multiple is 3360000 Hz = 3360 kHz, that's up by a factor of 75, low pass filter, and then down by 14. So, you'd need a 1/75 band lowpass filter. It's easy to design one using python or octave!


periodicity of constant discrete time signals

normally, "$n$" is the symbol we use here for discrete-time.  if your professor said that:

$$\begin{align}
x[n] &= e^{i10 \pi n} \\
 &= e^{i 2 \pi (5n)} \\
\end{align}$$

is not periodic with a period of $1$ (assuming $n \in \mathbb{Z}$) or a period of $\frac15$ (assuming $n \in \mathbb{R}$), then your professor is mistaken.


Analyze stability of a closed loop system with Bode

1) To determine if a system is stable by looking at a bode plot, generally, you just need to look at two things: Gain Margin and Phase Margin.

First find the frequency at which you phase plot reaches -180 degrees. In this case, it is 18.6kHz (I am inferring this from the pictures you sent because the plot covers up this crossing). Then find the gain at that frequency, which is -51.9dB. Invert that number and you have your Gain Margin, which is 51.9dB.

Second find the frequency at which the magnitude plot hits 0dB. This would be 3.54kHz. Then find the phase at that frequency, which is -100.4 degrees.Your Phase Margin will be 180 degrees plus this number, so 79.6 degrees.

The reason we find these two numbers is because we want to find out if the system will increase over time as it oscillates. When your signal hits -180 degrees, it has finished an oscillation (-180 degrees = 180 degrees). If you have positive gain when this happens then you signal increases with every oscillation, to infinity, which is unstable.

So if your Gain and Phase Margin are positive numbers then you know you have a stable system.

2) For the above reason, you closed loop system looks stable, but there might be a part of you bode plot you are not showing/is being covered up.


Hint:

Derivative in frequency property of FT:

$$\frac{d}{d\omega}jF(\omega) \rightarrow tf(t)%$$

Time shift property of FT:

$$f(t-\tau) \rightarrow F(\omega)e^{-j\omega t_o}$$

FT of rect:  $F(\omega) = sinc(\omega/2)$

For practice if you are learning FT I recommend deriving the properties above to confirm you can get them from the FT directly using (practice makes perfect!):

$$F(\omega) = \int_{-\infty}^{\infty}f(t)e^{-j\omega t}dt$$


Meaning: channel unknown and known at the transmiiter

You need to distinguish between transmitter (TX) and receiver (RX) here. For the receiver it is generally quite easy to gain knowledge of the channel: have the transmitter send a few known symbols, then the receiver can estimate the channel coefficients (e.g., via Least Squares or MMSE). The receiver needs this channel estimate for equalization. For example, the ZF receive strategy you mentioned essentially means you divide out the channel coefficient, i.e., if you receive $y = h \cdot s + w$ where $h$ is the channel, $s$ your unkown information symbol and $w$ the noise, the simplest you can do to estimate $s$ is divide out $h$ (use $y/h$ as an estimate), for which you need to know it.

The question you asked about is knowing the channel at the transmitter. This is much harder since in general, the receiver would need to send its estimated channel coefficient back to the transmitter to know it. This requires extra communication resources. And time, which is a problem since the channel information  might be outdated by the time it reaches the transmitter, if your channel is time-varying. Another option is to assume the channel between TX and RX are "symmetric", in communication parlance referred to as reciprocity. Then, the TX can estimate its own received channel for data it got from the RX and assume that the same channel coefficient applies for the reverse link. For this to work, in general we need to assume that TX and RX work on the same frequency (e.g., when they use time division duplexing).

The real question here is what would it help the TX to know the channel? Does that improve capacity? As I'm sure you read it does help in the MIMO case as this allows the TX to send data in the "proper directions", i.e., excite the strong eigenmodes of the channel and thus get more power across. There are other cases where it helps, e.g., when dealing with multiple users, interference, and other things.


What is the frequency of $\cos x -\sqrt 2\cos\sqrt 2 x$?

Not sure, whether it's really your question. The signal for which you asked for the frequency actually has two frequencies. There are two components, the two cosines. And each component has a frequency. Assume your frequency is called $f$. So, the signal looks like $\cos(2\pi f x)$. So, getting the frequency of a component is quite easy. Just take everything from it between the brackets and divide it by $2\pi$.

Probably, you already got the frequencies of your signal. But just to be sure, it's: $\frac{1}{2\pi}$ and $\frac{\sqrt{2}}{2\pi}$.

Hope, it was the answer, you're looking for...


How to measure acoustic pressure level under water with a hydrophone?

A hydrophone should come with at least a typical response curve.

The thing to aware of is that that response represents an idealized far field response in an infinite space referenced to an wave of an ideal point source taken at one meter (or yard).

A good reference that covers the conversion of acoustic to electrical energy is

  Horton, Joseph Warren. Fundamentals of sonar. United States Naval
  Institute, 1959.

but his book is scarce as hen's teeth and requires luck or access to a good University library that collected physics and engineering books from the 1950's.

There are other books on transducers.  Essentially an accurate SPL measurement is a bit more than a hydrophone hooked into a sound card.  The field expedient calibration  method is to use a calibrated source at a known direct path distance at least 100 wavelengths in distance.

In most cases the cable you need is going to be too long for a unamplified transduction signal.  It's best to have the converter at the sensor and send over a digital signal but have weak analog signals close to digital circuitry.

Long cables usually imply higher voltages to minimize resistance losses.  Sharks are attracted to cables that have high voltages so don't be surprised when you see cables offering Kevlar with steel reinforcement.

Ideally access to pressure chambers to test your the water-tight integrity of your hyrophone cable is a very good thing to have if you expect to dangle more than 20 feet and the deeper you go the more important it is to pressure check your set up.


What is the optimal adaptive grid for calculating a DFT using a fixed number of sampling points?

This can be split up in two questions for the sampling frequency and the window.

1) The required sampling frequency is given by the Nyquist theorem to be $f_s>2*f_{max}$ with $f_{max}$ being the largest frequency in your signal. When sampling actual signals with an ADC there is usually a low pass filter to ensure an upper frequency limit.

2) The function $f(x)$ is usually defined to $-\infty<x<\infty$. However, you can only pass a finite portion to the DFT. The DFT is not a time-discrete Fourier Transform but a Fourier Series. Hence, it is defined on periodic signals.

If your signal is actually periodic then it is favorable to perform the DFT over whole periods. From the DFT's point of view, the signal you hand to it is repeated infinitely and when you pass it an incomplete period, there will be border effects resulting in frequencies showing up that are not in the original signal.

If your signal is time limited, all of it should be contained in the vector you pass to the DFT.

If the signal is neither time limited nor periodic you would theoretically need a DFT with infinite length, simular to the actual Fourier Transform which is defined for $-\infty<x<\infty$. Since this is not possible, Spectral Density Estimation techniques can be employed. The data can then be visualized with Spectogram plots showing the frequency content over time. It depends on what you are trying to achieve, really.


For a low-pass filter it is sufficient to specify the band edges, as shown in this example on the mathworks website. From your code I suppose that your band edges are

f=[-1,-0.5,-0.4,0.7,0.8,1]

Note that you wrote -0.7 and -0.8 (i.e., with a negative sign), which I assume is a mistake.

Furthermore, think about the desired phase or group delay response. The phase factor exp(-j*pi*f*N-1/2) does not make much sense, an it is probably not what you mean. If you want a linear phase (with delay $N/2$, where $N$ is the filter order) there is no need to use cfirpm, and you could better use firpm.


What is the effect of padding zeros to FFT on time domain ? (opposite of what is usually done)

The same effect will happen on the time-domain sequence too, due to the fact that DFT time and frequency domains are exact duals apart from a scaling factor and reversal.

Therefore, by properly zero padding (to the center of) the FFT data, the corresponding time-domain signal will be interpolated; i.e., more samples from the same signal will be obtained.


Yes, this system is time-invariant assuming $x[n]\neq0 $ for all $n $.

The test for this is
$$x_{1}[n]=x[n-n_{0}] $$
$$y_{1}[n]=y[n-n_{0}] $$

So let's first express in terms of just $y[n]$.
$$ y[n]=\frac{x[n-3]-y[n-3]-y[n-1]}{x[n]} $$
Next, we go through the test.
$$y[n-n_{0}]=\frac{x[n-3-n_{0}]-y[n-3-n_{0}]-y[n-1-n_{0}]}{x[n-n_{0}]} $$
Substituting $y_{1}[n] $
$$y_{1}[n]=\frac{x[n-3-n_{0}]-y[n-3-n_{0}]-y[n-1-n_{0}]}{x[n-n_{0}]} $$
$$y_{1}[n]=\frac{x[n-3-n_{0}]-y_{1}[n-3]-y_{1}[n-1]}{x[n-n_{0}]} $$
And finally substituting $x_{1}[n] $
$$y_{1}[n]=\frac{x_{1}[n-3]-y_{1}[n-3]-y_{1}[n-1]}{x_{1}[n]} $$
Because the shifted sequence has the exact same relationship, it is said to be time-invariant. Most systems that don't alter $n$ or $t$ meet this. Be wary of anything multiplying or otherwise messing with the vector arguments beyond simple delays.


Audio signal series' beginning points(about 50) distort after a bandpass filter

That's the filter's output transient, whose length is dependent on the effective length of the filter impulse response. If you are performing block based filtering, then only the very first block should exhibit it and later subsequent blocks should not display this transient, due to properly set initial values.


Criterion to choose length of an accumulator and product

Fixed point processing is very difficult. Floating point is A LOT easier.
The best algorithm and scaling approach depends a lot on your specific filter and the statistics of your signal. There is no "one size fits all" solution.
Cascaded second order sections are almost always the way to go. Primarily they guarantee that your coefficients values are bounded to something reasonable (2 or less). With transfer function implementation the coefficients tend to get really large or really small wich generates a lot of noise or scaling problems.
Within each section, use either Direct Form I or Transposed Form II. This helps controlling the scaling of the state variables and intermediate result
The best way to approach this to use "Q notation" https://en.wikipedia.org/wiki/Q_(number_format) to determine for EVERY SINGLE operation, which bits to use for what purpose. Doing this analysis will determine which bits to compute and which bits to keep (using multiplies, shifts, adds and masks).
Sometimes you need to treat this as a statistical problem. In many cases doing conservative scaling results in very poor signal to noise ratio, so you need to trade off the probability of clipping versus your steady state signal to noise. That's highly dependent on your signal, the specific filter and the requirements of your application.
You also need to carefully control your clipping and rounding behavior to avoid wrap-arounds and limit cycles.


What is the difference between complex FFT of baseband fft(I+jY) vs. FFT of absolute fft(abs|I+jY|)?

Well, taking the absolute value is a nonlinear operation you do on your signal.
That means it introduces frequencies into your signal (harmonics!) that weren't there in the original, and you have no way of figuring out whether the things you observe are from your original signal or from your nonlinear operation.
So, you basically make your whole thing useless for spectral estimation. Don't do that!
It's easy to imagine how that goes wrong. Take the simplest to analyze signal we can think of: a simple real-valued cosine $\cos(2\pi t)$. We know the spectrum of that – a line spectrum, with components at $\pm 1$, each having power $\frac 12$.
If you take the absolute of that, that's (just for this specific signal!) equivalent with multiplying with a $\pm 1$ square wave that is scaled and shifted exactly so that it becomes negative whenever the cosine is negative. That way, the product is always the absolute value.
Multiplication of two signals means in spectrum a convolution of the spectra. The cosine spectrum we know, $\frac12(\delta(f-1)+\delta(f+1))$, and the spectrum of a square wave is an infinite sum of such deltas, at every odd multiple of the fundamental frequency $f$.
So, your "innocent" absolute just converted your pure and easy cosine to something with infinitely many spectral components. No good.


Segment highly packed nuclei with dotted high intensity signal inside each object

I wouldn't bother with correct bright pixel segmentation.
I think such a strategy would add complexity and another stage in the algorithm which might add errors at the eventual product.

I would use some form of scaling function for the pixel value so that the bright pixels would blend-in better while maintaining contrast in the darker pixels. One such function could be the log function:

  im = log(double(im));

Another one might be the square root.
You might even get away with using a max value for the image , e.g.

  thr = 150; im(im> thr) = thr;

or a combination of both, for instance a capped transform function
thr = 100;
tform_im = img.^0.5;
tform_im_scaled = tform_im - min(tform_im(img>thr)) + thr;
img(img>thr) = tform_im_scaled(img>thr);

Either way good luck!


A signal which is the sum of sinusoids with different frequencies $f_i$ is only periodic if

$$f_i=k_if_0,\quad i=1,2,\ldots$$

is satisfied for some $f_0$ and integer values $k_i$. Or, in other words, the frequencies $f_i$ must be rational multiples of each other. In your example, the signal is periodic but its fundamental frequency is not $f_1=800\,\text{Hz}$ because $f_2\neq k_2f_1$ for integer $k_2$. The fundamental frequency is $f_0=50\,\text{Hz}$, even though this frequency does not explicitly occur in the signal. However, note that its period equals $1/f_0$.


What are the pros and cons of wavelet for filtering compared to conventional filters?

Let us first consider the orthogonal DWT: this transform is build with several constraints: orthogonality (and invertibility) of course, and the discretization of some continuous wavelet transform, with a specific dyadic structure, yielding a frequency decomposition whose cut are approximately:

$$[0\;1/2^L\;1/2^{L-1}\ldots 1/2 \;1]$$

Discrete wavelets can be implemented as a bank of filters (or a filterbank) dedicated  to one of the above intervals, followed by the appropriate subsampling. And only some specific filters (albethey in infinite number) obey the above constraints.

Hence, with the DWT, only dyadic boundaries are available (*), only  a subset of filters can be used, and outputs are decimated. And orthogonality, scales are not used at all.

Whereas with standard filters, you only have linearity constraints: invertibility is not required, you can specify the bounds, ripples and decay you need (at the price of design issues).

So for mere filtering, I cannot see an advantage of using discrete and critical wavelet schemes. However, DWT can do some crude band-pass filtering while being used for other processing needs.

Wavelets now play a more interesting role for data sparsification, along with non-linear analysis, for compression, restoration, which standard filters generally cannot achieve.

As a side note, if you allow redundancy in the transformation, choosing a wavelet with a sufficient number of oscillations in a sufficiently long "window" could do a good job, but that would be overkill.

(*) with $M$-band wavelets and wavelet packets, you could get more generic $M$-ary integers $k/M^n$, but not all fractions or reals


Proper rounding when converting between digitized values and floating point

I think you don't have to worry too much about so-called 'transparency' (ability to represent accurately the integer value as a floating point value) unless you do normalization. See the libsndfile FAQ.

As quantization is a lossy operation (many-to-one, or surjective, mapping) you will always have artifacts when re-quantizing from floating point to integer values. The standard method for de-correlating the quantization error is to use dither. For small word lengths, such as 8 bit, the classic solution of adding noise with a triangular distribution might cause the dither noise to be unaccptably high, so you might have to look around for some semi-optimal (in terms of quantization error moments) dithering method that suits your application better. Or just re-quantize and accept the artifacts, they might be small, depending on your data and what you are planning to do with it.


High energy coefficients in 1d DCT for audio

When we calculate 1D DCT of a signal (vector) we will get the DCT coefficients of same length.

The first value in this is the DC coefficient and low frequency components are at the begnning, as the index increases the frequency also increases. And hence the last value in DCT coeffs is the highest frequency (ie. fs/2).

Zig zag scanning is done in 2D DCT to read the coefficients in the increasing order of frequency. But in 1D DCT there is no need of zig zag scan as it contains only one row (or 1 column), it is already in ascending order of frequency (starting from Dc value and ends at maximum frequency ie. fs/2).


How can a changing signal be Fourier transformed?

You are correct that it is often broken up into chunks. There are multiple ways to combine those chunks (Google: fft overlap save).

It is often important to window the data (again Google: hamming window fft). One critical reason to do this that gets to the heart of your question: the fft assumes the chunk you fed it continues infinitely forward and backward in time. Obviously an audio file does not have this property.

For your example you might want to chunk your audio file into groups of powers of 2 like, 1024,2048, or 4096.


Techniques for detecting small blobs in noisy images

I'd recommend looking at the state of the art using deep convolutional neural networks (CNNs) for object localization and detection.

The difference is that a deep CNN architecture facilitates a data-driven approach, where the output of your CNN is a trainable classifier, that with more and different kinds of noisy/scaled/translated/permuted input data, can learn the feature maps that allow the CNN to generalize much better (say to different light & noise conditions) than your hand-engineered features (morph filtering, laplace of gaussians, thresholding) used with a static threshold (0.001)

Start on github.


confused in difference between calculations of convolution and multiplication?

Just write down the convolution sum to see what's going on:

$$y[n]=\sum_{k=-\infty}^{\infty}x[k]p[n-k]\tag{1}$$

where we define the elements of the sequences $x[n]$ and $p[n]$ as equal to zero for the index $n$ outside the range of non-zero values, i.e., outside $n\in[0,2]$. Taking into account those zero values, we can rewrite $(1)$ with finite summation limits:

$$y[n]=\sum_{k=0}^{n}x[k]p[n-k]\tag{2}$$

because for $k<0$ all $x[k]$ are zero, and for $k>n$ the elements $p[n-k]$ are zero. Now you see that as $n$ increases from $0$ to  $2$ (outside that range the term $x[k]$ will be zero), you'll get more terms in the sum $(2)$:

$$\begin{align}y[0]&=x[0]\cdot p[0]\\
y[1]&=x[0]\cdot p[1]+x[1]\cdot p[0]\\
y[2]&=x[0]\cdot p[2]+x[1]\cdot p[1]+x[2]\cdot p[0]\end{align}$$


A question on Fourier Series and the frequency of the sinusoids

A function that is not periodic doesn't have a Fourier series. What you can do is take a finite length interval and construct a Fourier series which approximates the function in that interval (and continues it periodically outside that interval).
The sum of several sinusoids with one of the sinusoids having (fundamental) period $T$ can never have a period less than $T$, simply because that one sinusoid will destroy periodicity (with period $<T$) due to its larger period.


Applying a high-pass filter on constant signal

The input to your filter is essentially a step function (since it has value 0 prior to t = 0, and a positive value for t > 0), so you see the step response of the filter, hence the initial ringing. This is expected behaviour, and after a suitable amount of time the step response will have settled to zero.


Zero padding effect on a FFT of gaussian noise

Think about both questions separately. First of all, the (I)FFT is just an implementation of the (I)DFT, so I'm going to generalize all this to the DFT.

Does the zero-padded IDFT retain variance?

Parseval's theorem says power out = constant factor · power in, and the power of the zero-padded sequence is the energy of that sequence divided by it's length – and that length is larger than the original length, whereas the energy stayed the same.

Does the zero-padded IDFT retain gaussianness?

Long story short: yes. This is a result from the fact that the DFT is effectively a large sum of sufficiently identically distributed random variables. What you need is independence (which would imply whiteness), but as mentioned below, most people mean "WGN" when they say "GN".

Other effects?

When people say "Gaussian noise" they often mean "white Gaussian noise", but since that would have a constant PSD, and you explicitly made it so that your noise realization's Fourier transform is anything but constant, but comes in a boxcar shape, you obviously lose the whiteness.


Stability of system with poles inside unit circle - conflict with differential equation

What you are missing is that this is about a discrete-time system, because we're talking about poles and zeros in the complex $z$-plane and about poles inside or outside the unit circle. So there is no differential equation, but there is a difference equation:

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

The corresponding impulse response is

$$h[n]=\left(\frac12\right)^nu[n]\tag{2}$$

where $u[n]$ is the unit step sequence.

A continuous-time system with a pole at $s=\frac12$ would indeed be unstable, because for stability, all poles of a continuous-time system must be in the left half plane. In discrete time this corresponds to the requirement of all poles being inside the unit circle $|z|=1$.


Spacing between gaussian windows for STFT

usually the overlap has more clear meaning when used with a complementary window such as the Hann window.  a complementary window is such that the tails of all overlapping window functions add to 1.  $$ \sum\limits_{k=-\infty}^{+\infty} w(t-kT_{\text{hop}}) \ = \ 1$$  that cannot be the case for overlapping gaussian window functions.

if your STFT is just for analysis, not synthesis or reconstruction, then complementary windows do not usually matter.  then the issue is more about frequency resolution (which determines how wide the window is) and the STFT frame hop distance.


Relationship between Frequency response, magnitude spectrum and gain

ok let me give you a practical (discrete-time) example.

Consider a system with input-output relation of the form
$$ y[n] = x[n] + 0.5  x[n-1] + 0.25 x[n-2] $$

This input-output relation satisfies linearity and time-invariance properties and hence defines an LTI (linear time invariant) system and therefore it has an impulse response $h[n]$ found to be :
$$h[n] = \delta[n] + 0.5 \delta[n-1] + 0.25 \delta[n-2] $$

Which signifies an FIR (finite impulse response) filter. Now since the system has an impulse response, then taking its Fourier transform will give us the system's so called complex valued Frequency Response function, denoted as $H(\omega)$ :

$$H(\omega) = \sum_n h[n] e^{-j \omega n} $$

For the above system, the frequency response can be shown to be:

$$ H(\omega) = 1 + 0.5 e^{-j \omega} + 0.25 e^{-j2\omega} $$

The magnitude of $H(\omega)$ signifies the (linear) gain that the LTI system applies to its input at the frequency $\omega$. For example, if $ |H(\omega)| = 0$ the system completely attenuates the input at that frequency, or if $H(\omega) = 1$ the signal passes unaltered and if $ |H(\omega)| = 10 $ then the system applies a linear gain of $10$ which corresponds to a dB scale of $20$ at that frequency.

Let's find the magnitude of the frequency response $H(\omega)$ :

$$
\begin{align}
H(\omega) &= 1 + 0.5 e^{-j \omega} + 0.25 e^{-j2\omega} \\
&= 1 + 0.5 (\cos(\omega)-j\sin(\omega) ) + 0.25 (\cos(2\omega)-j\sin(2\omega) ) \\
&= [ 1 + 0.5 \cos(\omega) + 0.25 \cos(2\omega)] -j [0.5 \sin(\omega) + 0.25 \sin(2\omega) ] \\
&= A(\omega) - j B(\omega) \\
|H(\omega)| &= \sqrt{ A^2(\omega) + B^2(\omega) } \\
|H(\omega)| &= \sqrt{ [ 1 + 0.5 \cos(\omega) + 0.25 \cos(2\omega)]^2 + [0.5 \sin(\omega) + 0.25 \sin(2\omega) ]^2 } \\
\end{align}
$$

with the help of a computer you can evaluate this frequency response magnitude at any frequency you want and compute the gain of that filter that it applies to any input frequency at that frequency. Below figure shows the Frequency Response magnitude of this system (evaluated and plotted using Matlab)

As you can see, the gain is about $1.8$ at frequencies close to zero radian per sample, and the gain is about unity at frequencies close to $0.5 \pi$ radians per sample. Most often but not always, this gain is defined in terms of a dB (deci Bell) scale (instead of a linear one) using the formula:

$$ \text{Gain_dB} = 20 \log_{10}( \text{Gain_linear}) = 20 \log_{10}( |H(\omega)|) $$

which is plotted in the figure below:

AS you can see, at the frequency about $0.5 \pi$ radians per sample, where the linear gain is about $1$, the corresponding deciBell gain is about $0$ dB.


Are there any other objects that can move beside people? If there aren't, you can just find the  blobs (connected components) in your foreground mask, and these are your people.

They can also "collide" one with another, creating one blob instead of two. In this case, you can do a motion tracking and resolve the ambiguity by using the fact that the trajectory and the speed is smooth.

If there are other objects (like dogs, cars), you should create a classifier that gets blob parameters like:

Blob statistics (size, solidity,etc..)
Color
Edge information
Speed (in case of tracking)

And returns the correct class (Human/No Human).


I strongly agree with Ava. Without a clear formulation of your task, you cannot make a meaningful ranking of algorithms.

Think about your most important task and formulate clear goals. Here is an example of such an investigation:

"Detect only the outer edges of a shoe box in grey value images in a short amount of time".

Goal 1: Detect only the outer edges --> measure number of connected components, if 1, check if it is the contour of the parcel, if !=1, vary parameters and try again.

Goal 2: Be fast --> If goal 1 is reached, measure time needed to compute these edges.


Implementing Welch's method for Power Spectral Density

I believe these lines are you problem:

    data1(istart:iend,j) = data1(istart:iend,j).*window;
    data2(istart:iend,j) = data2(istart:iend,j).*window;

you are modifying the incoming data.  When you don't have overlapping windows, you don't notice it. However, when you have overlapping windows, the next window will include data that has already had a window applied... which will not be what you want.


The resulting analytic signal after using a the Hilbert transform filter is ideally a signal without any negative frequencies, hence, attenuating -1 (using normalized frequency) to 0 while transmitting 0 to 1 (note that this is a complex output and therefore one do not have the standard symmetry around 0). This is obtained by phase-shifting positive frequencies pi/2 and negative frequencies -pi/2 while keeping the magnitude to be one and adding the output with the original signal.

Since it is not possible to obtain this change in phase-shift without a transition band one will need to specify how wide the transition band should be.. Hence, in your case the 0.1 would indicate that your designed filter will perform well from 0.05 to 0.95 with a transition band from -0.05 to 0.05 and similarly from 0.95 to 1.05.

Increasing the order with constant transition band will produce a higher attenuation/smaller approximation error in the passband, while decreasing the transition band with the same order will have the opposite effect.

Also, if you will implement it on an FPGA I would suggest multiplying the coefficients with a power of two, e.g. 8192 to get a better range for the output and use of the bits.


Should the transmitted signal be continuous in FMCW?

Let us say the sweep repetition interval is $T_s$, it is the part with frequency modulation. If interval $T_i = T_s/N$ for large N, then drawbacks are: loss of average power, decrease of maximum measurable unambiguous Doppler frequency and it might cause amplifiers to introduce unwanted transients in the signal. Therefore, there is no advantage of adding an interval.

However, if interval $T_i = N*T_s$ for large integer value of N, then it is no longer called an FMCW, rather it will be called LFM, linear FM modulated pulse signal. The processing of which is more complicated than that of FMCW.


Confused about the definition of point to point ,this point means single antenna or single device?

Point to point typically refers to single devices transmitting to each other, regardless of how many antennas they have. The important thing is that in point to point systems, there is no interference from other transmissions, you only have signal and noise.

If transmitter and receiver have multiple antennas, you would typically call it MIMO, to specify even further, the terms single user MIMO (SU-MIMO) or point to point MIMO (P2P-MIMO) are not uncommon.

If only one antenna is used for data and the others for harvesting energy, it depends on your viewpoint. If it makes sense to treat these antennas separately, i.e., ignoring the energy harvesting antennas when designing the communication link, there might be a point to call it MISO. I would assume that one also optimizes the energy transfer so that all antennas are looked at jointly. This would advocate for calling it MIMO.

*edit: Regarding the scenario you edited in later: As Blackmath correctly said, this is a classical interference channel. So it's not a point to point setup. It's also not Point to Multipoint, in which the same information is broadcast to several users. Not so in your setup as you have different intended pieces of information for your two receivers. This is an interference channel.


Why do convolution kernels such as Gaussian, Laplacian, LoG almost always seem to be expressed in integers?

The Laplacian kernel with the 4 in the middle results from summing second derivatives along the two axes ([1,-2,1]). Those are the right values to use, you can show this by writing out the math for the second derivative and set the distance h to 1 (or search for discrete approximation to derivative). This kernel hasn’t been rounded, the values just happen to be integer.

The other kernel, with 8 in the middle, does not provide correct values for the Laplacian, but uses more input values and hence is a bit more robust against noise (but not by a whole lot).


The objective is to produce noise, presumably Gaussian distributed, that has both white and 1/f components. This is evident from the desired power transfer function, i.e., the square of the OP's "S" expression, which would be used to convert input white noise to output white plus 1/f noise. The  OP does not state whether the PSD should be unilateral or bilateral, so it will be assumed, without loss of generality, to be unilateral. Hence the unilateral noise PSD is

$$\mathrm{S^2 = k_1^2(1+k_2/f)} \tag{1}$$

where $\mathrm{k_1^2}$ is the unilateral noise PSD of white noise only, with units of $\mathrm{V^2/Hz}$ and $\mathrm{k_2}$ is the noise corner frequency, with units of $\mathrm{Hz}$. In a digital simulation,

$$\mathrm{k_1^2} = 2\sigma^2 /f_s = \sigma^2 /f_{nyquist} = 2\sigma^2 \times \Delta t    \tag{2}$$

where $\sigma$ is the standard deviation of the Gaussian white noise (units: V), $\mathrm {f_s}$ is the constant sampling frequency (units: Hz), $\mathrm {f_{nyquist}}$ is the Nyquist frequency (units: Hz), and $\mathrm {\Delta t}$ is the constant sample time spacing (units: s).

To generate the noise, first select parameters in accordance with equation 2. For example, if it is desired to have $\mathrm{k_1^2} = 5.00 \times 10^{-8}$ $\mathrm{V^2/Hz}$ and $\mathrm {f_s} = 1$ $\mathrm{kHz}$, then $\sigma = 0.005$ $\mathrm{V}$. This is the standard deviation entered into the Gaussian white noise generator in the figure below:

The second step is to specify $\mathrm{k_2}$. Using the noise generator described previously here, it is not feasible to directly enter a noise corner frequency into the non-white noise generator code. However, it is necessary to enter the desired low limit and high limit for the non-white noise, as shown in the dialog box in the figure, so the high limit can be adjusted empirically to obtain the desired noise corner frequency. Note that $\gamma = 1$ generates $\mathrm{1/f}$ noise and there is an optional gain adjustment as well.

The next figure shows a temporal trace of the noise produced with $\mathrm{k_1^2} = 5.00 \times 10^{-8}$ $\mathrm{V^2/Hz}$, $\mathrm {f_s} = 1$ $\mathrm{kHz}$, $\sigma = 0.005$ $\mathrm{V}$ and the non-white noise parameters shown in the first figure:

Then the third figure shows the average of 1000 32k FFT PSDs:

The noise corner frequency is where $\mathrm{f = k_2}$. From the plot, this is about 1.6 Hz or so.

If this noise was the dominant one in an experiment, and if the signal was baseband, then the measurement would be afflicted with $\mathrm{1/f}$ noise and all the annoying consequences that entails. But if it was feasible to modulate production of the signal, before the signal encountered the noise, then the signal could be deliberately located in the white noise 'flats' and a lock-in amplifier could perform the customary demodulation.


Fourier series coefficient of signal when Time period is twice the fundamental period

As Matt stated, by your calculation you have excluded options a and b but you should also check for options c and d, from which you would see that the answer is the option d.

You could practically check the result of coefficients $d_k$ from the interpretation that CTFS coefficients of a periodic waveform $\tilde{x}(t)$ can be obtained from an inverse-DTFT (or an inverse-DFT more practically), by treating $\tilde{x}(t)$ as a DTFT waveform. Note that the computation is exact if the CTFS coefficients $d_k$ were of finite length in advance, but otherwise approximate which would only get better by choosing long enough samples to represent the waveform $\tilde{x}(t)$.

Therefore, the following computes (approximately here) $3N$ CTFS coefficients of $x(t)$:

>     N = 128;
>     x = [ones(1,N) , -1*ones(1,N) , zeros(1,N)];
>     d = ifft(x);

On the orther hand the following code would do the same by treating $\tilde{x}(t)$ as periodic in $2 T_0$ rather than $T_0$

>     N = 128;
>     x = [ones(1,N) , -1*ones(1,N) , zeros(1,N)];
>     d = ifft([x x]);

Based on your edit, the following provides you the answer:
Given that the CTFS coefficients of the derivative signal is:

\begin{align}
d_n &=\frac{1}{6} \int_{-3}^3 [\delta(t+3)-2\delta(t+2)+\delta(t+1)+\delta(t)-2\delta(t-1)+\delta(t-2)]e^{\frac{-jn2\pi t}{6}}dt\\
&=\frac{1}{6}[  e^{j\frac{2\pi}{6}3n} - 2 e^{j\frac{2\pi}{6}2n} + e^{j\frac{2\pi}{6}1n} + 1 -2e^{-j\frac{2\pi}{6}1n} + e^{-j\frac{2\pi}{6}2n}] \\
&=\frac{1}{6} [  e^{j\pi n} - 2 e^{j\frac{2\pi}{3}n} + e^{j\frac{\pi}{3}n} + 1 -2e^{-j\frac{\pi}{3}n} + e^{-j\frac{2\pi}{3}n}] \\
\end{align}

Above three lines were straightforward. Now we shall group those terms to yield something that can be simplified:

$$d_n =\frac{1}{6} [  (1 + e^{j\pi n}) - 2 ( e^{j\frac{2\pi}{3}n} + e^{-j\frac{\pi}{3}n} ) + (e^{j\frac{\pi}{3}n} + e^{-j\frac{2\pi}{3}n})] $$

Now add $2\pi n$ to the negative angles so that they become: $$e^{-j\frac{\pi}{3}n} = e^{j( 2\pi n -\frac{\pi}{3}n) } = e^{j\frac{5\pi}{3}n } = e^{j\pi n }e^{j\frac{2\pi}{3}n } $$ and  $$e^{-j\frac{2\pi}{3}n} = e^{j( 2\pi n -\frac{2\pi}{3}n) } = e^{j\frac{4\pi}{3}n } = e^{j\pi n}e^{j\frac{\pi}{3}n } $$ respectively. And plugging them into $d_n$ line, yields:

\begin{align}
d_n &=\frac{1}{6} [  (1 + e^{j\pi n}) - 2 ( e^{j\frac{2\pi}{3}n} + e^{j\pi n }e^{j\frac{2\pi}{3}n } ) + (e^{j\frac{\pi}{3}n} + e^{j\pi n}e^{j\frac{\pi}{3}n})]\\
&=\frac{1}{6} [  (1 + e^{j\pi n}) - 2 (1 + e^{j\pi n}) e^{j\frac{2\pi}{3}n} + (1 + e^{j\pi n}) e^{j\frac{\pi}{3}n}]\\
&=\frac{1}{6} [1 + e^{j\pi n}]\cdot[1 - 2 e^{j\frac{2\pi}{3}n} + e^{j\frac{\pi}{3}n}]\\
&=\frac{1}{6} [e_n]\cdot[f_n]\\
\end{align}

Now it can be shown that the product term $e_n$ will be zero for all odd indice $n$, hence $d_n$ will also be zero for all odd $n$. Note that the other product term $f_k$ will be zero for $n = 6m$ that $d_n$ will also be zero for $n = 6,12,18...$ However for your example it sufficies to show that $e_n$ will be zero for odd $n$.

FURTHERMORE below is the theoretical proof that it's not a coincidence to have all the odd indexed terms in CTFS to be zer0, independent of the signal itself, when the period $T_y$ of the periodic signal $x(t)$ is assumed to be twice that of its fundamental period $T_x$. Assume $x(t)$ is a periodic signal with fundamental period of $T_x$ and let $y(t)$ be the same signal $x(t)$ but interpreted to have a period of $T_y = 2 T_x$. Let $a_k$  and $b_k$ denoted the CTFS coefficients of $x(t)$ and $y(t)$ respectively, then we have:

\begin{align}
b_k &= \frac{1}{T_y} \int_{0}^{T_y} y(t) e^{-j\frac{2\pi}{T_y} k t} dt = \frac{0.5}{T_x} \int_{0}^{2T_x} x(t) e^{-j\frac{2\pi}{T_x} (k/2) t} dt\\
&= 0.5 \left( \frac{1}{T_x} \int_{0}^{T_x} x(t) e^{-j\frac{2\pi}{T_x} (k/2) t} dt + \frac{1}{T_x} \int_{T_x}^{2T_x} x(t) e^{-j\frac{2\pi}{T_x} (k/2) t} dt \right)\\
\end{align}

Make the substitution $t' = t - T_x$ in the second integral and recognize that $x(t'+T_x) = x(t')$ as $x(t)$ is periodic with $T_x$ , yielding:

$$b_k = 0.5 \left( \frac{1}{T_x} \int_{0}^{T_x} x(t) e^{-j\frac{2\pi}{T_x} (k/2) t} dt + e^{-j\frac{2\pi}{T_x} (k/2) T_x} \frac{1}{T_x} \int_{0}^{T_x} x(t') e^{-j\frac{2\pi}{T_x} (k/2) t'} dt' \right) $$

Now recognize the integrals as $a_{k/2}$; i.e, the CTFS of the signal $x(t)$ evaluated at $k/2$. And simplify the sum:
\begin{align}
b_k &= 0.5 \left( a_{k/2}+ e^{j\pi k} a_{k/2} \right)\\
&= 0.5 \left( 1+ e^{j\pi k} \right) a_{k/2} \\
&= \begin{cases}{ a_{k/2} ~~, \text{ for k even, k=2m  , m=1,2,...}\\ 0 ~~~~~~~, \text{ for k odd  , k=2m+1, m=1,2,...}}\end{cases} \\
\end{align}


Sketch the following Signal: $x(t)=3\sin(\frac{\pi t}{4})$

From your physics knowledge you get that sine waves are usually equated, in the general case, as

$$y(t) = A * \sin(\omega t)$$

where $\omega = 2 \pi f$ and the periodicity is $T=1/f$

Comparing the general equation with your particular case, you have: $$2*\pi*f = \pi / 4$$
meaning that $$f=1/8 Hz$$
or $$T=1/f=8s$$
The amplitude is $A=3$

If you want to plot it in matlab, for example, just write

t = 0:0.01:16;
x = 3*sin(pi*t/4);
plot(x,t)

As a final comment, this is really a basic question and you should carefully read your textbook if you want to progress to more advanced topics.


Insert a tuner into the audio chain and take down the notes coming through. Use the circle of fifths to calculate the key as best as possible.


An effective algorithm for convolution of very many long signals

So, I'm becoming a bit notorious with the whole "by using commonly available tools, how complex is your problem really?" business, but oh well:

I went ahead and simulated the "last" of your convolutions, i.e. I went ahead and picked up a FFT FIR (which is convolution by the overlap-save method Jason R mentioned) by dumping 500 Million random samples through a filter of 100,000 taps:

So, this flow graph produces an average total of 42 MS/s, or 420 (500x100,000) convolutions per second. The complete program, which includes initial FFT of the taps, calculating of the taps and the random pool, loading of libraries and set up of all, takes about 12 seconds. So, yes, doing this exact operation 5000 times would exceed the average coffee break's duration, and take nearly 17h.

I tried timing the initial FFT of the tap vector (which the FFT filter blocks automatically), but I failed - it took much shorter than producing the taps vector itself. So I made a separate flow graph that just does 100,000-transforms of input data, and includes all the data generation/copying-overhead in my speed estimate. With that flow graph, my PC does 1900 FFTs per second, so it should take roughly half a millisecond to do a single one, or 2.5 s to do 5,000 of those.

Which also means that if you're smart, and just used the overlap-add algorithm as contained in the FFT FIR block and hoped that performance scales roughly linear with length of the input vector you're transforming, then every convolution would take about $\frac{12}5\text{ ms}= 2.4\text{ ms}$ longer than the previous, giving us a rough estimate of $\sum\limits_{n=0}^{5000} n\cdot 2.4\text{ ms}\approx 8\text{ h},\,25\text{ min}$.

Obviously, that leaves a bit of headroom for optimization. Now, Operlap-Add and Overlap-Save should actually scale exceptionally well to multi-core/distributed solutions. Also, doing a set of long FFTs also sounds like something that GPUs are great at.


Bits - symbols mapping in M-PAM beginner question

$2^k$-ary PAM maps $k$ bits (which can be expressed as integers in the range  $[0, 2^k-1]$ to $2^k$  levels that are equally-spaced and symmetric about $0$. ($0$ is NOT one of the levels).. The levels are odd integers, and so for $k=2$, the levels are $-3, -1, +1, +3$ which are equally spaced and symmetric about $0$.  As to which integer in $[0,2^k-1]$, there are several common conventions such as:
\begin{align}
00 &\to -3\\
01 &\to -1\\
11 &\to +1\\
10 &\to +3
\end{align}
or
\begin{align}
00 &\to -3\\
10 &\to -1\\
11 &\to +1\\
01 &\to +3
\end{align}
or
\begin{align}
10 &\to -3\\
11 &\to -1\\
01 &\to +1\\
00 &\to +3
\end{align}
etc.
In all cases, there is a one-bit change in going from one level to the next. Note also that your formula $2m-M-1, m = 1,2,\ldots, M$ corresponds to the first list if you assume that $m-1$ is expressed as a $\log_2M$-bit integer and expressed in Gray code so that adjacent symbols differ in only one of the $\log_2M$ bits.


Normalize data for transfer function determination?

For what I know there is no reason to normalize data in general, if you use least squares like methods, all you need is that your input is persistently exciting, in the sense that the Hankel matrix $H$ of the observations must be such that $H^T H$ is nonsingular.


Discrete Fourier transform of complex time series

Proposed answer to my own question:

We have that:

$$F_m = \frac{1}{2}(H_m + H^*_m)$$

and

$$G_m = \frac{1}{2i}(H_m - H^*_m)$$

where $H^*_m$ represents the complex conjugate of $H_m$.


What is the difference between Kalman filter algorithm and stationary Kalman filter algorithm?

I’m not sure what you mean by the stationary Kalman filter, but it seems to be what I would call the steady-state Kalman filter.

If that is the same thing, then you just solve for the Kalman gain at $t=\infty$ and apply the normal Kalman filter equations.

I’m not sure you mean “the Kalman gain goes to infinity” in a well-posed problem.


Does baseband signal has negative frequency?

It might help to watch my YouTube video explaining negative frequency: https://youtu.be/gz6AKW-R69s
I'm a professor and I've been building what I think of as an on-line video textbook for Signals, Systems, and Digital Communications.


Detection of a Pulse pattern with Matched filter

IF a 1 is always represented by the waveform in the figure, you can use that waveform as the matched filter response.
However, it sounds like the waveform could be anything as long as there are some pulses in it. In that case, the matched filter should be a single pulse, and you'll have to count how many pulses were detected afterwards.
The non-Gaussian noise can be a problem; if you don't know anything about its distribution, you'll probably just have to build a prototype and test it. You may end up having to design a filter tailored to the specific noise distribution in your system.


An alternative algorithm for blob detection

Since you have convolution and dilation you can use the Laplacian of Gaussian blob detector to detect the blobs and dilation to find the centre points. In MATLAB:

sigma = 3;

% Filter image with LoG
I = double(rgb2gray(imread('NCxQ8.jpg')));
h = fspecial('log', sigma*6, sigma);
B = -imfilter(I,h);
imagesc(B); pause;

% Threshold
B(B < 5) = 0;
imagesc(B); pause;

% Dilate then compare to get all
% local maximum in 3 pixel radius
Bd = imdilate(B,strel('disk',3));
imagesc(Bd); pause;
P = (B == Bd) .* B;
imagesc(P);

% Get point locations
loc = find(P > 0);
fprintf('There are %d blobs\n',numel(loc));

Note: "NCxQ8.jpg" is the smaller image embedded in the post. Adjust sigma for larger ones.


In the implementation of a real receiver, you have to do what is called "streaming", or handing of samples from one block to the next in real time.

Matlab does not lend itself to working with streaming samples; you need a different tool.

For instance, GnuRadio is designed to work in real time with streaming samples. You can even design your demodulator using a visual tool with drag-and-drop of different modules.

It should also be possible to use Python, by setting up a pipe to read samples from your front-end and processing them in sequence.

If you want to use a DSP, I can recommend this book: http://amzn.com/0387748857 which describes the entire design of a streaming digital communications system using a DSP evaluation board.


What Does It Mean Exactly When Two Parts of a Signal Are Correlated?

Yeah, it can mess you up pretty badly if you don't get the fundamentals right off the get-go.  This is how I interpret correlation, and it has worked for me for what I do for a living.

Let's start off with a relatively simple example.  Take a look at the following figure (pulled from dspguide... this is actually a great online book for knowing the basics of DSP).

We have an antenna that transmits a short burst of radio wave energy in some direction. If the propagating wave strikes an object.... like a helicopter in this figure, a small fraction of the energy is reflected back toward a radio receiver.  This receiver is close to the transmitting antenna.

This short burst of radio energy, for the sake of this example, is a small triangular shape.  When the signal is reflected off of the helicopter, and then echoed back to the receiver, this signal will consist of two parts:

A shifted and scaled version of the transmitted pulse, and
Random noise, resulting from interfering radio waves, thermal noise in the electronics and other factors.

Loosely speaking, we can actually figure out how far the object is by using this concept.   Since radio signals travel roughly at the speed of light, the shift between the transmitted and received pulse is a rough measure of the distance to the object being detected.

As such, this is our general problem:

  Given a signal of some known shape, what is the best way to determine where (or if) the signal occurs in another signal?

The best way to answer this is correlation.

There are two different paradigms for computing correlation.  The first one is called auto-correlation, where you are comparing a signal with shifted time offsets of itself.  This paradigm that we are describing (also seen in the figure) is defined as cross-correlation, where we are comparing with another signal, notably the received signal.  We essentially are comparing the received signal with shifted versions of the original transmitted signal.  Basically, we take a look at what we have received and what was transmitted.  We take what was received, and time shift the original transmitted signal over by different time values.  We then do a comparison with each of these signals and the received result.  Whichever gives us the highest value will denote how far away the helicopter is.

The amplitude of each sample in the cross-correlation signal is a measure of how much the received signal resembles the target signal, at that location. This means that a peak will occur in the cross-correlation signal for every target signal that is present in the received signal. In other words, the value of the cross-correlation is maximized when the target signal is aligned with the same features in the received signal.

If there is noise on the received signal, there will also be noise on the cross-correlation signal. It is an unavoidable fact that random noise looks a certain amount like any target signal you can choose. The noise on the cross-correlation signal is simply measuring this similarity. Except for this noise, the peak generated in the cross-correlation signal is symmetrical between its left and right. This is true even if the target signal isn't symmetrical.

A good thing to remember is that the cross-correlation is trying to detect the target signal, not recreate it. There is no reason to expect that the peak will even look like the target signal.  Correlation is the optimal technique for detecting a known waveform in random noise. To be perfectly correct, it is only optimal for random white noise. Using correlation to detect a known waveform is frequently called matched filtering.

tl;dr - Correlation is a measure of how much one signal resembles another.  The signal can be images, features, edges, etc.  It is simply a measure of resemblance between one signal and another.


How to remove a tone/interference from a signal, without using classical linear filtering

A sharp edge or transient may require a very wide-band spectrum to represent it.  Thus any classical or frequency domain filter that completely removes a spectral band could unsharpen or "smear" a sharp transient, by removing a necessary component of that transient.

There are two non-linear methods based on analysis/resynthesis techniques that might work.  Either estimate your tone or interference signal precisely enough to synthesize it and subtract it.  Or characterize your desired signal well enough to resynthesize it without the noise.  You will need a very accurate model for either of these.  Both of these will only remove or add the appropriate fraction of energy in any spectral band, instead off all or none, or some random percentage (relative to the actual S/N) given by a filter response curve.


Just read the graph carefully. With a low value threshold, you have a very high log probability of false detection. You want to minimize this detection rate. If your goal is to minimize the false alarm rate with a lower threshold, then the yellow curve is preferable. The false alarm rate drops off at a lower threshold in that case, and more rapidly too. Stated another way, you will get fewer false detections over a wider range of thresholds with yellow.


What is the best way(In terms of speed) to implement a direct form type 2 IIR Filter in VHDL?

I faced the same problem in the past, the problem is that it's not possible to pipeline the IIR feedback loop without changing the filter equation.
There's one technique you can use, it's called "scattered-look ahead IIR filter"
The gist of it is to change $H(z) = \frac{b_0 + b_1z^{-1} + b_2z^{-2}}{1 + a_1z^{-1} + a_2z^{-2}}$
To this
$H_1(z) = \frac{d_0 + d_1z^{-1} + d_2z^{-2}+d_3z^{-3}+d_4z^{-4}}{1  + c_2z^{-2}+c_4z^{-4}} = H(z)$
since the odd feedback coefficients are 0, it is possible to use pipelining in the feedback loop thus increasing the maximum frequency.
To go from $H(z)$ to $H_1(z)$ ou need to factor
$$H(z) = \frac{b_0 + b_1z^{-1} + b_2z^{-2}}{1 + a_1z^{-1} + a_2z^{-2}} =
\frac{b_0 + b_1z^{-1} + b_2z^{-2}}{1 -2rcos(\theta)z^{-1} + r^2z^{-2}}  $$
$$H(z) = \frac{b_0 + b_1z^{-1} + b_2z^{-2}}{1 -2rcos(\theta)z^{-1} + r^2z^{-2}} * \frac{re^{±(j(\theta+\pi/2))}}{re^{±(j(\theta+\pi/2))}} = \frac{d_0 + d_1z^{-1} + d_2z^{-2}+d_3z^{-3}+d_4z^{-4}}{1  + c_2z^{-2}+c_4z^{-4}}$$
Edit :
If your poles are not complex, the technique I showed will not work.  However you can still apply the look-ahead. You simply need to transform the order-2 filter in 2 cascaded order1- filters and then apply the lookahead transform.
You should consult this site for more information http://people.ece.umn.edu/users/parhi/SLIDES/chap10.pdf


You have two different meanings for ${γ}_{xx}$ when you write stuff such as
$${γ}_{xx}(τ) = {γ}_{xx}(t+τ,t)$$
because on the LHS, the function ${γ}_{xx}$ has one argument while on the RHS it has two arguments. Be that as it may, a very important property of what you call the covariance but what most everyone else on dsp.SE would call the autocovariance function is that
$$\text{For all values of }\tau, |{γ}_{xx}(τ)| \leq {γ}_{xx}(0).\tag{1}$$
It is easy to verify that $\exp\left(-(\tau-t_0)^2\right)$ has value $\exp(-t_0^2)<1$ at $\tau=0$, and larger value $1$ at $\tau=t_0$, in contradiction of $(1)$, and so $\exp\left(-(\tau-t_0)^2\right)$ cannot possibly be a valid autocovariance (except, of course, for the special case of $t_0=0$).


From the definition of the process you know that

$$x_{n+1}=x_n-0.2x_{n-1}+w_{n+1}\tag{1}$$

Since $w_n$ is white you can't predict it, so the best linear predictor for the given process is the filter

$$P(z)=1-0.2z^{-1}\tag{2}$$

which is a first order filter. It estimates the future sample $x_{n+1}$ by computing

$$\hat{x}_{n+1}=x_n-0.2x_{n-1}\tag{3}$$

The residual error is equal to $w_n$, which has an average power of $1$.


Why is C++ so popular for Image Processing?

At the "dawn" of modern image processing/computer vision, C++ had the best combination of speed and industry support (meaning tools, libraries, etc and infrastructure to support them).

OpenCV is natively written in C++, look at the OpenCV about page, and you can quickly get a sense for these historical currents.


Projecting a vector to another to detect the sparse values of such vector

When you have the described convolution measurement, you can indeed recover your $X$ using sparse recovery methods. Some examples are, as you suggest, OMP, MP, or for example subspace pursuit (SP), compressive sampling matching pursuit (CoSaMP), iterative hard thresholding (IHT), a plethora of other variants of greedy recovery methods, as well as basis pursuit (BP), basis pursuit denoising (BPDN), and approximate message passing (AMP).
The key to this is the measurement matrix. Have a look at the random demodulator architecture to see how they construct their measurement matrix ($\mathbf M$) [1]. This is very similar to what you want.
Your IFFT is modelled by their $\mathbf F$; in their case the transform is just DFT instead of IDFT, but that does not change the principle. Your measurement matrix (lets us call it $\mathbf H$) is a little bit different than [1]'s $\mathbf M$.
Assume that we can express your convolution as discrete convolution. I would model you measurement matrix as:
$$\mathbf H = \begin{bmatrix} \mathbf h & 0 & & \ldots && 0\\
0 & \mathbf h & 0 & \ldots && 0\\
\vdots\\
0 & & \ldots && 0 & \mathbf h
\end{bmatrix}$$
This is a convolution matrix. The non-zeros parts $\mathbf h$ of each row of $\mathbf H$ is the vector you convolve $x$ by (where I would call it vector $\mathbf x$). The non-zero parts of $\mathbf H$ generally overlap across the columns.
See for example MATLAB's convmtx for a practical example of construction of $\mathbf H$. You may want to sub-sample the rows of $\mathbf H$ (i.e. only keep every $m$th row), corresponding to a lower sample-rate of your sequence $y$ than your original sequence $x$.


But, without the measurement instrument, in general, what value will be shown on the plot if the given input is for example complex cosine waveform with amplitude 1?

You've done the "right" thing by simply trying.

Realize that the frequency sink simply does a forward FFT and windowing, if you don't set the window to rectangular; the window you're using has a response of ca -9.8dB at DC, so that's what you're seeing here. Use "FFT Window" none, and you'll see your perfect 0dB for a constant 1 input, and 40dB for a constant 100 input.

Since you only have a constant value, so all bins are 0, but the middle one, which will, as defined for the DFT without scaling,

$$\begin{align}
 Y[f] &= \sum_{k=0}^{N_{DFT}-1} y[k] e^{j2\pi f \frac kN},\\
\text{for }f&=0\text{, it follows that }
e^{j2\pi 0 \frac kN}\equiv 1,\text{ so}\\
Y[0] &= \sum_{k=0}^{N_{DFT}-1} y[k] &y\text{ being constant}\\
&= N_{DFT}\cdot y[0]
\end{align}$$

Because it's handy for visualization, GR's approach to scaling of these values is to divide them by the DFT length $N_{DFT}$; otherwise, the same constant signal would have more power in a longer DFT.


Your expression $A=\sqrt{a_x^2+a_y^2+a_z^2}$ calculates the length of the 3-dimensional vector with coordinates $(a_x, a_y, a_z)$. So, it is the magnitude of the acceleration. Your expression $a=\Delta_v/\Delta_t$ also gives magnitude of acceleration, but in a slightly different context. This comes from measuring speed at different times, and then you average the acceleration between the time steps. You can ignore this expression for your case.
given ax, ay, az are $N$-dimensional vectors that contain the measurements of $a_x, a_y, a_z$ over time, you would do A=np.sqrt(ax**2+ay**2+az**2) to calculate the magnitude over time.
Yes, it's the overall acceleration at every time point. Though, it is only a relative value, its unit will not be exactly $m/s^2$, but there is some scaling involved to transform your measurement $A$ to the common $m/s^2$ units. Though, you don't need to do it, since you are only interested in relative changes of the acceleration over time.
Looks reasonable. Just plot $A$ vs time for some steps and decide on your own, if your measurement would contain sufficient information.


Double the "speed", double the frequency?

White noise: sounds exactly the same if you play it back at double the speed
Stack up diminished fifth starting at a low enough fundamental (say 20 Hz). Play back at double speed: sounds exactly the same.
Stack octaves with equal amplitude starting with a low enough fundamental. Play back at twice the speed: sounds exactly the same
Detune the octaves slightly (say multipler of 2.05 starting at 20 Hz). Play back at double the speed: perceived pitch goes DOWN.

You get plenty more when fiddling with the harmonic structure.
Code example for the last one:

%% make some disharmonic sounds
fs = 44100; % sample rate
q = 2.05; % harmonic multiplier
f0 = 20;  % fundamental
n = 10; % number of harmonics
duration = 2; % length of file at fs
nx = duration*fs;
t = (0:nx-1)'/fs; % time vector
x0 = sin(2*pi*f0*t); % fundamental
f1 = f0;
for i = 2:n  % add harmonics
  f1 = f1*q;
  x0 = x0+sin(2*pi*f1*t);
end

x0 = 0.5.*x0/max(abs(x0)); % normalize
% and play
sound(x0,fs); pause(duration);
sound(x0,2*fs);


Frequency estimation of circularly shifted single tone signal

The clue is that without zero-padding, the circulary shifted sequence is just a shifted version of the periodic continuation of the original sequence. That's why without zero-padding the magnitudes of the DFTs of both sequences are identical.

When you use zero-padding, the two sequences cannot be obtained from each other by pure shifting. So the DFTs must be different.

You can avoid the problem by zero-padding the circularly shifted sequence between the last and the first element of the original sequence:

% this assumes that J is in [0,N]
y2 = [z(N-J+1:N),zeros(1,N),z(1:N-J)];
Y2 = fft(y2);

This will guarantee that the magnitudes of the DFTs of the two sequences are the same, even after zero-padding.


What does an ADC DNL specification mean, exactly?

Differential non-linearity specifically is the deviation from ideal between successive bits. For an ADC, the ideal would be the converted signal will not transition to another bit value until the input deviates by 1 bit. If the DNL is greater than 1 bit, non-monotonic behavior could result (an linearly increasing input could result in some transitions actually going down).

If the spec claims ±1 bit, this is a absolute maximum limit and is therefore guaranteeing monotonic behaviour. The "typical" limits are not so stringent in what that means and you would need to ask the manufacturer directly, but in essence it is what you could typically expect, on average (so therefore could be the the mean of the absolute value of the deviation).

Similar to if I said I had a 9V battery that had a spec of +/-0.5V and provided 9V typical. The average is 9V, the peak limit that the manufacturer will guarantee is 8.5V to 9.5V; now as far as the statistics that is completely up to them in balancing yield at final test in what they will ship.

If I was to model this, I was first tempted to generate a Gaussian random sequence with a standard deviation of $\sigma = (0.6) 4/\pi$ and clamp it at $\pm 1$ since the mean of the absolute value of a Gaussian R.V. Is $(4/\pi)\sigma$... but the clamping reduces the mean, so increasing that to $\sigma = (0.7) 4/\pi$ results in a random (clamped Gaussian) distribution that never exceeds ±1 but also has an average magnitude (therefore typical) of 0.6.


The earliest use of the word "peak" in the IEEE library is from 1937

H. Roder, "Effects of Tuned Circuits upon a Frequency Modulated Signal," in Proceedings of the Institute of Radio Engineers, vol. 25, no. 12, pp. 1617-1647, Dec. 1937.
doi: 10.1109/JRPROC.1937.228819
Abstract: Prior investigations indicated that the frequency modulated receiver would always respond to the signal having the largest amplitude. Thus, selective circuits would be required to pick out a desired signal existing simultaneously with a number of other signals. The first item considered in this paper is that the signal carrier is tuned to the steep side of the resonance curve. It is found that in this case conversion from frequency modulation into amplitude modulation can be effected. It is required that the amplitude and phase characteristic of the circuit be linear with respect to frequency over the whole frequency interval occupied by the modulated signal. In order to derive a faithful audio signal reproduction from the complete detection process, a phase modulated signal must be transformed into frequency modulation first. Next, the case is considered in which the signal carrier is tuned to the peak of the resonance curve. The single tuned circuit is taken up first and two methods of solution are presented. It is found that with certain values of the modulation index, the tuned circuit may cause very serious nonlinear distortion of the output. For large values of the modulation index the resulting variation in amplitude and frequency can be determined statically, while for very small values of the modulation index the effect of the tuned circuit is exactly analogous to that encountered with amplitude modulation.
keywords: {Amplitude modulation;Chirp modulation;Frequency modulation;Nonlinear distortion;Phase detection;Phase frequency detector;Phase modulation;RLC circuits;Resonance;Signal processing},
URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=1686321&isnumber=35536

As one of the commentators stated,  it's a very basic operation but also one that is not trivial.  The definition that I've used for myself is that a peak is a cell or bin that is higher than it's adjacent neighbors. It sometimes is the maximum likelihood estimate of discrete valued signal parameter.  This really ages me, but on a 300 pound, Numerix, Mars 432 array processor, searching through an array and testing if the left and right values of an element of a vector for "peakness" was a slow operation and it was faster to do two off set vector subtractions, clip and do a vector "and".


How to use MFCC (or any other tool/method/algorithm) for speech verification

This is not an easy task since its a classification problem. A while back at work I used time-frequency-domain transformations like STFT (Short Time Fourier Transformation), IWT (Integral Wavelet Transformation), DWT (Discrete Wavelet Transformation) STCEP (Short Time Cepstrum), WVD (Wigner Ville Distribution) to create images/matrices from voice recordings which were then classified using a convolutional neural network as classifier. This is a common approach for this task. You could try that or you could try setting certain limits, e.g. if in a certain frequency range a certain energy is exceeded for a certain time, the file is classified as a speech file.


Using binomial formulas one easily gets
$$
Y(z)=\frac{\frac12+z^{-1}}{1-\frac14z^{-2}}
=(\tfrac12+z^{-1})\sum_{k=0}^\infty 2^{-2k}z^{-2k}.
$$
Now compare to the coefficients in $Y(z)=\sum_{n=0}^\infty y_nz^{-n}$ for $n=2k$ and $n=2k+1$, even and odd indices.


A canonical implementation of a digital filter has the minimum number of delay elements. The same filter cannot be implemented with less memory. Since memory is often not the only concern, a canonical implementation is not necessarily always the best implementation on a given platform.


how to guess what the interference source it could be

I read about it and I found out that it could be our alarm system because the power is high and the transmission is constant so I run the technical support and they confirm, so I guess, problem solved.

However, if someone else had the same issue and found that it was something else, please share :) I read it could be also the thermostat but couldn't find the specs of ours and unless it transmits also when it's not working, I don't think it could be that!


Indeed, in practical systems there is usually a cut-off SNR above which communication is possible with a given amount of reliability. This is usually determined according to a design goal, expressed in terms of a bit error rate (BER) or a packet error rate (PER). Typically, the BER should not exceed $10^{-4}$ or $10^{-5}$.
According to your signal parameters (modulation and coding), sometimes it is possible to derive the BER as a function of the SNR. This depends on the complexity of your transmitter-receiver architecture and the channel model you use.
So:

Yes.

Now, regarding the RSS, I would say that it is not a standard metric. Some equipments give RSS metrics, according to an unknown criteria. Sometimes, it is just a table where a given range of received power is indexed. Hence:

It depends. In general, we don't use the RSS to directly determine design parameters of a demodulator (in this case, a threshold). But if you know exactly what it means, you may derive a relation SNR-RSS. But since RSS measures the total received signal power--including noise--I suppose you will have to estimate the noise power also.


Is the Bilateral Filter a Solution of Some Variational Method?

Yes indeed.
You may have a look on work (Paper) by Michael Elad which is called On the Origin of the Bilateral Filter and Ways to Improve It or Analysis of the Bilateral Filter.
You may have a look on the way he derives the Bilateral Filter from a Least Squares problem with weighted regularization on the Gradient of the image in the form of:
$$ \arg \min_{x} \frac{1}{2} {\left\| x - y \right\|}_{2}^{2} + \frac{\lambda}{2} \sum_{n = 1}^{N} { \left( x - {D}^{n} x \right) }^{T} W \left( y, n \right) \left( x - {D}^{n} x \right) $$
Where $ {D}^{n} $ is Image Gradient Operator (Raising by $ n $ simply shifts it) and $ W $ is the weights matrix of the Regularized Least Squares.


BER performance of fractional equalizers for colored noise

Yes of course,  that's true.

FS equalizer sample the signal in rate faster than Nyquist rate which provide more information about the signal. It's similar when you  increase the sampling frequency, you get better results.

If you need to understand that idea, you can read about oversampling, fractional sampling, and if you are working on sparse channel read you compressive sending working method.


Image zoom out using Gaussian blur and downsampling

What I understood from your post is that you don't like the excess blur that happens at the downsampled image.

The theory of signal processing states that, when you downsample a digital signal by a factor of $M$ there's the potential of aliasing to happen if the signal is not bandlimited to $|w| < \pi/M$;

The spectral effect of the downsampling is such that the non-zero portions of the original signal spectrum above $ |w| > \pi/M$ can overlapp into fake frequency positions in the range $-\pi< w<\pi$ so that they will create visual artefacts that does not belong to the original signal.

In order to avoid such an overlapp (to avoid aliasing) the formal approach is to apply a lowpass filter with a cutoff frequency of $w_c = \pi/M$ and a gain of 1 at the passband.

The effect of this filter is to blur the image to the extend that when downsampled there won't be any significand overlap from the high frequency portions of the image. On the other hand this is eventually a blurring operation and it will throw away signal content (details of the image). So there will be a loss of quality (in terms of high frequency details) in your downsampled image.

However the problem in your code is that there is too much blurring, due to the Gaussian filter radius set to an inappropriate value. In theory what you need is an ideal filter with sharp transition at the cutoff frequency $w_c = \pi/M$ but the filters desiged in your code produces not only mild transition region but also a lower cutoff frequency than necessary.

So you can modify your lowpass filter radius untill you get an acceptable downsampled image.

Below is the modified code that shows spectrum of the Gaussian filter, you can use this to deduce if the filter cutoff is too much.

close all; clear all; clc;
I = double(imread('Cameraman.tif'))/255; % Black and Whit eimage in [0-255] range
figure,imshow(I);title('Original Image');

zoom_factor=2;

sigma=0.8*sqrt(zoom_factor-1);   % I modified the radius here ???
[M,N,s]=size(I);
f1=-fix(M/2):ceil(M/2)-1;
f2=-fix(N/2):ceil(N/2)-1;
[f2,f1]=meshgrid(f2,f1);
Y=exp(-2*pi*pi*sigma*sigma*((f1/M).^2+(f2/N).^2));  % The BLUR filter
figure,imshow(abs(Y));title('Spectrum of the filter')

If=fft2(I);
If=fftshift(If);
for i=1:1
  If(:,:,i)=If(:,:,i).*Y;
end
newI=ifftshift(If);
newI=real(ifft2(newI));
figure,imshow(newI);title('Gaussian Filtered Image')

newI=newI(1:zoom_factor:end,1:zoom_factor:end,:);
figure,imshow(newI);title('filtered and downsampled')

figure, imshow(newI);title('filtered and downsampled image')

figure, imshow(I(1:zoom_factor:end,1:zoom_factor:end));
title('downsampled without filtering')

Another solution is to use a highpass filter after the downsampling operation to improve the image by emphasizing the high frequency detail a bit.


Does anyone know how and when and where used Legendre polynomial?

Legendre polynomials are orthogonal on the interval $[-1,1]$ and are therefore useful for approximating functions on a finite interval in a least squares sense. I.e., if you are looking for a polynomial $p^*_K(t)$ of degree $K$ which approximates a given function $f(t)$ on the interval $[-1,1]$ - other intervals are possible by shifting and scaling - by minimizing the error

$$\epsilon=\int_{-1}^1[f(t)-p_K(t)]^2dt$$

then the optimal polynomial $p^*_K(t)$ is given by

$$p^*_K(t)=\sum_{k=0}^Ka_k\bar{L}_k(t)\tag{1}$$

where

$$\bar{L}_k(t)=\sqrt{\frac{2k+1}{2}}L_k(t),\quad k\in\mathbf{N}$$

are the normalized Legendre polynomials $L_k(t)$ (i.e., $\bar{L}_k(t)$ are orthonormal, not only orthogonal). Because of the orthonormality of $\bar{L}_k(t)$ the coefficients $a_k$ in (1) can be easily found by computing

$$a_k=\int_{-1}^1\bar{L}_k(t)x(t)dt$$


Manipulating with frequencies through fftw

You applied the FFT to the full signal? Then modification of the amplitudes will likely destroy any time locality.

Use the so-called STFT, short term Fourier transform, or overlap-add method to get a time-localized frequency analysis.


The overlap is the way that you walk on your signal to be analyzed, lets go to an simple example, imagine that your signal X has a length = 14, NFFT = 4 and overlap/hop = 2

X = 1 2 3 4 5 6 7 8 9 10 11 12 13 14

To know the number of blocks of analysis you will:

int(n_samples/Overlap) - 1

Then for this example:

(14/2)-1 = 6

lets get 4 points from X to pass to your FFT

At the first time you get from X

X2 = 1 2 3 4

from now you need overlap by 2

X2 = 3 4 5 6

Third time

X2 = 5 6 7 8

fourth time

X2 = 7 8 9 10

fifth time

X2 = 9 10 11 12

sixth time

X2 = 11 12 13 14


comparison between Fourier transform and autocorrelation function

Signals can be classified in many ways, and one of them is according to their nature such as being deterministic or random (stochastic). When a signal is deterministic, its spectral content is given by the Fourier transform provided that the signal is absolutely (or square o.w.) integrable; i.e., its Fourier transform exists.

On the other hand when an signal is stochastic, then ideally by definition its Fourier transform does not exist. (a random signal will always have infinite energy as it cannot decay to zero when time goes to infinity because then it will not be random otherwise.)

Therefore for random signals, the Fourier transform will not exist and their spectral density cannot be computed that way. Nevertheless, for such signals an indirect description, based on an autocorrelation measure, can also be defined, whose advantage being that the Fourier transform of it may exist. Therefore the PSD of a random process is defined as the Fourier transform of its ACF.


Treating the measured frequency response of a system as a DFT

So, after worrying about whether the frequency response is "low pass in nature" (i don't think it needs to be a LPF, it could be high pass in nature, but all of the interesting features of your frequency response should be below Nyquist and maybe well below Nyquist), you might also wonder about if you have the necessary phase information in your frequency response.  if it is magnitude-only data, then you might have to guess at the phase.

if you iFFT the magnitude-only data (mirroring it about $f=0$), you will come up with an impulse response that is also mirrored about $t=0$.  that's fine, give it a delay of half of the length of the impulse response, and you have a linear-phase FIR.  you get linear phase because you started not knowing anything of the phase.  you can also take that FIR, factor it with some nasty factorization program (maybe MATLAB has that), reflect (using the reciprocal function) all zeros outside the unit circle to inside the unit circle, the re-multiply all of the factors and you will have a minimum-phase FIR with the same magnitude frequency response.


Since "green grass" and "viewers/whatevers behind the LED boards" do nicely contrast from the boards themselves, and because the shape of these is pretty precise known beforehand, I'd probably go with "pure computer vision". You could even make the image processing aware of what's displayed on the LEDs, so that recognition gets even easier.
Of course you could do something like blinking the LEDs at a specific rate and synchronize cameras to that blinking, so that it gets even easier on the processing side, but honestly, I don't think that's necessary. Might still be done to make the whole thing failsafer.


Combining simultaneous measurements of the same signal for better SNR?

Coherent Gain happens when you have copies of the same signal but different noise. If the noise is independent in each copy, the gain should be $10log N$ dB where $N$ is the number of copies. For a well crafted measurement system, additive electronic noise should be independent. Things like ambient noise will have some correlation provided a reasonable distance between sensors and $5logN$ is a reasonable lower expected gain.

If you don’t see at least $5 log N$ dB, then there is probably something wrong. Coherent Gain works. If it didn’t, many here would not have jobs.

You might try cross correlating pairs of your copies as a diagnostic. Without knowing your data, I cant say with certainty that you should see a well defined peak but the absence of a well defined peak would be a cause for concern


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

Because you are using a linear combination of the two filters, you can find the resulting transfer function by directly subtracting them from each other. If you want to do this, then you have to make sure that they have the same denominator, such that the total transfer function is one quotient of polynomials. If you do not know how to do this, you could check this example.


Should the phase coefficients of the DFT of a real, even input signal all be zero?

You are right, of course it's not necessary to position the peak of the triangle in the center. The only condition for the DFT of a sequence to be real-valued is that the sequence satisfies

$$x[n]=x^*[N-n],\qquad 0\le n<N\tag{1}$$

where $*$ denotes complex conjugation, and $N$ is the DFT length. If $x[n]$ is real-valued, $(1)$ reduces to

$$x[n]=x[N-n],\qquad 0\le n<N\tag{2}$$

Conditions $(1)$ and $(2)$ require the periodic continuations of $x[n]$ (period $N$) to be even with respect to $n=0$.

From your first figure it appears that your signal satisfies

$$x[n]=x[N-1-n]\tag{3}$$

with $N=15$. Of course this corresponds to a certain symmetry condition, but note that its periodic continuation is not even around $n=0$, as required by $(1)$ and $(2)$.

A simple example of a triangular signal similar to your example but with a purely real-valued DFT (i.e., satisfying $(2)$) is

x = [0 1 2 1]

Its purely real-valued DFT is given by

X = fft(x)
X =

   4  -2   0  -2

What follows is an explanation why the DFT coefficients $X[k]$ are real-valued if (and only if) condition $(1)$ is satisfied. If $X[k]$ is real-valued, we have

$$X[k]=X^*[k]\tag{4}$$

With

$$X[k]=\sum_nx[n]e^{-j2\pi nk/N}\tag{5}$$

where the sum is over one period, i.e., over $N$ adjacent indices, and where we assume that $x[n]$ is continued periodically, such that $x[n]=x[n+N]$. Using Eq. $(5)$ we can write $(4)$ as

$$\begin{align}\sum_nx[n]e^{-j2\pi nk/N}&=\sum_nx^*[n]e^{j2\pi nk/N}\\&=\sum_nx^*[N-n]e^{j2\pi (N-n)k/N}\\&=\sum_nx^*[N-n]e^{j2\pi k}e^{-j2\pi nk/N}\\&=\sum_nx^*[N-n]e^{-j2\pi nk/N}\tag{6}\end{align}$$

where I've used the index transformation $n\rightarrow N-n$, and the fact that $e^{j2\pi k}=1$. From $(6)$, Eq. $(1)$ follows immediately. Note that $(1)$ is dual to the fact that the DFT of a real-valued sequence is conjugate symmetric. In the case we've considered here, we have a conjugate symmetric sequence, leading to a real-valued DFT.


Regularization for Inverse Problems using the Singular Value Decomposition (SVD)

Similar to The Concepts Behind SVD Based Image Processing the horizontal axis are the samples index of the SVD basis.
The idea in the chapter you linked is generalizing the Wiener Filter.
While the Wiener Filter uses the Fourier Transform as a basis the SVD uses the data adaptive basis.


Calculating IIR Filter gain at given frequency

For continuous-time systems, you obtain the frequency response by evaluating the transfer function $H(s)$ on the imaginary axis $s=j\omega$ (assuming stability). In discrete-time, you get the $\mathcal{Z}$-transform instead of the Laplace transform, and the imaginary axis is replaced by the unit circle. So the frequency response is obtained by evaluating the transfer function $H(z)$ for $z=e^{j\omega}$. Note that for discrete-time systems, $\omega$ is a normalized frequency (in radians):
$$\omega=\frac{2\pi f}{f_s}\tag{1}$$
where $f_s$ is the sampling frequency.
Coming to you example, a frequency of $8000$ Hz with a sampling frequency of $4000$ Hz is the same as DC (Eq. $(1)$ should make that clear). Computing the frequency response at any frequency means to determine the desired $\omega$ from Eq. $(1)$, and then evaluate $H(z)$ with $z=e^{j\omega}$. In the case of DC ($\omega=0$) and Nyquist ($\omega=\pi$) this becomes especially easy: just evaluate $H(1)$ for DC, and $H(-1)$ for Nyquist.
For most other values of $\omega$, the frequency response is most likely complex-valued, so after computing $H(e^{j\omega})$ you just compute the magnitude of that complex number to obtain the gain at the given frequency. You don't need to find a general expression for $|H(z)|$.


Does the OFDM MMSE Channel Estimator Require Prior Channel Knowledge?

It's true that the MMSE channel estimator requires some a-priori channel knowledge, namely the autocovariance (or autocorrelation) matrix of the channel and the signal-to-noise ratio (SNR). Note that these are statistical quantities while the aim of channel estimation is to estimate the actual channel transfer function at a certain point in time.

The autocovariance matrix $\underline R_{HH}$ is based on some statistical channel model, e.g. the Rayleigh fading channel or AWGN channel. As you have observed correctly, the channel matrix $H$ is unknown and thus $\underline R_{HH}$ cannot be calculated from $H$. It's rather an assumption based on theroetical models or earlier measurements.

The SNR can usually be estimated from the received signal by measuring the noise power on zero subcarriers or analyzing the received constellation diagram.


Fourier Transform of sampled reflectance measurements

This elaborates on my comment and my linked FTIR example. Once the FTIR spectrum is obtained, the phase spectrum can be obtained via the Hilbert Transform of the spectrum and that can be performed as a convolution. The Hilbert Transform can be performed by various software packages. In Igor Pro (v. 6.3), the Help text on Hilbert Transforms (page 723 of the Manual), is simply:

In the linked example, the IR spectrum of ethyl acrylate was obtained via a Mueller optical calculus simulation. For present illustrative purposes, the spectrum was adjusted in two ways. First, everything below 800 wavenumbers was set to zero. This is typically where the noise is worst because IR detectors are relatively insensitive and noisy compared with detectors in higher energy ranges. Second, the spectrum was zero filled from 4001 to 4095 wavenumbers, in order to achieve a total of 4096 wavenumber values. This spectrum is shown below:

Performing the Hilbert Transform, as per the Igor Pro command in the first figure, then yields the phase spectrum:

Maybe this helps and maybe it doesn't. But it points to a way forward: find a reflectance spectrum in the refereed literature and the dispersion and absorption spectra that were computed from it. This has to be something about which there is no doubt, i.e., it will be the standard. Then try using software to compute the Hilbert transform and see if the result agrees with the standard. Lastly, if you still want to do so, then pursue the pathway you have outlined in your question text. Hope this helps a bit!


Is there a way to break down a signal into its respective phases (4 in this case) to be later analysed individually

This would be trivial to do as simple decimation where each block increments its samples by $n+4$ with each block starting at sample 0,1,2,3 respectively. This is common with polyphase filter implementation and similar techniques to reduce the overall clock rate requirement for the processing (parallel processing).

For more details on both of those approaches see these posts:

How to implement Polyphase filter?

4-phase FIR LPF in MATLAB

Why does this parallel IIR filter have such a weird form?

Another straightforward and interesting approach specific to DFT processing is to use the Decimation In Time binning that is inherent in the (DIT) FFT algorithm itself.

See the block diagram below for further detail on how an 8 point DFT can be binned in time into 4 2 point DFTs, and specifically how to combine the resulting DFT outputs for any size data block.

Expanding this to any general block length of radix 4 length (a length that is a multiple of $2^4$ so that it can be divided into 4 identical blocks. For blocks not in increments of $2^4$ simply pad with zeros to get to this length), the input sequence is binned by two decimation in time operations each with a factor of 2, best demonstrated by example:

Consider a sequence $x[n]$ numbered 0, 1, 2, 3, 4, 5, 6, 7, ...

After one decimation in time by 2 we divide this into two groups, noted here as Group one and Group two:

Group one (even samples): 0, 2, 4, 6, 8, 10 ....

Group two (odd samples): 1, 3, 5, 7, 9, 11 ...

Each of these is then decimated by 2 to form each of the four separate sample blocks, as follows:

Group $x_1[n]$ (even samples of Group 1): 0, 4, 8, 12, ...

Group $x_2[n]$ (odd samples of Group 1): 2, 6, 8, 10, ...

Group $x_3[n]$ (even samples of Group 2): 1, 5, 7, 11, ...

Group $x_4[n]$ (odd samples of Group 2): 3, 7, 11, 13, ...

The reason for binning in this fashion is for the efficient recombining of the DFT results for each block using 2 point DFT "butterflies" as shown in the graphic above and further detailed below.

The four DFT results are combined to be equal to the DFT of the whole sequence as follows:

Given each $N/4$ length DFT result of the four groups as $X_1[k]$, $X_2[k]$, $X_3[k]$, and $X_4[k]$, where k is the integers from $0$ to $N/4-1$ representing the $N/4$ samples in each group:

Combine $X_1$ with $X_2$ to form a $N/2$ length DFT of the combined result. $k$ is incremented from $0$ to $N/2-1$ and due to the cyclical nature of the DFT, $X_1[N/4]=X_1[0]$, $X_1[N/4+1]=X_1[1]$ etc
$$X_{1,2}[k] = X_1[k]+ W_{N/2}^{k/2} X_2[k]$$

Similarly combine $X_3$ with $X_4$ to form a $N/2$ length DFT of the combined result.

$$X_{3,4}[k] = X_3[k]+ W_{N/2}^{k/2} X_4[k]$$

Finally combine the two resulting $N/2$ length DFT's to have the full $N$ length DFT result, here k is incremented from $0$ to $N-1$:

$$X[k] = X_{1,2}[k]+ W_{N}^{k} X_{3,4}[k]$$

The notation above $W_n^k$ are the "roots of unity", coined as "Twiddle Factors" by W.M Gentleman and G. Sande in their 1966 paper "Fast Fourier Transform - for fun and profit". The twiddle factors are simply convenient shorthand for the exponential expression below and represent phase rotations:

$$ W_N^k = e^{j2\pi/N}$$

Below shows a graphic example for N = 8


Fourier transform of cosine to the power of 3

One way would be to use the power-reduction trigonometric identity:

$$
\cos^3(x) = \frac{3 \cos(x) + \cos(3x)}{4}
$$

Due to the linearity property of the Fourier transform, you can transform each term separately and take their weighted sum to get the transform of the entire expression. The relationship we will use (from line 304 here) is:

$$
\mathcal{F}\{\cos(ax)\} = \pi\left(\delta(\omega - a) + \delta(\omega + a)\right)
$$

Which assumes that you're using the non-unitary, angular frequency definition of the Fourier transform:

$$
\mathcal{F}\{x(t)\} = X(\omega) = \int_{-\infty}^{\infty}x(t) e^{-j\omega t}dt
$$

This would yield:

$$
\begin{align}
\mathcal{F}\{\cos^3(x)\} &= \frac 34 \mathcal{F}\{\cos(x)\} + \frac 14 \mathcal{F}\{\cos(3x)\} \\
&= \frac{\pi}{4}\left(3 \delta(\omega - 1) + 3\delta(\omega + 1) +  \delta(\omega - 3) + \delta(\omega + 3) \right)
\end{align}
$$


You just need to make a simple modification:

Send the original signal through each filter and sum the output of each filter together to get your final result.

At the moment you are passing the filtered data on to each subsequent filter. If you think carefully about that, the output will be silent i.e. you filter out everything but 523 Hz  +/- 25 which leaves you just frequencies around 523 Hz, then you take that and filter out everything but 1046 Hz  +/- 25 which will strip out the frequencies around 523 Hz and then you have silence after just two iterations of your loop.

s = s(:).';
sNew = zeros(1,length(s)); % The eventual output

for N=2:1:(Fs/(2*(523+25)))
    % High-pass filter
    FsNorm =  (523-25).*N / (Fs/2);
    [b,a] = butter(10, FsNorm, 'high');
    sHigh = filter(b, a, s);

    % Low pass
    FsNorm = (523+25).*N / (Fs/2);
    [b,a] = butter(10, FsNorm, 'low');
    sLow = filter(b, a, sHigh); % Note we are filtering sHigh, not 's'

    % Now sum the results
    sNew = sNew + sLow;
end


If you can be sure that your passive network is perfectly linear (does not create harmonics) you can just use the raw min/max values that you read from the ADC and compare them (correctly scaled) to the min/max values that you put into the DAC.
Some inaccuries will arise for sure, ie. because the DAC and ADC are not perfectly linear. If your passive network has low impedance, you would also have to take into account the internal resistance of the DAC.
If you need high precision, doing a FFT or Goertzel is the way to go.


Improving Canny Edge Detection and Contours Image Segmentation

You might try a Hough Transform after your canny-Detection instead of contour detection. (Given that you dont have too much perspective distortion, i.e. the cards are rectangular and not trapezoidal).

Have a look at this related question and the links therein.