As best I can understand, you are interested in achieving edge-preserving denoising of the same "quality" given by the algorithm in the paper:

  Giovani Gómez: Local Smoothness in terms of Variance: the Adaptive Gaussian Filter. Proceedings of the British Machine Vision Confernce, 2000.

The images from that paper that you used above (and in the duplicate of this question that you posted a month later) are available in Section 4 of the link you provided, which seems to be a later version of the paper.

There are two things you should try.

First, as @Jean-Yves suggested to you several times, median filtering is a non-linear filter that preserves edges (although it tends to round off sharp corners).  Whether it does so effectively depends on the amount of noise in the image, and your example images are very noisy.

Second, the currently popular edge-preserving denoising algorithm is the bilateral filter.  This is implemented in photoshop, and in GEGL (which is available through the Gnu Image Manipulation Program in the Tools->GEGL Operation menu).

Here's the pinecone with a radius 1 median filter:

With GEGL's bilateral filter (gaussian radius of 4, and "edge preservation" set at 8%):

With GEGL's bilateral filter (gaussian radius of 4, and "edge preservation" set at 4%):

And with median filter of radius 1 followed by GEGL's bilateral filter with gaussian radius of 4 and "edge preservation" set at 50%:

All of which I prefer to the result of Gómez's adaptive filter:

So, my answer to this question (and to How to remove Gaussian noise without destroying the edges?, which you posted on Feb 7, 2012) is: try median filtering and bilateral filtering.


Understanding Active Contour results - Williams and Shah 1992

Annnd I figured it out. It seems that it was just coincidence that the first/last point sits at an especially concave point on the object. I changed the ordering of my initial contour so that the start/end point sits over a different section of the object and the first point no longer shoots out.


How to encode binary sequence if the number of bits are odd to e.g. 4-PAM? (Beginner)

This problem is solved in the upper layers of the communication system, not at the PHY.
For example, in the data link layer (DLL), the transmission unit is a frame. Frames are designed to be compatible with the PHY, so that problems like the one you describe don't occur. Also, many DLL protocols allow for fixed-size frames to be padded, or for variable-size frames, which provide some flexibility.


Is there any good book regarding Image Processing Algorithms for Feature Extraction and Matching which gives examples in MATLAB?

you may refer Feature Extraction & Image Processing
 By Mark Nixon, Alberto S Aguado.


Let's say I have an RF sampling ADC with a sample rate of 4GSPS. The device has built in decimation with a minimum decimation of 4X (and I/Q output, per comment below) so my maximum capture bandwidth is 1GHz (I know slightly less to allow for aliasing guard bands etc.).

Ultimately the ADC is sampling at 1Gsps with I/Q output, so it's producing $2\cdot10^9$ independent samples per second.  The Nyquist rate is twice the bandwidth, so between your analog filter and the ADC's, you'd need a final bandwidth of less than 1GHz.
You're asking if you can separate the signal digitally into a number of sub-bands and then decimate.  The answer is -- yes.  There's no reason that your filtering has to be in the analog domain -- you can just as easily filter in the digital domain.
So -- make a filter bank in digital-land, and decimate the filter outputs.  Done properly, this'll work just fine.
As an example, say you separate that 1GHz signal into 8 signals, spaced 125MHz apart and filtered to only include the middle 100MHz of each signal.  Then you decimate down to 125MHz.  Now you have 16 samples (8 channels, I & Q) on a 125MHz interval.  That is the same number of independent samples per second that you started with, and you've reduced the signal content.  So -- you have less information, and just as many samples. You're fine.


If $x(t)$ is an action signal like voltage or current, then the square of $x(t)$ is proportional to instantaneous power and the constant of proportionality depends on what kinda animal $x(t)$ is and what load $x(t)$ is connected to.

So if $\big|x(t)\big|^2$ is proportional to instantaneous power, so also is the integral of $\big|x(t)\big|^2$ over all time proportional to energy (and having the same constant of proportionality).  So you can call this "energy":

$$E_x = \int\limits_{-\infty}^{\infty}\big|x(t)\big|^2 \, dt$$

as long as you remember that it's really proportional to energy and the constant of proportionality depends on what dimension is $x(t)$ and what load that signal is connected to.

For example, if $v(t)$ is a voltage, then $|v(t)|^2$ is proportional to instantaneous power and if $v(t)$ is connected to a resistor having resistance $R$, then instantaneous power is

$$ p(t) = \frac{1}{R}\big|v(t)\big|^2 $$

and the total energy is

$$E_v=\int\limits_{-\infty}^{\infty}p(t) \, dt$$

or

$$E_v=\frac{1}{R}\int\limits_{-\infty}^{\infty}\big|v(t)\big|^2 \, dt$$

Clearly the constant of proportionality is $\frac{1}{R}$.

If $x(t)$ is a dimensionless value in a DSP or computer, then you have to scale it with the reference voltage $V_\mathrm{ref}$ of the D/A converter to make this number a voltage that delivers power to a load.  Then the constant of proportionality becomes $\frac{V^2_\mathrm{ref}}{R}$ and the energy really is (with correct scaling):

$$E_x = \frac{V^2_\mathrm{ref}}{R} \int\limits_{-\infty}^{\infty}\big|x(t)\big|^2 \, dt$$


Why need an low pass filter after up-sampling?

Let's say you've sampled an analog signal $x(t)$ with spectrum $X(\omega)$ at rate $1/T$ that is high enough to satisfy the sampling theorem. The spectrum (i.e. the discrete time Fourier transform (DTFT)) of the sampled signal $x_{1,k}$ will be a periodic repetition of $X(\omega)$. The repetition period is $1/T$.

Now you sample the same signal with a higher rate $L/T,\, L\in\mathbb N$ yielding $x_{L,k}$. Again the spectrum will be a periodic repetition of $X(\omega)$ but this time the repetition period is $L/T$, so the spectral images have greater frequency distance than before.

The task of upsampling consists in calculating $x_{L,k}$ from $x_k$. First, $L-1$ zeros are inserted after every sample of $x_k$. Actually this just changes the basic frequency support of the DTFT to $-L/(2T)\ldots L/(2T)$ containing $L$ copies of the original (analog) spectrum. Therefore the unwanted copies are filtered out with a lowpass filter so that only the original spectrum in range $-1/(2T)\ldots 1/(2T)$ remains. This is identical to $x_{L,K}$

The above steps are quite well explained in the figure of the Wiki article you quoted (in the same order).


This website offers phase history (match filtered) data: https://www.sdms.afrl.af.mil/index.php?collection=gotcha. There are other datasets on the same website, some of which may have raw I/Q.


Sinusoidal liftering in implementations of MFCC

This paper$^1$ suggests:

that the reason is because the filtered versions give less weight to the higher coefficients which provide less discrimination than the lower ones.

That paper references this one$^2$ which shows the plot below indicating how the application of window reduces the variability.

References

K.K. Paliwal "DECORRELATED AND LIFTERED FILTER-BANK ENERGIES FOR ROBUST
SPEECH RECOGNITION"
B.H. Juang, L.R. Rabiner and J.G. Wilpon, "On the use of bandpass liftering in speech recognition", IEEE Trans. Acoust., Speech and Signal Processing Vol. ASSP-35, No. 7, pp. 947-954, July 1987.


How should you decide on the number of sweeps to be used in FMCW radar?

The basic performance requirement of FMCW radar is to measure the radial distance and velocity.

The number of sweeps or linear sweeps relates with the velocity measurement, thus if for a constant integration (processing) period you have more number of chirps (which can be achieved by decreasing the sweep duration) the max measurable velocity is increased.

For the case when the number of sweeps are increased by increasing the processing (integration) time the velocity resolution is enhanced.

In order to read more detail about the basic of the FMCW parameters, I would recommend to go through this paper FMCW Signal Processing


I'm not sure if I understand your problem, but I'll give it a try. If you have a complex frequency response

$$H(\omega)=|H(\omega)|e^{j\phi(\omega)}\tag{1}$$

where $\phi(\omega)$ is the phase, then you probably know that for a given frequency $\omega_0$, the frequency response might as well be written as

$$H(\omega_0)=|H(\omega_0)|e^{j(\phi(\omega_0)+2k\pi)}\tag{2}$$

where $k$ is some integer. The question is, when you compute the complex value $H(\omega_0)$, which of the infinitely many possible phases do you choose? The convention is to choose the principal value which is in the interval $(-\pi,\pi]$. The consequence is that whenever you compute the function $\phi(\omega)$ for continuous $\omega$, you'll get jumps as soon as the phase hits $-\pi$ or $\pi$, but no matter how you define the phase, you will not be able to avoid jumps. So if you want a continuous function you need to do phase unwrapping.


what is the use of signal processing in CT scans?

The C stands for 'computer', which should give you a strong hint that the answer is yes. The fundamental problem is the inverting the inherent radon transform that comes out of the measurement setup. There are other signal processing related issues too, like denoising, or image processing ones like feature detection and image segmentation.


Why OFDM is more appropriate with MIMO than other multiple access method?

One possible answer is given at the beginning of the text:

  Raleigh suggested and later proved that the processing required by
  MIMO at higher speeds would be most manageable using OFDM modulation,
  because OFDM converts a high-speed data channel into a number of
  parallel lower-speed channels.

Also:

  MIMO-OFDM is a particularly powerful combination because MIMO does not
  attempt to mitigate multipath propagation and OFDM avoids the need for
  signal equalization.


Zigbee Transceiver Using OQPSK Modulation under Fading Channels

