The OP may have removed DC (the mean of the signal) and that would be clear by zooming in on DC to visibly see the null that does exist there. If the null does not exist, then that would mean the mean signal was not properly removed.

The width (effective bandwidth) of the null if done by a simple subtraction of the mean would be approximately $1/T$ in Hz where $T$ is the duration of the data capture in seconds. This appears to be a very long capture and therefore the null would be very tight.

The plot suggests that there is a lot more low frequency content besides a DC offset. If the expected signal is at 5e6, then a high pass filter with a cutoff at approximately 1e6 would be easy to implement and more effective in this case. Further a log scale plot of the vertical axis will make for a better presentation of the spectrum details.


Understanding the over sampling factor effects before a Matched Filter?

Perhaps the answer to a similar question may be helpful.

I've spent most of my career in SONAR, so I want to see a lot of oversampling After a matched filter.

A matched filter should be sampled at the exact time corresponding to it's delay, which is unknown but can be within a range of time that is often called a range gate. Any filter output that corresponds to a maximum deflection inside of that range gate is a possible return.  The nearer those samples are in time the more likely a match in delay will occur, and the nearer to the actual time, the greater the expected deflection. So, in this case matched filter miss match can be mitigated with a higher sample rate.

The hard part is calculating the performance because the range gate is moving in time so there are several chances to pick a maximum that is a signal and several chances to produce a false alarm and the tests are on overlapping data, so one's tests are not independent.  The detector also has memory because the probability of a threshold exceeding is different if the previous test exceeded the threshold or did't exceed a threshold.  It does not produce simple closed form expressions.

So oversampling should increase performance but showing by how much, is typically done by simulation, and results will depend on the details of the filter.  Doppler introduces more complication.

Hopefully, the answer to a question you didn't ask may help.


What word can I use to describe time-varying spectral content?

The notions of harmonicity or non-stationary seem connoted.

Stochastic White noise or pink noise, or deterministic pure tones, are (strongly) structured in the spectral domain. So,  strongly structured, or strongly  spectrally-structured. So, in a soft manner, I would  describe the rich class as weakly structured, or weakly spectrally-structured.


The Chebyshev criterion minimizes the maximum weighted absolute error:

$$\epsilon=\max_{\omega\in\Omega}W(\omega)|H(\omega)-D(\omega)|\tag{1}$$

where $\Omega$ is the union of all frequency bands of interest, $W(\omega)$ is a positive weight function, $H(\omega)$ is the filter's complex frequency response, and $D(\omega)$ is the complex desired frequency response.

Note that in general, $(1)$ is a complex approximation problem, because $H(\omega)$ and $D(\omega)$ are generally complex-valued. However, in the special case of linear phase FIR filters, $(1)$ can be rewritten as a real approximation problem, for which a very efficient algorithm exists (the Remez exchange algorithm used in the Parks-McClellan method). In the general case of non-linear phase FIR filters or IIR filters, $(1)$ can be solved by (much) more complex general optimization algorithms. For FIR filters, the problem is still a lot easier than for IIR filters, and several algorithms have been suggested (cf. the thesis linked here and the references therein). One of the algorithms is implemented in Matlab's signal processing toolbox: cfirpm.m


For optimum coherent detection in an AWGN channel, GMSK with partial response signaling (intentional overlap of pulses to increase the amount of data within a given time and therefore bandwidth efficiency) can be done with maximum likelihood sequence detection, combined with Viterbi decoding which basically compares the correlation of all possible phase trajectories (the number of which is increased substantially due to the pulse overlap) and selects with soft decision detection the most likely set of data bits that would have created that trajectory. With full response signaling there are just two possible trajectories since only one data bit is involved, but with partial response signaling there are multiple data bits to create each trajectory due to the longer duration from each data bit that is longer than a symbol period. For example if each transition lasted 2 symbols, there would be four possible phase trajectories corresponding to the 00, 01, 10, and 11 data patterns. The trajectories are unique to the patterns and thus by choosing the most likely trajectory (after removing phase, frequency and time offsets) the data can be demodulated. As the overlap increases (duration of the phase transition over multiple symbols) the complexity of the optimum receiver significantly increases due to the number of phase trajectories and it can be seen that a trellis diagram results where the Viterbi algorithm can be used to efficiently determine the most likely path through the trellis. Further Laurent Decomposition can be used to decompose the signal into PAM modulations and reduce the possible combinations, simplifying the receiver. Other sub-optimum receiver implementations exist as well.
Here are related links for GMSK demodulation, including further details for carrier recovery, symbol synchronization and using Viterbi decoding and the Laurent Decomposition:
https://www.mathworks.com/help/comm/ref/comm.gmskdemodulator-system-object.html
https://core.ac.uk/download/pdf/195023475.pdf
https://www.atlantis-press.com/article/125913177.pdf
https://etd.lib.metu.edu.tr/upload/1057348/index.pdf


Estimating Real-Time Vehicle Velocity from low-frequency GPS, accelerometer, gyro and magnetometer in Smartphone

How to approach this problem? Am I even correct in using Kalman?

Yes, a Kalman filter (or a derivative) is correct.  Rotations are involved, and 3D rotations are highly nonlinear, so you'll pretty much have to use an extended Kalman or an unscented Kalman.

The basic approach is to model the vehicle motion as position, velocity, and angle driven by the IMU output, with the phone position estimate being corrected by the GPS.

You can correct the phone orientation estimate with the magnetometer, but then you need to take into account the various compass offsets.

  How to get correct deceleration? What if vehicle is cornering?

That will pretty much fall out of the Kalman solution.  As a plus, the phone's orientation with respect to the vehicle will only matter to the extent that you need to know where the vehicle is pointing, and that should be a pretty easy, fixed transform.


Why the angle of a real signal in frequency is continuous?

X = angle(fft(x))

is numerically very questionable. If your signal is periodic in exactly the length of vector x you're observing, then the (theoretical) DFT would be zero in all but two bins. You can't really take the angle of $0$.

If your signal has a period that doesn't exactly fit in x, then you're observing the phase of two superimposed sinc pulses, as that's what a rectangular windowing leads to.

A sinc is for all points (but the maximum) defined as $\frac{\sin ax}{bx}$ (with $a$ and $b$ depending on who you ask and how you scale), and if you look at that, it definitely does have at least a strongly linear component.


How to compute the free distance in TCM (Trellis-Coded Modulation)?

The free distance of a Trellis Coded Modulation system implemented either on BPSK or QPSK is a straightforward calculation. You'd have to compute the free distance $d_{free}$ of the convolutional code which is known as the Minimum Squared Euclidean Distance (MSED). Now, if the code has set-partitioned labeling to achieve coding gains over conventional labeling, then the minimum distance is given as $$\text{min}(d_{free},d_{ic})$$
where $d_{ic}$ is the minimum squared Intra-coset distance which can be calculated from the mapping. Having said this, the MSED of the convolutional code can be computed the same way its $d_f$ (the hamming free distance) is computed. You need to do a trellis search and replace hamming weights with squared euclidean minimum distances with the all zero-sequence mapping (this is valid because any convolutional code is linear and if the mapping is BPSK or QPSK, every symbol has a decoding Voronoi region that has the same area and the same shape as every other sequence). I believe you've implemented your trellis search perfectly. Having said this, the Ungerboeck code cannot be performing better than a code which has a higher Euclidean $d_{min}$. Suggestions:  1. Either you're computing one of the distances wrongly2. Are you sure about the minimum distance of the Ungerboeck code?


Does it make sense to recompute Parks-Mccellan on a per sample basis?

No, the Parks-McClellan algorithm, which is based on the Remez exchange algorithm, is a computationally quite expensive iterative method that is most commonly used for off-line filter designs. It is not at all well-suited for real-time applications, let alone for re-designing a filter each sample interval.

Depending on your application, you might be looking for an adaptive filter based on the LMS (least mean squares) algorithm.

Another approach, again dependent on the application, is to use an appropriate parametrization of the filter, where the parameters could be the gain, center frequency, Q factor, etc. This is easily possible with second order IIR filters.


Transfer function, amplitude response and difference equation for a filter

start from the transfer function: $$
H(z) = \frac{(1-z^{-6})^{2}}{(1-z^{-1})^{2}}
$$

expand it: $$
H(z) = \frac{ 1-2z^{-6} + z^{-12} }{ 1 -2z^-1 + z^{-2}  }
$$

Frequency response is:
$$
H(e^{j\omega}) = \frac{ 1-2e^{-j6\omega} + e^{-j12\omega} }{ 1 -2e^{-j\omega} + e^{-j2\omega}  }$$

Note: this may be simplified by proper algebraic grouping and cancellations to what you have provided.

Transform this rational H(z) directly back into its corresponding LCCDE:
$$y[n]-2y[n-1]+y[n-2] = x[n]-2x[n-6]+x[n-12]$$

I can't figure out a meaning for the wT representation, nor if it is necessary...


Nyqusit Frequency simply means "half the sample rate"
Undersampling means your signal bandwidth is higher than the Nyquist Frequency. You get aliasing
Oversampling means your signal bandwidth is lower than the Nyquist Frequency. You don't get aliasing
Most practical applications choose a Nyquist Frequency that's slightly higher than the highest frequency of interest. That gives some space to manage the transition band between the signal frequencies and the Nyqusit Frequency (at which the signal should be 0). For example audio is considered to have 20 kHz bandwidth but the typical Nyquist frequencies are 22.05 kHz or 24 kHz


Example of Fourier Transform not existing for real-life signals?

All real-life signals are finite energy. The universe contains a fixed (and finite) quantity of energy, which has been unchanged since it came into being.

A signal's energy is given by

$E =\int_{-\infty}^{\infty}|x(t)|^2dt$

Thus, the only way to make a signal's energy go to infinity is to allow it to continue for infinite time or reach an infinite peak level. While useful in mathematical and/or physics theory, neither of these is possible in reality.


The energy bin "width" of an FFT is the width of the transform of the window used (a rectangular window by default).

The transform of a rectangle the width of the FFT is a Sinc function (sin(x)/x) with a main lobe width equal to twice the DFT/FFT bin spacing, plus smaller ripples extending the full width of the FFT result (and actually circling around forever making it technically a Dirichlet function).  Note that the frequency response of each bin filter overlaps with others except at exact bin centers (representing exactly periodic-in-aperture pure sinusoids).

For the default rectangular window, only about 87% of a bin's passband is within 0.5 of a bin width from the bin center frequency, which is why ignoring so-called leakage might not be a good idea.  A longer FFT has a narrower main lobe bin response, with the ripples ("leakage") dying out faster.  But 2 half width Sinc functions do not sum to a single Sinc, so averaging a longer FFT will not produce identical results (except for sinusoids that are exactly periodic in both FFT lengths.)

A window other than rectangular (von Hann, etc.) will have a main lobe wider that 2 bin spacings, but, in return, far smaller ripples away from the main lobe.

The DFT/FFT resolution depends on whether you are trying to resolve closely spaced peaks as clearly separate peaks (requiring around double or more the bin spacing), or estimating the frequency of a single isolated peak with a relatively high local S/N ratio (sometimes in low noise allowing a fraction of a bin spacing in resolution after high quality interpolation).


