Friendly target identification in radar How do radar systems identify friendly targets to avoid AA locks during combat scenarios?
Do friendly planes broadcast a known signal or is something else going on?

Every system will be different, so it’s impossible to make a blanket statement that applies to everything, but IFF systems can be used to accomplish the task. The signal processing here can be as basic as looking for a predetermined pulse pattern, or require demodulation/decryption of some “special” signal. The Wikipedia article I linked covers the topic in pretty great detail.


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

Thanks to all
Stefano

Any spectrum that is between the two DFT bin centers ends up getting represented, in various proportions, in all the DFT bins (in the rectangular window case, the proportions decay as in a Sinc function, roughly by 1/(i-k)).  Those proportions might be needed for your synthesis to be an accurate enough reconstruction.

Using 2 bins alone usually creates a beating effect at a low beat frequency.


Is this a correct interpretation of the DCT step in MFCC calculation? This is a continuation of the discussion here. I would comment there, but I don't have 50 rep so I'm asking a new question.

Here's how I understand the DCT step in the MFCC calculation process: The rationale behind it is to separate the correlation in the log-spectral magnitudes (from the filterbank) due to the overlapping of the filters. Essentially, the DCT smooths the spectrum representation given by these log-spectral magnitudes.

Would it be correct to say that the blue line in the image below represents the spectrum as represented by the vector of log-spectral magnitudes, and the red line is that vector once its been DCT-ified?

Let me start from the beginning. The standard way of calculating cepstrum is following:

$$C(x(t))=\mathcal{F}^{-1}[\log(\mathcal{F}[x(t)])] $$

In the case of the MFCC coefficients case is a bit different, but still similar.

After pre-emphasis and windowing, you calculate the DFT of your signal and apply the filter bank of the overlapping triangular filters, separated in mel scale (although in some cases linear scale is better than mel):

In respect to cepstrum definition, you now represented the envelope of the spectrum (reduced spectrum) in mel-frequency scale. If you represent that, then you will see that it kind'a resembles your original signal spectrum.

Next step is to calculate the logarithm of the coefficients obtained above. This is due to the fact that cepstrum is supposed to be a homomorphic transformation that separates signal from the impulse response of the vocal tract, etc. How?

An original speech signal $s(t)$ is mostly convolved with an impulse response $h(t)$ of the vocal tract:

$$\hat s(t)=s(t)\star h(t)$$

In frequency domain convolution is a multiplication of spectra:

$$\hat S(f) = S(f)\cdot H(f) $$

That can be decomposed into two parts, based on following property: $\log(a\cdot b) = \log(a)+\log(b) $.

We also expect that impulse response is not changing over time, thus it can be easily removed by subtracting the mean. Now you see why we taking the logarithms of our band energies.

The last step in the cepstrum definition would be the Inverse Fourier Transform $ \mathcal{F}^{-1}$. The problem is that we have only our log-energies, no phase information, so after applying the ifft we get complex-valued coefficients - not very elegant for all this effort to be a compact representation. Although we can take the Discrete Cosine Transform, which is 'simplified' version of FT and get real-valued coefficients!
This procedure can be visualized as matching cosinusoids to our log-energy coefficients. You might remember that cepstrum is also called 'the spectrum of the spectrum'? That's the very step - we are searching for any periodicity in our log-energy envelope coefficients.

So now you see that now it's rather hard to understand how the original spectrum looked like. Additionally, we are usually taking only first 12 MFCC's, as higher ones are describing fast changes in log-energies, which is usually making recognition rate worse. So the reasons for doing DCT were the following:

Originally you must perform IFFT, but it's easier to get the real-valued coefficients from DCT. Additionally, we no longer have full spectrum (all frequency bins), but energy coefficients within mel filter-banks, therefore usage of IFFT is a bit of overkill.
You see on the first figure that filter banks are overlapping, so the energy from ones next to each other is being spread between two - DCT allows to decorrelate them. Remember that this is a good property for example in case of Gaussian Mixture Models, where you can use diagonal covariance matrices (no correlation between other coefficients), instead of full ones (all coefficients are correlated) - this simplifies things a lot.
Another way of decorrelating mel frequency coefficients would be PCA (Principal Component Analysis), technique solely used for this purpose. For our luck it was proven that DCT is a very good approximation of PCA when it comes to decorrelating signals, hence another advantage of using Discrete Cosine Transform.

Some literature:

  Hyoung-Gook Kim, Nicolas Moreau, Thomas Sikora - MPEG-7 Audio and
  Beyond: Audio Content Indexing and Retrieval


What is relationship between entropy and frequency in image When I was studying spatial frequency and entropy, it occured to me that "is there a relationship between entropy and frequency?".

As you can see, if we consider only horizontal line, the frequency of (a) is lower than (b).

Intuitively, I think that magnitude of frequency is proportional to entropy. But Google said nothing. Am I right?

Each entropy is the following.

$$H_a = -0.842\log_20.842 -0.157\log_20.157 = 0.209 + 0.419 = 0.628$$
$$H_b = -0.6\log_20.6 -0.4\log_20.4 = 0.442 + 0.529 = 0.971$$

(a)

(b)

If I understand correctly, you are taking the entropy in the image from the distribution of black and white pixels. In image (a) you have 50% black, 50% white, so the entropy is 1 bit. In image (b) you have 85% black, 15% white, so the entropy is 0.6 bits.

If you make another image (c) with black and white stripes equal in width to the black stripes in image (a), you will have 50% black, 50% white again, i.e. entropy 1. But the frequency will be less than image (a).

So for this notion of entropy, the answer is: No, in general there is no relation between entropy and frequency in an arbitrary image.

However, in real world images energy is more concentrated in low frequencies than in high frequencies. So if you define entropy in terms of the distribution of such images, you will find a relationship between frequency and entropy.


