Short answer: For a direct implementation of PWM in discrete-time, yes, for 48 kHz, 16-bit audio, a clock of 3.2 GHz is required.

Direct Stream Digital (DSD) format uses 1-bit $\Delta$-$\Sigma$ modulation (DSM), which is somewhat different than pulse-width modulation (PWM), although both generate an on-off switched sequence as the output.

Regular PWM uses a comparator (the sign function), where the input is a modulating (the desired signal) and a high-frequency carrier signal. The harmonic and intermodulation distortion between the desired signal and the carrier signal are what is going to determine the unwanted signal output limiting the signal-to-noise-and-distortion (SINAD) ratio. With a triangle-wave carrier with frequency $\omega_c$, the output for a single sinusoid with frequency $\omega_v$ and amplitude $M$ between 0 and 1 is:
$$
PWM(\omega) = \frac{1}{2} M \cos{\omega_v t} \\
+ 2 \sum_{m=1}^{\infty} \frac{J_{0}\left(\frac{1}{2} m \pi M \right)}{\pi m} \sin\left(\frac{1}{2} \pi m \right) \cos\left(m \omega_c t \right) \\
+ 2 \sum_{m=1}^{\infty} \sum_{n=\pm 1}^{\pm \infty} \frac{J_{n}\left(\frac{1}{2} \pi m M \right)}{\pi m} \sin\left(\frac{1}{2} \pi (m+n) \right) \cos\left((m \omega_c + n \omega_{v} ) t\right)
$$
$J_n$ denotes the n-th order Bessel function.
The first line has your desired sinusoidal signal, the second and third line are harmonic and intermodulation distortion. This is entirely deterministic and similar spectra can be computed for any input signals that can be described by Fourier-series. Sample rate does not play a role in the ideal, continuous-time case. The distortion products can typically be moved to higher frequencies and filtered out by a low-pass filter by choosing a higher carrier frequency $\omega_c$, but there is no guarantee that intermodulation products will not appear in the baseband. The third line contains what is called foldback distortion, and as you can see, there will always be distortion in the baseband, and there is no way to guarantee that some input signal will not cause some combination of superpositions that cause severe foldback distortion. The best you can hope for is that the foldback distortion is small for most signals (which it usually is, and it is dominated by other noise sources).

Discretization (quantization and sampling) effects cause additional distortion, and several PWM methods try to take this into account. As you have discovered, you need very high time-resolution in order to represent large word-widths where there is discretization in time. This does not mean that the (average) switching frequency has to be high, only that the time-resolution is high. That is, you need to represent your output sequence as a non-uniformly sampled signal. Hence you don't need a high sampling rate, only a mechanism on the output that can cause non-uniform switching with that accuracy. This does makes it difficult to accurately simulate PWM. There are several PWM-like methods that seek to solve these distortion problems.

DSM (noise-shaping using 1-bit) also uses the comparator, but there is no carrier signal. Instead there is feedback from the error between the input and output of the comparator. By virtue of Bode's sensitivity integral, it is then possible to spectrally shape the error, dependent on the feedback filter used. As the comparator is a discontinuous non-linearity (no Lipshitz constant), there does currently not exist any theory with regards to the stability of DSM, and the successful design is entirely dependent on simulations. It works most of the time because in most cases you have an actuating signal to the comparator that causes some sort of averaging, causing the discontinuity to become effectively continuous. The DSM does go unstable and produce weird results in some pathological cases. So in general, it does not work, it just works most of the time. In DSM the distortion is also entirely deterministic, although it can be chaotic. It is impossible to de-correlate the distortion in DSM from the input.

I do not know of any methodology other than (Monte-Carlo) simulation for reliably determining an approximate SINAD in either case.

I've added a couple of figures comparing PWM and DSM with 1-bit truncation.

Time-series after reconstruction:

Power Spectral Densities (up to 2 kHz):

For DSM a 5th order feedback-filter was used, oversampling rate of 128, and sample rate of 1 MHz. With this it is possible to achieve an ENOB in excess of 17 bit with a 2-kHz baseband. For audio this would have to be 20 kHz, hence a sampling rate of 10 MHz. The PWM carrier was at 4 kHz. Most of the distortion (the noise-floor) stem from time discretization, not having introduced proper pre-distortion needed for discrete-time PWM, and will not represent ideal (natural) PWM very well. I will see if I can update this later. Using proper pre-distortion you should see a SINAD in excess of 100 dBc (ENOB > 16 bit). A 1-bit truncated signal can have an ENOB less than one since the ENOB is based on the uniform quantization error distribution assumption with is only approximately valid for 7-bit quantization or higher.

Why not just use a 1-bit DSM re-quantization (e.g. DSD) which is much more linear than a PCM-PWM conversion? The answer to this is switching losses. With high OSR and high and irregular switching activity, the DSM bit-stream in its basic form is not very suitable to drive high power Class-D amplifiers. Likewise, PWM due to its two-level representation and high jitter susceptibility (the need for good switching time resolution) is not very suitable for high resolution small signal DACs.

It might also be noted, that it is quite common for Class-D amplifiers to re-quantize to e.g. 8-bit using DSM before producing the PWM signal, instead of using complicated pre-distortion and non-uniform switching techniques, as a low word length reduces the required timing-accuracy significantly.

Some literature to check out:

Direct Digital Pulse Width Modulation for Class D Amplifiers

Signal processing for high resolution pulse width modulation based digital-to-analogue conversion

Digital-to-Analog Conversion in High Resolution Audio

Understanding Delta-Sigma Data Converters

Oversampling Delta-Sigma Data Converters

Lee's rule extended (on DSM stability and design)


What you derive in your answer is that the iDFT of the DFT of a signal is the signal itself. The missing step is that $$ \sum_{k=0}^{N-1}\exp(j2\pi uk/N)=\sum_{m\in\mathbb{Z}}N\delta[u-mN].$$ Then, you get the identity $f[n] = \sum_m f[m]\delta[n-m]$.

However, this does not help for your problem. You need to express the IDFT in terms of DFT operations. So, you need to get

$$
X[m] = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}x[k]\exp(j2\pi km/N)
$$

from a function, which can only calculate

$$
A[m] = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}a[k]\exp(-j2\pi km/N).
$$

If you conjugate both sides of the first equation, you get:

$$
X^*[m]=\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}x[k]^*\exp(-j2\pi km/N).
$$

This equation is of the structure of the second equation, when you substitute $A[m]=X^*[m]$ and $a[k]=x^*[k]$. Hence, if you perform the DFT the conjugated signal, you get the conjugated of the IDFT of signal:

$$DFT(X^*)=IDFT(X)^*.$$

So, conjugating both sides yields
$$DFT(X^*)^*=IDFT(X)$$
which is exactly what you need to do to solve your problem:

Perform elementwise conjugation of the signal
Perform DFT of the signal
Perform elementwise conjugation of the result

Then, you get back the IDFT of the signal. It's analoguous in the 2D-case (i.e. images). Also, note that you might need to consider a different normalization factor (which would correspond to elementwise division by a scalar), depending on your definition of the DFT. If it is with $\frac{1}{\sqrt{N}}$, then normalization is OK as it is.