What are the largest FIR filter lengths used in practice?

All applications are bound to some notion of accuracy of the magnitude/phase response.

Given a FIR is a polynomial approximation to a desired magnitude and phase response:

The lower the number of taps, the poorer the approximation, but the
lower the computational overhead.
The higher the number of taps, the better chance you have of a more
accurate approximation (depending on your design approach), but the
higher the computational overhead.

There's not much more can be said on the finer points unless you ask a more specific question at which point there are many people cleverer than me in this forum who will be able to give you some good pointers.

For instance FFT makes high order FIR filters possible as it is computationally efficient and has good numerical properties. High tap FIR filters aren't rare and I can vouch for them being used in audio (64K and 128K taps are common for some purposes).

Using fixed point arithmetic usually implies you are computationally bound by a chip without an efficient floating point arithmetic unit and the numerical properties of fixed point arithmetic tend to limit the accuracy of high order filters. So high order filters are not aided by fixed point arithmetic.

UPDATE, based on question in comments about upper limit on taps for fixed point:

I've only ever implemented FIR filters using floating point arithmetic, but I have written fixed point routines (for non FIR related applications) on a 32-bit 16 instruction RISC architecture in assembler. It's possible to get any precision you want by extending your arithmetic across words at the expense of clock cycles i.e. you can improve your precision in fixed point if necessary, but at some point you will hit the limit of your processing capability. So you ideally need to say what chip you're using, what language/libraries you're going to use, show us a graph of your ideal magnitude/phase response, what latency you're happy with and what input/output rate. It's impossible to give hard limits without some real constraints. It might be another question on SO perhaps...


If you have conjugate symmetric poles and zeros then the coefficients of the system (i.e., the filter coefficients, or, equivalently, the coefficients of the corresponding difference equation) are real-valued. E.g., if the zeros are $z_0$ and $z_0^*$ then the numerator polynomial of the transfer function $H(z)$ is (up to a scaling factor)

$$N(z)=(z-z_0)(z-z_0^*)=z^2-(z_0+z_0^*)z+|z_0|^2=z^2-2\text{Re}(z_0)z+|z_0|^2\tag{1}$$

Note that the coefficients in $(1)$ are all real-valued. The same is true for the denominator polynomial. So the frequency response (i.e., the transfer function evaluated at $z=e^{j\omega}$) can be written as

$$H(e^{j\omega})=\frac{b_0e^{2j\omega}+b_1e^{j\omega}+b_2}{e^{2j\omega}+a_1e^{j\omega}+a_2}\tag{2}$$

with all coefficients $a_i$ and $b_i$ being real-valued. Consequently, the following equation must hold:

$$H(e^{j\omega})=H^*(e^{-j\omega})\tag{3}$$

If you write $H(e^{j\omega})$ in polar form $H(e^{j\omega})$=$M(\omega)e^{j\phi(\omega)}$ with magnitude $M(\omega)$ and phase $\phi(\omega)$ you get

$$M(\omega)e^{j\phi(\omega)}=M(-\omega)e^{-j\phi(-\omega)}\tag{4}$$

From $(4)$ it follows that for conjugate symmetric poles and zeros the magnitude of the frequency response must be an even function of frequency, and the phase must be an odd function of frequency, i.e., $M(\omega)=M(-\omega)$ and $\phi(\omega)=-\phi(-\omega)$.


What do certain terms mean in EEG processing describing frequency bands?

The short answer: The brain is a huge set of neurons that produce electrical activity as part of their function. We can sense this electrical activity and correlate it with brain states (alert, asleep, awake, meditating, etc). The passing of the brain between states (e.g. alert to asleep) is marked by modifications to the patterns of electrical activity.

The not so short answer: If you are "serious" about processing EEGs, get yourself a copy of Niedermeyer and Da Silva's: Electroencephalography: Basic principles, clinical applications and related fields. It is a monumental book on EEG and will answer all of your questions in excruciating detail. But, you have to give the book the time it needs. Especially sections 2,3,4,5 on the basics of signal generation and acquisition and then 11,12,18,26,30,31 and 56 which talk about modifications caused by certain diseases and during sleep.

Now, the brain is a lump of neurons. Different types of neurons that are there for different types of tasks. Some of them respond to electrical activity (from the nervous system) by propagating or inhibiting electrical activity. We can see this in the lab, by observing how does one single neuron behaves but to date it has been impossible to observe what EACH neuron is doing in-vivo in a functioning brain. This is the "promise" of Neuroimaging.

So, when it comes to electroencephalography, an electrical activity (of the brain) is sensed by an instrument (the EEG aparratus). Actually, in this case, a ridiculously small number of electrodes (a few tenths) is used to sense the combined functioning of a ridiculously large number of neurons (a few billions).

Because of this "imbalance" we see patterns in the electroencephalography measurements that, macroscopically, correspond to brain function. We don't really know what is happening at the neuron level, but we can observe waves of electrical activity spreading throughout the surface of the brain and we hypothesize that this is probably because of the brain's properties of segregation and specialisation (and this, go through the introduction, at least once).

In other words, certain parts of the brain are devoted to certain functions and they "connect" together to exchange information as the brain functions.

Because of this, certain "states" of cognition can be cross referenced with certain electrical patterns.

For example:

If you ask an average someone to close their eyes and relax, their brain will kick into "alpha" wave activity. If it doesn't, then this might suggest that this average someone, is not so average after all.
Theta waves are associated with hippocampal activity. If that activity is found to deviate from what is considered "normal", then this is a sign for things starting to go wrong (please see section 3.2 but also 3.1 for some general remarks.). Theta waves are also associated with another "big mystery" of brain function called "sleep".
Spindles are associated with sleep activity and are correlated with phases of sleep. Lack of spindles, is usually not a good sign for brain function.
As far as "...drop of voltage/waves", "...induces.." are concerned: The waves denote brain states. As you emerge from sleep, the brain makes a transition. So, it is expected that you will stop exhibiting theta waves and sleep spindles and you will come back to having alpha waves and ultimately normal dynamic brain activity. Anything that mentions drop of this wave and increase on that wave, etc, denotes the passing of the brain through different states.

As a side note to this, you probably are aware of various youtube videos claiming to relax, boost creativity, put you to sleep and other claims. I am not sure which and how many of them work but their "basis" is that you can synchronise the brain with an external signal source and induce some sort of brain wave to it. So, this is like saying "well, if the brain produces theta waves when it goes to sleep, why don't we replay some sound source, modulated at theta wave frequencies, to the brain to get it to synchronise and go to sleep?". In fact, certain practices such as meditation are like conscious attempts of a brain's "user" to put it into certain regenerative states. But which of these things work, inferred scientifically, is currently an open question.

Hope this helps.


0 dBFS refers to a full-scale sine wave or more rarely a full-scale square wave.
ITU-T telephony Recs. P.381 and P.382 and reportedly the paywalled digital audio device measurement standards AES17-1998 and IEC 61606 define that full-scale sine wave is 0 dBFS. ITU-T Rec. P.10/G.100 (11/2017) does not make the distinction and defines dBfs (sic) as "relative power level expressed in decibels, referred to the maximum possible digital level (full scale)".
Full scale DC has the same RMS value as a full-scale square wave, but is 3.010299956 dBFS RMS if the 0 dBFS reference is a full-scale sine wave. Looks like the different programs use a different reference (square or sine). Samplitude Pro X might use some approximation of RMS that gives in this case a 0.1 dB unit error.
The calculations:
$$\int_0^{2\pi}\frac{\sin(x)^2dx}{2\pi} = \frac{1}{2}$$
$$10\log_{10}\left(\frac{1}{2}\right) \approx -3.010299956$$