The pulse shaping is only required if you are concerned with spectral efficiency, as the pulse shaping will convert what would otherwise be a Sinc function in frequency to a spectrum that is much closer in overall bandwidth to your symbol rate. Also if the receiver assumes a specific pulse shape, the sensitivity will be optimized by transmitting with the matched pulse shape (as the matched filter in the receiver will then present the optimum SNR. Other than that, it is not necessary.

See my picture below demonstrating the time domain waveforms and frequency domain before and after pulse shaping. Note that the primary motivation to do additional pulse shaping (beyond the rectangular pulse you are otherwise using, which is indeed a pulse shaping in itself) is for spectral efficiency. The pulse shaping is required in IEEE 802.15.4 ultimately due to meeting regulations (such as FCC in the US) to ensure we all use spectrum efficiently and within regulated allocations and not interfere with users in other spectrum allocations. Observe the dramatic change in transmitted spectrum with and without the pulse shaping filter in the example below!


How to calculate Noise and distortion of an image?

You should do it on a known set of calibration targets. For example, this type of calibration target is being used to measure noise. You should find the patches locations, and measure the noise by some metric. If you don't know any metric, you can start by browsing DXOlabs site, or Imatest site.

I guess that you mean radial distortion. Radial distortion can be found by a process called camera calibration, by using a known target such as checkerboard. For more info, see Camera Calibration Toolbox. Here is an image from another software that does it:

I didn't understand your question at all. Please reprase it and add more information.


If you calculate the error, 44102/44100 is only about 45 parts per million. That is well within operating tolerance of many crystal oscillators used in consumer equipment to generate audio sampling rates and USB communication clocks. You can be quite pleased it is not even more off. Another problem is that if you simultaneously use different devices for audio capture or playback, they each have their own local clocks so they are not synchronized in any way and they all run free with their own local clockd, and thus you will have to do some kind of resampling to adapt the slight sampling rate differences.


Segmenting a sound file before each of its attacks

If it is a single instrument playing without any background noise/instruments, then the problem becomes simple. All you have to do is keep track of energy, which is calculated at a defined window size (say 40 milliseconds). Wherever you see the energy increasing and sustaining for a while (you'll have to define how long a note is good for you to split your audio), you can mark the ascent of such an energy plot as the point to split.

You can also split audio when a particular note is played, for this you'll have to track energy in the respective spectrum band of the note you want to split the audio on. For example to track note A4 (a') which has 440Hz frequency. You might have to track the energy in a band around 440 Hz, say 420 to 460 Hz. Mind you, this splitting business based on notes played gets more complicated when complex notes are played.

Also, this problem gets really difficult when you have multiple instruments.


Estimation of step amplitude using the CUSUM algorithm

Your straightforward idea of using moving averages might actually work quite well. Since you ask "is there a better solution", I must ask what you mean by "better."

Change point detection is a well studied problem in statistics and signal processing. The problem has many variations depending on your optimality criteria, and prior knowledge about the data. For example: do you care about catching the change point as quickly as possible? Or do you care about the precise location of the change? Or do you care about the exact amplitudes before and after the change, or just the difference in amplitudes?

Since you have a real-time requirement, I would search for "online Bayesian change point detection" which will show you lots of papers, and many packages in R to play with.

https://www.r-bloggers.com/a-simple-intro-to-bayesian-change-point-analysis/

https://www.jstatsoft.org/v23/i03/paper

https://hips.seas.harvard.edu/files/adams-changepoint-tr-2007.pdf

Detection of Abrupt Changes: Theory and Application, Basseville and Nikiforov


Wavelet Filter Coefficients from Scaling Filter Coefficients

For perfect reconstruction you need:

$$ g \left[ n \right] * \hat{g} \left[ n \right] + h \left[ n \right] * \hat{h} \left[ n \right] = \delta \left[ n \right] $$

Where $ g \left[ n \right] $ is the Analysis Wavelet Function, $ \hat{g} \left[ n \right] $ is the Synthesis Wavelet Function, $ h \left[ n \right] $ Analysis Scaling Function and $ \hat{h} \left[ n \right] $ is the Synthesis Scaling Function.

Practically, Scaling Function is the LPF and Wavelet Function is the HPF.


Is a recording of a chord merely a superposition of recordings of its constituent notes?

It's close enough for most practical synthesis purposes.  However in real polyphonic instruments, there tends to be some coupling between the various oscillators that can, for example, synchronize notes that are close enough to whole number ratios.

For other ensemble instruments, the coupling can work via the hearing of the instrumentalists and minute corrections (of embouchure, fingering pitch, and so on).

And for nonlinear effects (like accordion bass mechanic sympathetic vibration or a distortion pedal for a guitar or a distorted amp), the results are definitely non-linear.

But more often than not, just adding the samples is a good enough approximation.


If a pure sinusoid is exactly integer periodic in the DFT's aperture, then the Sinc function, resulting from the rectangular window, will pass exactly thru zero at all but two points of the DFT results, thus appear to be invisible except for the two deltas.  If you vary the DFT window size by fractions of a period of the sinusoid, then it will show up, as you expect, since the DFT will no longer sample the Sinc when it crosses zero.


Laplace transform of a time domain sampled data MATLAB

Since you are sampling a real signal, you can just use the a Fourier transform, the fft function in MATLAB. You can divide the FFT of the output by the input, and then fit a curve to the result to approximate the transfer function


Finding the four corners of each quadrilateral shapes in an image

I though of using a corner detector like harris, but it gives me many additional corners (as the sides of the shapes are not really straight due to discretization.

In that case you should keep only the strongest feature points.

  the corners may actually be lost and look like a curved line as shown
  below, even though the image before segmentation had these clear 4
  corners.

In that case, you can use scale space, first blur the images excessively, then use Harris, or directly use SIFT detector and keep only the features points of the scale, that match your desired points.


How to express FM and PM the most simple way?

In the simplest terms, the difference between analog Phase Modulation (PM) and Frequency Modulation (FM) can be defined according to which of the two (phase or frequency) is being directly proportional to the message signal as outlined by the following:

An angle modulated signal is defined as: $$x(t) = A_c\cos(\omega_c t + \phi(t)) $$ Where $\theta(t) = \omega_c t + \phi(t) $ is the instantaneous angle  of the modulated cosine, $\phi(t)$ is the instantaneous phase and  $ \omega_i = \frac {d\theta(t)}{dt} $ is the instantaneous frequency

Now consider the phase being given by $\phi(t) = K_p m(t)$ , where $m(t)$ is the message signal and $K_p$ is a simple constant for phase modulation. As clearly evident, here the Instantaneous Phase, $\phi(t)$, is directly proportional to the amplitude of the message signal $m(t)$ and hence this type of angle modulation is called as Phase Modulation (PM)

On the other hand, consider a message signal $m(t)$ such that $\phi(t) = K_f \int {m(\tau)d\tau}$, where $K_f$ is the constant for frequency modulation, then the instantaneous frequency is: $$ \omega_i = \frac {d\theta(t)}{dt} = \omega_c + K_f m(t) $$
As can bee seen, now instead, the instantaneous frequency in radians is directly proportional to the amplitude of the message signal $m(t)$ and this type of modulation is, therefore, called as Frequency Modulation (FM)


You're right, the solution manual isn't.


How do I implement the CDF wavelet inverse?

To the contrary, the odd tap filters allow you to keep everything perfectly symmetric. If you make the filter centered at $0$, then the application of the filter at position $i$ requires a symmetric range of coefficients around $i$.

All 2-channel wavelets will produce a quad-tree decomposition of a 2D image, regardless of tap length. The only complication of longer, non-trivial wavelet filter banks is the treatment of the boundaries. Here one has an advantage in using symmetric filters. (Symmetric and orthogonal wavelet filters exist for 3-channel, 4-channel wavelets and so on. See articles by Heller, Belogay/Wang, Turcajeva.)

If you continue the image by mirroring at the boundaries, the transformed image will also have odd or even symmetry at the boundaries so that the size of the transformed image can be kept equal to the size of the original image.

In the reconstruction process, you have to reconstruct those mirrored coefficients in the bands and then apply the centered filters to obtain the original image back.


Are there amplitude and phase characteristics of harmonic signal components?

If the amplifier is memoryless (i.e. there is only AM/AM conversion and no AM/PM conversion) and the input signal is bandpass (centered around some carrier frequency $F$), for input signal:

$$
x(t) = a(t)\cos(2\pi Ft + \alpha(t))
$$
the output signal
$$
y(t) = v(x(t)) = v(a\cos(2\pi F t)) = v(a \cos \theta)
$$

can be expanded using a Fourier series:
$$
v(a\cos\theta) = v_0(a) + v_1(a)\cos(\theta) + v_2(a)\cos(2\theta) \ldots
$$

If the amplifier is memoryless, the coefficients $v_m(a)$ are real and determine the harmonic amplitudes, and there is only AM/AM conversion and no phase shift on the harmonics.

The coefficients are known as the "Chebyshev Transform" of the nonlinearity $v(x)$ and are given by:
$$
v_m(a) = \frac{2}{\pi} \int_0^\pi v(a \cos\theta)\cos(m\theta)d\theta
$$
If the amplifier has some memory, but "not much", it is known as a "quasi memoryless" system, and the coefficients are complex (giving AM/PM conversion).

To characterize the amplifier, you would need to measure $v_m(a)$ for each harmonic $m$. However, since usually all you need is the first harmonic because others will get filtered out later, you can measure $v_1(a)$ from standard power out/power in curves. (The same ones used to measure 1dB compression and 3rd order intercept). The power gain measured in this curve is just $(v_1(a)/a)^2$.

Source:
appendix C of:
https://smartech.gatech.edu/bitstream/handle/1853/5327/ku_hyunchul_200312_phd.pdf?sequence=1&isAllowed=y


Algorithm for testing input sound for multiple expected notes?

I'd like to point out two things beforehand:

this is a complex question, and
as soon as you have figured out how to do this algorithmically, you'll have to write a lot of signal processing functionality in JS that other languages would already have access to (e.g. python through scipy/numpy, C/C++/Fortran through LAPACK/BLAS/FFTW etc)

so this will become a very complex project, and if you have the chance to influence the expectations for fast results, I'd recommend not promising a working prototype too soon.

Now, for a start, this looks like a linear algebra problem. That's because LA is kind of the sonic screw driver of DSP; give a man a sonic screwdriver, and everything looks like... wait, that metaphor doesn't work.

So, anyways, what you want to do is find a vector representation of your signal under test and map it to coordinates in a space spanned by the possible musical notes. Mathematically, you want to

Find a set of base vectors representing your notes,
Find a suitable base in which you can represent both these vectors and your signal
Project the signal vector onto your note vector; the magnitude of the coefficients gives you the "amount" of the respective notes being represented in the signal.

As an example, the discrete Fourier transform takes signals that are represented in a time sampling base (every base vector is $(0,\ldots,0,1,0,\ldots,0)$, with the 1 representing the the sample time) and transforms it to a base system of orthogonal oscillations (The nth base vector of that base is $( e^{j2\pi nt})_{t\in (0,\ldots, N)}$). That is such a base transform.

You could simply record fixed lengths of your tones, normalize them in power (important!) and do a dot product with each of these, and find the ones that are above a certain threshold. Do that again with the piece of your signal starting one sample later, and find the notes that have been present with enough energy for enough time. What you end up with is a FIR filter bank.

Now, with a proper language and libraries, that would be a few lines of code, and one could do everything in frequency domain rather than time domain, reducing the effort of the convolution above to a multiplication and two FFTs, but since there is (I don't think there can be, due to architectural restrictions) no FFT in JavaScript, this is probably not easy to optimize. It might be that for reliable results, your algorithm might become too slow to process the audio signal in real time.


According to this source, the sound power received by an aperture is proportional to the pressure squared, i.e.:
$$
P = \frac{A p^2}{\rho c} \cos \theta,
$$
where:

$P$ is the received power
$A$ is the surface area of the receiving aperture
$p$ is the pressure
$\rho$ is the density of medium
$\theta$ is the angle between the propagation direction and the surface normal


What is the Autocorrelation of the Impulse Response if the Magnitude of Frequency Response is >1

Make sure not to confuse the power spectral density (PSD) with the frequency response.

PSD is the Fourier transform of the autocorrelation function.
Frequency response is the Fourier transform of impulse response.

That aside, your question is about the Fourier transform of a constant $c$.
Since $$\mathcal{F}\{1\}=\delta(\omega),$$
considering linearity of the Fourier transform we have $$\mathcal{F}\{(c)1)\}=(c)\delta(\omega)$$


You should know charaterstics of an opamp it has infinite input resistance and zero output resistance hence opamp doesn't draw any current in the input side hence it is an open circuit and current through is zero apply kvl(Kirchoff voltage law) you will know


Let $T_0$ be the period of the signal  $s(t) = x_1(t) + x_2(t)$.
$$s(t) = s(t+T_0) \tag{1}$$

Then the period for $s^2(t) = ( x_1 + x_2)^2$ will be either $T_0$ or $T_0/2$ :

First, it's obvious that $T_0$ is also a period for $s(t)^2$ as it satisfies $$s^2(t) = s^2(t+T_0) \tag{2}$$

However, $T_0 / 2$ may also be period for $s^2(t)$. Since we are looking for the smallest number to satisfy eq(2).

Hence do the following:

Find the period $T_0$ of $s(t) = x_1(t)+x_2(t)$.
Check if $T_0/2$ satisfies $s^2(t) = s^2(t+T_0)$.
If yes; then period of $s^2(t)$ is $T_0/2$; otherwise $T_0$.


Coherence bandwidth and coherence time in an OFDM system

This diagram (from Molisch) shows the various Fourier relationships between measurements in wireless systems.


Since these are very short vector lengths, a "conventional" fast transform is not going to give you any gains.
Your best bet is probably to hand code each possible transform length indivdiually, unrolling all the loops and taking advantage of all "trivial " coefficients manually.
Another option could be to reduce the dimonsionality of the data but that depends how much codec gain you get in each dimension. If there is one dimension that has most of the codec gain, you can keep this and just linearize the other ones.


Detecting peaks in a noisy 2D correlation plot

You could try using the peak-to-sidelobe ratio, i.e. how many standard deviations above the mean is each point in the correlation output.

psr = ${p - \mu }\over\sigma  $

Typically you compute the mean and sigma in a window around each point excluding the region nearest to each point.


Positive or negative sign on Fourier transform formula

The definition with the negative in the exponent is the accepted definition of the Fourier transform... however, this is an arbitrary choice.  It could just as easily be defined with $e^{jw}$ and the inverse transform with $e^{-jw}$.


All you need to do is masking on your v we remember and image is a [rows,cols,layers] matrix, where the layers are Hue=1,saturation=2,intensity value=3

We then create a mask (array of 0s and 1s). For example your first range would be

v1 = (hsv_im(:,:,v_idx) <0.3);

we are taking the all rows, all columns, of layer v, and if the value is <0.3 make it 1, otherwise make it 0. Now to see only those pixels we can multiply the original value array by our mask.

hsv_im(:,:,v_idx) = v0.*v1_mask;

As you recall any value >0.3 was 0 in our mask, so all the other areas will be blacked out.

here is a full example

im = imread('flower.jpg');
hsv_im = rgb2hsv(im);
v_idx =3;

v0 = (hsv_im(:,:,v_idx));    %the original
v1_mask = (hsv_im(:,:,v_idx) <0.3);
v2_mask = (hsv_im(:,:,v_idx) <=0.3 & hsv_im(:,:,v_idx) <0.75);
v3_mask = (hsv_im(:,:,v_idx) >= .75);

%plots the images
figure(1);
subplot(2,2,1);imshow(hsv2rgb(hsv_im));title('original')

hsv_im(:,:,v_idx) = v0.*v1_mask;
subplot(2,2,2);imshow(hsv2rgb(hsv_im));title('0.00< v<0.30')

hsv_im(:,:,v_idx) = v0.*v2_mask;
subplot(2,2,3);imshow(hsv2rgb(hsv_im));title('0.30<=v<0.75')

hsv_im(:,:,v_idx) = v0.*v3_mask;
subplot(2,2,4);imshow(hsv2rgb(hsv_im));title('0.75<=v<1.00')

%plots the masks
figure(2)
subplot(2,2,1);imshow(v0);title('original v')
subplot(2,2,2);imshow(v1);title('0.00< v<0.30 mask')
subplot(2,2,3);imshow(v2);title('0.30<=v<0.75 mask')
subplot(2,2,4);imshow(v3);title('0.75<=v<= 1  mask')


object level sensor fusion for multiobject tracking

There are many different algorithms or theories to tackle your problem.

As suggested in the comments, Kalman filters (in a regular or extended implementation) ore often tried in this case.
If you are in a discrete world (I guess so from your question), you can try to solve your problem in a discrete setting with (for example) the Hungarian algorithm.
If your detections come with associated confidence or plausibility (likelihood) measurements and if you are not afraid by the maths, you can try the popular Dempster-Shafer evidence theory (or one of its variants).
Etc. (correlations between tracks, a variant of sparse regression...).

Fusion with Kalman filtering

Let's say you know that you have one object, with the corresponding state vector (e.g., position, or position + velocity).

Now, suppose that you are observing this state with 2 different sensors or algorithms.
For example, a robot or a UAV can have a first position estimation coming form an inertial measurement unit (IMU) and another positoin estimated via computer vision by detecting its pose with respect to known points of interests.

The Kalman filter with solve the problem of providing an estimate of the true state (position) accoridng to these two inputs.
It will solve it in a least squares sense taking into account the intrinsic precision of the two sources.
Note that it is not different to using it for tracking (in time) a single object: in the fusion case, the only difference is that all the observations were acquired at the same time.

Your inputs to the Kalman filters are the previous position + the 2 estimated positions, and the output is a single position (ideally the "true" one).
The observation matrix produces a position given the sensor inputs. In this example (input=position, output=position) it would be the identity.
You incorporate knowledge about the precision of each sensor in the variance matrix of the filter.

Here is an example application that I have found.


is it possible to matching b / w images without feature extraction steps? if possible which algorithm may be more suitable?

Yes, it is possible!

For example, you can take pixel by pixel comparison and apply MSE (mean square error). If the error is close to zero, it is the same picture.

However, you will be able to recognize only those images which are picture perfect matching. For example, you won't be able to account for brightness variations, scale variations, minor transformations, compression loss (e.g. JPEG) etc. So while human being might just see them as SAME image - they are not on every pixel basis. Depending on how much strict or tolerant your application needs to be, do we really need to then look for advanced algorithms that are smart enough to be invariant to these factors.

EDIT:

After your clarification, it does sound like you have more of a special case of matching rather than general purpose recognition problem.

Given the following assumptions:

A gray scale (or color) images are first converted to binary through some thresholding process.
Mostly these images are lines (thick or thin) and the key differentiation is how far these edges are from others.
Edges could be of arbitrary shapes and contours -no geometrical assumptions.
Given the edge detection limitations (in the presence of noise) and thresholding algorithms, edges might be disjoint

Here is what i would suggest to apply:

Edge following algorithms - to make continuous edges where applicable.
Ref #1. http://www.slideshare.net/kiara1011000/edge-following-algorithm-chiara-galdi
Apply Housdourf distances and similar shape/contour matching
Ref #1. Haudorff Distance by Normad
Ref #2. CV Online: The Hausdorff Distance
Ref #3. Hausorff based Matching

Basic idea is that if all edges are more or less at the same locations and of same length, then the images are same.

Given that large portion of region which contains Black and implies no information- MSE would be an extremely BAD idea.

I am only giving you some basic direction toward formulating your problem. As you dig deeper  you can put more specific questions. I would be keen to know what works for you finally.

EDIT 2: Adding one specific solution

One simple possible metric i can think of is:

Say, Ref[i][j] is the reference image and Test[i][j] is the test image.

pixel_similarity = 0;
For each pixel in Ref[i][j]
{
  if ( Ref[i][j] == Edge_pixel )
     (k,l) <- find_nearest_edge_pixel(Ref, Test, i, j, window_size)
     pixel_similarity += weighted_similarity (i, j, k, l)
}

image_similarity_metric = error / (total_edge_pixels_in_ref);

Please Note that this algorithm will be quite limited for heavy scaling and rotation. This is first step. Notify me for any typo or lack of clarity!

Observations:

If you keep two identical images (pixel by pixel)- you will find that (k,l) will be same as (i,j) and weighted error should be = 1.
By dividing the number of edge pixels by total edge population, you will get similarity metric = 1.0 for perfectly matching images.
When edges are almost similar, but slightly misaligned score will decline gradually. The weighted_similarity function should be chosen smartly to deal with what you consider as reasonably aligned edge vs. one that should be discarded.
Other extreme is that if total number of edge pixels in Ref is zero - there is no way to compare it with any other one (since we are considering background pixels having no information related to match).

Try to work this out and see what results you get.

Happy to help you!


Why should one use windowing functions for FFT?

The FFT can only be performed over a limited chunk of data. The basic math is based on the assumption that the time domain signal is periodic, i.e. your chunk of data is repeated in time. That typically results in a major discontinuity at the edges of the chunk. Let's look at a quick example: FFT size = 1000 points, Sample Rate = 1000 Hz, Frequency resolution = 1Hz. If you have a 10 Hz sine wave you don't have a discontinuity since exactly 10 periods fit into your FFT window and the values (and derivatives) at the edges are the same. The FFT of this siganl will be zero except for a single value in bin #10. This also works for a 11 Hz sine wave just as well. However, for 10.3 HZ sine wave you end up with a lot of discontinuity and the FFT will have energy in all bins with maximum around 10 or 11 and then "skirts" that roll trail off to the sides. So a small change in frequency results in a massive change in the FFT picture.

Windowing is used to avoid this: Windows make sure that the data at the edges are zero, so there is no discontinuity. However multiplication in the time domain is convolution in the frequency domain and that results in widening of spectral lines and also in side lobes. Teh choice of window controls the trade offs between main lobe width and side lobe spacing and height. Your application specific requirements determine what window to use and there are dozens of choices. Hanning is just one of them. It's basically "the window of choice if you don't have any better ideas". Personally, I prefer Kaiser windows as they have a continuous parameter that can control the window behavior over a wide range.

In general FFT is not a great method for pitch detection. For most audio signals the maximum in the spectrum is NOT the fundamental (typically harmonics have higher energy), in order to get decent resolution you need a long pieces of data but that makes the algorithm very slow and sluggish to respond to changes. Much better options are phase looked loops, delay looked loops, autocorrelations, max/min tracker, zero  crossing tracker, etc.


QPSK Phase Recovery : Maximum-likelihood Vs Costa's Loop

There is still a loop with an adjustable loop bw: The summing block shown is an indication of the additional integration to create a second order loop, although a proportional path should be included as well in order to maintain stability (PI Loop Filter, here with what is suggesting an accumulator you would only have "I"). I suspect the block diagram is just simplified and the summation shown is intended to be the more detailed proprtional-intergral loop filter structure as shown in your subsequent diagram.

Even without the summing block this will still be a loop with adjustable loop BW, just not the best choice: in this case it would be a first order loop that will lock to constant error given a constant frequency offset (and be unconditionally stable if not for parasitic delay elements the implementation will invariably have). If the loop gain is large (set by scaling the value at the input to the DDS), then the error can be minimized- but still exists. Adding the additional proportional-integral loop filter before the DDS input will maintain stability and lock to zero error in this frequency offset condition.

(The DDS, similar to a VCO is directly proportional to frequency- so in units of phase it  forms one integrator in the loop- with the PI loop filter added, we get the second integrator, and with both at DC to form a second order Type 2 Loop).

As I mentioned in the comments, if you do implement this as given, compare results to a fixed scaling (instead of the SNR) and the sign of the signal (instead of tanh) and let us know your results of that versus the optimal implementation shown.


What's wrong with this Average Magnitude Difference algorithm?

okay, i took a look at your code and at your data.

first of all, the algorithm you are using is not autocorrelation but is the Average Magnitude Difference Function (AMDF).  it will give results similar to the autocorrelation but upside-down.

you appear to be implementing the AMDF correctly but you are suffering from the so-called "octave error" problem.  you see, a note that is, say, A-440, has a fundamental frequency of 440 Hz.  that means the waveform repeats every $\tfrac{1}{440}$-th second.  but that same waveform also repeats every $\tfrac{1}{220}$-th second and every $\tfrac{1}{110}$-th second or every $\tfrac{1}{55}$-th second.  so, mathematically, it can be construed to be a 220 Hz or 110 Hz or 55 Hz (or even a $\tfrac{3}{440}$-th second period or $\tfrac{440}{3}$ Hz waveform).

so you need to figure out how to turn your AMDF upside down and offset it to get peaks instead of valleys.  for the math relating AMDF to ASDF and that to autocorrelation, take a look at this and particularly this.  you have multiple pitch candidates and you have to elect the correct candidate.  don't do it like the Americans did last November.


Frequency Domain Correction of Frequency Offset or Doppler Frequency in LTE

Generally, a modulation with a complex sinusoid in time domain is equivalent to a shift in frequency domain (I find that quite intuitive, since it's the very definition of frequency shift).

That means that for $f_\text{offset} = M\frac{f_\text{sample}}{N_\text{FFT}},\quad M\in\mathbb Z$ you can just correct things by shifting the frequency domain vector left or right.

However, you also have to deal with the fractional frequency offset. If you don't, you'll get Inter-Carrier-Interference (ICI).

The only way to solve that is by interpolating the correct values from the values you have with sinc interpolation.

Sinc interpolation is easiest done by taking the IDFT, then modulating with a $e^{j2\pi f_\text{offset fractional} t}$, and then DFT'ing back.

In other words: that frequency correction is done in time domain.

So, do your fine frequency correction in time domain, not in frequency domain. Doing it in frequency domain requires at least the effort of going back to time domain.


In short:

Upsampling: does/should not loose information  (if done wisely), then safer,
Downsampling: may loose information (if done unwisely), yet more computationally  efficient.

So if you compare data at different rates, and in an evaluation phase when one tries to define how the comparison should be done (which features are compared, with what metric, with which externals, like precision, efficiently, robustness, etc), a very basic first approach would be to upsample both signals by an integer factor to reconcile their sampling. Here, this is quite OK, 6000 Hz could work for both.

The reasons could be, for DSP practice:

with integer upsampling, you are not obliged to use tricky filtering techniques, and simple linear interpolation is easy. Remember though that upsampling adds some information.
with signals are the same scale, you can extract features and compare them: noise, variability, slopes, derivatives, etc. You can apply the correct scale/offset correction (they don't have the same amplitude), use linear or non-linear transformations (Fourier, etc.) to check whether similarities features exist in different domains
at this stage, you should be able to quality and quantify the features/metrics needed to build your algorithm. And you can estimate what you can loose from both data. For instance, you can create your algorithm, and see how it is robust to signal downsampling, and how far you can go. Here, your algorithm begin to be more efficient.

Once you have spent some time on that, you are more ready to start from scratch again, and decide whether you should downsample or not, with which method, etc. to reach both safety and efficienty.

To provide alternatives, if you decide to compare data on the Fourier domain, you can easily cast two signals with different length and sampling rate to the same number of Fourier coefficients, helping a comparison in the frequency domain.


How Does Color Conversion and Downsampling work When JPEG compressing a grayscale image?

Normally, monochrome images should be stored as images with a single channel. However, I have seen digital images with three channels containing the same values. This results in a displayed image looking grayscale.
Before compression multichannel data, it is common to decorrelate the channels. For RGB, one often concert them to luminance and chrominances. Several formulae can be seen, linear and nonlinear, to convert $R$, $G$ and $B$ to $L$ and the two $C_x$:
$$ L= \mathrm{c2l}(R,G,B)$$
and
$$ C_x= \mathrm{c2r}_x(R,G,B)$$
In most cases I know, for the same repeated channel (say $R$, but whatever),
$$ L= \mathrm{c2l}(R,R,R)\simeq R$$
and
$$ C_x= \mathrm{c2r}_x(R,R,R)\simeq 0$$
so the compression code will naturally "cancel" the unnecessary channel triplication for a grayscale image. As a side node, this can be the cause of errors in computing compression ratios,  as the original image is three times the size it should have been. This uses to happen  in  monaural (mono) audio stored on two duplicated stereo channels.
To be more concrete, with the classical linear YUV conversion:
Y =  0.299R + 0.587G + 0.114B
U = -0.147R - 0.289G + 0.436B
V =  0.615R - 0.515G - 0.100B

and since:
 0.299 + 0.587 + 0.114 = 1
-0.147 - 0.289 + 0.436 = 0
 0.615 - 0.515 - 0.100 = 0

one can see that the chrominance images are zero (or close to zero for nonlinear transforms), and remain very small in amplitude after DCT and subsampling, and will be unnoticeable in JPEG compression.


Deconvolution of a 1D Time Domain Wave Signal Convolved with Series of Rect Signals

Solving a deconvolution isn't easy even in simulated environment not to mention in practice.
The main trick to solve it is using the proper model / prior for the problem and very good measurements (High SNR).
So basically, for deconvolution we're after:
$$ \hat{\boldsymbol{x}} = \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} $$
Where $ H $ is the matrix form of the convolution operator of the known signal and $ \boldsymbol{y} $ is our measurement samples.
Now, we need to talk about the Convolution form. The convolution has to deal with boundary conditions which might be crucial for good results.
We have few approaches (Basically extrapolation):

Extrapolate with Zeros - Assuming data outside the samples of the signals is zero.
Extrapolate by Nearest Neighbor (Also called Replicate) - The unknown value is extrapolated by the nearest known value.
Extrapolate by Periodic continuation - The data is assumed to be periodic. Hence any missing value is based on that.

The building of $ H $ must match that. Since you used, in your code conv() with no explicit mode it means you basically chose zeros and since your convolution output is full (The default) it means we see the transients as well in the output.
The solution to the above is given by:
$$ \hat{\boldsymbol{x}} = \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} = {\left( {H}^{T} H \right)}^{-1} {H}^{T} y $$
The stability of this solution depends on the Condition Number of $ {H}^{T} H $.
Remark - One could solve this in Frequency Domain as well. Though it will require some touches as in Frequency Domain the model is the periodic model.
Let's have a look on the results:

First we can see the Condition Number is huge!
You may think about the condition number as the amplification of the error. It means even the slightest noise will make things unstable. As can be seen, indeed even a white noise with a standard deviation of 1e-8 caused errors!
In practice, to deal with this instability we use some regularization.
$$ \hat{\boldsymbol{x}} = \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda R \left( x \right) $$
Where $ R \left( \cdot \right) $ is the regularization function and $ \lambda $ is the regularization factor which balances between listening to the naïve deconvolution model or  to the regularization model.
The regularization function must be chosen with respect to the prior knowledge we have about the signal of interest.
In your case, something clear about your signal is its piece wise smooth property. Its gradient is very sparse. Hence it is a perfect match to the Total Variation model:
$$ \hat{\boldsymbol{x}} = \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda TV \left( x \right) = \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda {\left\| D x \right\|}_{1} $$
Where $ D $ is the finite differences operator (Discrete Derivative).
This is a relatively easy task to solve. In my project Total Variation (TV) Regularized Least Squares - Solvers Analysis I implemented and compared few solvers.
For this example I used the ADMM based solver.
Here is the result for the TV regularization:

As can be seen, it totally overcome the (Very Low!) noise from above.
In real world (And higher noise levels) one needs to tweak the $ \lambda $ parameter. You will hardly recover perfect results, but they will be much better than doing the naive approach.
MATLAB Implementation
The full code is available on my StackExchange Signal Processing Q71822 GitHub Repository.
It includes the functions to build the convolution matrix from the samples and solve the TV problem.


Is there an optimal way to quantize log-likelihood ratios of an AWGN channel?

It depends on your actual decoder architecture, but if memory serves me right, uniform quantization is optimal for Min-Sum or Sum-Product decoders. (Intuitively, kind of makes sense – any other quantization could be modelled as "let's first apply a function to the LLRs and then quantize the result of that uniformly", and LLRs are what asymptotically achieves maximum likelihood performance.)
The question is where you put your quantization boundaries: If you have a fixed number of bits for your LLRs, do you quantize the region from, say, $-2\sigma$ to $+2\sigma$, because everything larger is sufficiently "safely" the sign-indicated value, anyway? Or do you have a large code word length, and you want to make sure that in sea of large LLRs, where some represent bit errors, the "righter" ones are
still understood as such?
That's a question of looking your design SNR and your target FER; no general answer or formula is known, far as I'm aware.


Definitely you will have to calibrate your system. You need to know what is the relationship between dBFS (Decibel Full-Scale) and dB scale you want to measure.

In case of digital microphones, you will find sensitivity given in dBFS. This corresponds to dBFS level, given 94 dB SPL (Sound Pressure Level). For example this microphone for input $94 \;\mathrm{dB SPL}$ will produce signal at $-26 \;\mathrm{dBFS}$. Therefore the calibration factor for spectrum will be equal to $94+26=120\;\mathrm{dB}$.

Secondly, keep in mind scaling of the spectrum while doing windowing and DFT itself. More specifically, given amplitude spectrum (abs(sp)):

Total energy of the signal is spread over frequencies below and above Nyquist frequency. Naturally we are interested only in half of the spectrum. That is why, it important to multiply it by 2 and ignore everything above the Nyquist frequency.
Whenever doing windowing, it is necessary to compensate for loss of energy due to multiplication by that window. This is defined as division by sum of window samples (sum(win)). In case of rectangular window (or now window), it is as simple as division by N, where N is the DFT length.

Here is some example source code in Python. I am sure that you can take it from here.

#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt
import scipy.io.wavfile as wf

plt.close('all')

def dbfft(x, fs, win=None, ref=32768):
    """
    Calculate spectrum in dB scale
    Args:
        x: input signal
        fs: sampling frequency
        win: vector containing window samples (same length as x).
             If not provided, then rectangular window is used by default.
        ref: reference value used for dBFS scale. 32768 for int16 and 1 for float

    Returns:
        freq: frequency vector
        s_db: spectrum in dB scale
    """

    N = len(x)  # Length of input sequence

    if win is None:
        win = np.ones(1, N)
    if len(x) != len(win):
            raise ValueError('Signal and window must be of the same length')
    x = x * win

    # Calculate real FFT and frequency vector
    sp = np.fft.rfft(x)
    freq = np.arange((N / 2) + 1) / (float(N) / fs)

    # Scale the magnitude of FFT by window and factor of 2,
    # because we are using half of FFT spectrum.
    s_mag = np.abs(sp) * 2 / np.sum(win)

    # Convert to dBFS
    s_dbfs = 20 * np.log10(s_mag/ref)

    return freq, s_dbfs

def main():
    # Load the file
    fs, signal = wf.read('Sine_440hz_0dB_10seconds_44.1khz_16bit_mono.wav')

    # Take slice
    N = 8192
    win = np.hamming(N)
    freq, s_dbfs = dbfft(signal[0:N], fs, win)

    # Scale from dBFS to dB
    K = 120
    s_db = s_dbfs + K

    plt.plot(freq, s_db)
    plt.grid(True)
    plt.xlabel('Frequency [Hz]')
    plt.ylabel('Amplitude [dB]')
    plt.show()

if __name__ == "__main__":
    main()

Lastly, there is no better source on this type of spectrum scaling than brilliant publication by G. Heinzel et al. Just keep in mind that if you want to proper RMS scaling, then full-scale sinosuidal signal will be $-3 \;\mathrm{dBFS}$.

You might also find my previous answer being helpful.


In addition to the above comment:

Show that the 2D Z-transforms of both sides are equal.

Step-by-step: If $F(z_1, z_2)$ is the 2D Z-transform of $f(m,n)$, then what is the 2D Z-transform of

$f(m-r, n)$?
$f(m-r, n-s)$?
$f(m, n) * g(m, n)$?
$f(m-r, n-s) * g(m, n)$?

(Yes, I realize that the 2D Z-transform may not be taught before this exam was presented, but it is a valid solution, nonetheless.)


Can the Nyquist sample rate be extended to stochastic sampling?

As long the mean sampling frequency fulfills the Nyquist criteria, you're good to go. So, for well behaved distributions with known mean, you won't need any extra math, aside from the required special handling of the non-uniform samples themselves.


There are two things to consider here: the noise power after sampling, and the fact whether the sampled noise is uncorrelated or not. Note that the autocorrelation function of the sampled noise equals the sampled autocorrelation function of the continuous-time noise. For a wide-sense stationary (WSS) band-limited white noise signal $X(t)$ with bandwidth $B$ and one-sided noise density $N_0$, the autocorrelation function is given by

$$R_X(\tau)=BN_0\,\text{sinc}(2B\tau)\tag{1}$$

where I use $\text{sinc}(x)=\sin(\pi x)/(\pi x)$.

If you define a discrete time process $Y[n]=X(nT)$, where $f_s=1/T$ is the sampling frequency, then its autocorrelation function is given by

$$R_Y[k]=R_X(kT)=BN_0\,\text{sinc}(2BkT)\tag{2}$$

Since the power of the discrete-time noise $Y[n]$ is given by $R_Y[0]=BN_0$, it is obvious that the sampling frequency has no influence on the noise power. So no matter how fast you sample the original continuous-time noise, the power of the resulting discrete-time noise always equals the power of the noise before sampling.

Now let's have a look at the correlation between the noise samples. The autocorrelation function $R_X(\tau)$ has zeros at

$$\tau_i=\frac{i}{2B},\quad i=1,2,\ldots$$

which for $B=10\,\text{kHz}$ gives $\tau_i=i\cdot 50\mu s$ (this is the small numerical error in Dilip Sarwate's post you referred to in your question). This means that if you choose a sampling interval which is an integer multiple of $50\mu s$, the resulting sampled noise will be uncorrelated. This corresponds to sampling frequencies $f_s=2B/i$, $i=1,2,\ldots$, i.e. $20\,\text{kHz}$, $10\,\text{kHz}$, $6.67\,\text{kHz}$, etc.

So with a sampling frequency of $20\,\text{kHz}$ you do get uncorrelated noise samples.


EEG epoching is a procedure in which specific time-windows are extracted from the continuous EEG signal. These time windows are called “epochs”, and usually are time-locked with respect an event e.g. a visual stimulus.

If your EEG data are in a matrix [channel x time] where time is the complete continuous EEG signal, after the epoching procedure you should have a matrix [channel x time x epochs] where time is the time length of each epoch, and epochs is the number of segments you extracted from continuous EEG signal.

Finally, if you want to extract epochs from your signal, you should know what are the segments of interest to be analyzed, for instance, a specific stimulus.


This is the solution I think would work, there might be other more accurate and efficient ways to do this.

You might do this steps for every recording:

Find the silent sections (using the algorithms stated below)
Measure Standard Deviation of those silent portions of your recordings as an indication of noise power.
Select Standard  Deviation of silence sections of one the recordings that you are sure has acceptable quality, as a your threshold value.
Discard any other recording that its estimated noise power is higher that specified threshold (which you estimate in step 3).

For detection of silent portions of the voice, I suggest simply segment your signal into some non-overlapping windows, estimate signal power

$Power=sum(Segment_i^2)/lenght(Segment_i)$

any signal segment which has a signal power below a per-defined threshold, might be considered as silent section.
However this method is not very accurate. If you have enough time, try an algorithm called Voice Activity Detection (VAD), which is more  widely used (the ITU-T G.729 standard uses VAD  to reduce the transmission rate during silence periods of speech). Please, take a look at http://practicalcryptography.com/miscellaneous/machine-learning/voice-activity-detection-vad-tutorial/


Regarding the choice of cost function in adaptive control - squared error vs absolute error

This is an interesting question since both squared error and absolute error are convex functions, so they are both going to give the optimal solution when minimized. My intuition is that the $\ell_2$-norm (sum of squared values of error) converges to zero more quickly than the $\ell_1$-norm (sum of absolute values of error) when the search direction is right. For example, if the error is $\epsilon = y - Ax$. If $y$ is very close to $Ax$ and $0 < |y-Ax| \leq 1$, then $\epsilon^2$ is much smaller than $|\epsilon|$. Similarly, if $|y-Ax| > 1$, then $\epsilon^2 > |\epsilon|$. So the $\ell_2$ norm penalizes large errors more, and small errors less than the $\ell_1$ norm. This can also be understood by looking at the graphs of the two functions when $\epsilon \in \mathbb{R}$.

Of course the continuity of the derivative is another factor. The derivative of the absolute value technically does not exist at the minimum.


What Are the Alternatives to FFT for Computing High Resolution Tone Power Levels?

Actually all those "Angle of Arrival" algorithms can be used for that.

You can try:

MUSIC.
Pisarenko Harmonic Decomposition.
Sensor Array (MVDR).


Adaptive Digital Filter Block Diagram Question

Judging from the figure, the situation is slightly different from your explanation in the question. The noise $v(k)$ is the actual noise in the signal, not the noise picked up by the reference microphone. So the noisy signal is $d(k)=x(k)+v(k)$. If you knew $v(k)$ you could simply subtract it from $x(k)$ without the need to use an adaptive filter. What you have is another noise signal $r(k)$, which is a filtered version of the noise $v(k)$. This unknown filter is depicted by the "black box" in the figure. It is filtered because the transfer function from the noise source (road, tires, etc.) to the reference microphone is different from the transfer function to the microphone recording the speech. What the adaptive filter is trying to do is estimate the noise in the speech signal from the reference noise, i.e. it tries to invert the unknown filter in the black box. This can be achieved by minimizing the power of the error signal $e(k)$. The reason is that if you assume that speech and noise are uncorrelated, the output of the adaptive filter can only reduce the noise component in $d(k)$, not the speech component. So the power of $e(k)$ becomes a minimum if the output of the adaptive filter $y(k)$ equals $v(k)$. You don't need to worry that the speech signal is removed because $y(k)$ cannot model the speech signal at all, because noise and speech are assumed to be uncorrelated. So ideally the error signal $e(k)$ contains only clean speech. Note that due to noise and speech being uncorrelated, the power of $e(k)$ can never become zero. Neither can the error signal itself become zero (for all $k$).


Identify the Type of Image Distortion (On Lena Image)

Blur
If you want to reverse Blur applied on an image (Using Convolution, namely Linear Spatial Invariant Blur) you should use Deconvolution which, as name suggests, the inverse operation of Convolution.
Have a look at What Are the Types of Deconvolution, Sharpen Defocused Image (Deconvolution / Image Restoration), Deconvolution by Convolution and 1D Deconvolution with Gaussian Kernel (MATLAB).
Salt and Pepper Noise
Salt and Pepper noise is usually treated with Median Filter.
In the case of Color what you can do is either work on each channel on its own or generalize the cost function the Median minimizes to vectors (Namely minimize the $ {L1} $ Norm of the neighborhood of RGB vectors.
Contrast
The last degradation seems to be some kind of contrast removal from the image.
In order to reverse is normalize the image into the range $ [0, 1] $ (Black to White). You can do that by the following method:

Find the Minimum Value of the image, lets' call it minVal.
Find the Maximum Value of the image, let's call it maxVal.
Set the output value of the $ i, j$ pixel as following: mOuptutImage(i, j) = (mInputImage(i, j) - minVal) / (maxVal - minVal).


Question about the Haar Wavelet transform

The FFT is much better at detecting a sinusoid than a DWT.  The FFT is approximating a periodic signal with a series of periodic signals.  The coefficients of the FFT will be maximum in the frequency bins (could be a single bin with sufficient resolution) where the component of the FFT series best matches the periodic signal to be detected.  The noise will distribute roughly evenly in all bins, so the signal to be detected will show up readily.

The DWT is representing the signal to be detected (in this case a periodic signal) with a set of non-periodic functions, so this requires lots of components (bands as you refer to them – but DWT really works with scale not frequency) to follow the periodic nature of the signal to be detected.  The DWT is better suited to detect / analyze non-periodic signals.


Z transform getting different answer for transform of rational function

Your first line is wrong. The partial fraction expansion of $X(z)$ should be :

$$ X(z) = \frac{ z (2z-\frac{5}{6})}{ (z-\frac{1}{2})(z-\frac{1}{3})} = 2 + \frac{ \frac{1}{2} }{z -  \frac{1}{2}} + \frac{ \frac{1}{3}}{z -  \frac{1}{3}} $$

Then they should yield the same inverse (causal) transform as:

$$ x[n] = 2\delta[n] + (1/2)^{n} u[n-1] + (1/3)^{n} u[n-1] $$

which is identical to :
$$ x[n] = (1/2)^n u[n] + (1/3)^n u[n] $$

as obtained by the second method.


Confusion about result of FIR All-pass filter design

The dip at Nyquist has to do with the fact that you didn't assign the value $0$ to the desired phase at Nyquist. You correctly assigned $0$ to the phase at DC, but you have to do the same at Nyquist, because a filter with real-valued coefficients has a real-valued frequency response at DC and Nyquist. So you just need 127 random numbers, not 128.

But the plot of the magnitude response of the designed filter is deceptive, because by taking an FFT (of length 256) of the coefficients you basically just plot the desired magnitude (apart from the Nyquist point), because you just invert your design process. Try to zero-pad your coefficients and take an FFT of length 1024 or more. You will be surprised to see that your filter doesn't at all resemble a very good all-pass filter. You see some indication of this in your second plot, which is more realistic.

Note that a non-trivial FIR filter (i.e. one which is not just a single delta impulse) can never have an exactly constant magnitude response, because its transfer function is a polynomial which can't be constant (unless it is a trivial polynomial). Your all-pass filter has an especially poor magnitude response because it is very hard for the filter to approximate those random phase jumps.


Your $h(t)$ is an ideal low pass filter with cutoff frequency of $75$ Hertz. At the output, everything above $75$ Hertz will be gone and equal to zero. If you're thinking about the inverse system, you need to think about getting back the original input. What can you say about the original input signal at frequencies greater than $75$ Hertz? Isn't it anybody's guess as to what used to be there?


As I understood, if the frequency range from 1 kHz to 3 kHz, does that mean that we have a signal that maybe repeat itself from 1000 times to 3000 time every second?

No.

A signal can be composed of many different repeating signals that are added up. So, if you have a sine that repeats 1000 times in a second, and a sine that repeats 3000 times in a second, and you add these two up, you get a signal with energy at 1000 Hz and 3000 Hz.

But not all signals are purely sinusoidal. Those have energy not only at discrete frequencies, but over a range of frequencies.

There's different definitions of it, but essentially, the bandwidth of a signal is the width of the frequency range in which the signal has energy.

The way your material looks, you'll pretty soon learn about the Fourier Transform and  what Power Spectral Density is. That explains the mathematical foundation of how signals can have a continuous distribution of energy over a range of frequencies instead of just at discrete (i.e. separate, countable) frequencies.


I think you're misunderstanding the relationship between the time and frequency domains. Each point in the output of a DFT is a function of all of the input time-domain values. There is no one-to-one mapping between input points and output points.


Inter-point interpolation using FIR filter

From Hilmar's answer to the linked question, the Whittaker–Shannon interpolation formula is:

  $$x(t)=\sum_{n=-\infty }^{\infty }x[n]\cdot \operatorname{sinc}\left(\frac{t-nT}{T}\right).$$

If the signal is low-pass and the noise is high-pass, to filter high-pass noise, we can make a low-pass version of the interpolation formula:

$$x(t)=\sum_{n=-\infty }^{\infty }x[n]\cdot 2f_c/f_s\cdot \operatorname{sinc}\left(\frac{t-2f_c/f_s\cdot nT}{T}\right),$$

where $f_c$ is the cutoff frequency and $f_s$ is the sampling frequency. The highest signal-to-noise ratio is obtained by setting the cutoff frequency to a frequency for which the signal and the noise have equal power. Actually the Whittaker–Shannon interpolation formula is low-pass as well, with $f_c=f_s/2$.


To do something about the "Mother with kids"-Problem, you could implement an algorithm that sets a value to 1 or 0 based on whether the sensor was activated in a timeframe of ~5 seconds. Saving this value every 5 seconds leads to equidistant samples in time domain.

The coming in/going out-problem could be solved using two IR sensors that customers have to pass one after another to enter or leave. By checking whether the activation time difference is positive or negative, you can find out if they were coming or leaving.

I would not recommend interpolation as customer appearance is not necessary bound to any pattern or formula but somewhat random since it depends on a lot of things not easy to predict.
In this case, consider using histograms for fixed time intervals (15/30/60 minutes) to visualize customer spread (rush hours ...) .

Assuming you take aforementioned samples every 5 seconds, you are working with value- and time discrete signals which may or may not be deterministic/periodic (predictable) but will be random/stochastic to some extend.


Apply Singular Value Decomposition on Gabor filters

I won't recommend you apply SVD in your Gabor filter, since it does not bring much benefit but increase the computing load. If you implement SVD, you may not separate the filter at first, instead the SVD is performed on the 2D Gabor filter:

                for i = -filtSizeL:filtSizeR
                    for j = -filtSizeL:filtSizeR

                        if ( sqrt(i^2+j^2)>filtSize/2 )
                            E = 0;
                        else
                            x = i*cos(theta) - j*sin(theta);
                            y = i*sin(theta) + j*cos(theta);
                            E = exp(-(x^2+G^2*y^2)/(2*sigmaq))*cos(2*pi*x/lambda(k));
                        end
                        f(j+center,i+center) = E;
                    end
                end

               %% SVD %%%%
               [u,s,v]=SVD(f);

With u, s, and v, you implement the convolution with your image:

    convv = zeros(size(image_double));
    for i = 1:filtSizeR+filtSizeL+1
        convv1=imfilter(image_double*s(i,i),  u(i,:),'conv');
        convv2=imfilter(double(convv1),v(:,i)','conv');
        convv = convv + convv2;
    end

    figure
    imagesc(imag(convv));

Yet I don't think this method is as good as your separable f and g method.


FFTW: Logical array size in r2r transform?

You're on the right track.  The distinction must be made between the physical size of your array, n (generally $n_0 × n_1 × n_2 × … × n_{d-1}$ except for in-place R2C transforms), and the logical size, N.  For a 10x10 matrix, the physical size is n=10*10=100, so the logical size for this particular transform is N=2n=200,  the scaling factor for the unnormalized transform-then-inverse result.

They talk a little more about that here in the Real even/odd FFTW3 docs, although they don't give much more info than the link you provided.

It's always a good idea to test with a problem that you already know the answer to,


It really has been a long time since I have read Lindeberg's papers, so the
notation looks a bit strange.  As a result, my initial answer was wrong.
$\gamma$ is not a scale level.  It seems to be a parameter of some sort that can be tuned.  It is true that you need to multiply the derivative by the
appropriate power of $t$. $t$ itself corresponds to a scale level, and the power  depends on the order of the derivative.
You can find keypoints at multiple scales in the same location.  That is because you look for the local maxima over scales.  Here's the intuition: think of an image of a face.  At a fine scale you get a blob corresponding to the nose.  At a course scale you get a blob corresponding to the whole face.  The two blobs are centered at the same point, but have different scales.
Here is the whole algorithm:

Decide which image features you are interested in (e. g. blobs, corners, edges)
Define a corresponding "detector function" in terms of derivatives, e. g. a Laplacian for blobs.
Compute derivatives that you need for your detector function at a range of scales.
Multiply the derivative responses by $t^{m \gamma / 2}$, where $m$ is the order of the derivative, to compensate for magnitude decrease.
Compute the detector function over the whole scale space.
Find local maxima of the detector function over $x, y, t$.
These are your interest points, or keypoints.

Edit:

Lindeberg proves in the paper that $t^{\gamma / 2}$ is the appropriate factor for normalization of derivatives.  I don't think I can reproduce the proof here.
You do not take derivatives with respect to $t$.  You only compute derivatives with respect to $x$ and $y$, but you compute them at a range of scales. One way to think about this is you generate a Gaussian scale space first, by repeatedly blurring the image with a Gaussian filter of some variance $t$.  Then compute derivatives with respect to $x$ and $y$ at each scale level.
You want to find local maxima over scales because you may have image features of different size at the same location.  Think of an image of concentric circles, like a bulls-eye.  It will give you high responses of a Laplacian at several scales.  Or think of an image of a real human eye filtered by a Laplacian at a range of scales.  You will get a high response at a fine scale for the pupil, a high response an some medium scale for the iris, and a high response at a coarse scale for the whole eye.

The whole point is that you do not know at what scale the features of interest might be ahead of time.  So you look at all scales.


First of all you should take the magnitude of the FFT (use abs function) - what you've plotted is just a real part of FFT.
Secondly, depending on what you want to achieve, I would suggest to detrend your signal in order to remove the linear drift. From that point it's all up to you what you want to infer from this data.

To be honest, I'd suggest you to check out Orange3 with time-series add-on. It's a good starting point for quickly understanding your data. You can either import the CSV file or fetch series directly from Yahoo Finance. Then it's easy to perform any sort of analysis such as periodogram, ARMA, etc. This way you will avoid mistakes using FFT.


Because of the diode at the input, you get a DC offset at the output. Notice that a single diode is already a primitive rectifier, because it blocks the negative half wave.

But you usually will want a purely AC output, that's why you put a HPF with very low cutoff frequency after the LPF. It will block the DC and yield a pure AC output signal. You can see it either as part of the demodulator or as part of the following circuit, usually some kind of amplifier or buffer, but it is always required.


With respect to your comment on a low frequency component not appearing on the FFT:

What you are seeing is not a low frequency component but a low frequency modulation of the 148 Hz main signal. This originates from leftovers of the 150 Hz signal, and you can see it very clearly on the FFT plot you provided.

You may check the Wikipedia entry on beat frequency.


Gamma Correction is Pixel Wise operation.
Hence what you can do is estimate it per pixel and then average it per local area.


Kalman Filter: Why $ Q $ Discrete Is Defined as $\int_0^Te^{\mathbf{A}\tau} Q e^{\mathbf{A}^T \tau} d\tau$?

The simple answer is that you discretize Differntial Equation.
Actually a linear differential equation.

The question is why the Matrix Exponential?
Well, try to remember what are the solutions of Linear Scalar Differential equations.
The solutions are formed by the expontial function.
Hence what you see is the Exponent of a Matrix (Since in the General Kalman case we have a vector Linear Differential Equation) as solution (Which is the integration) and we discretize this because in real life the model is discrete.

You may have a look at ECE 595 - Discrete-Time Control Systems - Discretization of Continuous Time State Space Systems.
The solution given there for the Differential Equation in a vector form holds for the cases all variables and coefficients are scalars.


A [Very] Rough Approximation to "White Noise" with Sine Waves

Phase and amplitude of this sinusoids should be random, so you need Gaussian random number generator. If you don't have the random number  generator then might want to think about implementing one, here is, I believe, the most popular algorithm: Box-Muller transform.

Depending on your application and device, you might also want to use other noise source (i.e. Online generators, highly amplified signal from a probe).


What is the relation between noise (AWGN) variance and number of antennas?

Usually, the model is that every receiver antenna picks up noise of the same PSD, $N_0/2$. This means that the variance of noise samples in each quadrature branch is $N_0/2$. This noise is local to each antenna and is independent of the rest of the system.

To calculate the total amount of noise in the receiver, you multiply by the number of receiver antennas. This is usually not needed, though, since the figure of merit is the ratio of the energy per information bit (or symbol) and the variance of the noise affecting that bit (or symbol).


Smallest sampling frequency to fully reconstruct a signal

Your understanding is not correct for complex sampling:

For the specific case of a complex bandpass (analytic) signal whose spectrum is by definition zero for the negative frequencies such as:

$$ H(\Omega) =  \begin{cases}  0 &, \text{ by def. for } \Omega < 0 \\ A_\Omega &, \text{ nonzero for } \Omega_1 < \Omega < \Omega_2 \\ \end{cases}$$

then the necessary minimum sampling rate which would avoid aliasing (spectral overlap) is given by $$ \Omega_s > ( \Omega_2 - \Omega_1 ) $$ Note that if the signal were real with a symmetric bandwidth then the minimum sampling rate would be twice that of the complex case. Also then the allowed range of valid sampling rates would be found differently.

The reconstrcution filter that would yield the original complex signal $x(t)$ back will be a complex bandpass filter, not a real one. You can obtain the complex bandpass filter $H_+(\Omega)$ from the real bandpass filter $H_r(\Omega)$ using a Hilbert transformer such as:

$$ h_+(t) = h_r(t) + j \mathcal{H} \{h_r(t) \} $$

Note that for a given sampling rate you will be getting $F_s$ complex samples per second which is equivalent to $2 \times  F_s$ real samples per second. Hence the apparent advantage of complex sampling is actually not realized , as the total number of samples per second will be the same in both cases.


The base functions of the discrete time Fourier transform takes on values from the set $$\{z\in\mathbb{C}:z^N=1\}$$ where $N$ is the dimension of the vector space. The solutions can be parametrized to be in the form $$z_k = \exp(2 \pi i \frac{k}{N})$$ for $k=0..N-1$ because $$z_k^N = \exp(2 \pi i k \frac{N}{N}) = \exp(2\pi i k) = 1$$

In other words, the values the base functions components are chosen from are the $N$ non-identical $N$-th roots of 1, which are equidistantly distributed on the unit circle and include $1$ itself.


Convolution as associative, while correlation is not.  The associative property is what allows you to convolve multiple filters into a single one, and then convolve that one filter with the image.  That is the big advantage of convolution over correlation.


Getting Composition of a Mixture of Colors

You actually have 3 independent equations.
If one of them is solvable, all three are.

Now, the equation is given by:

$$ z = \alpha x + \left( 1 - \alpha \right) y $$

Assume $ \alpha, x, z $ are known, then:

$$ y = \frac{z - \alpha x}{1 - \alpha} $$

For any value of $ \alpha \neq 1 $ the solution is valid.
Moreover, if $ alpha = 1 $ then $ z = x $ and $ y $ is irrelevant.

Looking at the other case, restoring $ x $, yields:

$$ x = \frac{z - \left( 1- \alpha \right) y}{\alpha} $$

For any value of $ \alpha \neq 0 $ the solution is valid.
Moreover, if $ alpha = 0 $ then $ z = y $ and $ x $ is irrelevant.

As you wrote, in order to have a Linear Interpolation the parameter $ \alpha $ must be in the range $ \left[ 0, 1 \right] $.


What are the restrictions on DFT input sequences in order to produce valid spectral results

The only restriction imposed on the input of the discrete finite dimensional transform DFT (Discrete Fourier Transform) is that the input has finite energy ; i.e., $$\sum_{n=0}^{N-1} |x[n]|^2 < \infty$$
And a necessary & sufficient condition for an $N$-point sequence $x[n]$ to have finite energy is that all of its samples are bounded.
There's no more restriction on the discrete-time sequence $x[n]$ to be transformable into $X[k]$ by means of the linear mapping implied by DFT.
However, I guess, from your previous question, that you want to investigate whether periodicity is a restriction on the input or not? The (my) answer is of course not. DFT works on finite length input, and since it's impossible to tell (by anyone) whether a block of data belongs to one period of a periodic waveform, or it's just the whole data itself, hence it's not possible to restrict the input to be periodic (because it cannot be tested)...
But the DFT algorithm has been designed to operate on one period of periodic inputs. If you evaluate the inverse DFT of a given set of DFT coefficents for all $n$, you can see that data periodically extends outside of the base interval $0 \leq n < N$.


Appropriate channel bandwidth for my BPSK modulated Psuedo-Random code on direct conversion transceiver

It seems from your question that you are still lacking a few concepts and techniques that you'll have to master before succeding. I'll just give a few pointers:

Get a good book on SDR. I recommend "Software Receiver Design" by Johnson et al, and "Software Radio: A Modern Approach to Radio Engineering" by J. Reed.
The passband bandwidth is double the baseband bandwidth. However, your radio works with quadrature signals and complex sampling, which muddles that concept a little, since the baseband quadrature signal's spectrum is no longer symmetrical.
Do not use rectangular pulses in an RF application.
The actual bandwidth depends on the pulse shape (and in the case of root raised cosine, its rolloff factor). If your sampling rate is $f_s$, then your baseband bandwidth goes from $-f_s/2$ to $f_s/2$.
The receiver's sampling rate is independent of the transmitter's, because the receiver sees an analog signal. The only thing you need to worry about is meeting Nyquist and having enough samples for your synchronizers to work.
You may need to worry about radiating large amounts of energy on a wide band. You should restrict your transmissions to one of the ISM bands and in general comply with all the relevant regulations in your country.
Regarding transmit bandwidth: Let's say you want to transmit at baud (pulse) rate $R_p$, using (root) raised cosine pulses with rolloff factor $\beta$. Then, the baseband signal bandwidth is $$B = \frac{R_p(\beta+1)}{2}.$$ The transmitter sampling rate needs to be larger than $2B$, but for practical reasons it is usually a good idea to oversample at least by a factor of 2. Also, you'll need to select a frequency that is compatible with your hardware. As an example, if I wanted to transmit at $R_p = 100,000$ pulses per second with $\beta=0.75$, I'd calculate $B=87.5$ kHz, and then oversampling by 4 I'd end up with $f_s = 350$ kHz. I'd configure the hardware for the smallest supported sampling frequency that is larger than 350,000.


@Amelia. Hi. I tried to run your MATLAB code, but it contains several errors regarding vector lengths and produces error messages. But that's not the main issue here. The answer to your question is: If you compute the DFT of an N-point x(n) sequence you produce an N-point complex-valued xDFT(m) frequency-domain sequence. You can only reconstruct the original x(n) sequence by computing the inverse DFT of the N-point xDFT(m) sequence. You cannot recover the original N-point x(n) sequence by computing the inverse DFT of any sequence that is not the xDFT(m) sequence.


Matlab FIR-1 command designs FIR filters with at least two given parameters. P1: The order of the filter, P2: cutoff frequency, assuming a default lowpass filter. Order of the filter N determines a number of properties of the resulting filter such as its comptational complexity, transition bandwidth, passband and stop band ripples. In general large N gives better (closer to ideal) frequency response but worse computational load. Also order of filter being even or odd will have effect on zero-locations being at Nyquist frequency which might be important for some applications with high/low pass filters...

The second parameter, cutoff frequency, is basicaly determined by the application.


Blind Source Separation of Real World Mixture

Independent Vector Analysis which extends the idea of ICA seems to be the most robust blind source separation algorithm. It's able to separate real world convolutive recordings into surprisingly high quality components. IVA deals with the permutation problem by modeling each source as a multivariate random variable. For more details the original IVA paper by Taesu Kim can be found here: Independent Vector Analysis: An Extension of ICA to Multivariate Components.


Correlation between a signal segment and its stretched replica

Say you got two similar signals when one of them is stretched and you want to know the straching ratio...
Seems like you can
1. guess the straching ratio
2. resample the short signal with a resampling ratio equal to your guessed straching ratio.
3. Find the max of the convolution between the signals.
4. Optimize the estimation of the straching ratio using a numerical method.


Are the FFT coefficients symmetric in image processing?

For real images, there is indeed a formal redundancy, termed Hermitian or conjugate-symmetric as detailed by @Fat32. This symmetry however is "modulated" by the complex expression of the Fourier coefficients. So the FFT requires half the number of coefficients, but twice the amounts, due to the real/imaginary or modulus/phase couples. All in all, the redundancy vanishes.

More precisely, an FFT on a $2n$ length signal provides you with $n+1$ non redundant coefficients: the first (DC) and the last (Nyquist) are always real, the $n-1$ often complex. So you have $n-1$ complex coefficients, plus one pair of reals, altogether $n$ "pairs" of coefficients.

In general, with linear transformations, you cannot expect a bijective, one-to-one mapping with less transformed coefficients than samples in the signal/image, unless, as detailed by @Fat32, you reduce the data space, but then again, the transformed space would naturally have the same dimension as that of the data.


Impulse response $h[n]$ from input and output signal using cross correlation on Matlab

i want to know if taking the cross correlation of these signals would give me the impulse response?

No.
Let's look at it in the frequency domain. Let's call the input $x$, the output $y$ and the impulse response $h$. Uppercase letters are spectra, lower case time domain signals.
For the transfer function we simply have $Y = H\cdot X, H = Y/X$. The spectra of the autocorrelation $r_{xy} = y \star x$ is
$$R_{xy} = X' \cdot Y = X' \cdot H \cdot X = H \cdot |X|^2$$
So you will only the get transfer function if the magnitude of the spectrum of the input signal is $1$ at all frequencies.
If you do time discrete auto correlation you also have to properly manage circular versus linear auto-correlation  .

and if so, will taking the Fourier transform of that resulting signal give me the frequency response?

The transfer function is indeed the Fourier transform  of the impulse response but since the cross correlation is NOT the impulse response, you won't be getting the transfer function either.


Comparing Images by Defining a Reference Model

When looking at your data I want to say that when you have a good image the intensity along the x axis will be somewhat symetric and be much more random when you have a bad image.
The third order statistical moment, the skewness (1rst and second being mean and variance), is a good measure of assymetry. You may want to compare your image based on the skewness of the intensity along the x axis. Set some thresold either manualy or with basic machine learning.


There is no need to Dilate. Here is my segmentation results:

And here is my code using OpenCV:

#include <iostream>
using namespace std;
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
using namespace cv;

int main()
{
        int ht,wt;
    IplImage *im = cvLoadImage("2Dpg6.jpg");
        ht=im->height,wt=im->width;
    cvShowImage("RGB",im);

    IplImage *img = cvCreateImage(cvGetSize(im),8,1);
    cvCvtColor(im,img,CV_RGB2GRAY);

    CvRect rec;
    CvSeq *contours;
    CvMemStorage *storage=cvCreateMemStorage(0);
    IplImage *img2 = cvCreateImage(cvGetSize(im),8,1);

    cvThreshold(img,img2,30,255,CV_THRESH_BINARY);  // image segmentation
    cvErode(img2,img2,NULL,7);  // erode
    cvShowImage("BW",img2);  // show black-wihte image
    cvFindContours(img2,storage,&contours,sizeof(CvContour),CV_RETR_CCOMP);  // find contours
    while(contours){
        rec = cvBoundingRect(contours,1);
        cvRectangleR(img,rec,cvScalar(255));
        contours=contours->h_next;
    }
    cvShowImage("Gray",img);

    cvWaitKey(0);
    return 0;
}


Difference between freqz vs freqresp in scipy?

The equation of the filter is given as

$$H(z) = 0.2 + 0.8z^{-1}$$

This can be equivalently described with positive powers of z as:

$$H(z) = \frac{0.2z+0.8}{z}$$

The two equations above are mathematically equivalent. The function freqz specifies that the numerator and denominator polynomials are to be entered in decreasing (negative) powers of z, while freqresp specifies that they are to be entered in positive powers of z. So the OP should use the first form for freqz and the second form for freqresp. In contrast the OP has flipped the order which is the not the same filter.

In general, in order for the filter to be causal, if expressed in positive powers of z it is implied that it also must be divided by poles at the origin, in this case multiplied by $z^{-1}$.

Doing the following will result in the same answer as the result with freqz:

dlti = scipy.signal.dlti(filter_coef, [1,0]) # accounting for positive power convention

Flipping the coefficients, as the OP has done, is the "reverse filter". The reverse filter has the same magnitude response but has zeros at the reciprocal locations on the z-plane, given by $H(z^{-1})$, giving the result that the OP achieved.


Can I use FFT to interpret accelerometer gestures?

Looking at the data I can't see why you'd want to use FFT for this purpose (I may be wrong though). Lets say you want to detect single or multiple movements based on this data set (which you've attached) the methods I'd be looking at would be

Something on the lines of rate of change of absolute values. First derivative would do nicely I guess.
Wavelet transform maybe? I can't elaborate more on its utility until I know whether you want to know the the position of the peaks or not.

If the only thing you want to detect is single vs multiple oscillation then FFT is, in my opinion, not a very good choice for analysis.


Finding the Transfer Function of a Multiplicative Distortion in MATLAB

Basically the transfer function is given by (Continuous time case):
$$ H \left( j \omega \right) = K \frac{ \left( j \omega - {q}_{1} \right) \left( j \omega - {q}_{2} \right) }{ \left( j \omega - {p}_{1} \right) \left( j \omega - {p}_{2} \right) } $$
Now, given your frequency data sampled an $ N $ points $ {\left\{ {\omega}_{i} \right\}}_{i = 1}^{N} $ we need to use the discrete-time form of the transfer function over the Z domain (Z Transform).
Hence the model becomes:
$$ H \left( z \right) {\mid}_{z = {e}^{j \omega}} = K \frac{ \left( z - {q}_{1} \right) \left( z - {q}_{2} \right) }{ \left( z - {p}_{1} \right) \left( z - {p}_{2} \right) }{\Bigg|}_{z = {e}^{j \omega}} = K \frac{ \left( {e}^{j \omega} - {q}_{1} \right) \left( {e}^{j \omega} - {q}_{2} \right) }{ \left( {e}^{j \omega} - {p}_{1} \right) \left( {e}^{j \omega} - {p}_{2} \right) } $$
you may set a system of $ N $ complex equations and use non linear solver to find the 5 parameters ($ K $, $ {q}_{1} $, $ {q}_{2} $, $ {p}_{1} $, $ {p}_{2} $)  you need.
In case the measurements are noisy you may use Least Squares.
Remark
The above solves the problem from the data of @jmcd in frequency domain. In practice, using the data domain one could use simpler System Identification (See System Identification: An Overview) methods to get the equivalent ARMA model.
Regarding Frequency Domain based methods for System Identification have a look at Rik Pintelon - System Identification: A Frequency Domain Approach.


the ROC of a Z-transform for shifted signal

The $\mathcal{Z}$-transform of your signal is

$$X(z)=1+\frac12 z^{-1}\tag{1}$$

(as you figured out by yourself).

The ROC is obviously the whole $z$-plane except for $z=0$, because there's a pole at $z=0$. Note that the ROC of the $\mathcal{Z}$-transform of any finite length sequence must be the whole $z$-plane, possibly except for $z=0$ (for sequences with non-zero values for $n>0$), and $z=\infty$ (for sequences with non-zero values for $n<0$). So by merely looking at the sequence you could determine its ROC.

The reason why your second method of determining the ROC doesn't work is because when you add the two $\mathcal{Z}$-transforms you get a pole/zero cancellation:

$$X(z)=\frac{1}{1-\frac12 z^{-1}}-\frac{\frac14 z^{-2}}{1-\frac12 z^{-1}}=\frac{(1-\frac12 z^{-1})(1+\frac12 z^{-1})}{1-\frac12 z^{-1}}=1+\frac12 z^{-1}$$

So the restricted ROCs of both functions caused by the pole don't show up in the final result due to this pole/zero cancellation.

Note that you could express the unit impulse by $\delta[n]=a^nu[n]-a^nu[n-1]$ and obtain arbitrary ROCs of the separate $\mathcal{Z}$-transforms of the two terms on the right-hand side, depending on the choice of $a$. However, the ROC of the $\mathcal{Z}$-transform of $\delta[n]$ (which is $1$) is obviously the whole $z$-plane, including $z=0$ and $z=\infty$.

In general, if you have a $\mathcal{Z}$-transform $X(z)$ and you shift the corresponding sequence to the right by $k$ samples, $X(z)$ gets multiplied by $z^{-k}$. So all poles and zeros of $X(z)$ remain unchanged, and a pole at $z=0$ and a zero at $z=\infty$ are added, both with multiplicity $k$. Of course they can cancel with already existing poles or zeros. Analogously, if you shift the sequence to the left by $k$ samples, $X(z)$ gets multiplied by $z^k$, which adds a $k$-fold pole at $z=\infty$ and a $k$-fold zero at $z=0$. As an example, take the sequence $a^nu[n]$ with $|a|<0$. Its $\mathcal{Z}$-transform is

$$X(z)=\frac{z}{z-a}$$

with a pole at $z=a$ and a zero at $z=0$. If you shift the corresponding sequence to the right by one sample, the resulting $\mathcal{Z}$-transform is $z^{-1}X(z)$. The original zero at $z=0$ gets cancelled by the new pole at $z=0$, and you're left with the original pole at $z=a$ and a new zero at $z=\infty$. If you shift the sequence to the left by one sample you get $zX(z)$, which gives a double zero at $z=0$, the original pole at $z=a$, and an additional pole at $z=\infty$.


Can a causal filter without phase shifts exist?

Suppose that a linear filter has impulse response $h(t)$ and frequency response/transfer function $H(f) = \mathcal F [h(t)]$, where $H(f)$ has the property that $H(-f) = H^*(f)$ (conjugacy constraint).

Now, the response of this
filter to complex exponential input $x(t) = e^{j2\pi f t}$ is
$$y(t) = H(f)e^{j2\pi f t} = |H(f)|e^{j(2\pi f t + \angle H(f))}$$ and if
we want this filter to cause no phase shift, it must be that $\angle H(f) = 0$
for all $f$.

How about if, instead of no phase shift, we are willing to allow
a fixed constant phase shift for all frequencies? That is, $\angle H(f) = \theta$ for all $f$ is acceptable to us where $\theta$ need not be $0$? The extra
latitude does not help very much, because $\angle H(-f) = -\angle H(f)$, and
so $\angle H(f)$ cannot have fixed constant value for all $f$ unless that value
is $0$.

We conclude that if a filter does not change the phase at all, then
$H(f)$ is a real-valued function, and because of the conjugacy constraint, it is
also an even function of $f$.  But then its Fourier transform $h(t)$ is a
an even function of time, and thus the filter cannot be causal (except in trivial cases): if its impulse
response is nonzero for any particular $t > 0$, then it is also nonzero for $-t$ (where $-t < 0$).

Note that the filter need not be doing any
frequency suppression, that is, we did not need the assumption that
some frequencies are "removed" by the filter (as the OP's
professor's filter does) to prove the claim that zero phase shift
is not possible with a causal filter, frequency suppressor or not.


Creating 2D array to play audio in left and right channel in matlab

Since 20 Hz was a little hard to hear with my speakers, I've changed the main frequency to 600 Hz. I guess it should work:

clc;
clear all;

Fs = 44100;
N = 40000; % sample size
t = (1:N)*(1/Fs);
freq = 600;

sound_array = zeros(N, 2); % initializes a N x 2 matrix
sound_array(:,1) = sin(2*pi*freq*t);
sound_array(:,2) = sin(2*pi*2*freq*t);

% Sound 1
sound(sound_array(:,1),Fs);

% Sound 2
sound(sound_array(:,2),Fs);

% Play the first column at left channel and the second column at the right
% channel
sound(sound_array,Fs);

In fact, if you use the entire array as input in sound, the first column will go to the left channel and the second column to the right channel.


I will denote the given system as,

$$
G(s) = \frac{20(1+s)^2}{(1+\frac{s}{2})(1+\frac{s}{10})}
$$

The input or reference signal to the closed loop will be denoted by $R(s)$ and the output by $Y(s)$. The controller will initially be denoted by $H(s)$, while in this case it is equal to $K$. The  block diagram of the closed loop system can then be drawn as,

With its transfer function from input to output equal to,

$$
\frac{Y(s)}{R(s)} = \frac{G(s)}{1 + H(s) G(s)}.
$$

For root locus analysis you want to find the poles of this transfer function as function of $H(s)$. The poles can be found by solving when the denominator is equal to zero. However the denominator (and numerator) are polynomials of $s$, so can't be fractions themselves. In order to ensure this I will slit $G(s)$ up in to two parts, its numerator, $G_n(s)$, and denominator, $G_d(s)$. The same can be done for $H(s)$. The resulting transfer function can then be written as,

$$
\frac{Y(s)}{R(s)} = \frac{\frac{G_n(s)}{G_d(s)}}{1 + \frac{H_n(s)}{H_d(s)} \frac{G_n(s)}{G_d(s)}} = \frac{H_d(s) G_n(s)}{H_d(s) G_d(s) + H_n(s) G_n(s)}.
$$

As stated before, in this case $H(s)$ is equal to $K$, thus $H_d(s)$ is equal to one. By substituting in $K$ for $H_n(s)$ and the two polynomials, from this first equation, for $G_n(s)$ and $G_d(s)$, then the following expression can be obtained,

$$
\frac{Y(s)}{R(s)} = \frac{20(1+s)^2}{(1+\frac{s}{2})(1+\frac{s}{10}) + 20K(1+s)^2}.
$$

The resulting denominator is a second order polynomial, so solving for the poles yields two solutions, which can be simplified to,

$$
p=-\frac{400 K \pm 4 \sqrt{1 - 225 K} + 6}{400 K + 1}.
$$

For $K=-\frac{1}{400}$ the limits of both $p$ are $\pm\infty$ depending if you approach that value from the left or the right. Thus near $K=-\frac{1}{400}$ there will be values for the poles of the closed loop transfer function which will have a positive real values.