Why removing noise increases my audio file size? I took some mp3 files of people talk with noise in the background and then removed the background noise using online voice seperator tools (such as https://vocalremover.org/). I was surprised to find out that the size of my files increased (about 5 times bigger).
Why did it happen? Is there another audio format or background noise removing method that would reduce my file size when removing the background noise?

This is has nothing to do with the noise removal process but with your encoding. In order to do any type of processing with an encoded audio file you need to

Decode the input file to PCM
Process PCM data
Encode the PCM into the desired output format

Please note that steps and 1 and 3 are completely independent. The decode is determined by the input file format and the encode by the desired output file format. If you want those to be the same, you need to capture all encoding parameters from the input file and pass them to the encoding process.
In your case, you are probably using a different bitrate for input and output.


Can we determine if a filter is butterworth or chebyshev from its physical topology? Can all analog filters be classified as Bessel, Elliptic, Butterworth or Chebyshev?

Given a physical ladder topology of several stages of {L, C or LC} in {series or parallel}, is it possible to always classify it to one of the above?

(I got this question while trying to design a steep filter by trial and error on spice, and then realized that it has too long response, as a Chebyshev filter would have, so I wanted to optimize it.)

As pointed out in a comment by Jason R, you can obviously come up with some random coefficients for the numerator and denominator polynomials of the filter's transfer function, and you'll end up with arbitrary filters that do not satisfy the definitions of any of the filter types you mentioned (even if you make sure that the filter is causal and stable).

Concerning your second question, the answer is also no. A Butterworth and a Chebyshev (type I) filter have the same structure, just the element values are different. The structure of an elliptic filter is different because it has zeros at finite frequencies. For passive filters, these are achieved either by parallel circuits of L and C in the signal path, or by series circuits of L and C towards ground. However, this is also true for type II Chebyshev filters, which also have zeros at finite frequencies. So if your passive filter topology has LC resonators (parallel in the signal path, or serial towards ground) you know that the filter can't have a Butterworth, Bessel, or type I Chebyshev characteristic. It could be an elliptic or a Chebyshev (type II) filter, but it needn't be. If the structure has no LC resonators, the opposite is true: it can't be an elliptic or a Chebyshev (type II) filter, but it could be a Bessel, Butterworth, or Chebyshev (type I) filter. But again, it could also be some non-standard filter. It all depends on the element values.


How to interpret correlation angle from frequency domain Since the coefficient of one frequency could be seen the length of the signal projects on that frequency basis.

And the length is
$$|a|\cos\theta= \frac{a\cdot b}{|b|}   $$

If I divide the coefficient by $|a|$, how to interpret the correlation cosine angle from frequency domain?

If your signal is a single pure tone and your basis is a single pure tone of the same frequency, then the "angle" directly corresponds to the phase angle between them.  When they are totally in phase, the angle will be zero.  When they are totally out of phase, the angle will be $\pi$.  If the angle is $\pi/2$ then the signal is orthogonal to the basis.


How to frame an audio sample? I am trying to calculate the mfcc of an audio sample of 5sec duration. How can I frame this audio sample. Is there any criterion for selecting the frame size and number of frames? What all change will be there if the audio file is 30sec long?

Usually in speech recognition frame size is around 16 milliseconds (0.016 second), which corresponds to average length of an audio signal during which it is stationary (not to much variation). Regarding the overlap I suggest you to start with 50%, you can then try to play with it, but it should not change too much.

I do not really understand part of you question asking what will change if the file is 30 seconds long. Obviously frame length stays the same and only number of frames will increase.


Is there any other method to get the DFT of a signal without actually computing it using normal calculation Is there any other method to get the DFT of a signal without actually computing it using a normal calculation.
Please help me out in this query

There are a few possible answers depending on the signal and your meaning of "normal calculation".

If the signal is stationary, then you might be able to use an old fashioned analog spectrum analyzer, the kind that works by sweeping a narrow-band analog filter across the input signal, and graphing the amplitude results on an X-Y pen plotter.  Then you could estimate the plot heights at various graph points, corresponding to DFT bin frequencies.

If the signal isn't physical, but a vector of sample points, then you might be able to feed those samples to a synthesizing signal generator, and then feed the resulting analog signal to the above type of spectrum analyzer and pen plotter.

If the signal is periodic, and can be described by a closed form equation, then you might be able to symbolically compute or look up the harmonics (in a table, for instance), then sum a Sinc interpolation of those harmonic results to get your desired DFT bin frequency results.

If by "normal calculation", you mean the full O(N^2) 2D complex matrix multiplication, as indicated by the mathematical definition of a DFT, and the length of your desired DFT isn't a prime number, then various factorizations of that matrix will allow you to compute almost the same result (except perhaps with a tiny bit less rounding errors) in O(NlogN) time. See this method.


How does the number of frequency-domain sampling points influence the outcome of an inverse FFT? Given some frequency-domain representation of an impulse response.

How does the number of frequency-domain sampling points influence the outcome of an inverse FFT, if I keep the sampling frequency constant?

Example 1
Take x(t) = e^(-t)*sin(t) for t in (0,10). Sample the signal, take its fft. Omit every second point of the fft and on the result do an inverse fft. Here is the result:

So it looks as if the frequency-domain downsampling had removed the second portion of my signal, while dividing the first part by two. (Indeed multiplying the result by two results in a curve lying exactly above the first part of the original signal.)

Why did it remove the second part and not some arbitrary other part? I guess this is related to the second part being nearly zero everywhere, but I can't seem to find the exact reason.
Why is the result divided by two?
How does this generalize to other time signals?

Example 2 (pathological)
Same as above, this time with a signal that is linearly decreasing from 1 to 0.1.

Now what is that?

Edit There was a mistake here: I accidentally used an uneven number of sampling points, which resulted in a complex signal after the ifft. Here is the fixed plot.

I'm interested in mathematical/theoretical as well as intuitive explanations of what's going on, as well as pointers on where to read on. I even had trouble finding a correct term for what I am doing.

Here's the R code that produced the above plots.

# First plot
t <- seq(0.01, 10, 0.01)
z <- exp(-t)*sin(t)
Z <- fft(z)/length(z)
Z2 <- Z[seq(1,length(Z),2)]
z2 <- fft(Z2, inverse=T)
plot(z)
points(Re(z2), col="red")
legend("topright", legend=c("original", "half-sampled"), fill=c("black", "red", "blue"))

# Second plot
x <- seq(1,0.101, -0.001)
X <- fft(x)/length(x)
X2 <- X[seq(1,length(X),2)]
x2 <- fft(X2, inverse=T)
plot(x)
points(Re(x2), col="red")
legend("topright", legend=c("original", "half-sampled"), fill=c("black", "red", "blue"))

Regarding example 1:
first of all, either the fft or the ifft needs to be normalised by the number of sampling points as you have done (actually you can normalise each by a factor of the square root of the number of points, it is just a meter of definition). However, in your case the ifft is half the length of the fft you performed. Hence your signal is divided by 2. If you would perform the normalisation when calling the ifft (using half the original number of samples) you should get the correct height.
Now, regrading the second part of the signal, it is not truncated. What you see is some kind of aliasing. Since you downsampled  without filtering, you get aliasing. This is the same concept as frequency aliasing (DFT and IDFT are basically the same). You should try to flip the input signal in the time domain and witness the results.

Next, regarding example 2:
Your problem is with the number of sampling points. Let me start by mentioning that since your signal is real, the frequency domain is symmetric.
In your first example you had even number of points. when you downsampled the frequency you still got a symmetric signal. In the second example you have odd number of samples. Therefore your decimated frequencies are not symmetric and the result is a complex signal. If you try it with one less (or more) sample it should give a similar result to example 1. On the other hand you can perform the frequency decimation while keeping the signal symmetric.


Derivation of the Optimal Matched Filter - Convolution vs. Correlation On the Wikipedia page for Matched Filters here, there is a matrix algebra derivation for an optimal matched filter. Now, considering the output of an LTI system is found using the convolution operator, why is the first step of the proof on the page is to consider:

$$ y = \sum_{k=-\infty}^{\infty} h^{*}[k]x[k] $$

instead of,

$$ y[n] = \sum_{k=-\infty}^{\infty} h[n-k]x[k] $$

the convolution operation? And is $h^{*}$ the complex conjugate of the impulse response?

Convolution commutes
$$
y[n]=\sum_k h[n-k]x[k]=\sum_k h[k] x[n-k]
$$
for $n=0$
$$
y[n=0]=\sum_k h[-k] x[k]
$$
If $H(e^{-\jmath \omega})$ is the Fourier Transform of $h[n]$, $H(e^{\jmath \omega})$  is the Fourier Transform of $h[-k]$,

The maximization for the matched filter is at the point $n=0$.

In communications $n=0$ corresponds to synchronization.

In a RADAR/SONAR problem the maximum output of the matched filter is the estimate of where $n=0$


Wavetable and Nyquist: which size do I need? I was reading this tutorial by the master earlevel, while trying to build some sort of wavetable.
He says First, let’s back up and figure out how long our tables need to be. Recalling that we need to sample a signal at greater than twice the highest frequency component, that means that for 368 harmonics, we need at least 368 x 2 + 1 samples, or a table length of at least 737 samples., refering to a 40hz (lowest wavetable frequency) and the following harmonics (up to 14720 hz).
Not really sure about those 737 samples keeping the sampling theorem by Nyquist.
Should be 40 * 368 * 2 + 1 samples needed? That's the real "highest frequency component" of the signal.
Why 368 * 2 + 1?
Not really sure why I just need a 737 samples to express a signal that reach ~15khz.

The wavetable is ignorant or agnostic about the playback rate and the sample rate in Hz.  What the wavetable knows about is how many points or samples define the waveform, $N$.  All it knows is the amplitude and phase of every harmonic (which are two numbers for each harmonic), and with a little bit of nuance regarding the DC component and, if the number of wavetable samples is even, the Nyquist component.
There is no phase property of the DC component, just a bipolar amplitude, which is fully described by one real number.
Because of aliasing, the Nyquist component must be a cosine component with no sine component to it at all.
So if $N$ is odd, you can fully define the DC component and both the amplitude and phase of $\frac{N-1}{2}$ harmonics, all below Nyquist.
If $N$ is even, you can fully define the DC component, the amplitude and phase of $\frac{N}{2}-1$ harmonics below Nyquist, and only the bipolar amplitude of the harmonic at Nyquist.
In all cases, $N$ real numbets fully define the wavetable and the DFT maps these $N$ numbers to the harmonic amplitude and phase data which are also fully defined by $N$ real numbers.


Why do eigenvectors specify the direction of fastest and slowest changes in the image I'm reading Szeliski's Computer Vision:Algorithms and Applications. On page 212-213, corner detector is discussed. I can understand upto equation 4.8. From then on, I don't understand how come eigenvectors of A specified the direction of slowest and fastest changes, and why does the shorter eigenvector specified the direction of fastest change?

The book can be found here http://szeliski.org/Book/drafts/SzeliskiBook_20100903_draft.pdf

Any help would be appreciated.

The eigenvector corresponding to the largest eigenvalue of the autocorrelation matrix indicates the direction of fastest change, while the eigenvector of the smallest eigenvalue indicates the direction of slowest change. Nothing strange here.

What's confusing is the Uncertainty Ellipse (Figure 4.6, page 213). The direction of slowest change is longer because it's scaled by the square root of the inverse eigenvalue of A. Really what it represents is the direction of the highest uncertainty.

Uncertainty and speed of change are different sides of the same coin:

high uncertainty <--> slow change
low uncertainty <--> fast change

The purpose of all this is to help us find good match points in an image. An example of a good match point is shown in Figure 4.5b. The reason it's "good" is because it has a well defined optimum. This occurs when the image has fast change in more than one direction (i.e. both eigenvalues of the autocorrelation matrix are large).

Figure 4.5c shows a match point that doesn't have a well defined optimum (it's more like a  ridge). The fact that we cannot precisely point to the optimum means that there is uncertainty in the direction of the ridge. The autocorrelation function of this patch will have one large eigenvalue and one small eigenvalue. The large eigenvector is in the direction of fastest change (a direction perpendicular to the ridge), while the small eigenvector is in the direction of the ridge.


Audio Processing Used in Voip Mobile Apps I am new to VoIP apps and am learning about the various audio processing that are applied in such apps. I have looked at Linphone and CSipSimple apps for Android. I notice that they employ different set of audio processing like echo cancellation, equalization, compression etc.

My questions:

How would a VoIP app developer decide what audio processing should be
used in an app ?
Is there a list of all processing options somewhere
online ?
Is there a methodology involved in selecting the needed
audio processing for an app ?
If I were to identify the minimum set
of audio processing needed for a VoIP app, how would I go about doing
it ?

How would a VoIP app developer decide what audio processing should be
  used in an app ?

experience, testing, looking at what others do (aka. typical software development).

So, you, for example, know that you need to work in situations where you'll have echos of your speaker in your microphone, so you add echo cancellation.

Do that with all negative effects that you know beforehand.

Then build a prototype, identify problems, find method to solve problem, repeat.

All in all, engineering.

  Is there a list of all processing options somewhere
  online ?

Sorry, that list would be infinite, so no.

But: You could read a (good) book on speech processing. That would make (somewhat) of an expert on the topic, and experts find solutions to problems by applying their knowledge!

  Is there a methodology involved in selecting the needed
  audio processing for an app ?

See first point. Engineering.

  If I were to identify the minimum set
  of audio processing needed for a VoIP app, how would I go about doing
  it ?

I'd argue that you start with a decoder for the audio codec and call "none" a minimum amount of post-processing that. Then you work up until the application works as intended.


Data smoothing in temperature measurements from MLX90614 BCC IR sensor I am trying to measure temperature with the MLX90614 BCC IR sensor for my project, and I am having problems with my precision requirement.  I had taken data for 1 second then took the mean of these values. I measured the hand of a human, which was 36.2°C. I took measurements for different distances also like 1 cm, 3 cm, and 5 cm. However, sometimes there is more than 0.1 °C difference between the mean of all measurements( I take measurements for 1 second always), and my goal is to compensate this difference to < 0.1 °C. I tried median, moving average, Savitzky-Golay filter, and a couple more, but none of them lowers the difference. When I checked the histogram of my data, I saw that even for a constant distance from the sensor, there is 0.4 °C variance. Is there any way to compensate for this difference by a filter, or do I need to use more physical requirements while taking measurements? Here are my histograms of data measurements for different distances and mean values:
Mean of the first figure - unfiltered: 32.2072
Mean of the second figure - unfiltered: 32.3612
Mean of the third figure - unfiltered:  32.2749
Mean of the fourth - unfiltered: 32.2735
Mean of the fifth figure  - unfiltered: 32.2243
Mean of the sixth figure - unfiltered: 32.1224
Mean of the seventh - unfiltered: 32.0925
Mean of the last figure - unfiltered: 32.2129
In summary, is there any way to decrease these mean differences up to max 0.1.

In any measurement application the VERY FIRST thing you should to do is to calibrate the hardware and characterize it's noise floor and data variance by doing measurements on a known device.
Start with measuring something that's guaranteed to be at a constant and known temperature and take histograms. These SHOULD have a more or less a gaussian shape with the mean matching the temperature of the device under test and the standard deviation being the capability of your measurement setup. If that's not the case or if the standard deviation is larger than you need it to be, you need to start debugging the hardware.
You histograms do not make a lot of sense. Typically you would expect a gaussian shape with a continuous distribution around the mean. The large gaps you have in your histograms indicate that there is something not working as it should .