The DFT is discrete in both time and frequency domains with the same number of samples in each domain, this means the input to the transform and the output of the transform are both discrete and both have $N$ samples. This is defined in the formula for the DFT where we have $N$ samples in time indexed as $n = 0$ to $N-1$ and $N$ samples in frequency indexed as $k = 0$ to $N-1$. The sampling frequency is located at $k = N$.
$$  X[k] = \sum_{n=0}^{N-1}x[n]e^{-j k \frac{2\pi}{N} n}$$
This is by definition, as for example the DTFT is continuous in frequency given by
$$  X(e^{j\omega}) = \sum_{n=-\infty}^{\infty}x[n]e^{-j\omega n}$$
As we see in the DFT formula, each sample $k$ in $X[k]$ is a correlation (sum of products) of the time domain waveform $x[n]$ with the frequency tone given by $e^{-j k \frac{2\pi}{N} n}$ -- observe that the form $e^{j\phi}$ is a phasor with magnitude $1$ and angle $\phi$, so we see that for each value of $k$ that we pick, $e^{-j k \frac{2\pi}{N} n}$ is just a phasor spinning at a different rate defined by $k$. This causes the correlation to maximize when $k$ is equal to or close to the frequency of $x[n]$.
The reason for $N$ samples is also quite intuitive since as the OP saw the transform mathematically behaves the same way as if the time domain waveform was periodic: This is similar to the Fourier Series Expansion (FSE) which decomposes any single valued analytic function into an infinite series of discrete frequencies, with each frequency an integer multiple of the fundamental, with the fundamental given by $f=1/T$ Hz where $T$ is the duration in seconds of the time domain signal: That makes sense as the FSE also behaves as if that time domain waveform continued to infinity as a periodic waveform; if we repeat an arbitrary waveform over $T$ seconds, it will have a fundamental frequency at $1/T$ Hz. It also must be discrete, since each of the individual components given by the higher harmonics will also repeat only over duration $T$, and we recreate the waveform by summing each of these component (so any component that didn't repeat over $T$ would violate our ability to do that).
Thus knowing we have $N$ samples in time, the fundamental frequency would then be at $1/N$.  We also know that the sampling rate is at bin $k = N$ in frequency, thus the fundamental frequency is at $k=1$, and there must then be $N$ total frequency samples (some may be equal to 0), each one the integer multiple of the fundamental, just like the FSE!


The DC gain is simply the sum of filter taps or coefficients. This is the value of the frequency response at DC (i.e. $0\ \rm Hz$), or equivalently
$$
H(0) = \sum_{n = 0}^{N - 1}h[n]\tag{1}
$$
Because, for a digital FIR filter of length $N$ with impulse response given by Equation $(2)$
$$
\big\{h[n]\big\}, \quad\text{with}\quad 0\le n\le N -1\tag{2}
$$
the frequency response is the $z$-transform at the unit circle (i.e. $z = e^{j2\pi f}$), or in this case, equivalently
$$
H(e^{j\omega}) \equiv H(\omega) = \mathcal F \left\{h[n]\right\} \triangleq \sum_{n = 0}^{N - 1}h[n]e^{-j\omega n } = \sum_{n = 0}^{N - 1}h[n]e^{-j2\pi n f}\tag{3}
$$
Then you can think at DC (i.e. at $0\ \rm Hz$ or $f = 0$ or $\omega = 0$) to see the why of Equation $(1)$.
From DTFT to DFT
The DFT is the one practically computed in place of the DTFT. For finite-length signals (as is the case here), it provides the frequency-domain samples of the DTFT. Then $H[k]$, which is the DFT of the $h[n]$,  is computed for $N$-point as shown in Equation $(4)$
$$
H[k] = H(e^{j\omega}) \bigg\vert_{\omega = 2\pi k/N}\quad\text{with}\quad 0\leq k \leq N -  1\tag{4}
$$
i.e. $H[k]$ consists of equally-spaced (by $2\pi/N$) samples of $H(e^{j\omega})$.
Noting that
$$\omega \equiv 2\pi f \quad\text{with}\quad -\pi \leq \omega \leq \pi\quad\text{and}\quad -\frac 12 \leq f \leq \frac 12$$
With $\omega$ in [radians/sample] and $f$ in [cycles/sample].
In MATLAB
This can be done using MATLAB's freqz function as follows:
>> [h, w] = freqz([-3 0 -3 0], 1, [0 , pi/4])

h =

 -6.000000000000000 + 0.000000000000000i -3.000000000000000 + 3.000000000000000i

w =

                   0   0.785398163397448

>>

Giving you the flexibility to specify at whatever angular frequencies $\omega$  (in example above the evaluation is at two frequencies $0$ and $\pi/4$ rad/samples) you would want to evaluate the frequency response, (Here we're interested in the value at $\omega = 0$).  The magnitude response with these two points is shown below

Note that the two points in magenta correspond exactly to
>> 20*log10(abs(h))

ans =

  15.563025007672874  12.552725051033063

>>

The values at $\omega = 0$ and $\omega = \pi/4$ respectively.


Need an Identity for CTFT Polynomial Raised to an Exponent

Dilip's idea is an excellent suggestion. Let me slightly modify it. You can rewrite
$$a\omega ^{2}-b\omega +c = a(\omega -\omega_{0} )^{2}+d$$
So the whole thing can be written as

$$e^{d}\cdot e^{a(\omega -\omega_{0} )^{2}}$$

That's essentially a Gaussian shifted in frequency with a constant scale factor. The transform of a Gaussian is just another Gaussian and the shift in one domain corresponds to multiplication with a complex exponential in the other domain so the inverse ought to look something like:

$$x(t) = k\cdot e^{\tilde{a}t^{2}}\cdot e^{j\omega _{0}t}$$
where $k$, $\tilde{a}$, and $\omega _{0}$ are determined by the original a, b, and c. a better be a negative number, though, otherwise I don't think that the transform would be convergent.


The following two books by by Gonzalez and Woods can help you with image processing

Digital Image Processing Using MATLAB
Digital Image Processing


Use of the Sobel Filter for Image Gradient [MATLAB]

Well, if you go through the documentation of fspecial() you'd see it returns the following filter:

h = fspecial('sobel') returns a 3-by-3 filter h that emphasizes horizontal edges using the smoothing effect by approximating a vertical gradient. To emphasize vertical edges, transpose the filter h'.

[ 1  2  1
  0  0  0
 -1 -2 -1 ]

Namely in the way you applied it above you only got the vertical element of the gradient.

While imgradient() returns the image of the magnitude of the Gradient (Which has Vertical and Horizontal elements) and its direction.


Difference Equation - Time Response analysis of Discrete Systems

The answer to your first question (why $j$ starts at $1$) is contained in your first sentence: the output is computed from the current input value ($i=0$), from past input values ($i\ge 1$), and from past output values (i.e. $j\ge 1$). Imagine that you had the following difference equation with $j$ starting at $0$:

$$y(n)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=0}^Na_jy(n-j)\tag{1}$$

Then you could rewrite (1) as

$$y(n)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=1}^Na_jy(n-j)-a_0y(n)\tag{2}$$

and consequently

$$y(n)(1+a_0)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=1}^Na_jy(n-j)\tag{3}$$

Now you can divide (3) by $1+a_0$ to arrive at an equation like the one given in your question (with $j$ starting at $1$) (and with all coefficients scaled by the constant $1+a_0$). So you can always use the difference equation with $j$ starting at $1$ without loss of generality.

Concerning the 3 examples of difference equations you gave I'll just discuss the first one, the others are totally analogous. Here you have $M=5$ and $N=1$ with coefficients $b_1=0.002$, $b_5=0.01$, and $b_0=b_2=b_3=b_4=0$, and $a_1=-0.99$.

Finally, concerning your last question about the system $y(n)=2x(n)$. That's again a special case of your general difference equation with all $a_i=0$ (i.e. no recursion) and with $b_0=1$ (and all other $b_i=0$, $i\ge 1$). So all your examples are special cases of the general difference equation.


The problem with your reasoning is that $\pi \ne \frac{22}{7}$; $\pi$ is an irrational number. There is no period $N$ for which $x[n] = x[n+N] \ \forall \ n \in \mathbb{Z}$. Hence, the sequence is not periodic.


How does a correlation receiver ensure which transmitted data does a user see?

Correlation is a sum of products. With a "correlation function" (such as autocorrelation function, cross-correlation function, etc) we are actually doing multiple correlations, one for each possible change in some variable of interest. In this case, the OP has shown a cross-correlation function since it is the correlation between $x$ and $y$ with the variable of interest being a delay index $k$. It is also very important to point out that it is a complex conjugate multiplication (the OP did not raise the * so may not be clear so rewriting here):
$$R_{xy}[k] = \sum_{n=-\infty}^{+\infty} x[n-k]y^*[n]$$
In this case the variable of interest is the delay index $k$ where the correlation (sum of products) is being computed for each possible delay index $k$: we delay one waveform relative to another and repeat the sum of products computation (lots of processing!), and here we would be looking for either a delay index $k$ where the correlation is strongest to the waveform we are looking for (so if $y[n] = x[n] + noise$ for example where "noise" could be other users), and we would desire that other users be uncorrelated so not have any correlation response.
We could also use this property for timing and synchronization by using codes that have an auto-correlation property where they are very strong when the codes align and nearly zero for every other offset. Auto-correlation is given as:
$$R_{yy}[k] = \sum_{n=-\infty}^{+\infty} y[n-k]y^*[n]$$
A simple example of this is a 11-bit barker code given as 1 0 1 1 0 1 1 1 0 0 0
If you replace all zeros with -1 in the above sequence, you will see that the autocorrelation is 11 when the code aligns and -1 for every other rotational shift (by doing a sum of products which is correlation).
In terms of using this with multiple users (CDMA), consider that each user has a unique code, and very importantly we'll assume that the power from each user that a receiver sees is about the same (this is very important for CDMA to work properly and thus a reverse power control mechanism is often used, or as it the case of Satcom such as GPS, the transmitters are so far away that all receivers receive about the same power level from each of the satellites). If each user has a unique code and those codes for each user are known to be uncorrelated, we can use cross correlation of correlating the received signal given by $r[n]$ with the code for a given user given by $y[n]$ to extract the data for that user (one way to do this such as with spread spectrum is to modulate the code sequence so that the entire sequence is inverted according to the data and thus the data is at a much lower rate than the code). The math is to just use the cross-correlation function, or more likely use a delay lock loop to align the local code with the code position in the received signal and just keep computing the correlation: if our local code is known to be aligned from a prior acquisition operation, then we simply multiply the received signal by the local code and accumulate over the sequence (symbol) period. This is an integrate and dump receiver. Often there will be additional integrate and dump channels to maintain tracking (early-late).


You just shifted the low pass filter to the right, so you generated a complex-valued filter, as you've observed. Multiplying a real-valued impulse response with a complex exponential naturally results in a complex-valued impulse response. What you actually have to do is shift the spectrum to the right and to the left:

$$h_{BP}[n]=h_{LP}[n]e^{jn\omega_0}+h_{LP}[n]e^{-jn\omega_0}\tag{1}$$

where $\omega_0$ is the desired center frequency. Eq. $(1)$ is equivalent to

$$h_{BP}[n]=2h_{LP}[n]\cos(n\omega_0)\tag{2}$$

from which it is obvious that the resulting band pass impulse response is real-valued.

The reason why it works with the high pass filter is that $e^{jn\pi}=\cos(n\pi)=(-1)^n$, so for this special case ($\omega_0=\pi$) it makes no difference.


Smoothing a Signal which contain White Noise

A boxcar filter is a FIR filter, suppose your frame has length N and your boxcar has a length of M, you will have M+N-1 filtered values.There are 2 properties, time invariance and superposition that you can use.

Assume your boxcar has length 5, and examine 2 sequential frames,data is $x$

$$
\begin{align}xxxxxxxxxxxxxxxxxxxx&0000  \quad \text{Frame 1 with 4 zeros post appended} \\
                0000&xxxxxxxxxxxxxxxxxxxxxxx \quad \text{Frame 2, 4 zeros pre appended}
\end{align}
$$

If we could time align the 2 frames, and added them together, we would have continuity across the frames.  This is a consequence of superposition.

If we run the boxcar over each frame,including the zeros
$$
\begin{align}yyyyyyyyyyyyyyyyyyyyy&yyyy \quad \text{Filtered Frame 1 } \\
                yyyy&yyyyyyyyyyyyyyyyyyyyy \quad \text{Filtered Frame 2 }
\end{align}
$$

Adding the 2 time aligned filtered frames, is the same as filtering a gapless buffer.  This is superposion, and time invariance of the filter.


I think your question has nothing to do with "software", so I'll ignore this part, and only discuss the calibration part of it. Then again, your question is very broad and cannot be answered with yes or no: It really depends.

In some applications you might want to try to invert as much of the transfer function of your sensor as possible. In other applications you might not care about it that much and leave it in or only partially compensate it.

What's though true is that in general you cannot completely eliminate the effect of your sensing equipment. By the way it filters the "true" signal $x(t)$, some of its components might be filtered out and be lost completely. As a simple example: practically all real systems have some sort of low-pass characteristic so that very high frequency components will not do anything to it and thus never show up in $y(t)$. If you excite a 1 kHz low-pass system with a 1 GHz input signal, you cannot hope to get it back by inverting the low-pass characteristic, you'd have to divide by zero essentially.

There may be other reasons you would not want to compensate. Say your system does have a very small gain at some particular frequency. Then if you try to invert this behaviour, you'll need to amplify this particular frequency a lot. This would mean that any unwanted component, such as noise, would be strongly amplified at this particular spot. In applications like this you might want to do a partial calibration, where you do correct for the transfer function in a certain frequency region of interest only, and ignore the rest of it.


Should I filter before calculating power, if I'm looking for relative changes in power?

If the output from the SDR matches the band you're interested in, I see no point in filtering.

You want to filter when you have a scenario similar to this: you want to track the power in a band of $B$ Hz around a frequency $f_c$, but the SDR's output covers a band that is larger than $B$. In this case you want to filter, since otherwise a signal outside the band of interest could affect your calculations.


Confusion about the impact of flat fading and frequency selective fading on OFDM