Edit: As Royi has pointed out, if your original signal is real, you can omit the 2nd conjugation (since the signal is already real after the DFT, and conjugation won't do anything). As images are most often real-valued, this simplication is very likely to hold here.


It's a bandpass filter whose frequency response suppresses the low and high frequencies (with its zeros at $\omega = 0$ and $\omega = \pi$) and amplifies the band in between.

The bandwidth of the filter can be defined by reference to $-3_{dB}$ points, which would give you approximately $W_{-3dB} \approx 0.2\pi$, with a center frequency of $\omega_c = 0.5\pi$.

I would however not consider this bandwidth to be a descriptive one.


Convert one sound sample in different sample where each sample's pitch is a note (do-re-mi...)

One generic term for the class of libraries and algorithms that do this, make a set of music keyboard notes from random (psuedo-periodic) pitched sounds, is "time pitch modification".  This is sometimes accomplished by frequency domain phase vocoder analysis-resynthesis or by time domain synchronized overlap-add, followed by filtered resampling.  One example library might be Apple's OS X AVAudioUnitTimePitch effect unit.  Here's a wikipedia page on the topic: https://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification

First, you might have to use a pitch estimation algorithm to determine a perceived pitch for the original sound sample.  Here's a wikipedia page summarizing some of these methods: https://en.wikipedia.org/wiki/Pitch_detection_algorithm


Your u variable is just the magnitude of the FFT, not the actual complex numbers that represent the FFT. Try removing the abs() from u and then doing the IFFT.


Do Audio Interface manufacturers use A-weighted Measurements to make specs look better?

Most audio interface devices are built for the commercial electronics industry which produces devices to be used by people to listen to music, radio, TV etc; for multimedia reproduction purposes.

Therefore the commercial electronics standardisation organisations, suggest or enforce the use of a number of frequency weighting filters (A,B,C etc.) for getting more relevant results for the technical specs involved, considering that human beings will be the final consumer of the audio end result. It's not applied for getting an illusive improvement of the numbers (mostly SNR), but for providing an acceptable performance at the lowest cost.

If your purpose of audio (acoustical) interaction is some engineering or scientific measurement and computations, then look for the unfiltered (bare) specs if available. You may ask manufacturers to provide you those numbers, if possible. But most would restrain from disclosing that information due to confidential reasons...


Sample Rate Conversion between 32K and 44.1K

The standard way of doing this is a poly phase filter. Unfortunately it's not straight forward and the devil is in the details.

You need to determine cutoff frequency, number of phases, length of filter, and (to a lesser extent) shape of filter
These are typically derived from your specific requirements: what's your allowable bandpass ripple, stop band attenuation, residual aliasing, sine wave modulation, up to what frequency, etc.
How exact does your final sample rate need to be? If you can tolerate a quarter percent of frequency error you can approximate the ratio as 8/11. If it needs to be better than that, you may just as well go with an asynchronous converter
MIPS and memory footprint depend very much different factors. Number of channels to convert,  $C$, filter length , $N$, and number of phases $P$. Storage requirements are roughly $(P+C) \cdot N$. MIPS for synchronous are $C \cdot N$ multiply/adds plus some overhead for phase indexing.
Asynchronous will be more, maybe $(C+2) \cdot N$, depending on how exactly phase interpolation is done.
It works well with fixed point


Since this is a linear model if you add noise which isn't centered (Non zero mean noise) your estimation will be good up to a bias term.

The easy way to do so is to remove the bias from $ y $ and solve.

In case you know the mean of the added noise, just remove it from your measurement and your model becomes the classic Linear Least Squares.

If you don't know it, you have to estimate it. You can solve the problem either in 2 steps, namely estimate, remove, solve classic Linear Least Squares, or build a model which estimates the noise and solve the least squares at once.


How do you determine the properties of a differential equation?

If a system is represented by a differential equation then it must be LINEAR.
If the coefficients of differential equation are function of time then it is time variant otherwise time invariance.
For causality and stability we will need its transfer function for any comment.


In theory, a 4x oversampled quantizer with n-th order noise shaping feedback, is capable of providing you equivalent bit savings (wrt a direct quantization of the critically sampled signal) of 1 bits for n=0, 2.2 bits for n=1, 2.9 bits for n=2 and 3.5 bits for n=3 (this list goes further but in practice high order noise shaping feedback is difficult to implement due to potential instability)
Note that spectral shape of quantization noise (or analog noise present before sampling) is an important factor in achieving these gains. (Table excerpted from ch.4,section 4.9.2, Discrete-Time Signal Processing 2e, A.Oppenheim)

The mathematical exposition of this fact is a little long but you can find them in many DSP books which include an indepth discussion of sampling and ADC strategies...

In rough terms doubling the awgn noise power would yield 3dB SNR loss which is equivalent to a loss of less than 1 bit of linear uniform ADC. So you could expect SNR gains for feedback orders of n=1 or higher.

However the question is whether you can embed that sensor into the noise shaping quantization loop in a practically convenient way or not? If you can, then certainly go for 4X oversampled case. If your project is restricted in resources such that you cannot afford for such added DSP cost, then stay at the 1X rate.


How can I get the continuous-time transfer function coefficients (or poles and zeros) from the corresponding discrete-time TF and vice versa?

This is the formula that you need:
$$
H_d(z) = H_a \left( j\frac{2}{T} \tan(\omega_d T/2) \right),
$$
where $H_a(s)$ is the transfer function in the Laplace domain, and $\omega_d$ is the "warping frequency", i.e. the frequency where you want the transfer functions to line up exactly (usually chosen as the cutoff frequency or center frequency).


Remove audio signal component under certain frequency in python

Why should the be a mistake?
A linear system (like your filter) can never introduce frequency components that weren't there. So, the tone can't move anywhere. And because you don't show the mapping of colors to power, you can't notice any change in amplitude.
So, I bet your signal is properly attenuated, you just forgot to actually check whether it is.
Also, filfilt is almost certainly not the function you're looking for, read the documentation to that function before using it. You're even importing lfilter!
Furthermore, you label this as "BB (baseband?) signal" in your plot. Further guess: you really don't want a Butterworth filter, but a FIR with a linear phase.
(Using an FIR with a linear phase would most definitely make filtfilt obsolete, as you can just shift the signal by the constant group delay.)


Why would amplitude modulation result in change of frequency?

$$A[1+\mu\cos(2\pi 5000t)]\sin(2\pi 2000000t)= A\sin(2\pi 2000000t) + \dfrac{A\mu}{2}(\sin(2\pi[2000000-5000]t)+\sin(2\pi[2000000+5000]t))$$

If I didn't make an error with my trigonometric identities.

The three distinct frequencies are there: the carrier and the positive and negative frequency version of the tone around the carrier.

The above assumes an AM that is not suppressed carrier, since the problem statement didn't say "suppressed carrier".


How does an Image filter really sweep an Image?

I assume by image filter sweeping, you mean the image is convolved with a kernel.  In that case, the method is more similar to what you show in your second image.

Conceptually, the NxM kernel is multiplied by an NxM block of pixels in the image, and the results are summed to a single value-- this is the first value in your 2D result array.

Then the next NxM block of pixels is taken by offsetting the window one pixel to the right, the kernel is multiplied by this block, the results summed, and this is the second value (top row, 2nd from left) in your result array.

This continues until you reach the end of the row, then you offset down one pixel and start again at the beginning of the row.  This result is then the first result in the second row of your result array.

And so forth.

Of course, it doesn't have to be done in order, and many optimizations or parallel programming techniques may perform better if you don't step through sequentially overlapped like this, but conceptually this is what's happening-- take a block, convolve, get one pixel output, put it into the result for that offset.

There is also the question of how to handle edges-- if you want the convolution result to be the same size as the input image, you need to assume values for pixels outside the border of the actual image.  Zero is a common assumption.

Considering edges, and in reference to the question in the comments, where you start the kernel depends on what exactly you want out.  First, different kernels may have different "origins"-- typically the result of the kernel calculation is referenced to the center of the kernel, but that's not a requirement (and can't happen if the kernel is an even number of units across).

Then the tradeoff needs to be resolved between the size of the output and the validity of the data.  If you want an output image of the same size as the input image, then starting (3,3) of the kernel at (1,1) in the image, assuming 1 based indexing, will give you that result.  The challenge is what value to use for parts of the kernel that don't overlap the image.  For example, if you are using a kernel to average a neighborhood of pixels, and you assume 0 for values outside the image, then the edge-most pixels of your result image will darken because you are averaging in those zeros with the existing data.  That may be reasonably harmless.

Other kernels, however, may give bad data at the border if you assume values outside the image.  Assuming zero outside the image when you're taking a picture of sky could cause "phantom" edges to appear with an edge detection kernel, for example, and this could cause problems later in your processing pipeline.  In this case you might prefer to start with (3,3) of your kernel at (3,3) of the image, and then your result image will be 4 pixels narrower and 4 pixels shorter.


Deep learning model for phone recognition - issues with dimension the model

Since next layer is fully connected it does not really matter what shape your pooling output would be. You have 14x100, you can rearrange them as 1x1400 as input for next layer, 1000 elements as output. The paper says that they select the size of the fully-connected layer of 1000 to be close to the output size of the pooling layer.


How to interpret a spectrum with FFT mirroring?

Your field data is real (as in "not complex") and hence your spectrum is conjugate symmetric.
fftshift() rotates the spectrum so that 0 Hz is in the middle of the vector. Your x-axis on the plot should be fs*[-nFFT/2:nFFT/2-1]/nFFT; where $nFFT$ is the FFT length and $fs$ is the sampling rate.
Remember that time discrete signals are periodic in frequency the second half of the spectrum represents the negative frequencies.


State Estimation by steady state Kalman Filter

I've just tried a toy example of doing what you're suggesting and it works fine. The plot below shows how the standard Kalman filter (red line) and the steady-state Kalman filter (green circles) outputs are the same, except for some minor differences at the beginning.

The bottom plot shows the evolution of the Kalman gain coefficients for the standard Kalman filter.

Without seeing more detail of what you're doing, I don't think I can help much.  Note that I'm using SISO example, which may not be what you're after... but I haven't ever seen reasons for MIMO models to work differently than expected.

R Code Below

#27879 and 29963

T <- 100

#H = [3 -3 1]
H <- matrix(c(1,0,0),c(1,3))

#F is just a tapped delay line
alpha <- matrix(c(0.9,0,0,0,0.9,0,0,0,0.9),3,3)
A <- matrix(c(3,1,0,-3,0,1,1,0,0),3,3)
B <- matrix(c(1,0,0),c(3,1))

sigma_v <- 1
v <- rnorm(T,0,sigma_v)
sigma_w <- 0.01
w <- rnorm(T,0,sigma_w)

x <- matrix(c(0,0,0),c(3,1))
z <- rep(0,T)

for (t in 1:T)
{
  z[t] <- H %*% x + w[t]
  x <- A %*% x +v[t]
}
par(mfrow=c(2,1))
plot(z,type="l", col="blue", lwd=5)
title('Measurements and both Filtered Measurements')

Q <- matrix(c(0,0,0,0,0,0,0,0,sigma_v^2),3,3)
R <- sigma_w^2

library("MASS") # For pseudo inverse ginv()

xkm1km1 <- matrix(rep(0,3*T+3),3,T+1)
xkkm1 <- matrix(rep(0,3*T),3,T)
K <- matrix(rep(0,3*T),3,T)
Pkm1km1 <- matrix(c(1000,0,0 ,0,1000,0, 0,0,1000),3,3)
zhat <- matrix(rep(0,T),c(T,1))

for (k in 1:T)
{
  xkkm1[,k] <- A %*% xkm1km1[,k]
  Pkkm1 <- A %*% Pkm1km1 %*% t(A) + Q
  K[,k] <- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)
  xkm1km1[,k+1] <- xkkm1[,k] + K[,k] %*% (z[k] - H %*% xkkm1[,k])
  Pkm1km1 <- (matrix(c(1,0,0,0,1,0,0,0,1),3,3) - K[,k] %*% H) %*% Pkkm1
  zhat[k] <- as.numeric(H %*% xkkm1[,k])
}
lines(zhat, col="red")

xkm1km1 <- matrix(rep(0,3*T+3),3,T+1)
xkkm1 <- matrix(rep(0,3*T),3,T)
zhat <- matrix(rep(0,T),c(T,1))

for (k in 1:T)
{
  xkkm1[,k] <- A %*% xkm1km1[,k]
  K[,T] <- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)
  xkm1km1[,k+1] <- xkkm1[,k] + K[,T] %*% (z[k] - H %*% xkkm1[,k])
  zhat[k] <- as.numeric(H %*% xkkm1[,k])
}
points(zhat, col="green")

plot(1:100, K[1,], type="l", ylim=c(-1,1))
title('Kalman Gain coefficients')
lines(1:100, K[2,], col="red")
lines(1:100, K[3,], col="green")


Entropy would be a good metric in order to separate trees. However I would suggest you to calculate the entropy of gray values within a rectangular window. Consider this image:

After entropy filter, I could obtain this one:

Note that the trees (and also other informative areas) look white and it's possible to segment them out with a simple threshold. Try and see whether it also works for your case.

Due to the possible pre-computations, this could be optimized to run in real-time.


Can I create my IF signal on SDR before bringing data to PC?

The theoretical data rate to transmit a signal with bandwidth $W$ Hz and resolution $R$ b/sample is simply $2WR$ b/s. In practice, you will need somewhere between that and $4WR$.
One way to reduce the required rate is to preprocess the signal in the SDR's FPGA. This will require delving into Verilog, integrating your hardware with what is already there, and very likely simulating and debugging it. What can be done also depends on how much space is left on the particular FPGA in your device.


Here are some approaches to consider:

FMCW:

Transmit a "chirp" signal where the frequency transmitted is slowly ramped from a low frequency to a high frequency (repeatably as a sawtooth or ramp pattern).

Multiply the received chirp with a replica of the transmitted chirp. The frequency of the resulting signal (after low pass filtering) will be proportional to the delay. An FFT is often used at this point to measure the frequency, but other frequency estimation techniques can also be used.

Review more information on "FMCW" radar for more details on this approach. Such as at this link: https://en.wikipedia.org/wiki/Continuous-wave_radar

Ranging with PRN sequences

Transmit a pseudo-random noise sequence that can be generated with linear feedback shift registers as a modulated signal in your audio band (FSK or BPSK are good choices).

Cross correlate the received sequence with the transmitted sequence efficiently with FFT's using xcorr = ifft(fft(rx)*fft(tx)), here assuming both tx and rx are real.

Note if resources are severely constrained but you have time on your side, you can perform the cross correlation over time: To demonstrate this I will give an example:

Given you want to measure 1 cm to 1 m, means you want to measure delays from 300 us to 3ms, this means we would want to use an LFSR that does not repeat from 3ms. Further for an accuracy of 1cm, a chip rate of 4KHz should be adequate. This means an 11 chip barker code such as the one I list below would work but you could also explore longer LFSR sequences.

11 bit barker code: 1 1 -1 1 -1 -1 -1 1 1 1

Note, the unique property of this code like other LFSR maximum length sequences, the cross correlation is maximum when the code is aligned (in this case = 11) and -1 every where else.

Using the above barker code with a 8Khz carrier, When the code is 1 transmit the 8KHz carrier in-phase and when it is -1 transmit it 180 degrees out of phase, thus you are mulitplying your carrier by plus or minus 1. (Note that an XOR gate is such a multiplier if you want to make this "ultra-low" resources). Because of the relationship I used between carrier and code, there will only be two cycles of the carrier for every code chip transmitted.  The sequence is transmitted continuously.

At the receiver multiply in quadrature the received sequence with the same 8KHz carrier you already generated- meaning two multipliers where one of the received sequence is multiplied by the carrier directly and the other is multiplied by the carrier shifted 90 degrees at 8KHz, a quarter cycle.  (again you could do this most simply with square waves and XOR gates by hard limiting the received signal and applying a DC offset to be midrange in the XOR gate, which would really be an "analog" solution as we would be using the XOR gate as an analog multiplier similar to a mixer- given you are using a sound card which will essentially be your A/D converter a digital multiplier will be more likely). The reason for the two multipliers is due to various phase delays, one path will be at a minimum when the other is maximum but with the two you will always have a signal to detect.

The multiplier output is followed with a simple moving average low pass filter, averaging over 1/16KHz = 62.5 us would be a good choice as it will have a null at 16KHz where we expect content of twice the carrier after the multiplication.

After the low pass filter, pass the signal through an FIR filter with the coefficients of the filter equal to your barker code sequence in reverse order. I recommend decimating the received sequence down to twice the chip rate (8 KHz) and then therefore using 2 samples/chip as the coefficients:

1 1 1 1 -1 -1 1 1  -1 -1 -1 -1 -1 -1 1 1 1 1 1 1

The output of the filter will be similar to my plot below that is specific to GPS (1023 length sequence), but to show that you will get spikes that repeat at the symbol rate:

If you compare the spike locations with a reference pulse created by your start of your sequence, you have a measure of delay. To do this, start a counter at the start of your sequence, and have a threshold detector on the filter output which stops the counter. Note as I described earlier that two multipliers and thus two filters are used and one output is "I" and the other filter output is "Q". A single estimate of magnitude can be determined using the following simple magnitude estimator:

$$|I+jQ| \approx Max(I,Q)+ 1/2 Min(I,Q)$$


How can I modify a sound signal based on it's MFCC

The authors in the page you are linking are using the analog of an equaliser but the more accurate representation of what they do is a vocoder.

The typical application of a vocoder in music is to modulate one signal with the spectrum envelope of another. This sounds like this or this or this and so many other uses today, I hope these three examples are descriptive enough.

In this particular application, the Neural Network (NN) is "learning" what is signal and what is noise, something that looks very much like adaptive filtering.

Therefore, the signal path looks like this:

Input -+-----------------> Vocoder --> Output
       |                      ^
       |                      |
       +-- MFCC --> NN -------+

Hope this helps.

EDIT:

In terms of actually doing this you would first have to set up the basic pipeline that splits the Input into frames of N samples, calculates the Discrete Fourier Transform of each frame, derives the spectrum, modulates the spectrum with the coefficients of the NN and then does the inverse DFT to go back to samples in the time domain.

This basic pipeline is usually handled with one of overlap-add or overlap-save methods and Python's Scikit module includes everything you need to implement that.A good start would be the `fftpack' module. In addition to this, you can search for Python implementations of these two methods and see if there is something there already that you could draw inspiration from. (e.g. this one).

A detail here would be that if you want to use MFCC coefficients, you would have to split your DFT coefficients in the same bands (as the MFCC coefficients are derived from).

This would cover the Vocoder part which accepts the spectrum of the signal at its input and the MFCC "weights" and applies the weights to the spectrum.

The training / operation of the Neural Network can be handled with a number of other modules like those that you mention (or maybe even Shogun which is an older but very useful toolkit even for large problems).

EDIT 2:

The act of filtering each of the signal frames that result from an overlap-add or overlap-save method is a typical Digital Signal Processing operation.

To do that, all you have to do is multiply the DFT spectrum of your signal with the frequency response of the filter. The operation is concluded when you apply the inverse transform and you go from the frequency domain to the time domain to playback your signal.

What you get from the NN is basically the filter. So, the short answer is that you need to multiply your NN coefficients with the spectrum of a given sound frame.

The difference here is that instead of using all the possible coefficients of the DFT spectrum, you divide the spectrum in 22 bands. In addition to that, these bands are not at equal spacing to each other.

For example, in a typical filtering application, you could decompose your spectrum in 20 DFT coefficients and those would look like equally spaced band pass filters. But the Mel Scale or the Bark Scale are not dividing the frequency range at equal spaces.

So, prior to applying the "weights" that you get from the NN to the signal, you need to construct and apply those bandpass filters that divide the spectrum according to the Mel or Bark scales.


Level Correction For Digital Down-Convertion?

I think you miscalculated the power generated by your signal source; note that you need to take the load impedance into account:

$$
\begin{align}
P = \frac{V_P^2}{2R} &= \frac{(100\ \text{mV})^2}{100\ \Omega} \\
&= \frac{0.01\ \text{V}^2}{100\ \Omega} \\
&= 0.1\ \text{mW} \\
\\
\end{align}
$$

$$
\begin{align}
P_{\text{dBm}} &= 10 \log_{10}\left(\frac{P}{1\ \text{mW}}\right) \\
&= 10 \log_{10}\left(\frac{0.1\ \text{mW}}{1\ \text{mW}}\right) \\
&= -10.0\text{ dBm}
\end{align}
$$

Likewise, if your DDC output signal has a peak amplitude of $50\text{ mV}$, then you can repeat the above calculations to yield a power level of $-13\text{ dBm}$.


Bode plot of discrete-time transfer function $H(z)$

You can use the freqz command, available in Matlab/Octave and SciPy. In SciPy it is available as scipy.signal.freqz.

For your case it would be scipy.signal.freqz([b0, b1, b2], [a1, a2])

Here is the reference for more info:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.freqz.html


In computer stereo vision, what does it mean to "look in"?

"Looking-in" simply means that the cameras will need to be angled such that their principal axes cross over at some point in front of the camera (rather than being parallel as is often assumed for stereo work)

The reason for doing this when the cameras are far apart is also simple:

Stereo requires you to match features from one image to the other. Hence the cameras must both have a view of the objects you are interested in.  Parallel cameras only overlap when the object is sufficiently far away - by pointing them inwards, you can solve this. (Of course, if your object looks significantly different from the two viewpoints, you still won't be able to do a good stereo match.)


For a given «visual accuracy», you need to sample the sine at a sufficient number of time-steps per period.
At some point the display pixel density will be to low to render a sine accurately.
For waveform editors (that usually have access to only a finite rate sampled waveform, not a continously defined trigonometric function),  I assume that some practical approximation to the sinc(x) function is used to interpolate those samples to the desired density. There is still a question of what to do when the display is the limiting factor, rather than the input.


How to calculate the Fourier transform of absolute-valued sinusoid?

For $0 < a \le 1$, the Fourier Transform is straightforward:

$$\begin{align*}\mathscr{F}\left\{|1+a\sin(2\pi s_0t)|\right\} &= \mathscr{F}\left\{1+a\sin(2\pi s_0t)\right\} \\
&= \int_{-\infty}^{\infty}\left[1+a\sin(2\pi s_0t)\right]e^{-2\pi i st} \mathrm{d}t\\
& = \delta(s) +\dfrac{a}{2i}\left[\delta(s-s_0)-\delta(s+s_0)\right] \\
\end{align*}$$

For $ a > 1$, we have to rewrite the function to get rid of the absolute value bars:

$$|1+a\sin(2\pi s_0t)| = |s_0|\mathrm{III}(s_0t) *\left(\left[1+a\sin(2\pi s_0t)\right]\cdot\left[\mathrm{\Pi}\left(\dfrac{\pi s_0}{\frac{\pi}{2}-\mathrm{Arcsin}\left[-\frac1{a}\right]}t-\dfrac{\frac{\pi}{2}}{2\pi s_0}\right)-\mathrm{\Pi}\left(\dfrac{\pi s_0}{\frac{\pi}{2}+\mathrm{Arcsin}\left[-\frac1{a}\right]}t+\dfrac{\frac{\pi}{2}}{2\pi s_0}\right)\right]\right)$$

Where $*$ denotes convolution, $\mathrm{Arcsin}()$ denotes the principal arcsine,

$$\mathrm{III}(at) = \dfrac1{|a|}\sum_{n=-\infty}^{\infty}\delta\left(t-\dfrac{n}{a}\right)$$
and
$$\begin{equation}\mathrm{\Pi}(at) = \begin{cases}
1 & |at| <\frac1{2}\\
0 & |at| >\frac1{2}\end{cases}\end{equation}$$

Note that the $\mathrm{\Pi}()$ functions are two rectangles snipping out the two different segments of one cycle, and the convolution with the $\mathrm{III}()$ function creates all the periodic replicas of those two segments of that one cycle.

Now using tables of Fourier Transforms, and various, basic Fourier Transform theorems we get, for $a >1$,

$$\mathscr{F}\left\{|1+a\sin(2\pi s_0t)|\right\} =\mathrm{III}\left(\dfrac{s}{s_0}\right)\cdot\left(\left[\delta(s)+\dfrac{a}{2i}\left(\delta(s-s_0)-\delta(s+s_0)\right)\right]*\left[\dfrac{\frac{\pi}{2}-\mathrm{Arcsin}\left(-\frac1{a}\right)}{\pi|s_0|}e^{2\pi i\left(\dfrac{-\frac{\pi}{2}}{2\pi s_0}\right)\left(\dfrac{\frac{\pi}{2}-\mathrm{Arcsin}\left(-\frac1{a}\right)}{\pi s_0}\right)s}\mathrm{sinc}\left(\dfrac{\frac{\pi}{2}-\mathrm{Arcsin}\left(-\frac1{a}\right)}{\pi s_0}s\right)-\dfrac{\frac{\pi}{2}+\mathrm{Arcsin}\left(-\frac1{a}\right)}{\pi|s_0|}e^{2\pi i\left(\dfrac{\frac{\pi}{2}}{2\pi s_0}\right)\left(\dfrac{\frac{\pi}{2}+\mathrm{Arcsin}\left(-\frac1{a}\right)}{\pi s_0}\right)s}\mathrm{sinc}\left(\dfrac{\frac{\pi}{2}+\mathrm{Arcsin}\left(-\frac1{a}\right)}{\pi s_0}s\right)\right]\right)$$

So you have the difference of two modulated $\mathrm{sinc}()$ functions, with 1 real replica at DC and 2 imaginary replicas at $\pm s_0$ (due to convolution with the $\delta()$ functions), sampled at integer multiples of $s_0$ (by the $\mathrm{III}()$ function).


Let's take a slightly more general input signal
$$x(t)=\sin(\omega_0t)u\left(t-\frac{\theta}{\omega_0}\right),\qquad\theta\in [-\pi,\pi)\tag{1}$$
It's straightforward to show that the response of an ideal integrator to the input $(1)$ is given by
$$y(t,\theta)=\frac{\cos(\theta)-\cos(\omega_0t)}{\omega_0}\tag{2}$$
The response $y(t,\theta)$ always consists of a time-dependent component $-\cos(\omega_0t)/\omega_0$ and a DC-term $\cos(\theta)/\omega_0$, which varies between $-1/\omega_0$ and $1/\omega_0$, depending on the time when the sinusoid is switched on. Consequently, no matter how large $t$ becomes, the component that all responses to switched sinusoids have in common is always the time dependent part, but not the DC-term.
The ideal response to a sinusoid extending from $-\infty$ to $\infty$ only consists of that time-dependent component that is common to all responses to switched sinusoids. You can imagine this response as an average of $(2)$ obtained by integrating over $\theta$:
$$\tilde{y}(t)=\frac{1}{2\pi}\int_{-\pi}^{\pi}y(t,\theta)d\theta\tag{3}$$
For the some discussion on the computation of the response of an ideal integrator to a sinusoidal input, take a look at this question and its answers.


A State space model for discrete Sine wave Using kalma filter

You could use a nonlinear Kalman filter, such as the extended Kalman filter (EKF), and track the phase and frequency as your state variables.

In this case, your Kalman filter is essentially acting like a phase-locked loop (PLL).

Example reference


what is the periodicity of $e^{j\omega n}$ when $\omega=0$?

Mathematically speaking, the constant function is periodic with any period $P>0$, because is satisfies $f(x)=f(x+P)$ for all $x$.

The existence of a fundamental period depends on whether $x$ is discrete or continuous. In the first case the smallest positive period is $P=1$. In the second case there is no smallest period and therefore the function does not have a fundamental period.

In any case, claiming it is "undefined" is not accurate. This is all very well defined.


The cftool is going to use a curve fitting procedure.  Some time of non-linear regression.  In a general sense, it is a trial and error method:
1) guess a value for the coefficients 2) calculate the function with the coefficient, and determine the error between the calculated function and the original data, 3) try a new value for the coefficients, that is slightly different than the original guess. 4) go back to step 2, and keep going until the error is sufficiently small.