How to get a Standard Deviation weighted average in image? Now I'm trying to implement a SDLWGW algorithm by the Matlab.
currently I'm referencing from
Automatic White Balancing Using Luminance Component and Standard Deviation of RGB Components
the problem is I can't understand  how to get a $SDLWA_{R}$ and the bar of $L_{red}(k)$?
Also what if the $L_{weight}(i,j)$ is $0.9$ then how to calculate the bar of $L_{red}(k)$?
I can't understand it.
I want to know that what is the different between $SD_{red}(k)$ and $SD_{red}(l)$?
$$SDLWA_{R}=\sum_{k=1}^{n}\frac{SD_{red}(k)}{\sum_{l=1}^{n}SD_{red}(l)}\times red_{i,j}(k) $$
What is the $SD_{red}(l)$? Especially, what is the $l$?
$$ \sum_{l=1}^{n}SD_{red}(l) $$
update 1
I have got a question one more,
The paper was written like this
L_weight(i,j) is a positive single-peak function (e.g
triangular function or Gaussian function) value for the
luminance value at i-th row, j-th column of the k-th block.
but I can't understand what is the mean? How can I make L_weight(i,j) ?
Would you please give me any hint please ?
update2.
I'm trying to understand a below answer.
Q1. What if I've got a this block then I think that the k is to
be 12 and p is 5, and q is 5. am I correct?
Q2. How to get a $\overline{L\_red(k)}$ value as below the case?
Q2-1. Especially, I want to know that what does exactly indicate the $L\_weight(1,1)red_{1,1}(k)$ and $L\_weight(1,1)$, as below the case?
I think we know the value of the $red_{1,1}(k)$ But I'm confused that how to know the value of $L\_weight(1,1)$ ?
[![enter image description here][2]][2]
update 3
Does anyone know the relationship between Gaussian weight and one Block ?

The $k$ and $l$ indices are to be understood with indexes under the $\sum$ sign. They can be called "free variables". Suppose that the block $k$ has only two pixels, then $p=1$ and $q=2$. So $\overline{L\_red(k)} $ is just a weighted average (a kind of center of mass) of the $2$ red components from the two pixels  of the block:
$$ \frac{L\_weight(1,1)red_{1,1}(k)+L\_weight(1,2)red_{1,2}(k)}{L\_weight(1,1)+L\_weight(1,2)} $$
which gives you a single value for each block.
Formula (5) has the same interpretation,  you perform the weighted average of those averaged values over blocks, with weights $SD\_red(k)$.

it is quite easy to use Matlab's block processing tools.


What could cause fast Fourier transform to give complex conjugate of the intended result? I have 2 real time series $x(t)$ and $y(t)$, after fft it should become $\tilde{X}(f)$ and $\tilde{Y}(f)$. Then I need to normalize $\tilde{X}(f)$ with $\tilde{Y}(f)$ : $\tilde{X}(f)/\tilde{Y}(f)=\tilde{Z}(f)$
However fft gives me $\tilde{Z}^*(f)$ instead (the sign of the imaginary part is inverted).
What could have caused this ? I know $x(-t)$ and $y(-t)$ can cause $\tilde{Z}^*(f)$, but $x(t)$ and $y(t)$ have the correct physical meaning.

Taking the inverse FFT (IFFT) instead of FFT would cause a phase inversion.


Transfer Function to go from a Step Input to a Linear Ramp between the two step values I want a very basic simulation of a linear axis that can be given a position demand, and it will move to that position at a constant speed. At this point, I do not care about acceleration, but if I can modify the TF to incorporate it that will be a bonus.

I will program this simulation using scipy
This is a discrete-time system
The position the axis moves to is exactly the demand (no steady-state
error, gain 1)
The speed is constant. Ideally, I would like this to be configurable. But for the sake of this example, lets say it is 0.2m/s.
There is no overshoot
It is the same for both positive and negative steps, i.e increasing or decreasing the position demand
I do not care about the delay between the demand change and when it starts to respond. Ideally, it would be 0 or 1 time steps, but this is a really simple simulation so I do not care that much.
If it is given an impulse input then it will either move slightly or not at all, but I am not that interested in simulating this
If it is given a ramp input, then it will behave similarly to the step input if the slope of the ramp is steeper than the velocity of the axis, and will still move at the constant velocity even if the demand ramp is less steep (hence it will stop and start to track the demand). But again, I do not really care about simulating this, and would rather have a simplified solution.
A very rough approximation is fine, I do not need to identify the system to a realistic level.

So basically, the transfer function that represents the system is one that turns a step input into a ramp that goes between the start and end values of the step. If we also include acceleration, then it will turn a step input into a sigmoid looking signal.
What is this transfer function?
I could also represent this as ZerosPolesGain, or StateSpace within scipy, so either of those will also suffice as an answer.
Thanks

A simple moving average with a rectangular window will turn a step into a ramp, but no linear filter can give you a constant slope, because linearity implies that scaling the input (step) will scale the output (slope). Instead, what you want is a non-linear slew-rate limiter that steps towards the target at constant rate (eg. take the minimum of the "distance to target" and your allowable rate, then accumulate).
If you never want to move "too slowly" then you likely need a state-machine. If you are in steady-state and the target has moved "far enough" from your current value, then transition to moving state immediately. When you reach the target, transition back to steady-state. If you are in steady-state but the target only moved slightly, then transition into a timer-state where you still check if the target is far enough to start moving immediately, but also start moving when the timer expires. The downside is that small steps (or shallow ramps) will cause you to wait for the timer, but this is unavoidable unless you want to constantly (in the worst case every time-step) switch between moving and not moving (at which point you are basically doing PWM).
If you want to smooth the acceleration, then this can be done by taking the output of the slew-rate limiter and filtering it further. One (or two if you also want to avoid jerk) passes of moving average with short rectangular window often works well for this and will give you symmetric acceleration vs. deceleration and will still reach the target in finite time. Exponential moving averages (aka. one-pole low-pass filters) can also be used, but in that case you will only reach your target asymptotically.


Signal Processing/FFT gives very high magnitudes for low frequencies The script essentially pulls PCM data from the sound card and stores them in a buffer. Then I apply fft and graph it. I am looking through this blog post for some examples and ideas on how to implement it myself.

Here is the gist of the script:

self.rate = 48100
self.buffer_size = 1024
...
def get_fft(self):
        data = self.get_pcm() #pulls 1 buffer (1024) of PCM data from the soundcard.
        fft = numpy.abs(numpy.fft.fft(data))
        fft = numpy.divide(fft, 10000)
        freq = numpy.fft.fftfreq(len(fft), 1.0 / self.rate)
        return freq[:int(len(freq)/2)], fft[:int(len(fft)/2)]

I am graphing it in a window with PyQtGraph and using a simple tone generator website to produce frequencies.

The frequencies do appear in the correct spot but their magnitude varies quite a bit even though I am not changing the volume or anything. This is especially the case when I slide toward the lower frequencies < 100hZ and the data is much higher in magnitude compared with the rest of the graph.

Am I doing something wrong, and if not, is there a way to dampen the lower frequencies so the entire spectrum appears "equal in magnitude" so to say?