Because of wide-band nature of OFDM signals they are so prone and sensitive to multi-path delayed channel. The problem is that at the receiver side you will receive several copies of original transmitted signal, each with a different magnitude and delay. This "delays" are so destructive at the receiver side. The mathematics behind this: imagine the channel with multi-path problem. so u can model this channel as a linear-system with an "impulse response". this impulse response consists of several impulses with different magnitude and delays. so, your sent OFDM signal passes through this channel. the result can be guessed. at the output this system, the OFDM signal is convolved with the impulse response of the channel (system) in time domain. In frequency, it is like as the freq-domain OFDM signal is multiplied by the frequency-response of the channel. That's why we face a distorted received signal. At the receiver, when you apply FFT on the received signal you have to compensate that errors. This is called channel estimation (means estimating the freq-response of the channel). Then you should correct the signal. This is so crucial because in OFDM we usually have QAM modulation & demodulation. and in QAM the magnitude of signal is important which is already distorted by the channel.


Discrete Harmonics - Why multiplying digital frequency by k does not get next harmonic

First the continuous-time:

Consider the complex exponential: $ e^{j \Omega_0 t} $ where $\Omega_0$ is the continuous-time radian frequency, $t$ is the continuous time itself. Now from elementary calculus, the period of this complex exponential can be found from $x(t) = x(t+T)$ as :

$$ e^{j \Omega_0 t} = e^{j \Omega_0 (t+T)} = e^{j \Omega_0 t} e^{j \Omega_0 T} $$

Now in order for this equality to hold, the last exponential term must be $1$. From the algebra of complex-exponentials it's known that it will be $1$ whenever $\Omega_0 T = 2\pi m$ for some integer $m$ and real $T,\Omega_0$ which indicates that

$$e^{j \Omega_0 T} = 1 \implies \Omega_0 T = 2\pi m $$ from which we find the period of the continuous-time complex exponential as:

$$ T = \frac{2 \pi m}{\Omega_0} = \frac{2 \pi}{\Omega_0} = T_0$$

where in the left we used the fact that the fundamental period $T_0$ is the minimum (nonzero) real number $T$ that satisfied the equality for $m=1$.

Conclusion: any continous-time complex exponential $e^{j \Omega_0 t}$ is periodic for any real value of $\Omega_0$... This is so because $t$ is a continuous variable which admits the period $T_0$ to be continuous as well. Since the period is allowed to be continous, it can always be found to make $ \Omega_0 T$ an integer multiple of $2\pi$.

Furthermore, in the continous-time case the harmonic family of the complex exponential $e^{j \Omega_0 t}$ is defined to be:
$$\phi_k(t) = e^{j k \Omega_0 t}$$ for integer $k = 1,2,...,\infty $.

The particular period associated with the k-th harmonic $\phi_k(t) = e^{j k \Omega_0 t}$ is $T_k = \frac{T_0}{k}$, nevertheless its fundamental period is $T_0$.

Now, since the period in continous-time is a real variable it can take any value possible, as you can see, as the harmonic member index $k$ increases the particular period decreases like $T_k = \frac{T_0}{k}$. As the member index $k$ goes to infinity, the member period goes to zero but is a valid value. Hence we see that there are an infinite number of such members; i.e., the harmonic family in continuous-time has infinite members. for each $k=1,2,... , \infty$

Part-II: The discrete-time case :

The complex exponential is $e^{j \omega_0 n}$, where $n$ is an integer and $\omega_0$ is the discrete-time radian frequency (real variable).The headache comes beacuse the index $n$ is not continous but an integer, and therefore, admits only integer periods $N=1,2,...$ . The smallest allowed period is $1$ (unlike in the CT case where the smallest period goes to zero taking any real value)

Now for a discrete-time complex expoeential to be periodic, you should have $x[n] = x[n+N]$ for some integer $N$ as shown:

$$ e^{j \omega_0 n} = e^{j \omega_0 (n+N)} = e^{j \omega_0 n} e^{j \omega_0 N} $$

Again from the complex exponential algebra it's seen that :
$$ e^{j \omega_0 N} = 1 \implies \omega_0 N = 2\pi m $$ for some integer $N$ and $m$ . This implies that :

$$ \omega_0 N = 2\pi m  \implies N = \frac{ 2 \pi m }{\omega_0} $$

Now, in order for a discrete-time complex exponential $e^{j \omega_0 n}$ to be periodic with period $N$, it must be true that its frequency $w_0$ must be a rational multiple of $\pi$ as indicated by :

$$ \omega_0 = \frac{2 \pi m}{N} $$

Hence if $\omega_0$ does not satisfy the above condition that that complex exponential cannot be periodic at all. This is never the case with continuous-time complex exponentials which are always periodic for any $\Omega_0$.

After finding the condition on the periodicity of the discrete-time complex exponential, let's also observe their harmonic family:

In the discrete-time case, the harmonic family of the periodic complex exponential $e^{j \omega n} $ with a period of $N$ is defined to be:
$$\phi_k[n] = e^{j k \omega_0 n}$$ for integer $k = 0,1,...,N-1$.

Another difference between the CT and DT harmonic families occur on the particular period $N_k$ associated with the k-th harmonic: it is not $N_k = \frac{N}{k}$, as that won't be an integer for any $N$ and $k$. The correct period for the k-th member is $N_k = \frac{N m}{k}$ where integer $m$ is chosen to make $N_k$ the minimum integer for given integer $N$ and $k$

Now the last point, why are there just a finite number of harmonics in DT unlike the CT where there are infinite harmonics? This can most easily explained by the following:  Let integer $k = mN + r$ for some integers $r,m$ and let $r < N$ where $N$ is the period of the fundamental member $e^{j \omega_0 n}$. Then we have the k-the member as:
$$ \phi_{k}[n] = \phi_{m N+r}[n] = e^{j \omega_0 (mN + r ) n} = e^{j \omega_0 m N n } e^{j \omega_0 rn } $$

Now since $N$ is the period, we have $e^{j \omega_0 m N n } = e^{j 2\pi l m N n} = 1$ and therefore we see that

$$ \phi_{k}[n] = \phi_{m N+r}[n] = e^{j \omega_0 rn } = \phi_{r}[n] $$

The $k = mN + r$ th member is identical to the $0\leq r \leq N-1$ st member. Hence we conlude that in discrete-time, for a periodic complex exponential $e^{j\omega_0 n}$ of period $N$ there are only $N$ distinguishable members of the harmonic family.

I hope this clarified it.


Removing Noise from time across signal data

Is the width of your 5000-amplitude pulse always the same? If so, then just discard your signal samples that occur after seven seconds. If the width of your 5000-amplitude pulse varies then try lowpass filtering (experimenting with different lowpass filter bandwidths) your signal to see if the filtered signal contains the information you desire. If the width of your 5000-amplitude pulse varies then you might try differentiating your signal and measuring the time instant $t_o$ of the large negative amplitude transition. Then just discard your original signal samples that occur after $t_o$ seconds. Good Luck.


Reduce the "glare" effect of a receiver within a system

If you want to separate two sources you need some kind of diversity. Your know almost nothing about these signals so the only diversity you can exploit is frequency one. So first both spectrum should not be overlapped. And the second: as you know not all transmitted energy of the strong source (that you called $X(t)$) is allocated in the band you draw. Some out of band emission exists and its power depends on shape filter and power amplifier. So if even $X(t)$ and $s(t)$ are not overlaped at all, $s(t)$ may be totally shaded by out of band emission of $X(t)$. And you can't filter it out. You may refer to the problem of multiple access interference (MAI) problem of multi-user systems for details.

Now suppose frequency diversity is big enough and no out of band emission of $X(t)$ interferes with $s(t)$. As you were told FFT can be used to allocate both of the signals and further we can do bandpass filtering to completely distinguish them. But you probably need a large amount of data to achieve high resolution with FFT approach. Though you can improve FFT performance by windowning data set. The main advantage of FFT in this case is its ability to allocate signal even at very bad SNR (0 or less). You only need to increase its size.

The alternative is using some correlation properties and second order statistics. As I understand Blind source separation rely on it (PCA, ICA, but I can mistake). You may estimate input signal autocorrelation matrix as $R = E[xx^H]$. Further if you make $svd(R)$ you'll get singular eigen values of the signal mixture. Using these methods you can separate sources only if their eigenvalues are distinguishable from each other and noise ones (noise subspace). If the diversity is low or signal is too weak its eigen value decreases and it becomes "invisible" to the algorithm. The main advantage is much less amount of data is needed to allocate sources in comparison with FFT approach.