cftool is a very general tool that can be used for all kinds of problems, not just fourier series. cftool has no idea that you are trying fit a fourier series. In a general sense, it really is no different than if you just tried a whole bunch of combinations until you found one that worked, it's just that because it is a computer it can try many thousands of combinations in a second.

The formulas you showed, on the other hand, are the actual expression for calculating a fourier series.  Depending on your data, cftool will probably never match these exactly, although it might get close.  The reason it doesn't match is that there may be many different combinations that match the data fairly well, and cftool cannot tell the difference between them.  One way to help cftool get closer would be to give it more data to work with (i.e. a longer sample).

Depending on what your goal is, you might just want to use the closed form expression for a fourier series.  that will be the most accurate, and probably quicker to compute anyway.


Masking the mains hum to improve anonymity

I believe it's possible to get location information from 50/60 Hz hum, particularly if the recording is long-duration.  See this paper by Catalin Grigoras from 2009.

One way to defeat this would be to add enough sampling rate jitter to your recording so as to swamp the small variations in mains hum.  That paper showed information from variations of around 1 part in 1000, with sampling every 10 sec or so.  If you let the sampling rate of your signal drift around randomly on that kind of scale (which would have no perceptible effect), it would obscure the variations in the hum.

So, for instance, if you let your sampling rate drift by +/- 0.1% (e.g., 44,050 to 44,150), with a maximum rate of change of, say, 1 Hz in 10 sec, that would impose a random component on top of the underlying power-grid-derived variations, making them hard to separate.  This modification would be completely inaudible.


Standard deviation of Morlet wavelet's Fourier transform

I might have the ingredients to an answer here and here and here.


Finding the minimum phase h[n] and its Z transform

Since this looks like a homework problem I'll help you to solve it on your own, rather than just present you the solution.

The problem here is that you have a mistake in the first part of the solution. The evaluation of the first sum (from $n=-\infty$ to $n=-1$) is wrong. Redo the calculation and you should end up with

$$R(z)=\frac{1}{(1-az^{-1})(1-az)}\tag{1}$$

with some appropriate value for $a$. From $(1)$ it's immediately clear how you can factor $R(z)$ as

$$R(z)=H(z)H(z^{-1})\tag{2}$$

and how you have to choose $H(z)$ to get a minimum-phase systems.


Using real data is a way to validate the assumption that your algorithm will behave with real data in a similar way to the behavior with generated data.
In a general sense.
When we want to test an algorithm we can create tests, that are other algorithms that provide inputs and evaluate outputs of the algorithm we are design (your denoising algorithm).
Sometimes acquiring real data is difficult, but we can, making some assumptions generate data with similar distribution from data generator (the procedure by which you apply noise using your Rician noise generators), this makes easier to test your algorithm in much more data, and get more confidence about the algorithm.
When you write your data generator you are making one assumption about the types of distortion the images may have. Testing with real data you may find effects that are not documented, not studied, not expected. This is why in the real world the performance of algorithm may be degraded with measured data compared to generated data. Testing with real data will give you one idea of what is the impact of the neglected effects.
Different neglected effects may occur. The response may be non-linear and the  noise do not follow Rice distribution. The parameters of the noise distribution may depend on the position differently from what you assumed (you may have assumed that the distribution of the noise is independent of the position). Your scanner(s) may have different responses due to different temperature. Different scanners (same of different models/manufacturer) may produce data with different characteristics.
When you add noise to your images you are testing how the algorithm performs with the same real images and different Rician additional noise. There is nothing wrong in doing so, but you must know that worse quality images may have more of the distortions you are not considering.


Multirate Signal processing for matching DAC of the SDR

25.6 MHz is larger than the largest possible sampling rate of these two USRP models (25MHz). Therefore, this is impossible to implement directly; in any way, you'll need to generate your 25.6 MS/s signal first, and then resample to 25  MS/s. That resampler will be very CPU-consuming, probably more than your whole OFDM signal processing.

The underruns happen because your computer is, including that resampler, simply not fast enough to compute the samples at that rate. You'll need a faster computer, a more efficient resampler, or a different OFDM configuration.

Now, I don't know which resampler you're using, but if it's one of these included in GNU Radio, there's only two options:

the PFB arbitrary resampler with a ratio of 0.9765625
the rational resampler with an interpolation of 125, and a decimation of 128.

Both resamplers are really CPU-hungry, but for your case, I'd actually expect the arbitrary resampler to work slightly more efficient than the rational resampler in their default configurations, where the filters are choosen automatically based on the rate ratio alone.

However, you have a signal with unused carriers at the Nyquist band edges - you don't need as steep a core filter in your classical multirate resampler as dictated by the resampling ratio. So, make a drawing of the aliases that a decimation filter would have to suppress, and design a filter that works there. It will be significantly shorter than what would be designed automatically!


One of many possible algorithms to provide such edge sensitive information to its users are classified under change-detectors. The one that best fits to your kind of data uses thresholds, accumulators, memory, leakage and smoothing factors as well as variance and mean normalizers to decide on which changes belong to meaningful edges and which are just local variations.


Invertibility of an ideal differentiator

It is not. It suffices to find a counter example. Let me tell you that "I am flat". Could you derive my actual value?

So, any constant function $f(t) =c$ is differentiable, and have the same derivative, $f'(t)=0$. Only from knowing that  $f'(t)=0$, you cannot recover the original (constant) function. Hence the system is not invertible.


How to construct Polyphase (Frank) codes in MATLAB

% created by MUSTAFA SAMI AHMED
% Email mustafa_sami87@yahoo.com
clc;
clear all;
M =100;
L=sqrt(M);
bv = 0:L-1;
Matrix = bv'*bv ;
anglout = radtodeg(pi);
% alfa= (4*pi)/(L);

% Matrix_new = alfa*Matrix;
incPhi = (2*pi)/L; %incremental phase change
Matrix = mod(Matrix*incPhi,2*pi);

b=reshape(Matrix,1,[]); % matrix 1D size 1xM
for p = 1:M
  d(p) = exp(1j*b(p)) ;
end

AutoCorrelation = xcorr(d);

AutoCorrelationdB =10*log10(abs(AutoCorrelation)/max(abs(AutoCorrelation)));
 figure(1);
 stem(b);
%   x=wden(AutoCorrelationdB,'heursure','h','mln',10,'sym10');
  %x=wiener2(AutoCorrelationdB, [3 80 ]);
  figure(2);
plot((AutoCorrelationdB));


How to calculate the similarity of two electric waves

You could measure the Cross-Correlation between the two signals.

Here's an almost identical thread, with a filling answer:

How do I implement cross-correlation to prove two audio files are similar?

Some general info on cross-correlation from wiki:
https://en.wikipedia.org/wiki/Cross-correlation

Hope that helps.


What is the index modulation in OFDM and Subcarrier Index modulation?

Yes OFDM-IM is somehow new and it's very hot topic of searching. That article you have shares is the basic of OFDM-IM. So if you are at the beginning to understand it, that's the right paper to to read and understand.

OK let me explain that paper for you in easier way,

consider we have block with length 32 bits you want to transmit it, in the traditional OFDM, using 4-$QAM$ modulation, we supposed to have $32/2 = 16$ FFT size (which represents the number of sub-carriers). According to that figure 01 in the article you've shared, all sub-carriers will be active to convey data to receiver following the common steps of OFDM.

Now, let's look at OFDM-IM, using the block whose length is $32-bits$ and 4-$QAM$. In OFDM-IM, we start by dividing our bits into two parts. each with length of $16-bits$ The first part will be handled similar to traditional OFDM, but the second part will be handled using OOK and using also that module added in Figure 01 called (sub-carrier index modulation).  How??