UPDATE 1 (added a window function to the PCM data before FFT:

A very simple solution to your problem is to use a window on your dataset prior to taking the FFT. This classic paper by fred harris details the scalloping loss for all the popular windows. Note the following from this paper:

The scalloping loss for a rectangular window (meaning no window, which I believe is what you are doing) is 3.92 dB.   The minimum listed in Table 1 in his paper is 0.83 dB using a "Minimum 4-sample Blackman Harris". This presents a very simple solution in that you multiply your time domain by the appropriate window function prior to taking the fft, reducing the amplitude variation from 3.92 dB (36.4% drop from peak at bin centers) down to 0.83 dB (9.12% drop)!

Further you can combine this with overlap-add techniques if you are block processing streaming data, which is also further explained in the paper.

https://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf

Also if your requirements is simply for graphical reasons for a swept sinusoidal signal, do know that the signal is not actually "lost" but distributed to adjacent bins. You can recover most of the signal by root sum-squaring the adjacent bins (or all the signal by rss'ing all the bins and displaying this at the max signal location).  Doing this, for a sinusoidal signal, will eliminate all inter-bin variation.

Alternatively similar to the previous paragraph for a streaming application where we want to compensate the output for "presentation" purposes on a graph, predistortion (equalization) of the passband ripple prior to the fft would be simple to do, as long as you have more data available than the size of your FFT. A 3 tap FIR compensator would bring the ripple from 3.9 dB to less than 1 dB. This technique could also be combined with the windowing mentioned to bring the ripple down well below the 0.83 dB provided by the window.  Without windowing, each bin of the FFT output is a Sinc filter at the bin's center frequency with the nulls at all the other bins. Recognizing this, we could use an inverse Sinc approach as a compensator, following the design for a 3 tap inverse Sinc compensator given as my response to this post:

how to make CIC compensation filter

Trying out a first pass of this approach on a simple 4 pt DFT (to match the plots above), I was able to achieve the result shown in the plot below showing the scalloping loss of -3.92 dB as listed in fred harris' paper, and then the reduced deviation after using a simple 3 tap FIR prefilter.  This can be reduced further with an IIR approach of similar order, or more taps but at that point I would likely use a windowing approach (as the span of the taps is beyond the FFT data length).


Detect valve position without colors I can't find a solution for my problem and I need your help.

I have to create an application to detect if a valve is open or close like this :

https://www.youtube.com/watch?v=VY92fqmSdfA

Some valves had a handle with color, but some valve don't, I dont know how I am going to resolve this problem to detect the valve position "close" or "open" without colors, I can't use machine learning because I have only 3 valves without colors and I can't create a large database.

Template matching in the link below will work as a solution.

https://www.docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/template_matching/template_matching.html

The downside is you will need templates of all your valves handles(coloured or not), also the templates and images will have to be the same resolution.
Based on whether the template or the template rotated by 90 degrees matches you can come to a decision on the valves state.


How can I start learning about pitch detection? readers.

I'm working on a project where my goal is to implement a pitch-detection algorithm (PDA) in a piece of open-source software.

I have very little knowledge of pitch detection at the moment and started my research into it by reading through part of a paper on PDAs.

I wrote a similar post to this one on Music: Practice & Theory Stack Exchange (SE) and the advice I got was to start learning about digital signal processing.

My current plan is to study a set of lecture notes I have on digital signal processing.

I was also directed from Music SE to this SE site. Would any of you suggest a different or potentially better approach to learning about digital signal processing and PDAs (keeping in mind my ultimate aim of implementing my own PDA - I don't want to simply copy or plug in a library of someone else's, but study the pros and cons of other PDAs and then implement my own, with some element of novelty)?

i have to disagree with

  Calculation of the AMDF is less computationally expensive than the ACF due to the lack of multiplication operations (Niesler and Robinson ).

i don't think the cost of a multiplication is considered particularly more expensive than an absolute value.  (you might have a multiplier hanging around in your FPGA anyway.)

but this:

is new to me.  so they are looking for the value of $\tau$ that maximizes $f(\tau)$.

it looks interesting, but i don't see how it does better regarding the octave problem.  you could have a tone at A-440 that sounds like A-440 and then add to that a teeny-weeny (like -40 dB) amount of subharmonic at A-220.  the maximum $f(\tau)$ is might happen at $\tau = \frac{f_\mathrm{s}}{220 \text{Hz}}$ when you want it to happen at $\tau = \frac{f_\mathrm{s}}{440 \text{Hz}}$.

but i wonder what dividing by one plus the AMDF does to help.  it's something i hadn't thought about before.  i have to think about it a little.


How is frequency defined for a periodic signal? For sinsusoids, frequency is $2\pi/T$, but for general periodic signals, how is frequency defined? Is it $1/T$ or $2\pi/T$?

($T$ is the fundamental period of the signal)

In my world, frequency is inverse to period, i.e., a sinusoid with fundamental period $T$ has a frequency $f = \frac 1T$. Of course, angular frequencies are also common, in which case we have $\omega = 2\pi f = \frac{2\pi}{T}$, I guess this is what you were referring to.

If a signal is periodic but not purely sinusoidal, it does not have "just one" frequency. Instead, it will have a line spectrum, i.e., frequency content at integer multiples of its fundamental frequency. The fundamental frequency is, as above $\frac 1T$ if $T$ is the fundamental period, $\frac{2\pi}{T}$ if you prefer angular frequencies.

To be a bit more precise, if your signal $x(t)$ is periodic with period $T$ so that $x(t) = x(t+T) \; \forall t$, you can expand it into its Fourier series given by $$x(t) = \sum_{\ell = -\infty}^\infty \gamma_\ell {\rm e}^{\jmath \omega_0 \ell t},$$ where $\omega_0 = \frac{2\pi}{T}$ is the fundamental frequency and the coefficients $\gamma_\ell$ tell you how much energy there is in the different overtones of the fundamental.

*edit: Regarding your request for clarification "As there's "a time-period of a signal", there's no such thing as "a frequency of a signal"?"
You might think so, but I guess that's not the answer here. See, if a signal has fundamental period $T$, it is also periodic with $2T$, $3T$, $4T$ and to so. This means while we could consider $\frac 1T$ its base frequency, we might also consider $\frac{1}{2T}$, $\frac{1}{3T}$, $\frac{1}{4T}$ and so on, right? But here is the thing: this is also true for the pure sinusoid. And yet, its spectrum only has a line at $\pm \frac{1}{T}$. Which is the base frequency if you consider the base period, it would be the first overtone if you were to consider twice the base period.

So, that's not what's happening. What's happening is that the spectrum tells us how similar the signal looks to harmonics of certain frequencies. If you're given a harmonic, you just need one to explain the signal. If you're given a non-harmonic but periodic signal, one harmonic is not enough, you'll need the overtones as well.


Determining time-invariance of a system I have a question about determining time-invariance of a linear system. We are given this system and we need to determine if it is time-invariant or not:

$$y(t)=\int_{-t}^{\infty}x(-3\tau)d\tau$$

Now after doing the shifting $t-t_o$ you get two different outputs. Now that makes sense, but what confuses me is the variable substition that happens in order to check. I'll post a link to the picture on imgur,sorry for this but I don't know how to do it otherwise.

https://imgur.com/a/CBbe4Sp

Basically my question is why is the substittution $-3τ -t0$ and not just $τ -t0$. Also why are we substituing both the Z1 as well as Z2, isn't the goal to make try to make them equal? Like try to modify one to get the same result as the other?.Maybe someone can give me some insight.Sorry for the bad post I need instructions on how to post. Cheers!

You have a system with the following input-output relation:

$$y(t)=\int_{-t}^{\infty}x(-3\tau)d\tau\tag{1}$$

In order to check whether the system is time-invariant or not, we need to compare the shifted output with the output resulting from a shifted input. The shifted output is

$$y(t-T)=\int_{-(t-T)}^{\infty}x(-3\tau)d\tau\tag{2}$$

Shifting the input means applying an input signal $x_T(t)=x(t-T)$. Note that $x_T(-3\tau)=x(-3\tau-T)$, so the response to the shifted input is

$$y_T(t)=\int_{-t}^{\infty}x(-3\tau-T)d\tau\tag{3}$$

The system is time-invariant if $(3)$ equals $(2)$. So we try to make the integrand in $(3)$ look like the one in $(2)$ by substituting $-3\tau-T$ by $-3\zeta$, which gives

$$y_T(t)=\int_{-(t-T/3)}^{\infty}x(-3\zeta)d\zeta\tag{4}$$

Now $(2)$ and $(4)$ have the same integrand, but we see that the lower integration limits are different. Consequently, $y_T(t)\neq y(t-T)$, hence the system is not time-invariant.


Choosing a Sampling Rate and a Cutoff frequency I have an assignment:

  You wish to generate a pure 1000 Hz tone digitally using a computer. How would you choose a sample rate that assures that you could generate the tone and use the same sample rate to generate a 20 kHz tone? Specify the corner frequency and slope of the filter would you need to assure that the tone is as close to perfectly pure as possible?

My current thought is to sample at 10 kHz because that is well above the Nyquist rate for the 1000 Hz tone and then the first harmonic would be at 20 kHz. I assume I would then need a steeply sloping Chebyshev filter that cuts off just above 20 kHz? Am I on the right track?

The question states

  … generate … digitally … same sample rate to generate a 20 kHz tone.

So, you want to digitally create a 20 kHz tone, too.  You hence need to have a sample rate that is sufficient for 20 kHz.


Closed form expression for $\sum_{k=0}^{n} \alpha^{-k}$? I have seen this sum a couple of times now in the textbook and in the problems book but I don't know how to solve it. I know this might be more suited for math.stackexchange but since this is a fairly common sum and is related I'm pretty sure someone can help. Thank you!


Physical interpretation of 4th-order correlations BACKGROUND:

Let's say we have samples of a random process $X(t)$ at two different times, $t_1$ and $t_2$, denoted $X(t_1), X(t_2)$.  The values of $X(t)$ represent some voltage-like quantity (i.e. a voltage, current, or field). Assume $X(t)$ is a zero-mean, real-valued wide-sense stationary (WSS) process.

For the second-order statistics,  we usually treat the quantity $\mathbb E[X^2(t)]$ as the average power.
The expectation $\mathbb E[X(t_1) X(t_2)]$ is just the autocorrelation function evaluated at lag $\tau = t_2-t_1$.

QUESTION:

Is there some physical interpretation of the 4th-order correlations, i.e. $\mathbb E[X^3 (t_1)X(t_2)]$, $\mathbb E[X^2 (t_1)X^2(t_2)]$, and $\mathbb E[X (t_1) X^3(t_2)]$?

If you are willing to relax the WSS assumption, and consider cyclostationary signals, you might check out my theory of pure and impure sine-wave components of higher-order probabilistic parameters:

On pure and impure sine-waves, higher-order moments, and cyclic cumulants

and

Oddities concerning pure nth-order sine waves

I've thought about your question a lot, more so in the past than lately, and all I've been able to come up with is that higher-order moments contain characteristic sine-wave components (characteristic of the process, the order, and the number of conjugated factors), and higher-order cumulants characterize what is new in the moment that cannot be accounted for by products of lower-order moments. Unlike the easy physical interpretation of autocorrelation as power (think of the zero-lag autocorrelation), I don't have a simple physical unit to assign here, but maybe my hint will lead you to a more satisfying answer.


OFDM transmitter data rate i am simulating OFDM transmitter in matlab....As u all know OFDM consists of different sub systems such as FEC coding, Bit interlever , Modulator , IFFT block and Adding cyclic prefix.... i have integrated all the subsystems.. now i have to check the datarate of the complete OFDM transmitter...how to find the datarate of this system.... i am comparing Different modulation technique, in the sense am using qpsk, 8 qam and 16 qam modulations and have to compare the datarate of these modulation techniques...

A bit rate can't be "measured" like a physical quantity but it can be calculated from the following parameters (given the subsystems you mentioned):

$f_\mathrm{S}$ sampling rate
$N_\mathrm{SC}$ number of subcarriers (= IFFT size)
$N_\mathrm{U}$ number subcarriers used for data transmission (excluding possible pilot tones)
$N_\mathrm{G}$ length of cyclic prefic in samples
$M$ number of bits per subcarrier (for L-QAM, $M = log_2L$) (*)
$r$ coderate of FEC, where $r = k/n$, with $k$ length of code word, $n$ length of information word

The length $T$ of an OFDM symbol is the basic symbol length plus the length of cyclic prefix:
$$
T = \frac{N_\mathrm{SC}}{f_\mathrm{S}} + \frac{N_\mathrm{G}}{f_\mathrm{S}}
$$
Each OFDM symbol contains $N_\mathrm{U}$ subcarriers that carry $M$ bit of information each. Thus the bit rate $R$ is (excluding FEC):
$$
R = \frac{N_\mathrm{U}M}{T} = \frac{N_\mathrm{U}Mf_\mathrm{S}}{N_\mathrm{SC} + N_\mathrm{G}}
$$
Finally, if some overhead by FEC is added, the net bit rate $\tilde{R}$ is given by
$$
\tilde{R} = rR
$$

(*) A note on $M$: as Jim Clay has pointed out in his comment, the number of bits doesn't have to be the same for all subcarriers but is sometimes chosen individually for each subcarrier. This is often refered to as "bit loading". In this case $N_\mathrm{U}M$ in the expression for $R$ has to be replaced by
$$
\sum_i^{N_\mathrm{U}}M_i
$$
where $M_i$ is the number of bits on the $i$th subcarrier.


RoC of Z transform of signal consisting of 3 values Let's consider the signal $x[n]=\{x[1],x[2],x[3]\}$

It's $\mathcal{Z}$ transform is $\frac {x[1]}{z}+\frac {x[2]}{z^2}+\frac {x[3]}{z^3}$

My textbook says it converges for all values of $z$ but there is a pole at $z=0$, so which one is true?

When we speak about convergenge in all the $Z$ plane, the points $z=0$ and $z=\infty$ are not considered.

Note that by time-shifting the signal, you include/exclude zeros and poles at these 2 special points.


how to use image filters for spectrograms? Using MATLAB, I can import an audio signal and use some FFT function to get the spectrogram into the workspace. My question from here, is how to then process this spectrogram with image filtering techniques that usually import some image. For example, here is the code that filters an image:

J = imread('example.jpg');
K = somefilter(J);

my question is the imread part; as you can see the image is imported to J and then this J is used for the processing function below. However, can I simply input my spectrogram data from the workspace directly into the filter argument? or is there some other step that needs to happen before?

Also, most image filtering matlab codes mention sometime the input is grayscale image or RGB, color, etc. My question is: how is a spectrogram in Matlab classified as? does it matter for the filter? do I need to convert the spectrogram then?

A spectrogram of a monochannel (real) audio file would generally be a complex 2D matrix, hence a sort of complex image.  So you can use 2D filters directly on the complex matrix in the workspace. However, filtering complex data can be complicated, due to the non-linear coupling between the phase and the magnitude: if you want to preserve the Hermitian properties, which is useful when you want to invert the spectrogram into a real (filtered) signal. So traditional algorithms like  enhancement, shrinkage, adaptive filtering, masking are possible.

Thus, no need to go through an intermediate binary format like:

  J = imread('example.jpg');

that will quantize or compress values and somehow loose the complex aspect.

Note that processing complex values requires some care. In many situations, people only want to analyze the magnitude of the spectrogram, which then become a mere positive real-valued 2D matrix. Then, all sorts of 2D processing are available. In that case, you should take care of preserving the positivity. Most linear filters with non-negative coefficients will do the job. Non-linear processing tools based on histograms, on ranking, may require a simplification of the floating-point values.


Envelope detection in frequency domain with MATLAB I need to compute the envelope of a spectrum in MATLAB. Is there a specific function that can do it?  I saw the function

[yupper,ylower] = envelope(x,np,'peak')

but i'm not sure this one can be used in the frequency domain. The image below shows the result I would like to obtain (green line).

Any suggestion? Thank you.

you can use envspectrum.
a good example is shown in this example.


RMS averaging in spectrum analyzers While studying spectrum analyzers I ran into the concept of RMS averaging as a mean to reduce dispersion of data without affecting power spectral density (PSD).

What is not really clear to me is how this is achieved: as per the calculation, I found that it is obtained by averaging the magnitude of the squared values of each FFT's frequency bin over a certain number of acquired traces. However, while the definition itself is not the problem and it is obvious that the dispersion of data will be reduced (it's an average), I don't see how the PSD can stay the same without being affected by such a computation.

------EDIT------

Here follows all I found on the subject (professor's online notes):

`` • Change of point of view: now we want to measure the power spectral
density of noise without reducing it

• Since we processed the input signal by truncating and sampling, also white
noise trace is displayed with a «noisy» spectrum

• In order to quantify the noise power density, it is useful to introduce the
RMS averaging, that is the average on the magnitude of the square value
of each frequency bin of the FFT performed on Np traces

• This technique reduces the dispersion of data displayed without changing
the PSD''

A straightforward way of estimating the PSD is to compute magnitude squared DFT (a.k.a. periodogram).

Suppose we have an $N$ point sequence $x(n)$ and we would like to estimate its power spectral density (PSD) $P_{xx}(f)$.

Method 1: Periodogram

We compute the magnitude squared DFT. No averaging.
$$
\hat{P}_{xx}(f) = \frac{1}{N}\left |  \sum_{i=0}^{N-1} x(n) e^{-j2\pi fn/N} \right |^2
$$

Method 2: Periodogram Averaging

We instead use $M$ different realizations of the $N$-point sequence $x(n)$ giving us $M$ sequences $x_i(n)$, $0\leq i\leq M-1$. We compute the periodogram estimate $\hat{P}_{x_ix_i}(f)$ of each $x_i$ and average them to get the final PSD estimate:
$$
\hat{P}(f) = \frac{1}{M}\sum_{i=0}^{M-1} \hat{P}_{x_ix_i}(f).
$$

It can be shown that the variance of this averaged periodogram estimate is lower:

$$
\mbox{Var}[\hat{P}(f)] = \frac{1}{M} \mbox{Var}[\hat{P}_{xx}(f)].
$$

Note that it is a little unfair to compare Methods 1 and 2 because Method 2 uses more data ($MN$ data samples, instead of just $N$). If all you have is the original $N$ point sequence $x(n)$, you end up making a tradeoff between PSD estimator's variance and frequency resolution.

The PSD of the underlying signal is what it is. A computational routine will produce an estimate of this PSD. Whether a PSD estimate is good or bad will depend on your definition of good or bad. One commonly used metric variance. In that sense, periodogram averaging estimate $\hat{P}$ is a better estimator of the PSD $P_{xx}$ than $\hat{P}_{xx}$.

cf. Bartlett Method, Welch Method

Reference: Digital Signal Processing, Proakis and Manolakis, Ch. 14 (4th ed.)


How to Combine FFT Overlap Results? We currently have C/C++ FFT code with Hann Window function support. For a large data (over 10,000) we want to split this into 1024 samples with 50% overlap. For each 1024 sample, we window and fft.

What is the recommended way to combine all the results from these smaller overlapping results to obtain a presentable results for the over 10,000 data?

Update: For the poor explanation.
The process is best illustrated by the following links

https://spectraplus.com/DT_help/overlap_percentage.htm

https://www.youtube.com/watch?v=LlyH6YciDhw

I'm not sure what your intent is, but the organization of the computation can be done using straightforward overlap-and-add or overlap-and-save methods.

If you're attempting to look at data statistics in the frequency domain, a good starting might be to look at Welch's method and its descendents.


Simple VAD (Voice activity Detector) implementation I am to classify few recorded phone calls as either containing speech or not by sampling lets say first 10 seconds.

The files contain either silence, dialtone or ringtones, or real human voice.

I have tried implementing butter-worth filter 100hz-400hz, then calculating Short time energy, Zero crossing rate, then calculating variance of the resultant array. But the results aren't good, calls with ringtones are confused with human voice.

I am implementing this in matlab or python (scipy & numpy)

Based on the highest frequency you expect in your signal define the sampling rate. Accumulate samples for 10 seconds and carry on an FFT, in groups to allow for enough energy in bins based on expected frequencies.

silence will have a typical low power with noise structure.
Dial tones and ringtones will have distinctive, pre specified bins.
Voice will have higher power than noise with some similarities to noise. You might fine tune your analysis but I do not think you will need it.


How to prove $\int_{\Omega} \sum_{i=1}^{N} f_i(x)dx$ is equivilant with $\sum_{i=1}^{N} \int_{\Omega} f_i(x)u_i(x)dx$ I have a 2D image defined on a region $\Omega$. Assume that the region can be separated into $N$ sub-regions $\Omega_i$ such that $$\forall i,j=1... N:\Omega_i \cap\Omega_j=\emptyset$$ and $$\bigcup_{n=1}^{N}\Omega_n =\Omega$$

Let $u_i(x)=1$ if $x \in \Omega_i$, otherwise $u_i(x)=0$. Then for a familiy $\{f_n:n\in 1..N\}$ of functions on $\Omega$ we have $$x \in \Omega_k \implies \sum_{i=1}^{N}f_i(x)u_i(x)=f_k(x)$$

I have a energy function that is defined as following
$$E_1=\int_{\Omega} \sum_{i=1}^{N} f_i(x)dx$$

Does the below equation $E_2$ equate with above energy function $E_1$? How to prove it?
$$E_2=\sum_{i=1}^{N} \int_{\Omega}  f_i(x)u_i(x)dx$$

That is my prove

Starting from your $E_2$ and exchanging the finite sum with the integral we get this:

$$E_2=\sum_{i=1}^N \int_\Omega f_i(x) u_i(x) dx = \int_\Omega \sum_{i=1}^N f_i(x) u_i(x) dx$$

Next we can use the disjoint cover $\{\Omega_i\}$ of $\Omega$ to split up the integral:

$$E_2 = \sum_{k=1}^N \int_{\Omega_k} \sum_{i=1}^N f_i(x) u_i(x) dx$$

The $x$ in the integral are now from $\Omega_k$ and we can apply your identity for the sum over $f_i(x) u_i(x)$:

$$E_2 = \sum_{k=1}^N \int_{\Omega_k} f_k(x) dx$$

This is almost your $E_1$, but not quite. We cannot exchange the integral with the sum because the integral depends on the summation index. Extending the integration region to $\Omega$ is also not possible without reintroducing a selection function. So your $E_1$ and $E_2$ are not equal. The closest thing to $E_1$ is what I have derived above.


This is about signal processing in the first radar I read in a book that the first radar was a CW one that was used to detect ships.  Since it was CW, did it use Doppler to detect the moving ships?  What was the signal processing used in it?  Is there any reference to this information?

Indeed, in the very first time of radar, the technology necessary to measure delay between transmited and received echoes wasn't avaible for EM waves.
I think that these first type of CW radars weren't used for ranging, only for detection.
Using only one sensor which emit and receive the CW signal you can't perform ranging. In a bistatic configuration, i.e. the transmitter and the receiver arn't colocated, you may perform rangin by imposing a constraint on the target's kinematic (for instance, constant speed) and integrating measurments over time.
Using a network of sensor (so called multistatic configuration) you may perform "real time" ranging without having to integrate measurments nor imposing a kinematic model on the target's motion.

Direct answer : These early radar were used only for detection and not for ranging.


Haar Training with object Blacked out in Negative Samples I am wondering if there is any downside to blacking out the target object when it appears in negative samples during Haar Cascades training.

Basically, If i want to detect a human nose. Can I just get lots of face images and black out the nose for the negative samples. I would then get lots of cropped pictures of the nose for positive samples.

I was wondering if there is a downside or problem with having lots of negative samples with the same non-nose feature e.g. a black rectangle. Is this going to train the cascade to expect a black rectangle in the negatives....????

Sorry if this questions seems naive but I have not done haar training before and the answer might help others who are investigating the training process...

I have had good success doing this with my training sets. I have modified the OpenCV_Annotation application to present a fixed rectangle that moves with the mouse, once the space bar is pressed the coordinates are written to the positives.txt file and a copy of the image is saved into a pre-defined negatives subdirectory after graying out the rectangle.
I have seen no training problems or performance issues although I use other negatives as well as the blurred out images. The application uses a gray background to overwrite the identified area instead of just blacking it out. I am unsure if that would make a difference in the negative.


Is the STFT a good solution to guitar monophonic pitch detection? Let’s assume that the audio input will be:

Guitar audio
Monophonic audio

Is the STFT overkill? Is it enough to produce a time-frequency plot and from there find the notes played at each instance? What problems could arise?

No.  An STFT is not only not overkill, it is not enough to find guitar "notes" reliably.  An STFT measures energy at selected spectral basis frequencies.  But a note usually refers to psychoacoustic perceived pitch, or pitch frequency, which is very often not the same as the spectral frequency peak, especially for guitar notes.  Guitars can produce more sound power at various (potentially slightly inharmonic) harmonic frequencies than at the perceived pitch frequency.  Also, the STFT basis vector frequencies may not accurately correspond to any of the musical frequencies of interest (being between them instead).

Try looking up pitch detection/estimation algorithms instead of using an STFT or bare FFT magnitude.


How to detect Frequency Sweep Direction when Channel is unknown So I would like to try to modulate data using the direction of frequency sweep (a data bit of 1 would be an up sweep, and 0 a down sweep). Encoding my transmit signal is fairly easy, but i'm not sure how I would actually go about decoding the received signal. To help make things clear, please see the figure below where I have and 8 bit data stream, and the spectrogram of the transmitted and received signal. For this example my sampling frequency is $4000\textrm{ Hz}$, and my frequency sweeps are going from $0$ to $2000\textrm{ Hz}$

I've also added in a channel aspect the the figure above. My channel will be unkown, and will change from time to time (but will be constant during any single transmission). The figure below shows the channel response, which is just 2 stop bands.

In the first figure, I and can clearly see the patern of an up sweep and down sweep, but I'm not sure how I would go about actually decoding in an algorithm. I've done work with differential encoding (DPSK) and know how a method to sync and decode that kind of data, but i'm not quite sure where I would start here. The only think I could think of is to take over lapping FFT's and see which bins have the highest magnitude and try to track the direction from there.

Thanks for any input! Please let me know if I can clarify anything!

EDIT:

I tried using two matched filters as MBaz suggested such that my matched filter for my up sweep is $h$ = up sweep signal, in MATLAB it's chirp(time,startFreq,1,stopFreq). I'm then creating my matched filter output as seen below, where $y[n]$ is my output, and $x[n]$ is my received signal

$$y[n] = \sum_{i=0}^{\textrm{length}[h]} h[i]\star x[n+i]$$

I get the output as seen below, with thin spikes corresponding to the appropriate up and down sweeps. (note, it's hard to see, but there is a spike at the very beginning of the up sweep plot)

I'm hoping to get something similar to the bottom plot on the figure below, where the plot peaks at the end of the symbol, which could be used for syncing of the signal I believe.

See below for a python matched filter implementation. I generate an up-chirp and down-chirp. Then, subsequently I filter this signal by two matched filters, each filter is matched to one signal shape. As you see, there are two very strong peaks in the matched filtering. The reason why there are two peaks instead of (what you expect) slowly growing and falling triangles is that the chirps create an orthogonal basis, i.e. two time-shifted chirps are orthogonal, i.e. the MF output is zero. (The chirps are only orthogonal for infinite-time, which we dont have here, so there is still some small non-zero MF output).

import scipy

Fs = 10000
t = np.arange(0, 2, 1/Fs)

f = 500*(2-t)

signal = np.sin(2*np.pi*f*t)  # generate an down- and upchirp

f_ax, t_ax, Sxx = scipy.signal.spectrogram(signal, Fs)
plt.figure(figsize=(8,8))

plt.subplot(211)
plt.pcolormesh(t_ax, f_ax, Sxx)

plt.subplot(212)
plt.plot(t, np.real(signal))

chirpDown = signal[:int(Fs)]  # extract both signal shapes from the signal
chirpUp = signal[int(Fs):]

rx = signal + 0*np.random.randn(*signal.shape)

# perform the matched filtering (this means convolving with the time-reversed sequence)
t_c = np.arange(0, 3, 1/Fs)[:-1]
plt.plot(t_c, np.convolve(chirpDown[::-1], rx))
plt.plot(t_c, np.convolve(chirpUp[::-1], rx));

So, in order to detect those peaks, you can select the maximum of the MF output for each symbol duration (in case you are not perfectly synchronized) and compare which MF had higher output. Then, you reset the maximum value and search the next symbol period. Alternatively, you can convolve the filter output with some triangle or Gaussian, to get wider peaks.  For example, you can do the following to get an output similar to your posted figure:

triang = 1-abs(np.arange(-1,1,1/Fs))
# perform the matched filtering
t_c = np.arange(0, 3, 1/Fs)[:-1]
mf1 = np.convolve(chirpDown[::-1], rx)
mf2 = np.convolve(chirpUp[::-1], rx)
plt.plot(t_c, mf1)
plt.plot(t_c, mf2)

plt.figure()
plt.plot(np.convolve(mf1-mf2, triang))


Time position in STFT output How can I understand in which time position in STFT function output am I?

For example, if I have 3987 time frame in the output of STFT, my window length is 625 (hamming), my hop size is 125 and the length of signal is 2 second.

How can I estimate for example the first 5 milisecond or a window of 10 milisecond in the ouput of STFT? I know that the the number of time frames are calculated by
coln = 1+fix((xlen-wlen)/h);
But how is the equation in my situation?
Can I say that each time frame has a length of hop size?

Assuming 0-based vectors, hop size $H$, and window size $M$, the frame number $N_f$ will contain the DFT of a window that starts on sample $n_1 = N_f \times H$ and ends on sample $n_2 = n_1 + M -1$.

That means that for each STFT frame, you shift the window by $H$ samples. Note that $H$ and $M$ not necessarily coincide.


Are capacity and spectral efficiency identical for a dicrete-time digital signal? I saw this answer and saw on the wikipedia page that both spectral efficiency and capacity can be measured in bpcu i.e. 'bits/symbol'. I just want to confirm then that they are identical for a discrete-time digital signal.

This diagram is plotting $\log_2(1+SNR)$ but referring to it as 'capacity', which confirms my suspicion because this should typically be spectral efficiency before being multiplied with bandwidth to get capacity. I consistently see diagrams showing 'spectral efficiencies' and 'capacities' showing this range of values.
I do not know where the $1/2$ factor came from in the answer I linked, or why they've used variance of the discrete noise in the SNR, but it appears that capacity and spectral efficiency are the same for a digital signal.
My guess would be that 'channel use' means per sample. Imagine an OFDM with 64 subcarriers using 16QAM and pretend none of the carriers are used for pilots or guard bands. The total number of bits per symbol will be 4*64 i.e. 256, but because there are 64 samples in a symbol and hence 64 frequencies used, if you divide that by 64 you get 4. Therefore spectral efficiency = channel use in this scenario?
If 48 of the 64 subcarriers are used to transmit data and the rest are pilots and guard bands, then I'm guessing that the spectral efficiency changes to 192/64 and changes to 192/80 if you include the cyclic prefix i.e. 2.4 bpcu before taking into account error coding of 3/4 where it becomes 1.8bpcu. And modulation efficiency is 4 bpcu now? i.e. 192/48.
Is this because there is no concept of a capacity as distinct from spectral efficiency in a discrete-time signal?
If you calculate the spectral efficiency of the OFDM signal using the bps/Hz method, you get the same result i.e. $\log_2\left(1+\frac{S}{N}\right)$, but the capacity is instead $B\log_2\left(1+\frac{S}{N}\right)$ i.e. 20MHz x 4 bits = 80Mbps. You can also calculate this capacity if you know the capacity in bpcu and know the time interval of the channel use, then you do 4*sample freuquency = 4 x 20MHz = 80Mbps

The capacity is a property of a channel. A channel can transport no more than a certain amount of information per channel use. When we use a fixed modulation and coding scheme ("discrete-time signal"), this scheme will be able to support a certain amount of information per channel use (which for the channel to support it must be $\leq$ its capacity). It is thus strictly speaking incorrect to speak of the capacity of a certain modulation and coding scheme.
For a given modulation and coding scheme such as a QAM, you can of course compute its achievable data rate in bits per channel use (i.e., per unit bandwidth). You can also interpret this as a spectral efficiency, since it measures how efficient the scheme uses bandwidth (how many Mbit/s do I get for each MHz of bandwidth I invest?). And the results you get may be reminiscent of the capacity since under certain conditions, the schemes can get somewhat close to it.
It is still not the same. Capacity is a property of a channel, spectral efficiency is a property of a transmission scheme (modulation and coding scheme).


Room impulse response 'noise' I am working on getting room impulse response(RIR) and the first order reflections of a room.
For now I am stuck at getting proper RIR.
I followed Joseph's work and implemented on my own.

My setup uses:

microphone - mic in webcam (Logitech C920 HD Pro)
speaker - usb powered speaker connected to 3.5mm laptop audio port (havit brand with squarish shape)
room - almost empty room. dimension about 6.3 x 4.8 m or 250" x 190"
audacity - edit audio obtained
matlab - plotting of the graphs and doing other stuffs

The image below contains four graphs;

First is the recorded sound by Joseph
Second is the impulse response of a room used by Joseph
Third is the recorded sound by me
Fourth is the impulse response I've gotten.

The impulse in second graph is quite visible as compared to the fourth graph.
Here is my question.

Why is the impulse in fourth graph (the one I did) not very visible?
What causes this to happen?

I suspect it is caused by equipment and room as that is the only difference i can think of.

I wish to listen what you guys would say about this. Feedbacks, guidance and improvements will be very much appreciated.

Thanks

First of al it's a very exciting idea to capture a room's impulse response. Hence congratulations on your challenges. Assuming that you have correctly implemented the software he provided in his page, then the only cause of the differences are; (Note: I can say nothing about his method of computing the RIR. It can be a proper method or not... Only the possible cause of differences you observe I'll discuss)

1- Speakers: He uses monitor quality Yamaha speakers, you use crappy PC speakers (just like mine or yours; they are all crappy when compared to a Yamaha monitor speaker)

2- Microphones: He uses high fidelity, high linearity, low noise, high sensitivity microphones , you use web-cam crappy microphone. (again we all use those PC microphnes but they are crappy compared to any professional one)

3- Speaker and microphone placement: it's very vital that you place the speakers and the microphones to the correct places, otherwise you will be measure something that you don't want or need to.

4- Room: His impulse response is from a church. Your's is from a living room. When compared to such a structure, so you should be measuring different room impulse reponses of course.

However, even the most interesting part is, how and why do you judge your impulse response from its graphical plot appearance? You should judge it from its acoustical result point of view.

Have you tried your calculated room impulse response to add a reverb effect to dry audio, to see if it works? i.e.,to see if the dry audio becomes as if it was played and recorded in that room you refer to its impulse response?

You should do this test with a head-set ! otherwise you would be applying the room impulse response twice when played back in the same room...


Polyphonic detection/Mulit-pitch detection/Chord recognition I build application witch will be transform piano sound to musical notes. I found some pitch detection algorithms with implementations (mainly based on autocorrelation or fft), but chord recognition, of course is  not working.
What is best method for instrument as piano(both hands + chords)?
Is there any implementation of this problem?

As @jan pointed out, you're probably asking for a little too much, especially if you're looking for a ready implementation. Doing a quick search on Google, I came across several papers that may be a helpful start.

In this paper called Multi-pitch Detection Algorithm Using Constrained Gaussian Mixture, the authors use the Expectation Maximization algorithm to solve a Gaussian Mixture Model to detect multiple tones. This is most likely not a very computationally efficient algorithm, since mixture models are normally very hard to solve, and have to be primarily done offline (no real-time version).

If you're looking for a moderately robust, but potentially fast algorithm, look at this Stack Overflow answer. The author recommends MUSIC and ESPRIT algorithms.

The best thing to do is to give something a try and come back to us with specific DSP and algorithms questions and sites like Stack Overflow for specific implementation questions.


Real-time wavelet decomposition and reconstruction for ECG feature extraction I need to locate R-peaks in an ECG signal. I'm using wavelets to extract QRS complexes:
First, I decompose the signal using a maximal overlap discrete wavelet transform with the Symlet 4 wavelet. This wavelet resembles the QRS complexes I want to detect. I then copy scales 4 and 5, because this band maximizes QRS energy. The wavelet coefficients on scales 1-3, and the level 5 approximation coefficients are set to zero. Then I perform an inverse wavelet transform on these modified coefficients. The result is a signal in the time domain that contains mostly QRS complexes, and has very high amplitude at the R-peaks.
I just use a peak detector on this signal to locate the R-peaks.

Everything is well-explained here: https://mathworks.com/help/wavelet/ug/r-wave-detection-in-the-ecg.html

This is the code I use:

wt = modwt(rawECGsignal_buffer,5);
wtrec = zeros(size(wt));
wtrec(4:5,:) = wt(4:5,:);
filtered = imodwt(wtrec,'sym4');

From what I understand, the Symlet 4 is a biorthogonal wavelet, which means that the decomposition and reconstruction can be implemented as a bank of high- and low-pass FIR filters.

Right now, I read the live ECG data into a 5 second buffer, and then perform the wavelet filter on the buffer (as described above). This seems rather inefficient, because I have to filter the entire buffer again when new data comes in.
Is it possible to implement this in a way that allows for real-time filtering of an ECG signal without buffering?
(I.e. single value in → wavelet 'filter' → single filtered/reconstructed value out)

Right now, I read the live ECG data into a 5 second buffer, and then perform the wavelet filter on the buffer (as described above). This seems rather inefficient, because I have to filter the entire buffer again when new data comes in.

You cannot avoid the filtering / reconstruction steps over the buffer with this kind of processing.

  Is it possible to implement this in a way that allows for real-time filtering of an ECG signal without buffering?
  (I.e. single value in → wavelet 'filter' → single filtered/reconstructed value out)

Yes.

For block processing, you can use the overlap add or overlap save methods which can also work straight in the time domain.

For sample-by-sample processing, you can start with the basic formula of discrete convolution:

$$ y[n] = \sum_{k=0}^{k<N} x[n-k] \cdot h[k]$$

Where $y$ is the output, $x$ is the input and $h$ is the impulse response, or "filter coefficients".

To get rid of the indexing by $n$, shift the input $x$ by one sample and place the newly acquired sample in the beginning of $x$. You can do this in MATLAB with circshift. So, this would probablly look like x=circshift(x,1);x[1]=input_value.

This now leaves us with getting the $h$ coefficients. You can get those for the wavelets you are using, in MATLAB, using wfilters.

This would cover the application of 1 filter. You will have to repeatedly do this for all the levels you need for both the directions of analysis and reconstruction plus the steps of decimation / upsampling.

So, overall, denoising the ECG in such a way is very demanding. Were the typical QRS detectors (possibly with the addition of "pulse-filters") failing to provide a robust enough R-R sequence?

Hope this helps.


OFDM over FHSS Constellation detection I am working on identifying the constellation used by an OFDM based protocol.

After extracting the Symbol and Cyclic Prefix from the recorded signal, interested to identify the used constellation/modulation scheme(QAM4/16/…).

Applying a high resolution FFT(size=$2^{19}$), reveals the ~64 bins(Red picks) of the first symbol payload(without the CP).

However, examining the samples on a complex axis, yields(right)

Wondered what may be the  cause for such a structure.

Here
is my MATLAB data Structure of a several burst (I+Q), and can be loaded using:

strct=load('E:\....\fhss_1.mat');
FHSS_1=strct.fhss_1;

The beginning of the first symbol for fhss_1.mat is located at: 14653, the size is 3650(samples).

Not a definite answer, but here's some analysis on the data:

strct=load('/tmp/mozilla_mmatthe0/fhss_1.mat');
FHSS_1=strct.fhss_1;

start = 14653;
Ns = 3650;
Ncp = Ns/8;
N_total = round(Ns + Ncp);

symind = 10;

X1 = FHSS_1(start+symind*N_total+(1:Ns));
subplot(211);
plot(mag2db(abs(fft(X1))))

fstart = 2593;
fend = 2701;
xlim([fstart-50, fend+50]);

QAM = X1(fstart:fend);

subplot(223);
plot(QAM, 'x-')
axis equal;

subplot(224);
delta = QAM(1:end-1) ./ QAM(2:end);
hold off;
plot(abs(delta)); hold on;
plot(angle(delta), 'k-');
plot(abs(QAM), 'r-');
legend({'abs(delta)', 'angle(delta)', 'abs(QAM)'});

My observations:

the SNR seems to be fairly high (the noise floor in the spectrum is much below the signal part)
There seems to be a strong correlation between adjacent symbols along the subcarriers. I mean, when drawing the constellation symbols along the subcarriers, and connecting the adjacent subcarriers with a line (i.e. a normal "plot", I get a somehow spiral (bottom left figure).

My conclusion: The QAM symbols are highly structured. This does not seem like a data transmission. Instead, it appears to be something like a preamble/synchronization sequence, and these dont need to follow a given constellation. So, the answer might be, that there is no constellation behind.

This answer is to start some discussion on the data. It's not definite.


Linear Predictive coding vs AR modeling I'm looking for a suitable explanation of the circumstances in which the LPC error polynomial for a discrete time process x[n] is replaceable with an error polynomial categorized under the AR model? I found this book which states that LPC reduces to AR if the error becomes predominantly white noise(i.e by increasing the number of previous samples in the summation on the RHS of the prediction error equation: $$e[n]=\sum_{i=1}^N a_nx[n-i]+ x[n]$$ Is this the only condition or am I missing something out?

Also, I can't seem to figure out why the complex conjugate of the AR optimal coefficients is taken when moulding an AR process into the LPC form. in the first picture(Th 5.1) note the coefficient derived is $C_n$ and not Cn(complex conjugate). But in Eq 5.5 coefficient used is Cn

I apologize for any technical terminologies I might be messing up and things I haven't attentively read. Being relatively new to this part of the subject, any edits are appreciated. Thank you.

Chapter 5 of this is what my queries pertain to https://authors.library.caltech.edu/25063/1/S00086ED1V01Y200712SPR003.pdf

LPC reduces to AR modelling only if the stochastic time process is stationary (does not change distribution parameters over time) and ergodic (average over time is equivalent to mean of ensemble average).

This connection between auto-regressive coefficients and the autocovariance of the process is described by the Yule-Walker-Equations (mentioned in the book you linked).

The filter coefficients in your book are defined as conjugates to make definitions more easier (as mentioned below equation 2.5, e.g. equation 2.10).


How should this fft output be intepreted? I am currently reading some code, so I can understand how this FFT output is actually been stored.

I have a function which computes FFT of audio file, and stores is in the format.

[real0, realN/2-1, real1, im1, real2, im2, ...]

which kind of confuses me, as I remember DFT/FFT converts from time domain to frequency domain, in which the real part is the amplitude, and the complex part is the phase, but aren't I missing some information regarding what frequency has what amplitude and what phase?

Am I missing something?
Or am I right when i say that I can't from these complex numbers extract the amplitude for a certain frequency?

I am currently using Kaldi framework, in which i am trying to compute the spectogram of an audio file...

The output file it has generated looks like this.

This output was generated from a 1 second audio file.
sampled with 16 kHz, and frame length = 25 ms and hop_length = 10ms.
The number of datapoint the function has generated is 25816.
I am not sure how i should interpret it, i mean is each value supposed to be the power for a given frequency, and if so which frequency ?

"[...] the real part is the amplitude, and the complex part is the phase [...]" No, complex numbers (and that's what the output of a DFT/FFT is) can be represented either by their real and imaginary parts (as in the output vector of your routine), or by their magnitudes and phases. Please refer to the linked page on how to convert one representation to the other.

The indices $i=0,1,\ldots N-1$ of the output vector of a length $N$ DFT/FFT are related to actual frequencies via the sampling frequency $f_s$:

$$f_i=\frac{if_s}{N}$$

If the input vector is real-valued, the first $N/2+1$ values (assuming $N$ is even) contain all information about the signal.


Complex Cepstral Transform on Audio in MATLAB Hello I am trying to computer the Complex Cepstral Transform of an audio signal. I am using wavread to get an array of data type double precision. However, when I try to use cceps to do the Complex Cepstral Transform, I get the following error:

Error using cceps>chkinput (line 157)
The input signal X must be real.

Error in cceps (line 73)
chkinput(x);

Is there something I am doing wrong or is there another way to do this transform? Thank you!

Also, I tried computing this manually using the definition of the complex cepstral transform as follows:

C=ifft(ln(fft(f)))

where f is the array of double precision audio data. However, this returns the error:
Undefined function 'ln' for input arguments of type 'double'.

Natural log in matlab is 'log(x)' and log to the base 10 is 'log10(x)'

More information on Mathworks


Filter Design for Phase Response How can I design an all pass filter to have a constant phase shift over a bandwidth centered around a carrier?
I don't care about phase shift outside the band.
I would like to have the filter in time domain. This is not a straightforward job right?
Any keywords, design methods, external links are appreciated.

Edit: i need it to be causal. Data comes in real time in time frames.
thanks

It's instructive to see what an ideal filter adding a constant phase shift would look like. If $\theta$ is the desired phase shift, the corresponding ideal frequency response is

$$H(e^{j\omega})=\begin{cases}e^{-j\theta}&,\quad 0<\omega<\pi\\
e^{j\theta}&,\quad-\pi<\omega<0\end{cases}\tag{1}$$

Using the sign function $\text{sign}(\omega)$, the frequency response $(1)$ can be rewritten as

$$H(e^{j\omega})=\cos\theta-j\,\text{sign}(\omega)\sin\theta,\quad -\pi<\omega <\pi\tag{2}$$

With the DTFT correspondence

$$-j\,\text{sign}(\omega)\Longleftrightarrow g[n]=\begin{cases}\frac{2}{\pi n},&\quad n\text{ odd}\\
0,&\quad n\text{ even}\end{cases}\tag{3}$$

the impulse response corresponding to $H(e^{j\omega})$ is given by

$$h[n]=\cos\theta\cdot\delta[n]+\sin\theta\cdot g[n]\tag{4}$$

where $g[n]$ is the sequence on the right-hand side of Eq. $(3)$, which is the impulse response of an ideal discrete-time Hilbert transformer. Eq. $(4)$ shows that an ideal phase shifter can be implemented as a weighted parallel connection of a wire ($\cos\theta\cdot\delta[n]$) and a Hilbert transformer.

So your problem can be solved by using any of the many available designs of discrete-time Hilbert transformers. Note that you can get much better performance for a given filter order by taking into account that the approximation needs only be accurate in the given frequency band. For a frequency-domain design method this just means that in the formulation of the desired response given in $(1)$ you replace the positive frequencies by the frequency interval of interest and leave the rest as a "don't care" region. The same is done for the negative frequencies.


increase of encoding rate increases bandwidth? I came across this paragraph in an article about signal processing.

Addition of redundant bits for improving the error probability leads to bandwidth expansion of the
transmitted signal by an amount equal to the reciprocal of the code rate.

(page 16)
http://www.ece.rice.edu/~ashu/publications/encylopedia.pdf

I am not sure I understand this. why adding redundancy means increasing the bandwidth? it will just take more time to transmit this signal, no?

Please help me clarify this. thanks.

As per @JasonR's suggestion (but no longer succinct...., though
hopefully still correct...)

Error-control coding creates redundant symbols that are also transmitted
over the channel. A simple description of what happens is as follows.
The data symbols are divided into chunks of $k$ (data)
symbols and to each such chunk is appended a chunk of $n-k$
redundant symbols to create a codeword of $n$ symbols. The
rate of the code is $R = \frac{k}{n}$ since $n$ symbols must
be transmitted over the channel in order to get $k$ data symbols
across more reliably. The device that
creates and appends the redundant symbols is called an encoder.
Note that the encoder accepts $k$ symbols as input and spits
out $n > k$ symbols as output.  Now, it is possible for the encoder
to send the $n$ symbols to the transmitter for transmission using the
system and signaling design, modulation method that is already
set up. In this case, the channel signaling rate is not changed
at all and so the bandwidth remains the same. However,
the codeword, consisting of $n$ symbols, takes longer
to transmit than the $k$ data symbols would have using the
same transmitter and channel that we have available.
There is also the issue of what happens to the next chunk of
$k$ data symbols that are knocking at the encoder input while
the encoder is still busy sending the redundant symbols to
the transmitter.  So this scheme can be implemented if
we don't really care about how long it takes to transmit
the data (which is presumed to be a finite-length file or
audio track (say) and not a (potentially) infinite never-ending
stream of data all of which needs to be delivered to the
receiver, and are willing to have lots of buffers
between the encoder and the transmitter to save the codewords
being generated until the transmitter gets around to transmitting
them.  We will also need buffers at the receiver where the
redundant symbols will be stripped off, and the data
symbols delivered to the destination in chunks of $k$
symbols followed by $n-k$ intervals of dead silence: buffering
can be used to save the $k$ symbol chunks and patch them
into a continuous stream of data.

The alternative, which most people opt for, is to modify
the transmitter and receiver so that each channel symbol
takes less time (by a factor of $R$) to be transmitted,
so that the $n$ symbols of the codeword can be transmitted
in the same time that the $k$ data symbols would have been in
absence of error-control coding. The increase in the
signaling rate means that the transmitter output requires a
larger bandwidth (by a factor of $R^{-1}$) for transmission.
The channel thus must have larger bandwidth too, which can
create problems if wireless channels are being used.
Frequency bands are allotted by government agencies and if
your transmitter is already using the full spectrum allotted
to you, a Plan B and a complete re-design might be needed.
These systems with larger bandwidth also need buffers
at the transmitting end as well as the receiving end,
but only two relatively small ones of $k$ symbols at both
ends. The two buffers precede the encoder and are used
in ping-pong fashion. The data source is reading in
$k$ symbols into one buffer, say one symbol every $T$
seconds, and thus taking a total of $kT$ seconds to fill
the buffer. During this time, the encoder reads out
the $k$ data symbols from the other previously filled buffer
at a rate of one symbol every $RT$ seconds for a total
of $k(RT)$ seconds. The data symbols are also sent on to
the transmitter while the $n-k$ redundant symbols are created
within the encoder, which then spends the remaining
$kT-k(RT) = (n-k)(RT)$ seconds sending the $n-k$ redundant
symbols to the transmitter at a rate of one every $RT$
seconds.  At the end of a $kT$ second
period, the data source starts to fill the buffer just
emptied by the encoder, while the encoder starts to
accept data from the buffer just filled by the data
source. If you are still following all this, note
that the encoder and the transmitter are working
with a clock that is running at a higher rate
(by a factor of $R^{-1}$) than
the clock of the data source, while the clock
signals to the buffers are alternately at the
low rate (when connected to data source) and
at high rate (when connected to encoder).
Similar things occur in reverse between the
receiver output and the data destination
but I will skip the details.

A third alternative, as pointed out by Bryan,
is to change the modulation format
on the channel so that, for example, instead of transmitting one channel bit
with each channel symbol (as in BPSK), you transmit more channel bits per
symbol (e.g. use QPSK to send two bits per channel symbol). In this case,
there need not be any increase in bandwidth (which is primarily determined
by the symbol rate (rate in baud)). A common use of the BPSK/QPSK usage
is the use of rate-$\frac{1}{2}$ convolutional coding which would double
the bandwidth if BPSK were used, but by switching to QPSK, the bandwidth
remains the same even when coding is used. However, as also noted by Bryan,
the transmitter and receiver become more complicated.


use wavelet for improving spectral resolution let us consider following code

function [sca_1,sca_2,sca_3,sca_4]=calc_wavelet(y,wname,scales,freq,fs)
%y-input signal
%wname-wavelet basis name
%freq-test frequencies
%fs-sampling rate
TAB_Sca2Frq = scal2frq(scales,wname,1/fs);
[~,idxSca_1] = min(abs(TAB_Sca2Frq-freq(1)));
sca_1 = scales(idxSca_1);
[mini,idxSca_2] = min(abs(TAB_Sca2Frq-freq(2)));
sca_2 = scales(idxSca_2);
[~,idxSca_3] = min(abs(TAB_Sca2Frq-freq(3)));
sca_3 = scales(idxSca_3);
[mini,idxSca_4] = min(abs(TAB_Sca2Frq-freq(4)));
sca_4 = scales(idxSca_4);
coefs = cwt(y,scales,wname);
clf; wscalogram('image',coefs,'scales',scales,'ydata',y);
hold on
plot([1 size(coefs,2)],[sca_1 sca_1],'Color','m','LineWidth',2);
plot([1 size(coefs,2)],[sca_2 sca_2],'Color','m','LineWidth',2);
plot([1 size(coefs,2)],[sca_3 sca_3],'Color','m','LineWidth',2);
plot([1 size(coefs,2)],[sca_4 sca_4],'Color','m','LineWidth',2);

i have  took following data

>> wname = 'morl';
scales = 1:1:128;
>> fs=100;
>> freq=[13.7   10.5    29.9    31
];

when i run following code

[scal_1,scal_2,scal_3,scal_4]=calc_wavelet(B,wname,scales,freq,fs);

got result :

one  frequency is lost,i have tried  also following  basis

>> wname = 'mexh';
>> wname = 'morl';
>> wname = 'haar';
>> wname = 'gaus4';

please  pay attention that  my model is following

https://dsp.stackexchange.com/questions/15559/understanding-1d-wavelet-analysis

so which wavelet basis should i choose for  good spectral  resolution?i want to use wavelet for ability to distinguish signals which are closed  spaced to each other,like in my case

freq=[13.7   10.5    29.9    31];

it could be  even more closed to each other

The window shape chosen for your wavelet basis will generally only have a slight effect on frequency resolution.  To increase frequency resolution more, increase a scale factor that is related or proportional to the window length for a given frequency.  This will also decrease temporal resolution.


Out of memory problem with filter design tool in Matlab I have a set of data in excel like this:

column A is time in ns and column B is the electric field strength.
now I want to convert the time-domain signal from these data to a frequency-domain signal with DSP toolbox in matlab.

to calculate Fs (sampling frequency) in order to use in signal analyse i use this formula:

time = T(:,1);
L=2033;
Ts = mean(diff(time));
Fs = 1/Ts;

which leads to :

Fs= 5e+09

then I import the signal (E) with sampling frequency Fs in signal analyze toolbox.
my signal is like this:

now i want to apply a bandpass filter in 16-32 MHZ range , so :

I've increased the paging file to maximum on my system with no success!
I should say that my system configuration is like this:

i5 CPU at 2.5 GHz

8 GB R3 Ram at 1600 MHz

I have two specific questions:

1- what should I do? Is there any thing that I should do to to be able to design the filter on my system?

2- if I change the time to second and the frequency to hz , how much does the results change?

Your sampling frequency is currently set to 5000000000 MHz, which is 5000 terahertz!  Notice that the units on the frequency specification should all be in MHz. Change the Fs value to be 5000 (MHz) and you will be much better off.

However, even once you fix this problem, you still may run into trouble.  You are specifying transition bands that have a width of less than 0.01% of your sampling rate.  This is not going to be practical, especially as an FIR filter.  I recommend that you consider a good low-pass filter followed by lots of down sampling.  Then you will be able to realistically extract the band of interest.


Why do AAC files seem to have an inexact bitrate? I'm using ffmpeg to encode audio files as AAC at 256kbps. However, the actual bitrate of the resulting file is rarely 256. It's usually a number close to 256 like 241, 255, 257, 254. In one case it was 125.

What's going on? Is this is a property of AAC or ffmpeg? If I ask ffmpeg for mp3 at 320kbps I always get 320. I thought for a while that the AAC encoder was using 256 as an upper limit and only using the bitrate it needs but then I got a few 257 files so that can't be it.

Both AAC and MP3 are not always encoded with constant bit rate but they support variable bit rate encoding too.


Understanding IIR , Low Pass, High Pass, Chebyshev, Elliptic Filter? I see these terms everyday in every lecture, I do read stuff from wikipedia, follow lecture notes, study solved exercises. All in all I do have a rough idea about these, I know a little from everything, but the picture is not complete, far from complete, I would like to understand all of them and improve myself because in 2 weeks I will have an exam, is there a website which you can suggest, describing these very well? Animations would be great, I'm clueless from where shall I start and how do I close all these gaps :(

You did not posed any particular problems and asking for animations? I think that books are way better. We don't know what are your topics, but knowing you did all the studying and have two weeks so I suggest to:

Do the ELEC301x – Discrete Time Signals and Systems course from the Rice University. They do have a good part about design of digital filters, especially about differences between different topologies (including placement of zeros and poles), just watch.
Design few filters in MATLAB, do some filtering and try to understand their characteristics. fvtool is great, especially if you want to visualize anything you need.
Do the exams from past and if you feel confident then just go for a pint!
Read all the questions and answers on DSP SE regarding digital filters ;)

Yep, and after typing into google "digital filter applet" for example you can get:
link1, link2, link3.