It is also important how large band of search is. It restricts complexity of the computations required. Furthermore $svd$ based methods (e.g. spectrum estimation) are good for narrowband sources (as I've seen, can mistake) while FFT is well enough for both narrow- and broadband cases.


Use of Tukey window and its effect on a graph

The technique that you have described looks similar to the Welch's method for estimation of the power spectral density. Though, it seems that there is an error in your implementation: you should take the squared absolute value of the FFT, instead of the complex value. Such an error might affect your results significantly as the random phase might bring you to a zero mean value of the spectrum. Anyway, most of the languages used for signal processing such as MATLAB and Python contains a ready to use implementation o the Welch's method, so you do not have to mess with the details.
Suggestion: since the variation of the spectrum is due to the user of several windows (variation reduction proportional to N), you might want to overlap the windows. The typical overlap for the common Hann window is 50%.

Window type should not affect the spectrum in a way that you have described. Multiplication in time is equivalent to convolution in the frequency. Therefore, the windowing effect should mostly affect your spectrum leakage. Is your signal stationary? this is a fundamental assumption for using such a technique.

Actually, as long as I know, the signal that you have described does not contain information in the time domain but only in the frequency domain. In other words, there should be no periodic components with defined phase. Therefore, it is usually processed with a rectangular window (and then there is no need for overlap).

Using any window reduces the energy as the window's value is smaller than 1. This could be compensated by dividing the result with the window norm/mean value (maybe with the power of two or some other coefficient - depends on the type of the spectrum you want to estimate). Anyway, you don't have to worry about it if you use the implementation by MATLAB which wrappers it all for you.


Analysis of the ratio of two moving average filters

This depends a bit on what you want to get our of the analysis
Step 1: Instantaneous  power
You square the signal. That changes the spectrum considerably. In particularly you need to watch out for aliasing. Let's say your signal is a 15kHz sine wave sampled at 48 kHz. If you square this you get one component at DC (0 Hz) and another at 30 kHz. However, the 30 kHz component will alias down to 18 kHz, so your squared spectrum is outright wrong in this case. To be safe, you should either up-sample the signal by a factor of 2 before squaring OR lowpass filter it at a quarter of the sample rate. Many "natural" audio signals don't have a lot of energy at high frequencies, so could also choose to just live with the aliasing error, but that's an application specific decision.
The physical interpretation of instantaneous power is complicated. Let's say your input signal is the voltage at the terminals of a loudspeaker: Squaring it does NOT represent the instantaneous power. The actual instantaneous power is the product of the voltage and the current waveform. Since a loudspeaker is a reactive load, this will be quite different from the squared voltage. For example, it's perfectly normal for the instantaneous power to be negative which the square of a signal can never be. Negative instantaneous power simple means that the load has energy storage and that at times it can feed stored energy back into the source.
Going back to the sine wave example. A squared sine creates a component at DC and one at double the frequency. One possible interpretation: the DC component reflects the actual power consumed, the double frequency component represents power that gets exchanged between the source and the load but not consumed: it just gets shoved back and forth.
Provided that the signal is the "actual" instantaneous power, than the mean of it will represent the average power and the integral will represent the real energy consumed (exactly).
Step 2: Moving average
Moving average is just a low pass filter where the length of the averaging window determines the "cutoff" frequency. Unfortunately it's a rather poor one. It attenuates the "higher" frequency in the spectrum but very unevenly. Personally I would assume that in most cases a simple IIR filter would work much better.
A low pass filter will eliminate the "back and forth components" of the power signal but keep the "actual consumption". The choice of cutoff frequency (or time constant) should be tied to the physical process you want to observe. I.e. could be to time constant of the power supply storage or the thermal time constant of the system.
Step 3: Dividing averages for different time constants
This creates the ratio of "short term power " vs "long term power" where you can define "short" and "long" by the cutoff frequencies of your low pass filter. Whether that's useful or not depends on your application. It's a relative metric: it shows how "spikey" your energy consumption is.
Since real instantaneous power can be negative, it's conceivable that the lowpass filtered version can be negative or zero as well, which can make the division problematic.


To connect one microphone to the Panda board, use its audio input. The homepage says it's a stereo input, so yo can actually connect two microphones assuming your microphones are mono. To apply any DSP on the analog signal it must first be converted to a digital signal, of course. For that you need an analog-to-digital converter (ADC). It's an electronic device. You cannot do analog-to-digital conversion by yourself. I suspect the Panda board audio input to have a dual-channel ADC, otherwise it would be quite useless.

I haven't dived into the technical specs of the Panda board but I'd be very surprised if its general input pins were made for analog signals. So you cannot use those for recording audio, because they're lacking ADCs (unless you manage to use the ADCs of the RF interfaces present on the OMAP platform). For each microphone you need an ADC and an interface to the Panda board. Any selfmade solution will be a real hassle here, I would not recommend it.

A possible alternative solution is to use a professional audio interface that has multiple microphone inputs and a USB output. Then connect this audio interface to the Panda board via USB. The challenge here is to get a driver running on the Panda board. But I think it should be feasible. Keep Linux support in mind when choosing an audio interface.

If you've managed that, and you arrange your microphones in a reasonable way you have a microphone array.


Determing inverse Z-transform using impulse response?

When you have an $H(z)$ (a transfer function), its inverse Z-transform is the impulse response $h[n]$. iztrans is a symbolic function to compute any (causal) inverse Z-transform, either it is related to an impulse response or not. impz is a non-symbolic function to compute some samples of the impulse response of a digital filter.

If I were you and I wanted to find the inverse Z-transform of the given $H(z)$ - which is the impulse response -  I would use residuez:

[r,p,k] = residuez([4 3 9], [4 3 -4])
r =

 1.0544
 2.1956

p =

-1.4430
 0.6930

k =

 -2.2500

That allows you to write the impulse response as $$h[n] \approx -2.25\delta[n] + 1.0544(-1.443)^nu[n] + 2.1956(0.693)^nu[n] $$

given that we're talking about a causal system.

Alternatively, you can use

[h,n] = impz([4 3 9], [4 3 -4]);

but that will give you only a couple of samples of the impulse response.


How to sketch the following discrete-time signal?

I give you some hints and then you can solve this homework.

Your $x[n]$ has only $8$ nonzero values. Figuring out what happens to them (in an exhaustive way) is not difficult.
Consider $(n-1)^2$ and change $n$ over $(-\infty, \infty)$. You can see that it is always non-negative. It means that we never can have $(n-1)^2=-1$. Hence the samples of $x[n]$ for $n=-3,-2,-1$ are never used. We can only have samples of $x[n]$ at $n=0,1,2,3$.
Solve $(n-1)^2=0$, $(n-1)^2=1$,$(n-1)^2=2$, $(n-1)^2=3$. Only accept those results that lead to an integer $n$. Then you can see at what $n$ in $x[(n-1)^2]$ we have what value of $x[n]$. For instance, $(n-1)^2=\color{red}1\Rightarrow n=0,2$. It means in $x[(n-1)^2]$ the samples at $n=0$ and $n=2$ are equal to $x[\color{red}1]=1$.
Except at the points mentioned above, the transformed signal would be zero.


Adaptive Wiener Filter Coefficients Calculation

The Wiener filter is, by definition

a) not adaptive and

b) not FIR / AR.

You seem to want an adaptive FIR filter.

There are many variants of this: LMS, NLMS, RLS (as you say), or the Kalman filter. Choose your poison! :-)

ALL of them are (generally) less computationally intensive that the Wiener filter.


The main issue here is that you are implementing a time-variant filter. Both FIR filter and overlap algorithms are only valid if your filter is time-invariant.

If you need time variant filters, you need to solve two problems: continuity of the state variable and continuity of the output waveform. The easiest way to deal with this is to basically run both filters in parallel and then cross-fade between the outputs at switch time. The time constant of the cross fade determines what audibility you get, so this can be adjusted to the desired level.


Ground plane estimation from a single image (was: confusion about homography and calibration camera parameters)

Yes it is possible to compute the extrinsics given the intrisics, some points in 3D and their projections in the image.  If all your 3D points are in the same plane, then the math for computing the extrinsics is explained in the paper by Zhengyou Zhang, which is the basis for the camera calibration code in OpenCV.

If your 3D points are not co-planar, then you need to use a different algorithm that is described in Hartley and Zisserman.


LPF and HPF Confusion - Rectangular and Circular Cut-Offs

You're probably best off asking your professor for clarification. As you reasoned, it sounds like you're being asked to multiply the image in the frequency domain by either a rectangular or circular mask that eliminates all frequencies outside the mask. This is not typically how you would apply a filter, however, as "ideal" frequency-domain filter masks have unsatisfactory time-domain properties (e.g. a truly ideal rectangular filter has an infinitely long impulse response).

As you noted, filters with a tapered response (of which the Butterworth filter is an example) are more often used. However, the problem specification doesn't seem to contain the information that you would need to design such a filter, such as the type of filter and its order.


Getting a more accurate frequency read from autocorrelation and peak-detection algorithm

If you were using an omnidirectional microphone to pick up the instrument sound you wanted to determine the pitch for, then using the autocorrelation method of determining the period of a waveform could have some merit in reducing the impact of random uncorrelated noise.

But, the way it is attempted to be used here seems to be an incomplete match to the problem's specifications. The signal is not expected to have high levels of noise, the hardware platform is "weak" (limited wordlength and processing power) and all that the selected method is doing is a "fancy" way of deriving a (periodic) signal's period. In addition to this, at some point later on, the same platform is going to have to control the motors too.

Since the signal will be coming directly from the guitar's pickup, it will be loud enough and clean (assuming no problems with the instrument's wiring). In this case, the zero-crossing method is probably the better choice for a guitar tuner. All that the processor would be doing is count how much time passes between setting and resetting a counter as the signal crosses a "zero voltage" point within limits. This method would return the pitch of a guitar string with much higher accuracy given the clock speeds that an Arduino is capable of running at and also leave plenty of time to the CPU to perform other tasks with ease (such as controlling the motors).

For more information on pitch detection in DSP, please see this link.

For more information on zero crossing, please see this link (linked from the same Instructables article that was posted along with the question).

For more information on the basic technique required to create the circuit that will be converting the guitar's signal to the digital form that Arduino expects, please see this link.


Recognition of markes in long audio recording

You can use DTMF tones which are very easily decodable with resonator banks. Brief explanation at http://en.m.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling

If you are in a reverberant room then something like a mobile phone will not put too much energy in it and consequently the recording will not be affected too much by the reverberation. Also, DTMFs are relatively high pitch and would stand out from the background.

There are 16 combinations in a typical keypad but then you can alter symbols (e.g. 1213), possibly in a recording, to build more complex phrases or markers. Altering the symbols quicker than the time constant of the room will reduce the effect of reverberation.

If you are using the starter gun to obtain impulse responses from the room, you can play a sequence in the beginning and just after the end of the recording to roughly identify a particular response but I wouldn't recommend relying on the markers for absolute syncing. You can add a mic close to the gun to obtain the pulse start and end and use the room mics to estimate the dynamics of the room (attack, decay and others)

Hope this helps

Updated part of this answer:

The general idea remains the same, tag a point in time by playing a sound and detect its presence later. The question now is, which sounds and how to detect them. Here is an example using DTMF codes.

1) Get a DTMF generator (for example, a DTMF android app such as this one, https://play.google.com/store/apps/details?id=hu.soska.dtmf&hl=en )

2) In a "clean" (non-reverberant) room, record a sequence of sounds, for example "1928". This is the "tag". Please make sure that each number is keyed in for at least 1 second.

3) In the room under measurement, start your recording. When you want to tag a point, have the "1928" sound reproduced and recorded along with the main recording.

4) Build a filter bank of 8 filters at the DTMF frequencies. The resonators are dead simple filters, here is some example code to get your coefficients: http://lifeorange.com/MATLAB/MATLAB_FD.htm

5) Open the file, run the recording through the filters. Their output will vary depending on the power of the tone in the signal. During the reproduction of DTMF tones, the output of the filters will be increasing. Apply a very simple rule: To maintain a "correct match" you would have to see pairs of filters (representing numbers) going "high" and staying high for at least 1 second. Look for this rule in the outputs of your filters. You now have the matches.

Why single tones and resonators? Because they are very easy and fast to decode.

Alternatives?

Record a Pseudorandom generator signal at step 4 and use cross correlation for step 5. Cross correlation though will be much slower because it would have to run repeatedly in a "sliding window" fashion (please see http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method).