That second part, we start count how many zeros and ones we have in that block (it's called subblobk). suppose we have 10 ones and 6 zeros similar to that example in your article,That's ok, but the issue is how can we know the location of zeros and locations of ones? That's what the subcarrier index means!!!  It means that the index of sub-carrier will indicate that location.

For example, in that example, you've 16 FFT size representing the number of sub-carriers, so we use each index to point that location of zeros. In other words, we use the subblock in 4-$QAM$ to show the location of zeros in subblock OOK. It means, we look at first bit in OOK, if it's 0 we let the sub-carriers to be empty, if it's 1 we upload the bits of $QAM$ into sub-carrier and so on. So, it's called OOK fashion.

That's what the idea of paper you've shared, I will let the other parts of paper to you to analyze and understand. then you notice easily the gain of using OFDM-IM

Hope that will help


What's the Underlying Algorithm for Detail Preserving Upsampling in Photoshop CC?

It's really nothing beyond Bi Cubic Interpolation with "Sharpening".

http://www.lynda.com/Photoshop-tutorials/interpolation-settings/124096/140573-4.html

They haven't updated their interpolation algorithms for ages.


How to remove frequency offset with RRC as pulse shaping filter

The RRC output only takes the exact constellation point values at exactly the right timing instant. That's what I meant with "coherent detector feeding a synchronously sampled matched filter" in an answer to a previous question of yours.
You'll have to deal with the inter-symbol interference with previous symbols. Which is no big deal – all symbols should have the same probability, so the average phase error you'd get is zero.
But, not so much for the fourth power: that's always a positive error, so yes, you get a biased phase correction term, and that means a misestimate of your frequency. Although I only mentioned noise, uncorrelated ISI looks a lot like nose, and thus it should have been among the reasons when I said

I'd advise against this whole approach!

in the answer to a question that Linda posted a couple of months ago (and seeing that this deleted question of four hours ago is practically a precursor to this question, I'll assume you and Linda basically share a team, or actually are two accounts for the same person. If the second account was made by mistake: Moderators can merge these for you, no problem! Just ask over in Meta.DSP).
You can now either:

Do the timing recovery before the frequency correction, and live with the significantly reduced performance that brings due to ISI or
Drop the fourth-power approach and go for a second-order PLL.


What you're doing wrong is considering only the main lobe. Don't do that!

The sinc as spectral shape is elegant, because it has its zeros in all the other carriers' exact frequencies. So don't truncate; also, truncating a sinc after the main lobe ignores a lot of its energy.


Probability distribution of windowed cross-correlation

Expanding on my comment, $\{\phi(\tau)\}$ is a non-stationary nonGaussian random process, and I doubt that there is any simple answer (or even a rather complicated one) for the probability density function of the random variable
$\phi(\tau)$ for an arbitrary value of $\tau$.  But, the (time-varying) mean
function of the process is easy to calculate.  We have

$$\begin{align*}
E[\phi(\tau)] &= E\left[\int_{-T/2}^{T/2} g(t)g(t-D+\tau)\, \mathrm dt\right]\\
&= \int_{-T/2}^{T/2} E[g(t)g(t-D+\tau)]\, \mathrm dt\\
&= \int_{-T/2}^{T/2} R_g(\tau-D)\, \mathrm dt\\
&= T\cdot R_g(\tau-D)
\end{align*}$$

where $R_g(\cdot)$ is the autocorrelation function of the input process
$\{g(t)\}$.  Note that it is not necessary that the input process
be Gaussian for this to hold; wide-sense-stationarity is enough.
Since autocorrelation functions have a peak at the origin,
we see that $\phi(D)$ has
the largest mean value.  Also, the mean value decays away symmetrically
about $D$:  that is, $E[\phi(D+\epsilon)] = E[\phi(D-\epsilon)]$
and
$$|E[\phi(\tau)]| \leq E[\phi(D)] = T\cdot R_g(0).$$

Finding the variance of $\phi(\tau)$ is a much messier calculation
that may or may not be included in the paper cited by
Charna (which is behind a paywall).


HSV is one of the color space transforms that separate color from intensity. Depending on your application (my understanding is contrast enhancement is somehow related to image segmentation in your OP), there are several advantages of HSV:

Histogram equalization of a color image is suggested only on the intensity component;
The Saturation component is regarded as invariant in shadow (only intensity changes), so processing the image in HSV space is better suit for shadow removing. This post that tried to remove the shadow from an image is for your reference;
The Hue component makes the algorithm better immune and thus more robust to lighting variations. This feature makes it better fit in some medical applications such as the palm skin segmentation (under normal RGB space it is not easy to thresholding out the hand palm).
In color enhancement that you mentioned, if the colors in your image are not so strong, it would be quite difficult to detect colored objects. Adding some arbitrary value in the Image would not Help, since it would increase the brightness but not the contrast. After the conversion to HSV space you may increase the Saturation then convert it back to the RGB color space. The colors of interest may appear much better in the image which would facilitate the object recognition nicely. You can have a try by this means to adjust your image contrast.

You may also want to check this post for more discussions.


How do I perform Spectral Analysis (FFT, Windowing, Detrending) on Sonic Anemometer Data?

take fft of data

let's say data is x = [ 3 4 5 6 6 9  7 ]

take fft

y = fft(x);
shift so -fs/2  to fs/2
y = fftshift(x);
plot mag
plot(abs(y))

see link for help
fft Help


Are there any open source libraries for Adaptive noise cancellation?

If you are working on chat application (presumably web), then I suggest to take a look at WebRTC. It offers a noise suppressor that works ok for speech.

Another option would be to use part of the Speex, which also has a noise suppression module.


Implementing overlap add method for convolution with a slice of the filter

What you are describe is typically called "Partitioned Convolution".  The benefit is reduced latency at some cost to efficiency (unless the larger size FFT is considerably less efficient e.g. due to cache size).  This reduction in efficiency may be outweighed by the increased ability to use multiple cores for the parallel tasks.


Finding the phase and frequency of a tone with Doppler. What is wrong in the code?

Your FFT method of finding the phase of a single tone is only valid if your 's' signal contains an exact integer number of cycles. I.E., no spectral leakage. And that is NOT the case for your 's' signal.


Basic question regarding third octave filters

Someone released my natural inheritences and regulatory systems calculated as it formed my employment, rewards  and inheritences payable to me obly all as one from more than just my g.c., Tricon, Albertsons, Tetra,  and more...as someone or a group if someones have changed my statuses to a protective state and have done so as if court ordered. I gave nevet in my life been so isolated during major life upsets such as missing children and death with zero compliance of the government and of others involved. My personally named for claim and my personal poatal mail and hijacked emails go uncorresponded and still remail displaced like my paymemt and documentations I have  applied for in the last entire seven years and my lifes worth is wromgly dispensed. From my insurance policies to my ach as named, global this state is acting as if I am dead. Even as the shut down goes, these are being processed illegally like my procured custody reformed payments from my base assigned living EXPOSURE money.
A step father and father with uncle's and aunts steal. Like they always have.
I am Lindsey ann maxfields
717 briarwood lane Hurst rd.


How to separate a low amplitude signal of same frequency but different phase

Two exact sine waves of the same frequency but different phases sum to another exact sine wave.  That resultant sine wave can be decomposed into an infinite numbers of pairs (or any other greater number) of sine waves of the same frequency, not just the two original ones.  Thus more information is required to reduce the possible solution space below infinite.


Real time background noise reduction or removal

A typical first approach to solve your problem would probably be to use one of the many existing noise reduction algorithms that target speech signal applications. These algorithms typically consist in

noise PSD estimation and
noise reduction filtering.

For each task, there are a variety of algorithms to choose from. Example noise PSD estimation algorithms are those based on minimum statistics of the input signal [1] or based on the minimum mean-square error [2]. The actual noise reduction filtering can, e.g., be performed by using spectral subtraction or a Wiener filter.

References

[1] Rainer Martin, “Noise Power Spectral Density Estimation Based on Optimal Smoothing and Minimum Statistics,” IEEE Transactions on Speech and Audio Processing, vol. 9, no. 5, pp. 504–512, Jul. 2001. PDF MATLAB implementation

[2] T. Gerkmann and R. C. Hendriks, “Unbiased MMSE-Based Noise Power Estimation With Low Complexity and Low Tracking Delay,” Audio, Speech, and Language Processing, IEEE Transactions on, vol. 20, no. 4, pp. 1383–1393, May 2012. PDF MATLAB implementation


Autocorrelation function of a discrete signal

First: you should really read some basic theory of autocorrelation. For example.

  I also don't know why we subtract the mean

First, to subtract the mean is the usual and right thing to do – it's so standard that often it is straightly assumed that the signal has zero mean. Recall that the covariance of two variables is $E[ (x-\mu_x)(y-\mu_y)]$ – of which the variance is a special case. Here we are assuming that the process is stationary, so the mean is constant.

  I don't really see what a negative correlation would entail.

The correlation (as the covariance) can be positive, zero or negative. A negative correlation says that the values tend to have opposite values, that is: when X has a "big value" (relative to the mean), then it's more probable that Y has a "small value" (relative to the mean). If the correlation is positive, then's the reverse.

  However, I don't see why we divide by the variance.

You don't have to. You divide by it if you want a normalized correlation (rather: a correlation coefficient), that will be in the $[-1, 1]$ range.

  I understand why we divide by $(n−k)$...

Actually you have two alternatives here: if you divide by $(n-k)$ you get an unbiased estimator (good), but, you get large variance (the "noise" you see in the graph) for large values of $k$ (bad; however, one is often interested only in the correlation for small values of $k$). Alternatively, one can divide by $n$; this produce a biased estimator but better behaved (lower variance) for large $k$. This is also explained here or in any textbook about correlation estimators.


Dimensional analysis of integrated white noise process

The problem comes from the dimension of $\sigma^2_i$, which you assume to be $[I^2]$. That's, however, not the case if you define

$$E\{i(t_1)i(t_2)\}=\sigma^2_i\delta(t_2-t_1)\tag{1}$$

Note that the dimension of a Dirac delta impulse is the inverse of the  dimension of its argument, which is $[1/T]$ or $[Hz]$. So you get for the dimension of $\sigma^2_i$ $[I^2T]$ or $[I^2/Hz]$. You can also see this by looking at the power spectral density (the Fourier transform of $(1)$), which is simply $\sigma^2_i$, and the dimension of which must be $[I^2/Hz]$. With this dimension of $\sigma^2_i$, the dimension of your result is correct.


converting block diagrams with delays to equations

If you are confused about the interpretation, why not divide the diagram into 2 parts. The signal to the left of the rightmost delay element is assumed to be z[n].

Thus, now $$y[n] = z[n-1]$$

$$z[n] = x[n] + (-1)\cdot x[n-1]$$

Thus

$$y[n] = x[n-1]  -x[n-2]$$


Fringe movement analysis to extract displacement

Answer to: Is there an easier way to count fringes?
I synthesized an image to resemble your image with
x = linspace(0, 1, 256);
[x,y] = meshgrid(x,x);
image = sin((7*x + 2*y) * 2*pi) ./ (0.1 + (x - 0.5).^2 + (y - 0.6).^2);
imagesc(image);

Then I can get the vector the 2D FFT
A = abs(fft2(image));
A = A(1:end/2, 1:end/2)
[~, imax] = max(abs(A(:))) % 899
% get line and column from the index
idx = [floor((imax-1)/size(A, 2))+1, mod(imax-1, size(A, 2))]

idx is set to the expected wave vector [7, 2] thus the length of the fringes must be $l = \sqrt{W/7^2 + H/2^2}$, where W and H are width and height of the image.
Update after comment

What kind of information can the wave vector provide about the fringe movement? In my video the interference pattern does not change, it just moves...

You must have realized that with this interference pattern you can only detect the component in the direction of the wave vector.
Also you cannot detect movements beyond one half of the distance between the fringes, so you can use unwrap to solve it. Here a demonstration with multiple frames and some movement.
function fringes
  k = [3, 10];
  t = linspace(0, 1, 100);
  phi = t * 0;
  d = 2*sin(5*t);
  WATCH = 0; % set to 1 if you want to see all frames
  % simulate some movement on the fringes
  for i = 1:length(t)
    image = create_image(k, d(i), 256);
    %% if you want to watch the movement
    if(i == 1 | WATCH)
      figure(1), imagesc(image), drawnow;
    end
    [~, phi(i)] = detect_fringes(image);
  end

  figure(2);

  dist = sqrt(256/k(1)^2 + 256/k(2)^2);
  c = plot(t, d*dist, ...
       t, phi*dist/pi/2, ...
       t, unwrap(phi)*dist/pi/2 ...
  );
  l = legend('displacement', 'pricipal phase', 'estimated displacement')
  set(l, 'fontsize', 12);
  set(c, 'linewidth', 2);
end

function image = create_image(k, d, N);
  x = linspace(0, 1, N);
  [x,y] = meshgrid(x,x);
  image = sin((k(1)*x + k(2)*y + d) * 2*pi) ./ (0.1 + (x - 0.5).^2 + (y - 0.6).^2);
  image = image + randn(size(image)) * 10;
end

function [k, phi] = detect_fringes(image)
  A = fft2(image);
  A = A(1:end/2, 1:end/2);
  [~, imax] = max(abs(A(:)));
  % get line and column from the index
  k = [floor((imax-1)/size(A, 2)), mod(imax-1, size(A, 2))];
  phi = angle(A(imax));
end

I added some noise to make it more realistic

The result is this

Tested in Octave 6.1.0
Edit: Why the wave length is inversely propoertional to |k|
The wave length is the separation between two points where the wave field is in phase.
The wave vector $\vec{k}$ is associated with a wave of the form
$$
\begin{eqnarray}
 F &=& A exp\left( 2i \pi \vec{k} \cdot \vec{u}\right) \\
   &=& A exp\left( 2i \pi |\vec{k}| \cdot |\vec{u}| cos( \angle(\vec{k}, \vec{u}))\right) \\
\end{eqnarray}
$$
Let $\phi$ be the phase of the field
$$ \phi(u) = |\vec{k}| \cdot |\vec{u}| cos( \angle(\vec{k}, \vec{u})) $$
One wave length may be defined by the minimum $\Delta \vec u$ such that $\phi(u) + 2 \pi = \phi(u + \Delta \vec u)$, the direction of $\Delta \vec u$ is choosen to maximize $cos(\angle(\vec k, \Delta \vec u))$, i.e. $\angle(\vec k, \Delta \vec u) = 0$, thus $\Delta \vec u$ is parallel to $\vec k$. In this situation $\phi(u + \Delta \vec u) = \phi(u) + |\vec k| |\Delta \vec u| = \phi(u) + 2\pi$. Solving for $\lambda = |\Delta \vec u| = 2\pi / |\vec k|$.


Finding the correct $x[n]$ from a given DFT $x[k]$

Let's solve the exercise. It's asking for your awareness of periodicity in DFT and some trigonometry.

First, beacuse of the question content, let's state the following :
$$\delta[n-d] \overset{DTFT} \longleftrightarrow e^{-j \omega d } \overset{DFT} \longleftrightarrow e^{-j \frac{2 \pi}{N} d k } $$

Then given our DFT $X[k]$ work it backwards into $x[n]$ as a sum of delayed impulses.

$$
\begin{align}
X[k] &= 2 \cos(\frac{\pi k}{2}) + 2 \sin(\frac{14 \pi k}{8}) + \sin(\pi k) \\
X[k] &= 2 \cos(\frac{\pi k}{2}) + 2 \sin( \left( 2\pi - \frac{2\pi}{8} \right) k) + 0 \\
X[k] &= 2 \cos(\frac{\pi k}{2}) + 2 \sin(- \frac{2\pi}{8} k) \\
X[k] &= 2 \cos(\frac{\pi k}{2})  - 2\sin(\frac{\pi}{4} k) \\
\end{align}
$$

We have used basic trigonometry to reach the above line. Now lets use Euler's formula to expand the cosines and sines into complex exponentials so that we can use the corresponence of the first line to deduce the time domain impulses.

$$
\begin{align}
X[k] &= 2 \cos(\frac{\pi k}{2})  - 2\sin(\frac{\pi}{4} k) \\
X[k] &= 2 \left( \frac{ e^{j \frac{\pi}{2} k} + e^{-j \frac{\pi}{2} k} }{2} \right)  -2 \left( \frac{ e^{j \frac{\pi}{4} k} - e^{-j \frac{\pi}{4} k} }{2j} \right) \\
X[k] &= \left( e^{j \frac{\pi}{2} k} + e^{-j \frac{\pi}{2} k}  \right)  +j \left( e^{j \frac{\pi}{4} k} - e^{-j \frac{\pi}{4} k} \right) \\
\end{align}
$$

Now the correspondence between $\delta[n-d]$ and its $N=8$ point DFT is:
$$\delta[n-d] \overset{DTFT} \longleftrightarrow e^{-j \omega d } \overset{DFT} \longleftrightarrow e^{-j \frac{2 \pi}{8} d k } = e^{-j \frac{\pi}{4} d k } $$

And by using ths relationship we can deduce from the last line that the impulses are:

$$
\begin{align}
X[k] &= e^{j \frac{\pi}{2} k} + e^{-j \frac{\pi}{2} k}  +j e^{j \frac{\pi}{4} k} - e^{-j \frac{\pi}{4} k} \\
x[n] &= \delta[n+2] + \delta[n-2] + j\delta[n+1] -j \delta[n-1]
\end{align}
$$

One last step remains to complete the answer; representation of $x[n]$ in the range $0 \leq n \leq 7$ as it is the valid range for the formal relationship between $x[n]$ and its $N$-point DFT $X[k]$. Then we should map those impulses outisde of this range into it. As you can see $\delta[n+1]$ and $\delta[n+2]$ are outside of this range and should be mapped into $0 \leq n \leq 7$ by shifting them right by $N=8$. This shift is the consequence of the inherent periodicity in both $x[n]$ and $X[k]$ as $x[n-N] = x[n]$ etc. So we decude that $x[n]$ in the range $0 \leq n \leq 7$ is:

$$x[n] = \delta[n+2-8] + \delta[n-2] + j\delta[n+1-8] -j \delta[n-1]$$
$$x[n] = \delta[n-6] + \delta[n-2] + j\delta[n-7] -j \delta[n-1]$$

which is shown in the option b.


Cross-correlation of two signals using matlab

xcorr function (of Matlab) computes the cross-correlation between two sequences $x[n]$ and $y[n]$ of length $M$ each. If $x$ and $y$ are random processes (jointly WSS) then xcorr returns an estimate $$\hat{r}_{xy}[m] = \frac{1}{M} \sum_{n=0}^{M-1} x[n]y[n+m]^*$$ computed over the two random vectors $x$ and $y$, of the theoretical cross-correlation between the two random processes $X$ and $Y$:
$$r_{xy} [m] = E\{ X[n]Y[n+m]^* \} $$ (Note that the practical estimate computation (the sum's range and the scale) may be modified to make it an unbiased estimator and to deal with out of bound entries...)

When the two sequences belong to deterministic signals, then it's called as the deterministic cross-correlation, essentially the same thing computed from a practical point of view, but its interpretation is made carefully depending on the case.

In signal processing theory and signal detection theory, the operations of correlation, convolution and matched filtering merge at some point. Without further details, one can observe that given two sequences $x$ and $y$, the the computation mechanics and hence the results of the three operations, will be the same (with slight modifications in the orientation of the arguments)

Matched filtering, essentially convolves a test signal with a target signal, with the test signal reversed in time. It can be shown that there'll be a unique peak at the matched filter output, if the target signal involves a copy of the test signal inside. From a theoretical point of view, intuition tells that, if the target and test signals are uncorrelated (and orthogonal, for zero mean processes, as a result) their cross-correlations should produce low values in line with inner products between orthogonal vectors. But when the target signal involves a copy of the test signal at some point, then there will be high correlation between the target and test signals close to those shifts, at the output, that will create the peak.

There are subtle details, however, such as if the test signal is contained more than once, if several test signals overlapp, and if the test signal is not contained purely but through some (inevitable) transformations, which make the comparison more difficult or less reliable unless those transformations are known and rolled back properly.

In most practical scenarios, the target signal will consist of noise  or irrelevant signals plus the test signal. And for those lags which compare the test signal with the noise portions, the output will be arbitrary (in the ideal case of when the noise belongs to a zero mean white random process, the output should tend to zero, as the summation would sequentially add and subtract test signal samples which would produce apprx a zero, when the test signal belongs to a zero mean (ergodic) process). And when the comparison is between target signal and test signal for a lag that corresponds to the place of the test signal in the target signal, the computation should produce a large value, as the sum is essentially computing the energy of the test signal; i.i, sum of $x[n]^2$ values.

Note that when the SNR is low; that the noise portions have large amplitudes compared to the test signal embedded in the target signal, then the above paragraph becomes invalidated and the expected peak is burried within random peaks produced as the result of the irrelevant computations between the test signals and noise contained in the target signal.


Image processing and the Fourier Transform

At a conceptual level, the Fourier Transform tells you what is happening in the image in terms the frequencies of those sinusoids. For example, if you have a picture of a plain wall, the values of the pixels change very little as you go from left to right or from top to bottom.  In the frequency domain that means that your image contains low frequencies, but no high frequencies.

On the other hand, if you have a picture of a picket fence, then the values of the pixels change all the time as you go from left to right.  So in Fourier domain you have high frequencies in the X direction, but not in the Y direction.

Finally, if you have a picture of a checkerboard, then the pixel values change a lot in both directions.  Thus the Fourier transform of the image will have high frequencies in both X and Y.

Because the Fourier transform tells you what is happening in your image, it is often convenient to describe image processing operations in terms of what they do to the frequencies contained in the image.  For example, eliminating high frequencies blurs the image.  Eliminating low frequencies gives you edges.  And enhancing high frequencies while keeping the low frequencies sharpens the image.

FFT is used extensively in image processing and computer vision. For example, convolution, a fundamental image processing operation, can be done much faster by using the FFT.  The Wiener filter, used for image deblurring, is defined in therms of the Fourier transform.  But more importantly, even when the Fourier transform is not used directly, it provides a very useful framework for reasoning about the image processing operations.

Steve Eddins, one of the authors of "Digital Image Processing with MATLAB", has a whole series of blog posts on the Fourier transform and how it is used in image processing.


Without being an expert in the image processing field there is something that comes to mind that maybe could point you in the right direction. Usually we express a feature as a number, to which we assign an estimator, which is a random variable, with some probability distribution (for which we normally care about mean value and variance). If we take the noise example which i think is the easier. You could try to express this resistance in term of the variation of the probability distribution of the feature estimator given the perturbing noise source. Let the output of your estimator for the feature be the random variable $\mathbf{X}$, and let the noise be characterized by $\mathbf{Y}$. Some measure of the resistance could be $\frac{P(\mathbf{X})}{P(\mathbf{X}|\mathbf{Y})}$. If this value is close to one, then the feature would be resistent to perturbations by noise, if it is not then it won't be. Maybe you could define a function of this to adjust the values to be more significant. For the other transformations such as rotation, scaling etc, you could use the same but do $\frac{P(\mathbf{X})}{P(\mathbf{f(X)})}$, where $f(\mathbf{X})$ denotes the transformation of the random variable that characterizes the estimator when you apply the rotation to the image. Of course, I think this $f()$ would be very hard to find in general but perhaps if the feature is not hard to estimate you can do some math and some change of variable and arrive at closed expressions for it.

Hope this helps.


How to Estimate a Normalized PSD Using the Burg’s Method in MATLAB?

The link to the paper is not working.

If you could show your code maybe we could help to correct it.

With Fs=250Hz you will only be able to see frequencies up to 125Hz (Fourier transform theory).

For using the pburg method you only need to provide the samples and the order of the model (usually the model order is the double of the number of spectral peaks).


Eventhough your expectation is sensible on the surface, once you think deeper into audio signals, you'll see that modulation of audio in that way will not produce the expected sonic result. Furthermore your implementation is also wrong.

Consider the audio spectrum; it has two conjugate symmetric lobes into the positive and negative frequencies each about $W$ kHz denoting the bandwidth of your audio. And lower frequency band between $-20$ Hz and $20$ Hz is empty.

First note that you should keep this symmetry in the frequency domain if you want to listen to the modulated bare audio. Your multiplication of a single complex exponential completely destroys the spectral symmetry. [edit: as @DanBoschen reminded, you take the real part of the multiplication so that spectral symmetry is preserved!]. Nevertheless, it's cheaper to multiply with a cosine than a complex exponential, so you better multiply with a cosine() waveform instead of multiplying with a single complex exponential and taking real part of it.

Second, even if  the audio is multipleid with a cosine waveform, a shift of $100$ Hz simply creates a huge overlap in the spectrum resulting in aliasing distortion; i.e., shifting of the spectrum to right and left by $100$ Hz creates right and left lobes to cosite on each other, creating terrible aliasing. To prevent this, you can, in principle, apply separate shifts of left and right single side lobes independently and then sum the result.

Third, even if you do this perfectly, you will not get what you expect as the harmonicity of the audio spectrum is also distorted. The fundamental frequencies and their corresponding higher harmonics do not align on proper places. You should have scaled the frequency axis instead, but you have only linearly shifted the spectrum. To numerically see the effect, consider three harmonic frequencies in the original spectrum at, say, fundemantal at 120, and hamronics 240, and 480 Hzs. When you shift them by, say, 1499 Hz, the new frequencies will be 1619, 1739, and 1979 Hzs. And this new set is not harmonic anymore; i.e., they won't sound natural...

If you want to listen to the same audio at a higher pitch, then you can play with the output DAC sampling frequency. It will strecth the spectrum correctly keeping the harmonicity intact and prevent aliasing also, but it will change the duration of the playback...


Self studying, getting a quality spectrogram

Why are my peaks capped?

Your amplification gain is set to too high, or you are too close to the microphone. The amplifier is driven to its limits and it clips the output. Keep this recording and make another one where you are a little bit further away from the microphone to later compare the differences in the spectrogram. It will be interesting to see how this clipping manifests itself in the frequency spectrum.

  ...how do I get better resolution and clarity so as to read stuff such as formants in vowels, i tried changing the size of my partitions, but still get very similar results, more windows get less data of frequencies in each window, and less windows get poor time resolution.

On line 7 of your point #6, you make use of numpy.fft.rfft.

From the documentation ...the length of the transformed axis of the output is therefore n//2 + 1..

Your signal is about 2 seconds long at a sampling frequency (Fs) of 16kHz and you are dividing it into windows of 1000 samples that overlap by 965 samples. That's about 97% overlap.

This 97% overlap is a very high temporal resolution.  What you are lacking is in frequency resolution and the only way to increase this is to increase your window size. This will give the Fast Fourier Transform (FFT) the opportunity to resolve more frequencies.

These are Audacity's parameters for deriving spectrograms:

There are two things to notice here:

All of Audacity's window sizes are powers of 2. This is done to exploit the structure of the calculations in computing the FT and do it F(ast).
The window size is inversely proportional to the resolution of the FFT. A size 8 window is marked as "most wideband" and a size 32768 is marked as "most narrowband". Of course, your window size is not independent of your Sampling Frequency and there are limits to how many frequency components it can resolve given the data that has already been captured at sampling. Therefore, higher true frequency resolution means capturing more data which means increasing your sampling frequency. With 16kHz you can resolve (theoretically) up to 8kHz.

So with the exception of a few details and optimisations here and there, you are down the right track with your code.

You are missing:

The windowing functionality (nothing to do with the length of the sliding window you apply in your code (1000)). This will become important later on if you want to resolve things like formants.
"Proper" plotting which sets the x and y axes of your plot to the time and frequency scales required to interpret the spectrogram. This is not something incredibly difficult to do, but you will find yourself needing it, otherwise you will be doing "back of the envelope" calculations every time you want to read frequencies and offsets from your plots.

Ultimately, you will add those to your code too and you will have replicated, to a large extent, the functionality of scipy.signal.spectrogram.

Therefore, I would recommend to you to focus your studying efforts on the specifics of the spectrogram in order to understand how it works and what the impact of each one of its parameters is to the quality of its output.

A good introduction to the spectrogram itself is this one. And of course, it is not the only one out there.

scipy.signal.spectrogram includes all of the key parameters and it will allow you to explore spectrograms comfortably.

Finally, if you are interested in audio analysis, there are some really good libraries in the Python space, that implement a lot of functionality you will need. Some examples are pyAudioAnalysis and librosa (and here for something closer to what you are asking). Many more pointers available here.

Hope this helps.


Developing DSP software, am I 10 years too late?

DSP is a wide field and goes beyond audio/video processing. And, since new digital devices are developed in any field, DSP algorithm implementation, simulation and design is still a very important area.

Some examples that come to my mind beyond audio/video:

wireless communications: for example there is plenty of research going on in 5G cellular (i.e. mobile phones) and 802.11 (i.e. WiFi) standards.
medical devices: more and more devices operate (semi-)automatically, requiring sophisticated signal processing to interpret their measurements.
DSL: as users search for faster internet, the research on DSL improvement is very important.
Big Data and deep learning: On the one hand, it's about designing low-complexity algorithms to solve the problems of huge sizes. On the other hand, it's about providnig hardware that can do these operations quickly.

This list is not at all exhaustive, and there are many more fields, where DSP is absolutely necessary and new techniques are developed on a daily basis.


meshgrid is simply a way to create a discrete grid. If you think of a regular MATLAB matrix of size MxN, it defines indices from 1 to N in x and from 1 to M in y, with the step size of 1. But let's say you want to evaluate some function f(x,y) on the x-interval [-3, 1] and the y-interval [-1, 2], and you want your step size to be .2.  The meshgrid helps you create a matrix of all the x-values and a matrix of all the y-values.  If you do

[X,Y] = meshgrid(-3:0.2:1, -1:0.2:2);

You can then easily evaluate your function f(x,y).  For example f(X(1),Y(1)) = f(-3, -1). Of if f is a vectorized MATLAB function, you should be able to evaluate it on your entire grid with one line:

Z = f(X(:), Y(:));

In this particular example, the meshgrids contain the indices of the frequency coefficients in the same order used by fft2 function. Remember, the Fourier transform of an image is periodic, it wraps around. For calculations it is convenient to have the zero frequency at (0,0), then the positive frequencies, and then the negative
frequencies wrapping around.

On the other hand, for visualization it is convenient to have the zero frequency in the center.  This is what the fftshift function does.  It is used purely for visualization.


impulse response cascaded with time reversed of itself

HINT: See what happens in the frequency domain. Convolution corresponds to multiplication. You just have to figure out the Fourier transform of $h[-n]$, expressed in terms of the Fourier transform of $h[n]$. Multiplying the two functions results in the Fourier transform of the convolution of $h[n]$ with $h[-n]$. The result has a special property which makes it very easy to determine its phase.


For class matching, Hietanen in [29] compares several
binary descriptors and SIFT with different detectors, including
a dense grid. SIFT preformed better than other descriptors and
dense grid responds very well.
This result leads us to test dense detector for different
descriptors…

It seems that a dense detector is one that uses a dense grid on which to evaluate some feature metric.
This is opposed to "classical" feature detectors that search the image for points with features.
Frankly, spanning a grid over an image to reduce it to a lower resolution does sound like what I'd call a subsampling and image transform, but maybe I'm misunderstanding this!


Your filter is a 5-tap delay line FIR filter. The FIR filter's coefficients are [2 6 1 5 1]. If x is your filter's input sequence and you execute the following MATLAB command:
h = [2 6 1 5 1];

you can then implement the filter (to produce a y output sequence) using the following MATLAB command:
y = filter(h, 1, x);

You can see your filter's frequency magnitude and phase responses by executing the following MATLAB command:
freqz(h, 1, 256)


polyphase sample rate conversion with non-integer factor

Your approach seems conceptually sound.  I suspect that the problem is one of two things: 1) you have implemented it incorrectly, 2) Your filter bandwidth is too wide.

You are implementing the "smart" approach in that you are doing it the computationally efficient way.  I would try doing it the dumb way (insert I-1 zeroes between every sample, filtering with the entire filter, get rid of the extra samples) to verify your implementation and to see if the filter itself is the problem.  You can verify your implementation by comparing your resulting samples against the samples produced by the dumb approach.  After you have filtered the upsampled data one of the sample "phases" (there are "D" phases whose start samples are samples 0...D-1) should be the same as the smart approach's results.  If not, something is wrong in your implementation of either the smart or dumb approach.

If the results do match, then the problem is your filter.  You need to look closely at the bandwidth to make sure that it isn't too wide.  Since D > I the ideal filter bandwidth, assuming a perfect brick wall filter, is $\frac{I}{2D}$, where the factor of two comes from the Nyquist rate.


How to properly match bit growth of a FIR filter with a reference value

I've worked a lot with FIR and IIR filters in FPGAs, here are a few pointers

1 - Keep track of your bits and their respective weights.

2 - Keep track of your filter gain and the number of bits for the coefficients. For example, assume you have a 14-bit signed input. Your input can go from +16383 to -16384. Now you filter it in a 17-taps FIR low-pass filter (for example), its DC gain should be '1'. Assuming 16-bit coefficients, and no coefficient greater than or equal to '1', the sum of the coefficients should be 32768 (2^15). It could be slightly smaller, it doesn't really matter, especially if you round the output. However, it is possible, that because of the scaling, the sum of the coefficients could be 32769, 32770, etc. In this case your DC gain would be slightly bigger than unity and you will likely need guard bits.

3 - Assuming there can be no overflow at the output of the filters, now you need to determine how many "fractional bits" you need to keep. There are no simple answers. Assuming no decimation, it could be a good idea to keep the output format the same as the input. For example, 14-bit input with 1 sign-bit ---> 14-bit ouput with 1 sign bit. However, please round the data before truncating, otherwise you could insert some DC offset or other unpleasantness.

4 - If you decimate, one of the reasons why could be to increase the resolution of your data, in this case your output should have more fractional bits than your input.

5 - If your filters have a gain higher than 1 (on purpose, not because of quantization), such a resonant IIR filter, you will need to implement the appropriate number of guard bits. For example, you add a 20 dB-gain at a certain frequency, you will need 4 additional guard bits at the output.


how to find the "Natural and Total Response" of the system

I'll assume you do do what a Laplace transform really is!

All you have to do, is just compute the la place inverse for each part to get the result you want.
If you want the natural response only, just find the inverse Laplace transform of the noted part. If you want the total response just take the inverse Laplace transform for the whole factor.


Denoise Techniques When Clean Signal and Pure Noise Are Available

If the data is stationary and the noise is white then you should use the Wiener Filter.

If data isn't stationary you should look into the family of adaptive filters (LMS Filter and RLS Filter for starter).


Drawing the modulus from a Transfer function

Your sketch is not bad at all. I don't know why your teacher drew a "minimum" (do you mean a zero?) at $\pi/4$, because there shouldn't be any. The zeros are clearly at $\pm\pi/2$ and at $\pi$, and the main peak should indeed be close to $\pi/4$. By the way, I'm missing a pole. There are $4$ zeros and only $3$ poles. The fourth one should probably be at the origin. Maybe your teacher didn't give this exercise as much thought as he should have ...

EDIT:

Concerning your second example, it's always the same: a pole gives a bump in the magnitude response, the closer the pole to the unit circle, the more pronounced (sharp) is the bump. A zero on the unit circle gives an exact zero in the magnitude response, a zero away from the circle gives a dip. The closer the zero to the circle, the more pronounced (deeper) is the dip. Note that the exact maxima and minima in the magnitude response caused by poles and zeros close to the circle are often not exactly at the frequencies that correspond to the angles of the poles or zeros, but often they are close. This is all about a basic sketch, so no need to try to be overly precise.


image resolution in smartphones and laptop

Based on your comment:

  I mean that the image is captured using say, for example, the 5
  megapixels camera of the smartphone, and displayed on its screen
  having a certain dpi value. What happens if the same 5 megapixels
  image is displayed on another smartphone having different screen size
  and different dpi?

If you display an image (taken by whichever device, with whatever megapixel camera) on two different displays with two different DPI or PPIs, then it will seem smaller on the high PPI screen and larger on the low DPI screen.

This is very easy to see. Lets say the image has 2000V x 3000H pixels. And display this image on a screen with 200 PPI. Then it will take 15 inches horizontally and 10 inches vertically. On the other hand, if you display it on a second device with 100 PPI, then it will take 30 inches horizontally and 20 inches vertically, hence enlarged by 4 times. Lets conclude :

  Everything else being the same except the screen PPIs; a given image displays larger on a low PPI screen
  and smaller on the high PPI.


Reconstructing a sine wave from an interval shorter than half its wavelength

If your signal is really as simple as
$$x(t)=A\sin(\omega_0t)\tag{1}$$
with known $\omega_0$, and you have observations $y(t_i)$, which are noisy samples of $x(t)$ at known time instances $t_i$, then a simple solution would be the least squares estimate
$$\hat{A}=\frac{\displaystyle\sum_iy(t_i)\sin(\omega_0t_i)}{\displaystyle\sum_i\sin^2(\omega_0t_i)}\tag{2}$$
Of course, this simple solution won't work if your signal actually has the form
$$x(t)=A\sin(\omega_0t+\phi)+c \tag{3}$$
with unknown phase $\phi$ and DC-offset $c$. However, you can compute optimum least squares estimates for that problem too. This is discussed in Cedron's answer.


Combining CDMA with differential Manchester-like encoding?

With CDMA everything you would traditionally do with a symbol such as timing and carrier recover still applies- but in CDMA the symbol is the series of many “chips”.

So yes you could certainly add any higher level coding to the symbols where in CDMA the symbol may represent a data bit such as +1 and -1 only (perhaps), but each of these data bits after such coding would then be expanded to the CDMA sequence.

There is no motivation to change the sequence itself other than its cross correlation properties to the other codes used and the overall processing gain required. Timing and carrier recovery is done after despreading.


I think this is the equation you are using

http://en.wikipedia.org/wiki/Normalization_%28image_processing%29

where b=newMin and a=newMax These values can also be found from your histogram. Usually you expand the new image to take up the full intensity range. The intensity range of your image is the X-axis of your histogram. If it goes from 0 to 1, then a=1, b=0 if your hsitogram is from 0 to 255 a=255,b=0

a=newMax= most likely the last value of the x-axis on your histogram
b=newMin= most likely the very first value of the x-axis on your histogram
c=Min=last  nonzero element in histogram
d=Max=first nonzero element in histogram


Average power of finite length discrete signal

A finite length signal has a power of zero. This becomes obvious if you just use the first formula in your question and apply it to a signal of finite length. Finite length signals are so-called energy signals, and their energy is given by

$$E_x=\sum_{n=0}^{N-1}\big|x[n]\big|^2\tag{1}$$

where $N$ is the length of the signal (and we assume that the signal is defined in the index range $n\in[0,N-1]$).

The expression

$$P_x=\frac{1}{N}\sum_{n=0}^{N-1}\big|x[n]\big|^2\tag{2}$$

is the power of an $N$-periodic signal, as explained in this answer.


What's the relationship between the parameters of this noise generator and the gaussian curve it produces in the frequency domain?

This seems to work fine if everything is in rad/s. I think that the "problem" is with what you have implemented.

Here is a back of the envelope implementation of what you present:

Fs = 1000; % Sampling frequency in Hz
T = 4; % Total duration of the output signal
f = 125; % Centre frequency in Hz
s = 10; % Bandwidth in Hz

% Pre-allocate the output
y = zeros(1,T*Fs);

% Simple "buffers" for the previous sample in each filter
pb=0;
pp=0;

% For the duration of the signal...
for n = 0:(T*Fs)
    % Integrate b
    b = (1-2.*pi.*s./Fs).*pb + ((2.*pi.*s./Fs)./(2.*pi.*f./Fs)).*unifrnd(-1,1);
    % Integrate p
    p = pp + 2.*pi.*f./Fs.*(1+b);
    % Produce the output
    y(n+1) = cos(p);
    % Store the current values to the "buffers" to produce the n-1 indexing
    pb=b;
    pp=p;
end;

% Frequency vector for the FFT assuming nbins=length(y)
f_v = Fs.*(0:(length(y)-1))./length(y);
% Spectrum of the produced signal
semilogy(f_v, abs(fft(y)));grid on; xlabel('Frequency (Hz)');ylabel('Amplitude');

For f=125, s=0:

Clean as a whistle, right on the f

For f=125, s=15.625

For f=125, s=62.5

Notice that I provide the bandwidth at fractions of f. The bandwidth cannot be wider than f.

I think that this is closer to the discrete Gaussian as it is more akin to a power law for very narrow bandwidths.

The deviation is at:

br = (1 - w ) * br + w * random.uniform(-1, 1) / max([0.001, f])

Why .../max([0.001,f])? The uniform() already returns numbers between $[-1..1]$ why do we need the additional "normalisation" there?

Overall, this is like an oscillator whose phase becomes a random variable. No matter how you are going to achieve it, this oscillator's phase must accumulate with an average rate of $\Delta \phi = \frac{2 \pi f}{Fs}$. The deviation from this would be proportional to the width around $\Delta \phi$. When setting a bandwidth, you are trying to limit the "phase growth" between two limits (but again, on average). So, for the Gaussian, the $\sigma$ (the standard deviation) does not correspond to the point in the curve that the output is at half the maximum. This occurs at $\approx \pm 1.1775 \sigma$, which you can apply as a correction factor to your s to modulate where you want your amplitude to be positioned approximately. But that would still depend on a few factors (for example the length of the signal and the whole sequence of random values that determines constructive and destructive interference throughout the signal).

Since you are in Python, you can construct such a "probabilistic" oscillator by drawing samples directly from a Gaussian $\mathcal{N}(\mu_f, \sigma_f)$ where $\mu_f, \sigma_f$ have frequency units as above) to obtain a series of $\Delta \phi$s and then simply add them up as you along (think of it as cumsum). Of course, this is not going to work if the hardware this oscillator is to run on can only generate uniform random numbers.

Hope this helps.


Difference between $\tt freqz()$ and $\tt plot(abs(fft()))$ in MATLAB

You calculating FFT only from two samples. You need to pad your impulse response with zeros to get a valid result. So in MATLAB that would be:

N = 1024; % Number of points to evaluate at
% Create the vector of angular frequencies at one more point.
% Filter itself
b=[1,-1];
[h_f, w_f] = freqz(b, 1);
figure
grid on
hold on
plot(w_f, abs(h_f), 'or') % MATLAB
h = [b, zeros(1,N-2)];
HH = abs(fft(h));
HH = HH(1:length(w_f));
plot(w_f, HH); % Manual calculation
legend({'MATLAB freqz', 'Manual'})

As you can see it matches first and last value from fft you calculated. Please keep in mind that it is shown in linear - not dB scale.

For more info you can see my previous answer.


As far as I can tell, Matlab's Computer Vision toolbox provides vision.CascadeObjectDetector for object detection, with support only for Frontal Face (CART),Frontal Face (LBP),Upper Body,Eye Pair,Single Eye,Single Eye (CART),Profile Face,Mouth,Nose. When you say:  "the rectangle is drawn around the face instead.", that is happening because you are calling CascadeObjectDetector without specifying a specific object to detect, resulting in CascadeObjectDetector setting the to FrontalFaceCART by default. You are probably doing something like this:

detector = vision.CascadeObjectDetector;

Try doing this:

detector = vision.CascadeObjectDetector('Nose');

And you'll see how the nose is detected.

You are probably then getting excited, because it would be really easy then passing 'Hand' as a parameter instead of 'Nose', or anything. But unfortunately until now CascadeObjectDetector doesn't provide a model for 'Hand'. However, there exists a way to archieve this, the last ComputerVision toolbox provides the trainCascadeObjectDetector which you can use for detecting your own models(the hand for example). You'll see that this consists of a training process where you have to supply positive and negative images to develop your own detector, further explanations are given in the links. There is another useful tool you can use for this: a GUI tool for getting easier the classification process.

Hope this helps


FFT shows systematic deviations from analytical result

You have aliasing
Your continuous spectrum is not band-limited, so you are violating the sampling theorem. Sampling in time results in periodic repetition in the frequency domain so your first mirror spectra are leaking into your base band spectra.