An alternative for step 5 could be multimon (please see http://manpages.ubuntu.com/manpages/gutsy/man1/multimon.1.html ), but that would not give you the offset.

These are all approximate solutions though, they will not give you a dead accurate point in time that your "event" occurs, only a rough approximation (which also depends from the length of your recording).

Hope this helps.


Actually, we have two kinds of autocorrelation functions. One is defined for stochastic signals and the other for deterministic ones.

If $x(t)$ is a stochastic signal, then its autocorrelation function will be $$R_x(t+\tau,t)=\Bbb E\{x(t+\tau)x^*(t)\}$$where $\Bbb E(\cdot)$ denotes the mathematical expectation.

If x(t) is a deterministic signal, then its autocorrelation function will be $$R_x(t)=x(t)*x^*(-t)=\int_{-\infty}^\infty x(\tau)x^*(t+\tau)d\tau$$
where $\cdot *\cdot$ denotes the convolution operation.

Based on the previous category, we have four possible cases:

  (1) Both $x(t)$ and $h(t)$ are deterministic.

In this case, $y(t)$ is deterministic and we obtain $$R_y(t){=\int_{-\infty}^\infty y(\tau)y^*(t+\tau)d\tau\\=\int_{-\infty}^\infty \int_{-\infty}^\infty\int_{-\infty}^\infty x(\tau_1)h(\tau-\tau_1)x^*(\tau_2)h^*(t+\tau-\tau_2)d\tau_1d\tau_2d\tau\\=\int_{-\infty}^\infty \int_{-\infty}^\infty x(\tau_1)x^*(\tau_2)\int_{-\infty}^\infty h(\tau-\tau_1)h^*(t+\tau-\tau_2)d\tau d\tau_1d\tau_2\\=\int_{-\infty}^\infty \int_{-\infty}^\infty x(\tau_1)x^*(\tau_2)\int_{-\infty}^\infty h(\tau)h^*(t+\tau+\tau_1-\tau_2)d\tau d\tau_1d\tau_2\\=\int_{-\infty}^\infty \int_{-\infty}^\infty x(\tau_1)x^*(\tau_2)R_h(t+\tau_1-\tau_2) d\tau_1d\tau_2\\=\int_{-\infty}^\infty \int_{-\infty}^\infty x(\tau_1+\tau_2)x^*(\tau_2)R_h(t+\tau_1) d\tau_1d\tau_2\\=\int_{-\infty}^\infty R_h(t+\tau_1) \int_{-\infty}^\infty x(\tau_1+\tau_2)x^*(\tau_2) d\tau_2 d\tau_1\\=\int_{-\infty}^\infty R_h(t+\tau_1) \int_{-\infty}^\infty x(\tau_2)x^*(\tau_2-\tau_1) d\tau_2 d\tau_1\\=\int_{-\infty}^\infty R_h(t+\tau_1) R_x(-\tau_1) d\tau_1\\=R_x(t)*R_h(t)
}$$

  (2) $x(t)$ is stochastic and $h(t)$ is deterministic.

In this case, $y(t)$ is stochastic and we obtain:
$$R_y(t_1,t_2){=\Bbb E\{y(t_1)y^*(t_2)\}
\\=\Bbb E\left\{\int_{-\infty}^\infty\int_{-\infty}^\infty x(\tau_1)h(t_1-\tau_1)x^*(\tau_2)h^*(t_2-\tau_2)d\tau_1d\tau_2\right\}
\\=\int_{-\infty}^\infty\int_{-\infty}^\infty \Bbb E\{x(\tau_1)x^*(\tau_2)\}h(t_1-\tau_1)h^*(t_2-\tau_2)d\tau_1d\tau_2
\\=\int_{-\infty}^\infty\int_{-\infty}^\infty R_x(\tau_1,\tau_2)h(t_1-\tau_1)h^*(t_2-\tau_2)d\tau_1d\tau_2
\\=\int_{-\infty}^\infty\left[\int_{-\infty}^\infty R_x(\tau_1,\tau_2)h(t_1-\tau_1)d\tau_1\right]h^*(t_2-\tau_2)d\tau_2
\\=\int_{-\infty}^\infty\left[ R_x(t_1,\tau_2)*_{t_1}h(t_1)\right]h^*(t-\tau_2)d\tau_2
\\=\left[ R_x(t_1,t_2)*_{t_1}h(t_1)\right]*_{t_2}h^*(t_2)
}$$where $*_u$ means convolution w.r.t. $u$.

  (3) $h(t)$ is stochastic and $x(t)$ is deterministic.

This case is very similar to case (2). Since the system is LTI, we can reverse the impulse response with input signal to obtain $$R_y(t_1,t_2)=\left[ R_h(t_1,t_2)*_{t_1}x(t_1)\right]*_{t_2}x^*(t_2)$$

  (4) Both $x(t)$ and $h(t)$ are stochastic.

As the statistical sources of $x(t)$ and $h(t)$ are often independent, it is quite reasonable to assume that $x(t)$ and $h(t)$ are also independent. To use this fact, we start by:$$R_y(t_1,t_2){=\Bbb E\{y(t_1)y^*(t_2)\}
\\=\Bbb E\left\{\int_{-\infty}^\infty\int_{-\infty}^\infty x(\tau_1)h(t_1-\tau_1)x^*(\tau_2)h^*(t_2-\tau_2)d\tau_1d\tau_2\right\}
\\=\Bbb \int_{-\infty}^\infty\int_{-\infty}^\infty \Bbb E\left\{x(\tau_1)h(t_1-\tau_1)x^*(\tau_2)h^*(t_2-\tau_2)\right\}d\tau_1d\tau_2
\\=\Bbb \int_{-\infty}^\infty\int_{-\infty}^\infty \Bbb E\{x(\tau_1)x^*(\tau_2)\}\Bbb E\{ h(t_1-\tau_1)h^*(t_2-\tau_2)\}d\tau_1d\tau_2
\\=\Bbb \int_{-\infty}^\infty R_x(t_1,\tau_2)*_{t_1}R_h(t_1,t_2-\tau_2)d\tau_2
\\=R_x(t_1,t_2)*_{t_1}*_{t_2}R_h(t_1,t_2)
}$$
which means that a dual convolution must be performed: one on $t_1$ and one on $t_2$.


Assuming both black boxes are LTI systems, that's reasonably easy to do.
Let's call the transfer function of the first box $H_A(\omega)$ and the second one $H_B(\omega)$. The open look transfer function is simply the product of the, i.e. $H_O(\omega) = H_A(\omega) \cdot H_B(\omega)$
A sufficient stability condition is $|H_O(\omega)| < 1$. For an actual acoustic feedback loop that's really all there is to it since there is always plenty of group delay in the system and the phase is spinning so fast that any type of phase criteria is pointless.
So measure the transfer functions (fully calibrated !), multiply them and check whether the max gain is smaller than unity.


I think the easiest option is to detect the massive sudden increase/decrease.
Try calculating the difference between samples. If this difference is too big (positive or negative), we substract this difference on all future measured samples.

Create a variable for this offset. start with an offset of 0, when de absolute value of the difference between samples is too big, add this (non absolute) difference to the offset, then all next samples are $x_{new}=x-offset$.


How to convert a sound signal function to wave file?

i don't consider this a "bad" question.  But there is a lot that nano needs to deal with.

first, you must be able to think about conceptually and mathematically converting your continuous-time signal

$$ x(t) = \sin(\Omega t) $$

into a discrete-time signal

$$ x[n] = \sin(\omega n) $$

how $n$ is related to $t$ and how $\omega$ is related to $\Omega$.  this requires knowledge of the sample rate.

finally, after creating an array of samples, you can write that array to a .wav file using a library such as this one from Erik de Castro Lopo.  you might have to massage the code to make it work for C#.

or you can learn about the format of the particular .wav file (nowadays they can be float or int format) and write that file using the C# counterparts to fopen(), fwrite(), and fclose().  but i dunno shit about C#.


Is the value of a discrete time signal 0 when the index is a non integer value?

Discrete-time signals are, unsurprisingly, only defined for discrete times, i.e. for integer values of their argument. The value of $x[n]$ for $n$ not an integer is undefined, and $x[3/4]$ or $x[\pi]$ is meaningless.


Orthornormal Wavelet scaling function coefficient calculation (filter design)

Add twice 5.65 to 5.64, and let $j = h(0)+h(2)$ and $k = h(1)+h(3)$; then we get

j + k = sqrt(2)
j*j + k*k = 1

which represents the intersection of a line with a circle, and we get

j = k = 1/sqrt(2)

Now subtract twice 5.65 from 5.64 and let $m = h(0)-h(2)$ and $n = h(1) - h(3)$; we get

m*m + n*n = 1

so for same angle $b$ say we get $m = cos(b)$ and $n = sin(b)$. We now have, for example

h(0) + h(2) = 1/sqrt(2)
h(0) - h(2) = cos(b)

which we can solve for $h(0)$ and $h(2)$. Finally shifting $b$ to get a gives the required expressions.


What is use of a gaussian filter over histogram?

For you questions:
1. After applying gaussian filter on a histogram, the pixel value of new histogram will be changed.
2. The sum of pixels in new histogram is almost impossible to remain unchanged.

Visually speaking, after your applying the gaussian filter (low pass), the histogram shall become more smooth than before. Thus, the new histogram is definitely changed. With regards to the sum of pixels in new histogram, you may consider the problem a little bit differently.

Assume that you have a normalized image histogram $$p(x) = {\# {\rm pixels\,\, of\,\, value\,\,} x\over N},$$where $N$ is the total number of pixels in an image. Then $p(x)$ is also a p.m.f., because $\sum_{x}p(x)=1$. Then the sum of pixels $$S=E[x]\times N,$$
where $E[x]=\sum_{x}xp(x)$ is the mean pixel value over the entire image.

Let's say your have a 1D gaussian filter as
$$f(y)={1\over \sqrt{2\pi}\sigma_y}\exp\left(-{(y-\mu_y)^2\over 2\sigma_y^2}\right).$$ Commonly, people set $\mu_y=0$ as a zero-mean gaussian, and $\sigma_y^2$ is the variance.  As a result, the new histogram after applying the gaussian filter can be written as
$$p'(x) = \sum_zp(z)f(x-z),$$
which can be considered as the gaussian weighted sum of the original neighbor histogram stems. Alternative, you may consider the relationship among the new histogram, the old histogram and the gaussian filter as
$$p'(x) = p(x)*f(x)$$
where $*$ denotes the convolution operator.

This notation then brings out an alternative interpretation from random variables (r.v.). Assume r.v. $a\sim p(a)$, and r.v. $b\sim f(b)$, then r.v. $$c=a+b \,\sim\, p'(c),$$
when $a$ and $b$ are independent. Though it is somewhat hard to believe at the first glance, this interpretation tells you that the theoretical histogram of a noisy image (which is corrupt by the noise following the same gaussian distribution you used in filtering) is the identical to the histogram that you filtering the original histogram with that gaussian filter. One thing that I need to point out here is that even though $c\sim p'(c)$ doesnot mean that you will see the exact same distribution, because all what you can see is realizations of this distribution, but not itself directly.  Please see the following figures for details. As you can see, red and green curves match very well, but they are still slightly different.

Finally, we are ready to answer your second questions whether the sum of pixels changes before and after filtering. Using our previous derivations, you will see this question is equivalent to ask whether
$$E[c] =E[a] ?$$
where $c\sim p'(c)$ and $a\sim p(a)$. If $b$ follows a zero-mean gaussian, then $E[c]=E[a]+E[b]=E[a]$. Otherwise, they are not equal. Once again, you may not expect to see these values are identical, because $E[c]$ is only a theoretical value, and the actual observed mean value can be deviate from this theoretical value (the degree of how much the observed mean deviate from the theoretical one depends on the number of pixels, the more pixels the closer these two means).

Here is some Matlab code that generates the above figures. Play this demo, and you will see what I mean.

I = imread('cameraman.tif');
[p,val] = imhist(I);
p = p./numel(I); % <== p(x) original histogram
figure,plot(p)
sigma = 5;
f = normpdf(-20:20,0,sigma); % <== f(x) gaussian distribution
p1 = conv(p,f); % <== p'(x) new histogram after applying gaussian filtering
hold on, plot(val(1)-20:val(end)+20,p1,'r--','Marker','o')

% alternative interpreation
N = randn(256)*sigma; % <== white gaussian noise following p.d.f f(x)
I2 = N+double(I); % <== a noisy observation by adding noise to the original image
[p2,val] = hist(I2(:),val(1)-20:val(end)+20); % <== p''(x) the hisogram of the noisy image
p2 = p2./numel(I);
hold on, plot(val,p2,'g-.','Marker','*')
legend('original histogram', 'histogram after applying gaussian filter', 'histogram after adding gaussian noise')

figure,
subplot(131),imagesc(I),axis image,colormap(gray),title('original image I');
subplot(132),imagesc(N),axis image,colormap(gray),title('white gausian noise N');
subplot(133),imagesc(I2),axis image,colormap(gray),title('noisy image I2 = I+N');


List of possible image features for content based image retrieval

The field itself is too vast. So i doubt you can have a fully exhaustive list here.
However, MPEG 7 is one of the primary effort in standardizing this area. So what is included here is not universal - but at least the most primary.

Here are some key feature set which are identified in MPEG7 ( I can really talk only about Visual Descriptors not others see this for full scope).

There are 4 catagory of Visual Descriptors:

1. Color Descriptors which includes :
Dominant color,
Color Layout (essentially Primary color on block-by-block basis)
Scalable Color (essentially Color histogram),
Color Structure (essentially local Color histogram),
and Color spaces to make things interoperable.

2. Texture Descriptors (see also this) which includes :
Texture Browsing Descriptor - which defines granularity/coarseness, regularity,and direction.
Homogeneous Texture Descriptor - which is based on Gabor filter bank.
and
Edge Histogram

3. Shape Descriptors which includes :
Region based descriptors are scalar attributes of shape under consideration - such as area, ecentricities etc.
Contour based which captures actual characteristic shape features and
3D descriptors

4. Motion Descriptors for Video
Camera Motion (3-D camera motion parameters)
Motion Trajectory (of objects in the scene) [e.g. extracted by tracking algorithms]
Parametric Motion  (e.g. motion vectors, which allows description of motion of scene. But it can be more complex models on various objects).
Activity which is more of a semantic descriptor.

MPEG 7 doesn't define "How these are extracted" - it only defines what they mean and how to represent/store them. So research does exists on how to extract and use them.

Here is another good paper that gives insight in this subject.

But yes, many of these features are rather basic and may be more research will create more sophisticated (and complex) feature set.


Confused on the difference between the frequency spectrum of an entire song, and the frequency spectrum of a point in time

As far as my logic goes, I wont ge able to tell any of musical features just of an amplitude value in the time domain.

That's wrong. The amplitude-over-time actually is the way the song is played by your sound card (we call that PCM). So, this is your song.

What you really need to understand that your analog audio (i.e. the variations in air pressure over time) is being sampled and stored digitally, and reconstruction happens based on these samples.

Aside from that, you're absolutely right, the Fourier Transform and the time domain signal are equivalent representations of the same signal.

Regarding the question what a graphical representation will tell you: That's quite impossible to answer, as it depends on you ;) Now, there's a few basic things that one can note: For example, if you look at a plot of the time domain signal, and you see high amplitudes in a certain range of time, you can assume that it's loud during that time. Same goes for the absolute of the Fourier Transform: If the amplitude spectrum is large for a range of frequencies, then you can assume that a loud tone of that frequency range is audible.


You are confusing "processing time" with "latency".

Real-time filters are able to generate output samples at the same rate as they receive inputs.
They would however induce latency, meaning that the bulk of the energy generated for an input appears later in time with respect to that input.

Consider for example the following input/output:

time  : 0 1 2 3 4 5 6 7
-----------------------
input : 1 2 3 2 1 0 0 0
output: 0 0 1 2 3 2 1 0

The output is generated at the same rate as the input is received, so the system can perform in real-time. However, there is a latency of 2 samples in the output when comparing with the input.

Whenever the expression of the filter relies on past samples which have not yet been received (at the start of an input sequence), initial conditions are assumed (often assuming that those previous values were zeros).


A spectrogram only contains magnitude info, not phase info.

That means half of the original's signal information is lost; thus, the original signal cannot be recovered.


How to fix audio clipping in Adobe Audition?

In Adobe Audition 3 there is Effects... Restoration... Clip Restoration (process).


Why is TV static noise always black and white?

The color burst is also an indicator that there is a color signal.

This is for compatibility with black and white signals. No color burst means B&W signal, so only decode the luminance signal (no croma).

No signal, no color burst, so the decoder falls back to B&W mode.

Same idea goes to FM stereo/mono. If there is no 19 kHz subcarrier present, then the FM demodulator falls back to mono.


I've added a link to the paper you're quoting in the question.

The issue is that both the Moravec corner detector, and the change to it suggested first in that paper:

use the derivative of the image. ANY difference operation will tend to enhance higher frequency noise in the image.  The idea with the Gaussian smoother is to reduce this effect.  The two operations (Gaussian smoothing and difference operation) are often combined into a single operation: the difference of Gaussians.

As the paper suggests, the anisotropy of the Moravec detector is why the differential is used, rather than the up, down, and diagonal differences in the Moravec algorithm. The smoothing is introduced to counter the noise issue.


how can i call the input data in wavelet transform and generate code for gabor wavelet manually?

You're probably way out of your league if you have these problems, and just getting code won't help you with your project. your teacher will spot rather quickly that you didn't write it.

To start, you should read up on wavelet transforms in general. Gabor wavelets are just a specific kind.

You'll learn that wavelet transforms work on signals. That means you'll need to represent your DNA as a signal, i.e numbers.


How to get the DCT energy distribution image in MATLAB,or we may call it the DCT coefficients distribution image?

The general shape of this  image can (probably) be obtained with Matlab function DCT2 applied on the whole image (problem 1). I suspect this  image comes from the absolute of the  actual DCT matrix which generally has positive and negative values (problem 2). The absolute value was probably modified by a non-linear mapping, such as a logarithm or a power. The reason is you almost mostly black values on the bottom-right, probably zeroes at high frequencies. Would you have positive and negative values, this area could appear in mid-gray colors.

The PNG file has 251 colors, so the  absolute DCT matrix  with real values was somehow rounded to 8 bits, possibly scaled, and not binarized.

On your question: How to deal with the coefficients? you should tell us what you would like to do apart from displaying  a grayscale absolute 2D DCT image. You can compute energy concentration in the DCT domain, or identify the two bright lines as two main orientations with high gradients on the original image.

The following code produces a similar image, depicted below.

parBoxCox = 0.15;
data = imread('gantrycrane.png');
dataTrans = (1+(abs(dct2(rgb2gray(data))))).^parBoxCox;
dataTrans = floor(dataTrans*255/max(dataTrans(:)));
imagesc(dataTrans);colormap gray


Filter before or after multiplication of two signals?

A personal rule: in general, it can be better to perform non-linear operations before linear ones. One reason behind that is that a lot of practical concerns are related to outliers or suspect behavior, which can  easily be smoothed out (and become indistinct from other signals) by  linear filters.

Let me reformulate. If $f_i$ denote filters, and $s_i$ signals, should one do $f_0 \ast(s_1 .s_2)$ or $(f_1 \ast s_1)(f_2 \ast s_2)$? Without a better knowledge on the spectra of the signal, the nature of the noise and the numerically objective, I have no definite answer. The second one is apparently more flexible, become you can play on two filters.

If the result is some kind of average, I would filer the product, as  averaging is filtering, and it commutes with filtering. Thus, you have more chance to preserve the average after filtering the product, if the noise is low. Since two signals like $+1,-1,+1,-1\ldots$. Any even-length avering will turn them into $0$, while their product is flat with average 1.

I cannot see why you will have less numerical problems.
Noise is added "logarithmically", but the same happens to signals. But yes, modulation can be troublesome, but two cosine with zero mean will be multiplied into a non-zero mean signal, and this is what you want to measure.

In some cases though, to preserve contrast in image, homomorphic filtering convert a product into a sum to filter separately the two components (cf. "The second one is apparently more flexible"). Finally, you can use non-linear filters on the product as well, in case of complicated noises.  A related question on the ordre of operations can be found in Is convolution distributive over multiplication?


Decorrelating Stationary Colored Gaussian Noise -- Effect On The Desired Signal

Yes, the "Whitening" is basically filtering the signal using an LTI System.

The Result would be the signal $ \mathbf{s} $ filtered by the system which whitens the noise.

In the framework of Matched Filter this is OK since you will be able to filter the Reference Signal as well and hence have the same performance.

Yet for other usages you must take under consideration the effect of whitening system.


If the problem description is correct, i.e., if $h[n]$ is zero for $n<0$ and $n>7$, and if we assume that $h[7]\neq 0$ (and why should we assume otherwise?), then the filter has $8$ taps and it is a $7^{th}$ order FIR filter with $7$ zeros. Since it is a linear phase filter and the number of taps is even, it must be either a type II filter (even number of taps, even symmetry), or a type IV filter (even number of taps, odd symmetry). In the first case it must have an additional zero at $z=-1$, in the second case it must have a zero at $z=1$. Refer to this answer for more details on the $4$ types of linear phase FIR filters.

So if we assume even symmetry (type II), the zeros are $z_0=0.4e^{j\pi/3}$, $z_1=z_0^*$, $z_2=1/z_0$, $z_3=1/z_0^*$, $z_4=3$, $z_5=1/z_4$, $z_6=-1$.

If we assume odd symmetry (type IV), the zeros are $z_0=0.4e^{j\pi/3}$, $z_1=z_0^*$, $z_2=1/z_0$, $z_3=1/z_0^*$, $z_4=3$, $z_5=1/z_4$, $z_6=1$.

The corresponding impulse responses are

$$h_{II}=[1,   -5.23,   11.84,  -12.42,  -12.42,   11.84,   -5.23,    1]$$

$$h_{IV}=[1,   -7.23,   24.31,  -48.57,   48.57,  -24.31,    7.23,   -1]$$

EDIT:
The answer above is correct (as far as I can tell) for the given problem description. Now that I've checked the original source (Schaum's Outlines of DSP), which includes the solution, I believe that there are the following possibilities: either there's a typo in the problem description and they actually meant that $h[n]$ is zero for $n<0$ and $n\ge 7$ (note the "greater or equal" sign). In this case we really have a $6^{th}$ order FIR filter and the given solution in Schaum's Outline is correct. The other option would be that they don't know what they're talking about (and I hope and believe that this is not the case).


As you've told the main goal of pulse shaping filter is to restrict signal bandwidth in the transmitter while in receiver you should place the matched filter to maximize SNR. In the practical modems pulse shaping filter in the transmitter and matched filter in the receiver are usually the same in terms of frequency response. The task is to choose filters to minimize ISI (not all TX-RX filters pairs satisfy this condition while if even maximizing SNR value). From the theory is known raised cosine filter satisfy ISI condition. You can read about this filter here. Let's place such a filter in TX and RX side:

$H_{system} = H_{Tx} * H_{Rx}$

We can see the total response of the system is no longer raised cosine. So the root raised cosine filter was proposed. The main idea is

$H_{rrc} = \sqrt{H_{rc}}$, so for our system

$H_{system} = H_{Tx} * H_{Rx} = H_{rrc} * H_{rrc} = (\sqrt{H_{rc}})^2 = H_{rc}$

By doing this we can minimize ISI and maximize SNR if the filter bandwidth is closely matched to signal's one. So it is very practical and widely used in digital modems (especially single carriers (SC) modems).


survey/book on adaptive/self-tuning of PI controllers?

This is definitively not a satisfying answer, but what you call "adaptive" in combination with a pi-controller is commonly called gain-scheduling or lpv-gain-scheduling (lpv = linear parameter varying). Maybe that helps you find a book.


Breaking a convolution into smaller pieces

Yes, you can split them up.  Convolution is a linear process, which means that superposition holds.  Thus, you can break up any convolution kernel $k$ into multiple parts ($k_1, k_2, ... k_N$) such that $k = \sum k_i$.

For example, if you had a convolution kernel that looked like [1 2 3 4] (granted this is a silly kernel, but does fine for purposes of illustration), you could break it up into the following kernels, [1 2 0 0] and [0 0 3 4].  Now, you could simply do the convolutions like normal and then add the results together.  The sum would be equal to the convolution product of the original kernel.

Doing that would be inefficient, though, both in terms of computations and memory.  Instead, you could simply drop the 0's at the ends of the "sub-kernels", and do the convolutions using [1 2] and [3 4].  The one tricky part to this is that you have to offset the results before adding them together to get the correct answer.


In Big-O notation, $\mathcal{O}(N\log N)= \mathcal{O}(\frac N2\log N)$, as big-O notation only describes an upper bound for growth up to a constant factor, so your first question is kind of impossible to decide; in practice, the effort for a cleverly implemented real-valued FFT will be less than that of a (normal, complex) FFT.
But whether it will be exactly half might be doubted: as basically everywhere in numerical algorithm, the number of operations isn't actually sufficient to describe the effort or time needed. When I look at my PC, it does about 200 to 1000 multiplications in the time it needs to access a random address in RAM that's not cached. So, you'll see big jumps in actual time when your data size crosses cache size boundaries, which might happen later with real-valued data; or it might not matter at all.
The same problem, big-O notation only requiring the existince of a constant, finite factor $k$ such that the complexity of the algorithm stays below $k$ times the function in the parentheses, remains for your 2D question.
Generally, you'll find that the pure description through numbers of multiplications and additions makese nearly no sense, unless you're dealing with very large numbers, so that you can be asymptotically sure to never be able to e.g. align memory accesses. I wish people would teach  that more intensely when they tell people about algorithmic complexities: for algorithms where the input data is almost certainly not randomly spread across memory, the memory access usually becomes a very dominant factor!
In the case of FFTs, the problem is even more prominent: Everyone (and their grandma) knows that the $N$-point FFT's complexity $c(N)$ is in $\mathcal O(N\log N)$, but nobody notices that there's quite possibly a very large constant factor in $\lvert c(N)\rvert \le k\cdot N\log N$ (and that the base of the logarithm isn't even defined), and that the formal definition especially notes that this only needs to hold true for all $N$ larger than some very large $N_0$.
But it gets worse: Practically, we know that on "normal" computers, on most FPGA IP cores and DSP slices, and most other platforms, power-of-2 FFTs are very fast, whereas FFTs with larger prime factors do still exist. But, I wouldn't be surprised at all if the $N_1=4\cdot 2^{n}$-FFT was faster than the $N_2=3\cdot 2^{n}$-FFT, even if by judging the O-notation, for sufficiently large $n$ that shouldn't be the case! People really mislead when they tell other people the FFT is always in $\mathcal(N\log N)$; you'll need to put the FFTs with the same prime factors in separate classes and only change the exponent of one of these prime factors for that to actually be a sensible statement.
Sorry that I'm such a downer about big-O notation – it's just that beyond showing how a Cooley-Tukey / Radix-2 FFT can save you computation for power-of-2 FFTs, it's very rarely used to imply anything correct, less frequently even to arrive at a useful result!


Your answer is correct. Please note that your graph is in the range $0$ to $1$ while the graph in the text is in the output range of $-\pi$ to $+\pi$

There is some output scaling issue. But since you are getting the same curve, you are just messing some constants is all.

please try $\text{plot}(w,z)$


Where in the signal chain is Channel Equalization applied?

Generally, any matched filtering would be done before equalization, since there is no practical advantage that I am aware of to applying a matched filter afterwards.  Most textbooks that I've read present an architecture in which a matched filter is applied first, the signal is sampled at 1 sample/symbol, then an equalizer is applied at 1 sample/symbol.  But it does not have to be this way: you could apply a matched filter, but not downsample, then apply a fractionally-spaced equalizer and sample the output at 1 sample/symbol; or your could skip the matched filter entirely and apply an equalizer directly, in which case the equalizer would adapt to include both the matched filter and equalizer response.

Regarding fractional delays: if the equalizer is symbol-spaced, then we must perform symbol timing recovery prior to downsampling so that we sample the matched filter output at the correct times.  We need to perform symbol timing recovery anyway to correct any rate offsets, but if we are downsampling to 1 sample/symbol, we must also get the symbol clock phase correct.  If the equalizer is fractionally-spaced, then it can adaptively refine the sample time, although it can't correct any substantial rate offsets.  This is an advantage of using a fractionally-spaced equalizer; the primary disadvantage is the higher input sampling rate.


The terminology is a bit unfortunate here. "Signal Power" and "Physical Power" are two very different things.

why is E(x(n)2) called signal power?

Because signal power is defined this way.

Is it really power? Any proof?

It's NOT physical power. So there is nothing to proof here. A signal doesn't have power in the physical sense. Physical power only occurs when the signal is associated with some sort of physicals arrangement with an impedance in it. Physical power typical is the product of two complimentary physical field quantities (Voltage/Current, Force/Velocity, etc).
We can relate Signal Power to Physical Power:

It never DIRECTLY represents physical power. The units are the square of the original units and for it to be physical power the units of x(n) would have to be $\sqrt W$ which doesn't exist
It's often PROPORTIONAL to power (or intensity). That's the case if the impedance across or through which x(n) occurs is real and frequency independent.

Examples:

Voltage across an ideal resistor: $<x^2>$ is proportional to the power dissipated in the resistor
Sound pressure measured with a pressure microphone sufficiently far away from a sound source: $<x^2>$ is proportional to the intensity of the sound field at the location of the microphone
Voltage across a dynamic loudspeaker: $<x^2>$  does not represent anything that can easily be  related to physical power.


Help in problem formulation for estimation of image as a feature vector - SISO or MIMO FIR channel model?

This question is confusing, but I thought I'd try to make some sense of it.

Suppose you are transmitting one of your $\mathbf{x}_i$ vectors one component at a time. That is, the transmitted signal, $s[k]$,  for the $i^{\rm th}$ feature vector is:
$$
s_i[k] = x_{ik}
$$
If this signal is corrupted by a channel with impulse response $h[k]$ then the received signal, $y[k]$ will be
$$
y[k] = h[k] \star s_i[k] = \sum_{m=0}^{M-1} h[m] s_i[k-m] = \sum_{m=0}^{M-1} h[m] x_{im}
$$
where $\star$ represents convolution.

If we use this formulation, then the answer to:

  Should the source input be each component of the feature vector or an entire example?

is that it should be each component of the feature vector.

  if the input in the form of the feature vector is transmitted via a channel whose impulse response is modeled as moving average (finite response, FIR) then inputs and how many outputs should there be?

There should be a sequence of outputs. If the FIR filter is length $M$, then the output will be of length $M+d-1$.

  Would the channel be Single input-Single Output FIR or Multiple Input Multiple Output FIR ?

In the model above, it is a SISO system.

  Would the estimation be performed using one example or all the examples?

If the channel does not change, then you might be better off using all the data you have available.

  Should there be $d$ channel coefficients?

There is no point in tying the number of feature vector components with the length of the channel. In the above, the length of the channel is $M$.


How Can I Detect Peaks and Regions of Highest Variance in a 1D Signal?

I would do the following:

Create a smoothed signal using $ N $ points averaging window to estimate the local average.
On the smoother signal I'd find an approximation which regularizes the $ {L}_{1} $ norm of the gradient.
Locate on the output of (2) samples where a large jumps occur.


How to implement the imaginary part of FFT equation applied to a signal in computer/C++?

In computer programs, complex numbers are usually represented by an array, field or vector containing two values: one value represents the real part, the other represents the imaginary part of the complex number. The imaginary unit itself is usually not represented at all, because this information would be redundant.

An alternative representation is to store the magnitude and phase angle of a complex number.

Specifically in C++, there is the class complex<T> from the STL library that takes care of storing two values of type T for every complex value. You should use that, it's part of the standard libraries.


DFT symmetry vs DFT duality in Richard Lyons' "Understanding DSP"

1. Duality between discrete frequency and discrete time domain.

DFT Duality is generally referred to the duality of DFT-IDFT pairs. This in turn comes from the similarity between analysis and synthesis expressions of DFT and IDFT.
$$X[k] = \sum_{n=0}^{N-1}x[n]e^{-j\frac{2\pi}{N}nk}$$
$$x[n] = \frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j\frac{2\pi}{N}nk}$$
(Although I will encourage you to understand DFT as projection of Finite-length sequence x[n] onto Discrete Fourier Orthogonal Basis Vectors, and IDFT as representation of x[n] as linear combination of those orthogonal fourier basis vectors, where coefficients of linear combination is are the DFT coefficients $X[k]$. You might want to read this answer : DFT as Projection on Orthogonal Fourier Basis Vectors)

By Duality between the DFT-IDFT pairs I mean, for example, DFT of discrete $\delta[n]$ is a constant $1$ in freq-domain and DFT of constant $1$ will be discrete $\delta[k]$ in freq-domain. And other example would be DFT of discrete $rect$ sequence i.e. sequence of $M$ $1$'s in an $N>M$ length sequence. It has its DFT as follows:
$$X[k] = e^{-j\frac{\pi}{N}(M-1)k}\frac{\sin[\frac{\pi}{N}Mk]}{\sin[\frac{\pi}{N}k]}, \forall \ k \in \ \{0,1,2,...,(N-1)\}$$
And, if we took DFT of $x[n] = e^{-j\frac{\pi}{N}(L-1)n}\frac{\sin[\frac{\pi}{N}Ln]}{\sin[\frac{\pi}{N}n]}$, we will get a sequence of $L$ consecutive $1$'s in an $N$ length DFT. We can just run the steps backwards to compute the DFT of this $x[n]$.

For continuous time fourier transform, duality would mean the following : if $f(t)$ has fourier transform $F(\Omega)$ then a time domain function $F(t)$ will have its fourier transform as $2\pi f(-\Omega)$.

  2. Symmetry in Discrete Fourier Transform Coefficients.

DFT Symmetry in the book is mentioned in context of symmetry properties in DFT coefficients when DFT of a real valued time domain sequence $x[n]$ is computed. That is DFT coefficients of all real valued $x[n]$ are conjugate symmetric modulo $N$.
$$X[k] = X^*[(N-k) \ \mod \ N]$$