texts: Phase difference calculation between two wave files

texts:
I am doing comparison between two wave files, How to calculate phase difference between those files?
Second wave is generated by making some changes in the first one .I have tried calculating phase like this:-

y, sr = librosa.load('first.wav')
D = librosa.stft(y)
magnitude, phase1 = librosa.magphase(D)
y1, sr1 = librosa.load('second.wav')
D1 = librosa.stft(y1)
magnitude1, phase2 = librosa.magphase(D1)

than

calculated the difference(phase1-phase2).

Is this the correct way?


texts:
Talking about Butterworth filters my prof said that a filter is described by its frequency response $H(\omega )$.

What I think is that filter is really described by its transfer function, since there can exist many transfer functions that share the same $H(\omega )$.
Was my prof wrong?


texts: Filtering out a specific frequency in an analog signal

texts:
I'm wondering how I would go about filtering out a regular sine-wave signal with a constant frequency and voltage.

I'm really new to the whole DSP-area but imagine I would have a regular sinewave at a specific frequency (let's say 30Hz), and on top of that signal I have a bunch of other small peaks (which are the ones I would want to sample and read). What method would I choose?

Here is a visualization of what I meant:

Excuse my terrible Paint-skills but how would I filter out that sinewave, and just keep the small spikes in voltage? What might be worth sharing is that the time between the spikes does have an impact on my measurement of the spikes, or to rephrase: The amount of spikes within x-units of time does have an impact.

Any guidance to the right direction would really be appreciated.

Thank you.


texts: Method for modifying frequency-domain signal to produce predetermined time-domain signal

texts:
We are performing a convolution of audio signal, with 511th order FIR
filters, using fast convolution methods: overlap-add or overlap-save.
Filters are being designed in frequency domain several thousand times
per second. Filters need to be zeros padded to be used in order to be
used in fast convolution algorithms, so to acquire appropriately
padded filters we do:

frequency domain filter design, filters of 511th order
IFFT into time domain
zeros padding to 2048 length (1536 zeros)
FFT back into frequency domain (for multiplication with spectral
representation of input audio signal)

Computational complexity of such operation occurred be to high for our
needs. We're trying to figure out if there's a method to avoid
IFFF->FFT steps and reduce the overall complexity from O(NlogN) to
O(N). Any ideas if it is possible, and, if so, how can it be achieved?


texts: Right algorithm for fourier transform on physical heights

texts:
I have data from a LIDAR unit that I would like to get the spectral density of. Unfortunately, the only thing I remember from my Fourier analysis class are the methods that I know will not work.

The data comes from a 1D LIDAR scan of a (mostly flat) surface, which returns radial distance at evenly spaced $d\theta$'s. I can convert this data to x-y data which looks distinct depending on the type of surface (e.g. grass looks a lot choppier than concrete). I think Fourier analysis would be a good way to distinguish between the different types. Unfortunately the data has some problems that makes it difficult to analyze:

It is unevenly spaced in x.
It has some missing values.
It is not strictly a function in x (if there is some overhang, an earlier part of the sweep might hit under the overhang to get a distant x value, and a later part could strike the overhang, to get a closer value.)

It has occurred to me to do a Fourier analysis on the original $r-\theta$ data, but since I am concerned with the deviations around perfectly flat ground, I am not sure how I could use it.


texts:
This is probably as basic a question as it gets, but still the answer eludes me. I have a function from a library that I can use to both modulate, and demodulate an FSK encoded piece of data. For the sake of simplicity, let's just say it's one byte.

From the example provided, it exists in the perfect world of PC memory. The modulate function simply updates the pointer, the receive function takes that and demodulates the buffer. This is on an STM32F4.

In the real world, I need to:

1- Convert the data value to an ADC value (I know how to do this)
2 - Output the data at the sampling interval/rate (pretty sure I have this figured out with a bit more testing)
3 - Output to an amplifier & transmit through antenna (I have this done)
4 - Receive signal into antenna, amplifier and anti-aliasing LPF (OK, I have this)
5 - Process incoming signal through ADC at sampling rate - ideally, the same as transmit.
6 - The data is in a buffer. This is where I am stuck!

The receive amplifier and LPF is continuously processing incoming samples. How do I "look" for the FSK data? How do I know what I am looking for? What would an algorithm be to perform this task?

In analog, I would send out a preamble tone burst of a number of cycles such that the receive would use this to buffer data after that. In the world of DSP, I have no clue how this would happen.

Can someone enlighten me? (Make me clue-ful instead of clue-less?)

Thank you...


texts:
I am having problems in understanding how to do it practically

I have a wav file that contains pure speech and another ave file that just contains the background noise (can be various things, such as white noise, crowd noise, a recording of blowing wind, etc). These are either purely speech or purely noise. So I suppose I can get an SNR value from them by simple division of corresponding samples (or the average of a frame of samples) in both files. I then combine them in audacity to get a noisy speech file. I am guessing this file will still have the same SNR.

Now I pass this file through my noise reduction program and get another file as a result. How do I calculate the SNR of this "noise reduced" file?

--- EDIT ---

follow-up question posted HERE


texts: Proof for the solution of homogenous difference equation

texts:
Suppose the output $y_h[n]$ of a linear, time-invariant system is described by by the following equation for input $x[n]=0$,

$$\sum_{k=0}^{N}a_k y_h[n-k] = 0$$

My book states the $y_h[n]$ is in fact a member of a family of solution of the form:

$$y_h[n]=\sum_{m=1}^{N}A_mz_m^n$$

where the complex numbers $z$ are the zeros of $A(z)=\sum_{k=0}^Na_kz^{-k}$.

What is the proof that $y_h$ is in fact of the form given?

A simple substitution would result in:

$$\sum_{k=0}^N (a_k \sum_{m=1}^NA_mz_m^n) = 0$$

but I don't see to proof showing a set $\{z_1,z_2,...,z_N\}$ and $\{A_1, A_2,..., A_N\}$ indeed exist for all n. Sorry if this seems like a poor question.


texts: Cross-Correlation Signal Delay Estimation Variance

texts:
I am working on a project which intends to use Time Difference of Arrival (TDoA) for localization.

Firstly, my understanding is that a matched filter is the most common method for estimating signal-delay.

To get performance metrics for TDoA, I need the variance of the time-delay estimate. Thus, what I'm looking for is a way to calculate the variance in the signal-delay estimate using a matched filter as an estimator.

This seems like it would be a very common problem; however, I have consulted three books and searched online, and I have not found anything which addresses this issue.


texts: FIR butterworth also possible or just IIR?

texts:
can we use butterworth and other such filters like chebyshev,elliptic etc  with FIR

or they can be only used with IIR?


texts: Can someone explain what a butterfly is in regards to DSP?

texts: I often see the term "butterfly" in discussion and methods relating to DSP. What is a "Butterfly?"


texts:
In FMCW radar rather than sending a signal at a constant frequency we are sending a chirp which goes e.g. from 6 GHz to 6.1 GHz in 5 ms.

What I cannot fit in my mind is this (numbers are just for example):

The RF signal is moving at the speed of light so while we are changing the chirp frequency linearly e.g. we start from 6 GHz and waited like 500 us, then increased it to 6.01 (up to 6.1 GHz) and we already received the 6 GHz signal from receiver without completing 5 ms chirp period. So up to this point we have nothing to do with other frequencies of chirp (6.02, 6.03, ..., 6.1). Basically how IF shift in signal occuring. Is it occuring for every frequency part of the chirp signal (6 GHz for 500 us, 6.01 for 500 us ... up to 6.1 GGz) or is it occuring as a result of whole chirp package?

Shortly should i just simultaneously change chirp from 6 to 6.1 and 6.1 to 6.0 back and forth and at the same time A/D convert the upcoming signal and save it somewhere until it makes 5 ms then plot the fft of the whole 5ms block.

I hope I am clear. Please show me what I am missing here :)

LATER UPDATE: Everyone is trying to make me understand the theoretical background where i already know but thank you guys for your time.

I am teling this with examples so people who have same problem in future can understand. While sending a chirp we start sending with a fix freq. as a start point like 6ghz. While it is traveling to the target and coming back a little bit of time passed and during this time our TX chirp signals freq. changed a little bit linearly like 6+X GHz so multiplexer difference is X Hz. Therefore this change depend on the distance of the target since let say target is so far far away we will maybe receive the first signal which was at 6GHz while our chirp is at its halfway of 6 to 6.1 GHz cycle. So the difference will be like 6.05-6=0.5GHz.

Another way of saying, for stationary object nothing happening on the transmitted signal(doppler effect says reflected data is radited with same structure if object is stationary) but until the transmitted signal come we changed the transmitted signal so the upcoming signal will be multiplexed with different freq. signal and based on this change we are telling this is object at this much distance. Thank you


texts: Are There Common Values of Standard Deviation for Gaussian Noise of an Image?

texts:
For example, it occurs to me that there might be a standard deviation value of Gaussian noise in which the human eye could no longer distinguish an object because the standard deviation is very high and many edges were removed because of that amount of noise. Or I think maybe there are values of standard deviation in which the human eye can better distinguish an object in an image because the model of vision of the eye is modeled in such a way that these values of standard deviation allow the eye to recognize or distinguish an object. Is there any research about this that I am commenting on? Are there "important" values of Gaussian noise standard deviation in an image?
Thanks in advance


texts: Narrow band Interference affecting timing acquisition in spread spectrum communication systems

texts:
It is often said that a narrow band "in band" interferer will collapse and its BW will spread when it is correlated with a spreading code at the receiver of say a CDMA system while the signal of interest will pop up with a narrower BW (the data BW), and thus could be filtered and that is what is called processing gain.

However, in order for this to take place the code at the receiver needs to be aligned in time with the incoming signal of interest.

How can timing acquisition be implemented in the presence of the interferer? Traditional symbol timing synchronization (if applied to the chips) and which relies on the output of a matched filter would lead to errors in the presence of an inband interferer.


texts: Why does resampling change the frequency range?

texts:
I am currently working on a set of .wav files which, unfortunately, do not have the same sampling rate - I need to resample them for the purpose of feeding them to a neural net.
So - using Sox I resampled every file - with the command:

sox -v 0.99 filein -G -r 192000 fileout

However, having a look at the resampled files: ,
the frequency range has changed. Which is confusing me. I have put several hours into finding out why this is happening but i can't seem to find the reason.
Can somebody explain?

EDIT1: Just realized that this example is misleading as I am referring to the change in maximum Frequency, (the y-labels)


texts: What is the difference between PSOLA and TDHS time-scaling or pitch-shifting?

texts: What is the difference (if any) between PSOLA (Pitch Synchronous Overlap and Add) and TDHS (time domain harmonic scaling) time-pitch modification algorithms?


texts: Calculate the power of a discrete-time signal

texts:
We got this question in our test :-
$$S(t) = 5\cos(10πt - π/2) + 6\sin(15πt)\cos(15πt)$$
My Solution :-
$$S(t) = 5\cos(10πt - π/2) + 3\sin(30πt)\qquad    \textrm{[Using $\sin(2A) = 2\sin(A)\cos(A)$]}$$
=> Power$ = 5x5/2  +  3x3/2
         = 25/2 + 9/2
         = 17$
But in the solution, the correct answer was given to be 21.5 watt.
What mistake did I do?


texts: What's the point of using Morphological processing concerning images?

texts: I dig deeper in internet to figure out what's the point of morphological processing on images, but i'd rather to hear the answer from people with experience, can you give me a hand with this? Thank you in advance


texts: The traditional Discrete Fourier Transform (DFT) and its cousin, the FFT, produce bins that are spaced equally. In other words, you get something like the first 10 hertz in the first bin, 10.1 through 20 in the second, etc. However, I need something a little different. I want the range of frequency covered by each bin to increase geometrically. Suppose I select a multiplier of 1.5. Then we have 0 through 10 in the first bin, I want 11 through 25 in the second bin, 26 through 48 in the third, etc. Is it possible to modify the DFT algorithm to behave in this fashion?


texts: Removing empty/low amplitude part from signal

texts:
I have a signal of length 'N' which looks like this

[.......p-set...] [SINE-WAVE] [....q-set...]

amplitude of points in p-set << amplitude of points in sine-wave

Sometimes there are a few sparse points in p-set whose amplitude is comparable to sine-wave points. However, number of such points is much less than the length of the sine wave.
I want to find the beginning point of the sine-wave.

Clearly I cannot use thersholding as those sparse points will be counted as the beginning of the sine-wave which is wrong.

Is there any effective solution or existing functions? Sliding window may be? Please explain with some code (MATLAB). Due to firewall restrictions I cannot upload image. Sorry.


texts: FFT spectrogram in log frequency space. How?

texts: I was reading a paper and the authors say that they extract FFT spectrograms and log-scale in frequency domain. I understand how the general spectrogram is computed, but how to make it log-scale in frequency domain? Or maybe there are libraries in Python, which already implement this one?


texts:
I've got an LTI-system such as follows:
$$y'(t)+{2} y(t)={5} x(t-{3}), t>0,
  \\ \\ y(0)=0 \ \text{ ja } x(t)=0, \ t<0.$$
From this i've already figured out the transfer function:
$$H(f)=\frac{5\cdot e^{\left(-\mathrm{i}\right)\cdot 2\cdot \pi\cdot f\cdot 3}}{2+\mathrm{i}\cdot 2\cdot \pi\cdot f}$$
And the amplitude response:
$$\frac{5}{\sqrt{4+\left(2\cdot \pi\cdot f\right)^2}}$$
However, I seem to have trouble with the phase response. I know the formula for phase response is as follows:
$$θ(f)=arg[H(f)]$$
But I still have some trouble using it. The denominator would go as follows I think:
$$arg(2+i*2*pi*f)=arctan(\frac{Im}{Re})=arctan(\frac{2*pi*f}{2})$$
But i'm a bit confused about the numerator, and the exponential within it. Is the imaginary part of the numerators argument pi times 6, or does the exponential stay? Or perhaps there is no real part at all?


texts: Assume frequency response of x(t) is X(f). Find frequency response of x(-2t+4)?

texts:
Frequency response of $x(t)$ is $X(f)$. Find frequency response of $x(-2t+4)?$
Here is my work using the fourier transform property:$
x(-2t+4) = x( -2(t-2) )$,
+ First, I apply the property,  $x(at)$  <---> $1/a \cdot X(f/a)$, by setting $a=2$, I have:
      $x(2t) <---> 1/2\cdot X(f/2)$
+ Second, I use the time-delay property,  $x(t-t0)$  <----> $X(f) \cdot e^{(-j \cdot 2\pi \cdot f \cdot t_0)}$, with $t_0=2$, I have:
      $x( 2(t-2) ) <---> 1/2 \cdot X(f/2) \cdot e^{(-j \cdot 2 \cdot \pi \cdot f \cdot 2)}$
+ Third, I use the rotation property, $x(-t)$   <-----> $X(-f)$, then I have,
     $x( -2(t-2) ) $<---> $1/2 \cdot X(-f/2)*e^{(-j \cdot 2 \cdot \pi \cdot f \cdot 2)}$
+ Lastly, because spectrum of FT is symmetric, means $X(-f)=X(f)$, so the final result is:
                        $1/2 \cdot X(f/2) \cdot e^{(-j \cdot 2 \cdot \pi \cdot f \cdot 2)}$
I am not sure what I did is wrong or not. Please help me point out and explain my wrong concepts or way?


texts: What is it called when you have a single-pole recursive digital lowpass filter where the coefficients don't add up to unity?

texts:
Is there a name for a single-pole recursive digital lowpass filter where the coefficients don't quite add up to 1?

For example: with the filter y[n]=a0*x[n]+b1*y[n-1] instead of using coefficients

a0=0.1
b1=0.9

What if I used

a0=0.11
b1=0.9

Is there a name for this, or is it just functionally equivalent to something else like y[n]=a0*x[n]+b1*y[n-1]+c0

Also, at what point will the filter become unstable? The example above where the coefficients add up to 1.01 looks stable to me but I think a0=0.009 and b1=1.001 would be unstable. Where's the line where it crosses from stable to unstable? b1=1?


texts: Numerical Calculation of impulse response out of frequency response

texts:
Currently I work on my Masterthesis which deals with structural dynamic simulation. As a part of it I have to filter a Signal with a FIR-Filter. From that Filter I know the Frequency Response (picture).

The code is written in Python and I'm not sure how to apply the IFFT since I have just a real input.

Thank you for your answer robert bristow-johnson!

In python there is function called irfft which stands for inverse real fft. So a ifft for real input. But it seems that something goes wrong with the time signal. I'm aware of that I have no phase in this case. But I guess for Filters in Signal processing it is pretty common to just have the frequency response and calculate the impulse response out of it? So there should be a right way to do it...
Unfortunately I'm no expert in Signal processing and at the moment I'm pretty much stuck at this problem.

UPDATE: I think the correct way is to add just zero phase (so +0j) to the frequency response. For the ifft the first bin has to be 0 valued, from 1 - N/2 i add my frequencies as I have it from the response, and from N/2 - N I add the conjugate complex numbers (as the phase is zero the values are just in  descending order).
Hope this will do the trick.


texts:
I am studying linear systems from the book "Signals and Systems Laboratory with MATLAB". I have performed an example on MATLAB myself in this regard.
Code is as follow:

clc
clear all
close all
t=-3:.1:3;
x1=sin(t);
x2=cos(t);
a1=2;
a2=3;
z=a1*x1+a2*x2;
y1=2*z+2*cos(pi*t/3)
plot(t,y1);
ylim([-1 11]);
figure;
z1=2*x1+2*cos(pi*t/3);
z2=2*x2+2*cos(pi*t/3)
y2=a1*z1+a2*z2;
plot(t,y2);
ylim([-1 19]);

When I run this program I get two  figures containing two same shapes that are curve-like but amplitude/size/height is not same.

I am confused if my this system defined by equation y=2*z*cos(pi*t/3) used in program above is linear or not? If still yes, then why (as we have size difference in both curves)?


texts:
Consider the following sequences:

$x_{1}(n) = A$ (a constant), $x_{2}(n) = u(n)$, $x_{3}(n) =\delta(n)-\delta(n-1)$.

($\circledast$ stands for linear convolution)

If I perform the operation $x_{2}\circledast (x_{3}\circledast x_{1})$, the value I am getting is $0$, where as if I perform $(x_{2}\circledast x_{3})\circledast x_{1}$ the value I am getting is A.

Since Convolution is associative, why are the answers different?

My approach: In general, assuming $x_{1}(n)$, $x_{2}(n)$, $x_{3}(n)$ are of infinite lengths,

$$x_{2}\circledast (x_{3}\circledast x_{1})=\sum_{k=-\infty}^{\infty}x_2(k).x_{3}\circledast x_{1}(n-k)=\sum_{k=-\infty}^{\infty}x_2(k)\sum_{l=-\infty}^{\infty}x_3(l)x_1(n-k-l)$$

Let $m=n-k-l$,

$$=\sum_{k=-\infty}^{\infty}\sum_{l=-\infty}^{\infty}x_2(k)x_3(l)x_1(n-k-l)=\sum_{k=-\infty}^{\infty}\sum_{m=-\infty}^{\infty}x_2(k)x_3(n-m-k)x_1(m)$$

$$=\sum_{m=-\infty}^{\infty}x_{2}\circledast x_{3}(n-m)x_1(m)=(x_{2}\circledast x_{3})\circledast x_{1}$$.

Hence I feel Convolution is associative even if the sequences are of infinite lengths. Where did I go wrong?


texts:
Steganography can hide one image inside another.

If we have a compression algorithm that allows us to fit the bits for two images into the size of one, can we think of a way to modify a run-length encoding algorithm to take two images and produce one, in such a way that the first is retrieved in a lossy way, and the second is retrieved?

Please explain this with full description of your thinking.

If you know a good reference, please let me know.


texts:
Upon reading this microphone array tutorial, I'm stuck in the following piece:

The spatial sampling frequency along the x-axis is given by
$f_{x_s} = \frac{\sin \theta \cos \phi}{\lambda}$

where $\theta$ and $\phi$ are the elevation and azimuth angles of the incoming signal, and $\lambda$ is the wavelength.
I cannot grasp the meaning of the equation. How come the sampling frequency depends on the angles? Also, shouldn't it depend on the inter-element distance?


texts: what is happening when i run this code line?

texts:
I have the following MATLAB code:

x=[1 2 3; 4 5 6; 7 8 9;];
u=(0:255)/(255-1).^1.05;
x2=u(x+1)

when I run this code I get the following as a result in x2:

x2 =

0.0030    0.0060    0.0090
0.0119    0.0149    0.0179
0.0209    0.0239    0.0269

what is happening when I call this line x2=u(x+1)? and how to write it mathematically?

Thank you very much in advance


texts: Which filter to use for data with high amount of errors?

texts:
I have the following data collected from a heart rate sensor.
The data is in bpm vs. milliseconds. All the data points below 80 is incorrect (errors/noise). When it plummets below 80, it's because the heart rate sensor fell off the subject.
Similarly, although on this graph it is not there, there are often spikes that go as high as 500. Those high peaks are caused by something physically tapping the heart rate sensor. The rate should ideally be between 100-160. However, I'm not sure what filter to apply to correctly display this data.
I tried applying a 100 point median filter. This got rid of majority of the low and high peaks. However, I was told that this removes too much of the detail and that I should use an average filter so that it more accurately describes the data. My argument against this is that $\frac{100 + 0}{2} = \frac{50+50}{2} = 50$. Many different values can give me the same average.
I do not come from a DSP background. Hence, how should I proceed? Are there other types of filter that will more accurately let me display this data? Ideally, I'd like to keep the general trend, but not include the sudden dips(any data that dips below 80) and spikes(any data that shoots above 200bpm).


texts: Evaluating the autocorrelation function of a telegraph signal to get exponential decay?

texts:
I've been driving myself absolutely crazy trying to do autocorrelation analysis on some data that I've got.  I've read from multiple sources that the ACF of a random telegraph signal / random telegraph noise is given by an exponentially decaying function where the decay constant is the average rate of switching between states (cf. Example 7.3.2 here for example).  Since I had trouble getting anything that even resembled exponential decay with real data, I decided to generate a fake signal that telegraphs between the value 0 and 1 with lifetimes centered binomially around two characteristic values for the 0 and 1 state.  The autocorrelation function for this signal is still not at all exponential.  In each case, the ACF ends up strongly oscillating.

I'm working in Mathematica, using CorrelationFunction to get the autocorrelation function.  Based on my reading, this is a standard definition for autocorrelation.

So my question is can someone show me an example with a numerically obtained ACF from a random telegraph signal that decays exponentially?  Am I missing something stupid here?  Am I using an incorrect definition for the autocorrelation function?


texts:
I am reading this paper to learning basic concepts of dsp and I want to reproduce the following scalogram of a test signal (fig 4.2 of the paper):

It has been produced from the discretization of the formula:
$$
\frac{1}{s} \int_{0}^{\Omega} f(t) \overline{g\left(\frac{t-\tau}{s}\right)} d t
$$
Where $g(t)$ is the wavelet:$$
g(t)=w^{-1} e^{-\pi(t / w)^{2}} e^{i 2 \pi \eta t / w}
$$
And $f(t)$ is the function:
$$
\begin{array}{l}
\sin \left(2 \pi \nu_{1} t\right) e^{-\pi[(t-0.2) / 0.1]^{10}} \\
\quad+\left[\sin \left(2 \pi \nu_{1} t\right)+2 \cos \left(2 \pi \nu_{2} t\right)\right] e^{-\pi[(t-0.5) / 0.1]^{10}} \\
\quad+\left[2 \sin \left(2 \pi \nu_{2} t\right)-\cos \left(2 \pi \nu_{3} t\right)\right] e^{-\pi[(t-0.8) / 0.1]^{10}}
\end{array}
$$
I have  tried to reproduce them using the function scipy.signal.ctw(). I have coded $g(t)$ as a function of t and $\omega $. Nevertheless, I get only non-zero coefficients for the last part of the wave, I guess that I could have something wrong. How can I compute the scalogram using scipy.signal.ctw()?


texts: Calculating frequency shift of short bursts

texts:
I am attempting to figure out the best method of determining the frequency shift of small burst signals. I have an incoming signal which is 1Mhz, and only in 0.0001s windows, seeing 10kHz shifts, which I am trying to measure using an FPGA and ADC. I have tried to run the signal through a BPF and FFT but the computing time is long enough that I am missing a bunch of signals and losing accuracy. Now I'm trying to take the raw signal and measure phase change, and/or frequency by count the crossings of a threshold value. I've tried looking at larger windows, but the bursts are small enough that they essentially get erased.

Are there high-speed methods for measuring signals like this? I'm afraid too much decimating is required for the FFT

Are there ways to measure phase/frequency that are a bit more flexible? My resolution is now 10kHz and only ~0.3% of samples have shift. Better resolution is erasing the shift since windows are longer.

TIA for any comments!


texts:
I am having difficulties implementing state-space filters in (32-bit) fixed-point. This is because the coefficients have a huge dynamic range, for example (MATLAB code):
A = [0.989923894 -116924.375; 4.34027786e-10 1];
B = [1; 0];
C = [0.010076086 1];
D = 0;

When converted to biquad sections:
[sos, gain] = ss2sos(A,B,C,D);

the coeffs are pretty normal:
sos = 0    1.0000   -1.0000    1.0000   -1.9899    0.9900

b0 =  0.0000
b1 =  1.0000
b2 = -1.0000
a0 =  1.0000
a1 = -1.9899
a2 =  0.9900

gain = 0.0101

Is there anything I can do to make my life easier? Any advice most welcome.


texts: Influence of a RHP zero/pole in the frequency response

texts:
I am studying loop shaping, and I am looking at loop shaping design with unstable poles and zeros. I have seen that noth unstable poles and zeros introduce limitations in the bandwidth. I have also seen that a non- minimum phase zero introduces an undershoot in the step response.

But are there other implications of these unstable ploes and unstable zeros in the frequency response?

sometimes I get some weird looking frequency responses, such as:

in this case I have a non-minimum phase zero. Is this behaviour due to the unstable zero, or there are other reasons?

or also something like:

I have these doubts because usually I see complementary sensitivity functions that roll-off smoothly, and in this case this does not happen.

[EDIT]The equations are the following:

the plant is:

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

and the controller is:

$K=\frac{-8}{s}$

and this is the code if it can be useful:

s = tf('s');
G = (10*(s-1))/((s+10)*((s+5)^2));
K1 = -8/s;

S1 = 1/(1+K1*G);
T1 = K1*G/(1+K1*G);

bodemag(S1),grid

%first weight
%W_bt1 = 0.5;
W_bs1 = 0.03; %same cross over frequency as the previuos point
M = 2;           %peak of the sensitivity
A = 0.001;      %attenuation
Ws1 = (s/M + W_bs1)/(s+W_bs1*A);   %sensitivity weight
%Wt1 = (s/M + W_bt1)/(s+W_bt1*1);
%bodemag(1/Ws),grid;
Wu=tf(8)
[K2,CL,GAM1] = mixsyn(G,Ws1,Wu,[]);  %define the controller with the mixed
sensitivity
display(GAM1);
K2 = minreal(K2);  %define a minimal order controller
T1_W = K2*G/(1+K2*G);
S1_W = 1/(1+K2*G);

%second weight
%W_bt3 = 0.0125;
W_bs1 = 0.3; %same cross over frequency as the previuos point
M = 2; %peak of the sensitivity
A = 0.001;      %attenuation
%Wt3 = (s/M + W_bt3)/(s+W_bt3*1);
Ws1 = (s/M + W_bs1)/(s+W_bs1*A);   %sensitivity weight
%bodemag(1/Ws),grid;
Wu=tf(8)
[K3,CL,GAM2] = mixsyn(G,Ws1,Wu,[]);  %define the controller with the mixed
sensitivity
display(GAM2);
K3 = minreal(K3);  %define a minimal order controller
T3_W = K3*G/(1+K3*G);
S3_W = 1/(1+K3*G);

%third weight
%W_bt4 = 0.00625;
W_bs1 = 1; %same cross over frequency as the previuos point
M = 2;           %peak of the sensitivity
A = 0.001;      %attenuation
%Wt4 = (s/M + W_bt4)/(s+W_bt4*1);
Ws1 = (s/M + W_bs1)/(s+W_bs1*A);   %sensitivity weight
%bodemag(1/Ws),grid;
Wu=tf(8)
[K4,CL,GAM3] = mixsyn(G,Ws1,Wu,[]);  %define the controller with the mixed
sensitivity
display(GAM3);
K4 = minreal(K4);  %define a minimal order controller
T4_W = K4*G/(1+K4*G);
S4_W = 1/(1+K4*G);

dcgain(T4_W)

figure;
bodemag(S1_W,'r',S3_W,'y',S4_W,'g'),grid
legend('weight 1','weight 2','weight 3');
title('sensitivity function')

figure;
bodemag(T1_W,'r',T3_W,'y',T4_W,'g'),grid
legend('weight 1','weight 2','weight 3');
title('complementary sensitivity function')


texts: removing vertical lines in grayscale images by thickness

texts:
Suppose we have a grayscale image that contains vertical lines. Now suppose that not all vertical lines are the same, some of them have different thickness.

Question is, is there a way, in MATLAB or other programming language, to filter the vertical lines by thickness? In other words, based on the user selected thickness, only thin vertical lines are removed, while all other thick vertical lines are kept intact? or all thick vertical lines removed, all other thin vertical lines intact?

I tried experimenting with MATLAB with the morphological operators, but nothing seems to really work, perhaps I am using the wrong method.

edit:
I am thinking about one possible way to solve this, but not in code, just as an idea. Every vertical line has 2 vertical edges. For every pair of 2 edges (1 line), calculate distance between two edges. Then, based on user threshold, remove or keep corresponding lines based on these calculated distances.

edit2: here is sample image:

How to remove only 3 thin lines and keep 2 thick lines OR how to remove 2 thick lines and keep 3 thin lines? That is what I have to accomplish.

edit3: what I mean by remove is in this context interpolate them with the background (average value of left and right close pixels).


texts: Draw a frequency response graph from a simple equation

texts:
How is it possible to draw an audio frequency response graph (x-axis : freq from 20 to 20 000hz, y-axis : dB)  from a simple equation like

y[n] = x[n] - x[n-486]

(Example: with this equation I get a nice comb filter that removes frequency 197,5Hz and all its harmonics, for an audio file with sampling rate 96 Khz)

How to turn such an equation into a graphical interpretation like this
http://downloadfreesamples.com/wp-content/uploads/2013/08/EQ-Four-CIS-DSP_3.jpg ?
Then I could see how deep / steep the filtering is.

Thank you

(PS : I continue to read references and online books about filter design that were given to me in previous questions, thanks for these references by the way.)


texts:
The 2D Gaussian function is defined as:
$$G(x,y) = \frac{1}{2\pi \alpha}e^{-\frac{x^{2}+y^{2}}{2\alpha}}$$
And this is a Gaussian kernel:

If I take the top left corner as the origin and set $\alpha=1$, then at $x$=4 and $y$=0, $G(4,0)$ = $5.3\times10^{-3}$. But here at $G(4,0) = 3.66\times10^{-3}$. Then how they design this Gaussian kernel? I am new on this topic. So, this question may seem too much beginner level.


texts: Dimension error using findpeaks function in Matlab on Power Spectral Density to calculate SNR of audio data

texts:
I have a set of audio files for which I would like to determine a SNR metric. I tried to implement in Matlab as follows:
% Calculate the FFT and PSD of each of the signals in the signal vector.
afftvectors = {};
hfftvectors = {};
psdvectors = {};
halffreqvectors = {};
powdbvectors = {};
signalpeaks = {};
signalpeaklocs = {};
noisepsd = {};

for k = 1:numel(signalvectors)
    afy = abs(fft(signalvectors{k}));
    afftvectors{k} = afy;
    % Due to the symmetric nature of FFT, only half the spectrum is actually required.
    hfy = afy(1:length(afy)/2+1);
    hfftvectors{k} = hfy;

    py = (1/(freqarray{k} * length(signalvectors{k}))) * abs(hfftvectors{k}).^2;
    % since we take only half of the spectrum, we can conserve the energy by multiplying
    % by 2. Zero frequency (DC) (index 1) and the Nyquist frequency (last index, i.e, end)
    % do not occur twice so, we'll skip the multiplication operation on them.
    py(2:end-1) = 2 * py(2:end-1);
    psdvectors{k} = py;
    halffreqvectors{k} = 0:freqarray{k}/length(signalvectors{k}):freqarray{k}/2;
    powdbvectors{k} = 10 * log10(psdvectors{k});

    % Find peaks
    [signalpeaks{k},signalpeaklocs{k}] = findpeaks(psdvectors{k});
    noisepsd{k} = psdvectors{k} - signalpeaks{k};
end

So, the idea was to get the peaks of Power Spectral Density vector. I hit a dead end when I got the output where 'signalpeaks{1}' is a vector of size 13235x1 but my 'psdvectors{1}' itself is a vector of size 36001x1. All the elements in cell array 'signalvectors' has a sample size of 72000. What exactly is going wrong here? Am I using the wrong function in findpeaks() or something else needs to be done?


texts: What is the rate of expansion of an image as it aproaches the human eye?

texts:
My intuition about  the scaling (x,y) of the 2d representation of the 3d object generated by our native visual processing system tells me it accelerates as it approaches the visual sensor (our eye).

Is this true?  What is the rate of expansion of objects within our visual field?


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

texts:
Can someone point me towards a good book or survey article on adaptive/self-tuning of PI controllers?

All I can find online are articles which are either vague or heavy on theory.


texts: Response of Linear System to Stochastic Process

texts:
Somehow I am getting the variance{u(n)} equal to '0' !! This is the case when I take the coefficient 'a' as real. As it is not mentioned in the question I need to find the solution to this question for a complex 'a' also. I would be glad I anybody could help me solve it. I waold also like to clear my concepts about the complex coefficients, as in how does the Z and inverse Z-transform takes place when 'a' is complex.
This is a back problem of the second chapter in the book - Adaptive Filters: Theory and Application by Farhang-Boroujeny


texts: Finding the Energy & Power of a Composition of Odd and Even Signal

texts:
Given two CT signals $x_1(t)$ (even signal) and $x_2(t)$ (odd signal). If $x_1(t)+x_2(t)$ is an even signal then what is the energy and power of $x_2(t)$.
My Attempt
$\int \limits _{-\infty}^{+\infty}$ $\left| x_1(t)+x_2(t)\right|^2 dt$
Since the functions are real we can
= $\int \limits _{-\infty}^{+\infty}$ $\left( x_1(t)+x_2(t)\right)^2 dt$
= $\int \limits _{-\infty}^{+\infty}$  $x_1^2(t)dt$ + $\int \limits _{-\infty}^{+\infty}$  $x_2^2(t)dt$ + $\int \limits _{-\infty}^{+\infty}$  $2 x_1(t) x_2(t)dt$
This one was useful for the next step
= $\int \limits _{-\infty}^{+\infty}$  $x_1^2(t)dt$ + $\int \limits _{-\infty}^{+\infty}$  $x_2^2(t)dt$
Now the energy of $x_2(t)$ is the difference between the energy of $x_1(t) +x_2(t)$ and that of $x_1(t)$.
We know that $x_1(t)$ is even , $x_1(t)+x_2(t) $ is even , $x_2(t) $ is odd (however its energy function $x_2(t)^2$ is even since its product of two odds)
~~ And I'm stuck here ~~~


texts:
I'm trying to implement a singing game that will analise raw mic input and tell the player how good is he singing. That needs to be done in real-time.

I've come across a lot of threads asking the same question but I'm still quite not done with it, probably due to my lack of experience in the field and shallow math background. I've implemented an algorithm based on the DSPDimension website pitch shift's article: http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/

I extract the true frequency and magnitude just like the article explains, but I don't know find the fundamental frequency with this. I've tried to get the bin with greatest magnitude but that only give me right results for higher pitch signals, it doesn't matter which oversampling factor I use I still get bad data for low freq signals. Is this approach completely wrong or am I in the right track but just missing something?

Thanks in Advance,

EDIT: I forgot to mention that I'm only interested in the pitch class, so it is ok if the fundamental is missing but I have a strong overtone in the sample.

EDIT2: Thanks to everyone, I just finished a version of the algorithm that's working like a charm. The low pitch estimation problem was due to my input test. When I sung the note it matched correctly. Also, I'm considering all harmonics now, not just the highest peak.


texts:
I am extremely new to this and I'm learning by building stuff myself so please let me know if this is too vague and Ill elaborate if I can. Im sure this is something very simple, but cant figure out how to do it.

I have built radios before and know how to modulate a signal as ASK but now I'm trying to send a simple bitstream from a USB port to a radios input.
My idea was to use a serial program to dump bytes into the radio input signal but all the research I have done indicates using rs232 or UART or something. I have no experience with this and I dont want some protocol sticking parity bits in all over the place.
I simply want to be able to send, for example, 0x1234 as
00000001000000100000001100000100 at a baudrate of 2048.

My intention is to monitor the frequency with an sdr and then learn how to demodulate the bits from the IQ data.

Is there a simple method for doing this or something I dont know about which will prevent me?

Any help or direction would be greatly appreciated.


texts:
I try to implement a qpsk modulator in Octave.
The chain is the state of the art I guess:
$$\text{Symbol mapper} \rightarrow \text{Upsample 4} \rightarrow \text{Root raised cosine filter} $$
My main question is about the upsampling. I try to do it two ways:

zero hold (I think it is called like that - adding factor-1 last values)
zero padding (adding factor-1 zeros, here the spectrum is duplicated and alias filtered by RRC)

I have not tried yet to do a BER measure with AWGN, but eye-diagram and spectrum looks different depending how I upsample. I have the feeling that the spectrum and eye diagram is more correct with zero hold but get a residual bias at the sampling point.
Am I wrong?


texts: What is the signal-noise model of laser induced fluorescence?

texts:
The following image is an example of a fluorescence signal trace from the photomultiplier tube detector (PMT). Each spike represents one fluorescently labeled cell.

This signal model is definitely not additive white Gaussian, although the noise term is Gaussian. The signals are low variance but the point is that when the signal amplitude increases, the noise variance rapidly decreases. In the given example, above the intensity value of $0.6$ all three Gaussian signals are almost noise free. Around $0.4-0.5$ intensity of the noise is reduced but can be seen if zoomed. Below $0.4$ the noise is significantly apparent.

  How can this signal-noise relation be properly modeled? For example for additive noise we have $$x[n]=s[n]+w[n]$$ where $x$ is the received signal $s$ is the error free signal and $w$ is the Gaussian noise.

My aim is to simulate such signals in Matlab using a theoretical model. However, I was not able to see and/or find any model via google search or on some related books.

The physics behind this is due to detection of laser signal via photodiodes or PMTs. I was thinking that the noise source was probably the quantum noise but I am not sure because for the quantum noise, the noise variance does not decrease when the total number of photons $N$ increases. Instead it increases as $\sqrt N$.

What I tried was dividing the noise values by $k+s[n]^2$ before adding to the signal, where $k$ is some constant. I did this over additive Gaussian noise model. The results were okay. But I am not able to justify this theoretically. It is just my intuitive understanding.

Sources:

https://www.cut.ac.cy/faculties/fet/mem/research/research-units-and-laboratories/biolisys/research/imaging/cytometry/?languageId=1

https://en.wikipedia.org/wiki/Laser-induced_fluorescence


texts: Are the bit-changing frequencies in a binary sequence related to the dft of that sequence?

texts:
I work with binary a lot, and I've always noticed that an incrementing binary sequence has sub-frequencies in the columns:

000
001
010
011
100
101
110
111

So columnwise, that's 01010101, 00110011, 00001111

So these three columns could be considered to be 3 separate sequences of their own. The only difference is the scaling (each column is a different power of 2). These also are all the harmonics in a 8-long sequence.

From this I concluded that a sawtooth wave should have a dft of all bins, with descending heights. I tried it in octave (this is a fft):

This sort of looks as expected. I would guess bin 5 is the 2^2 column (lowest frequency, highest amplitude), 6 is the 2^1 column and 7 is 2^0 column.

So then I was like, well, what does a sinusoid look like in binary. Because that's only one changing  frequency. So I made a binary sequence in octave:

0000
0011
0101
0110
0110
0100
0000
1101
1010
1001
1001
1011
1110

So it looks sort-of sin ish. But it's still a whole bunch of different frequencies, I assume because it's a discrete sequence. It's still not obvious.

Is it some kind of established property that the columns in a binary sequence are related to the dft of that sequence? or does the sawtooth just happen to work like that coincidentally?


texts: How to generate a sinusoid with STFT at a frequency which is between bins

texts:
Is it possible to generate a sinusoid at a frequency which is between two bins (so a fractional index) with the STFT algorithm (by filling bins and doing the inverse) ? If yes then how can this be done ?

In my experiment with overlap add STFT algorithm and with a window size of 1024 i just compute the distribution of energy between the two bins that the sinusoid fall into however this produce two sinusoids plus some noise in between... is that normal ?


texts:
I need to draw an outline of text in an image. Consider the below image as an example.

Can anyone suggest me a direction to achieve this? I don't have experience in image processing. Any tools/lib or anything that can generate this kind of image will be helpful.


texts: Continuous frequency grid to discrete grid

texts:
I am designing a controller for a system using several methods, one of which is a discrete method. In the continuous time I am looking at a logarithmically spaced frequency grid in the range $$\omega \in [0.1,1]$$Now I want to design a controller in the discrete time, but I want to evaluate the h-infinity norm (which I am minimizing) over the same frequency grid as in the continuous time.

How can I minimize the norm over the same frequency grid in discrete time?


texts: Understanding the transfer function of an FIR filter

texts:
I'm currently studying FIR filter and am having trouble understand how the following equation works, and it's implication.

$$ y[n] = h[n] * z^n = H(z) \cdot z^n $$

I don't really understand how this works given that

$$ y[n] = h[n] * x[n] $$
$$ Y(z) = H(z) \cdot X(z) $$

It seems to me that $ x[n] = X(z) = z^n $.  What's going on here?  What domain is $ z^n $ in?

I thought that convolution is done on two functions in the n-domain; however, in the equation $ y[n] = h[n] * z^n $, $ z^n $ does not appear to me to be in the n-domain.

If it is in the n-domain, then I don't understand how the other part works, $ y[n] =  H(z) \cdot z^n $, because I thought that then it should be

$$ y[n] = Z^{-1}(\,H(z) \cdot Z(z^n)\,) $$

Thanks.

Edit:
Here's the page from the book with the equation.  It does seem to me that $z^n$ is used in both the time and frequency domain.


texts: Necessary image processing operations before template matching

texts:
Well, this may show I didn't take image processing class.

I have this template to match an object in images. But real object in images, for example, does not look like that but the second image. What operations do I need to take for the images like the second one to be ready for template matching? FYI, the third image shows a ideal matching.

In another idea, I fit the template to the image. That is, I give four corner coordinates on the image to match those in the template. Then it will compute a way to fit the template to the area.

UPDATE: Problem solved. Thanks to the answer I selected below. I successfully managed to apply my template on the image. The last image shows the result.


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

texts:
I have implemented a QPSK Costa's loop in GNU Radio and run some BER benchmarking. All is going well. Out of curiosity, I'm trying to implement the Maximum Likelihood phase recovery shown below.

For the Costa's loop, a loop bandwidth, which specifies gain constants for the loop filter (F(z)) and the integrator,  of a few percents of the symbol rate is adequate.
My question is, first of all, since the ML phase recovery doesn't seem to have any traditional loop filter (e.g. proportional-plus-integrator), does the very concept of loop bandwidth apply? If the concept of loop bandwidth is applicable, how do you set it and what are the appropriate values (in relation to symbol rate, maximum frequency offset etc)?

UPDATE

Harris' ML structure


texts: Peak to Average Power Ratio of an exponentially increasing signal

texts:
I am having an exponentially increasing sinusoidal signal.
After sampling, I am dividing the signal into frames of length 128 and doing windowing operation with a hanning window of length 128. Then the FFT of this windowed sequence is found out frame by frame.
The average power and peak power of the windowed signal in each frame is found out and Peak to average power ratio (PAPR) is calculated.
Will the PAPR increase with each frame?


texts: Estimate Instantaneous Frequency Using LMS Algorithm

texts:
I hope someone can help me with the following problem:

I want to estimate the frequency of a sound file that is composed of a sinusoidal with varying frequency and additive white noise:

$$ x \left[ n \right] = \sin \left( \varTheta \left[ n \right] \cdot n \right) + w \left[ n \right] $$

Now I implemented a linear predictor using LMS algorithm to estimate the parameters of an AR-Process (As described in Haykin: Adaptive Filter Theory).

$$ x(n) = -\sum_{k=1}^M a_k(n)x(n-k) + v(n) $$
$$\hat{w}(n+1) = \hat{w}(n) + \mu x(n-k)f_M(n) $$

With $f_M(n) = u(n) -\sum_{k=1}^M \hat{w}(n)x(n-k)$ being the prediction error.

From that I calculate the time-varying frequency function:
$F(\omega,n) = \frac{1}{|1-\sum_{k=1}^M \hat{w}_k(n) e^{-j\omega k}|^2}$

This looks like the following:

For now I compute the instantaneous frequency by searching for the maximum of F for each time sample n. But the problem is, that it is quite noisy and the frequency overshoots a lot at the transitions:

Now I wanted to ask if there are any ways to optimize the computations, I would be very happy for some ideas.


texts:
I'm trying to develop an application for the demodulation of some GMSK signals transmitted over the air.
I'm using a RTL-SDR which outputs 8 bits IQ samples of the baseband signal.
Here is what I've understood and what I've done  :
Since they are GMSK signals, the binary data is encoded by phase variations. A +PI/2 phase change equals 1 and a -PI/2 phase change equals 0.
So I developped the following piece of software :

apply a frequency translation, then low pass filter and decimate to 1 sample/symbol
read each couple of I and Q samples
compute the instantaneous phase with arctan(Q/I)
compare phase change between the n-th and the previous (n-1) sample
if n > n-1 then we have 1 or we have 0

While this method works relatively well with a high SNR (i.e. 60dB), it become realy bad with a lower ratio.
I guess this bad performance is due to the non-coherent demodulation.
I saw that coherent demodulation which uses carrier/clock recovery then phase error estimation is a lot more reliable and accurate.
I'm a true signal processing beginner. Do you know what should I do with my IQ samples to gain a better demodulation?
Thank you.
EDIT 2021/05/16 : Trying another approach
I guess a timing recovery algorithm sould be applied to an output NRZ signal.
So I'm trying another way to demodulate GMSK.
In order to use a TED algorithm (such as Zero Crossing) later, my input baseband signal is sampled at 2 samples/symbol,

For each complex sample, I compute the instantaneous phase with arctan(Q/I) :

Then I perform phase unwrapping :

And I compute the derivative by doing nth-(n-1)th phase and finally I get a FM demodulated audio of my baseband signal and not a NRZ signal :

However, I saw that passing this signal to Clock Recovery MM and Binary Slicer blocks in GNURadio Companion gives the array of 0s and 1s.
How can I get an NRZ signal ?


texts: Finding the convolution $a^n u[n]$ with $b^n u[n]$

texts: Hi I'm trying to solve the problem when studying for an upcoming test. The given solution is $$y[n]= \frac{1}{b-a}(b^{n+1}-a^{n+1}) \quad \text{for } n\ge0 \ .$$ However, I'm not sure how to reach this point. We have to also verify using the z-transform. Any help would be appreciated so much.


texts: A (Clear) Line Between Computer Vision and Image Processing

texts:
I have been working in and learning about both Computer vision and Image processing for a few years now, and I believe that I am not a complete beginner any more.

Still, after all these years, it is hard for me to tell for any particular part of my work whether it is mostly Computer vision related, or if it is Image processing. I just can't see the line -- when I work, study and research, I read reference materials with both keywords.

So, I am interested in the definition of the Computer vision and Image processing fields, with focus on the comparison (differences as well as overlaps) of the fields.

Additionally, I think it would be valuable to have an example of a (conceptual or existing) practical applications, projects and works dealing with/utilizing:

solely (or mostly) Computer vision tools and ideas
solely (or mostly) Image processing tools and ideas
a combination of tools and ideas from both fields

with special attention paid to what makes it one and not the other, or what makes it both.

I understand that these fields are highly related and that the "line" might not be as clear as this question is asking for, but I hope you understand that the point of this question was not to design a simple decision rule for classifying (my) work, but rather a better understanding of the focus and goals of these fields. Also, any additional information that seems on-topic with my question tone is welcome, even if I did not specifically ask for it.


texts: Computing narrowband spectrograms using MATLAB

texts:
I'm having an assignment of computing narrowband spectrograms using MATLAB.
And I totally have no idea about the code.
Can someone help me writing the code and explaining what's going on to me.
Lots of thanks!!

Followings are the requirement:

B.1. Load the recorded .wav file using the function “wavread”. Let y be the variable
storing the signal;

B.2. Perform short-time Fourier transform on y as follows:
(i) Divide the signal into many short-time frames. Each frame is 50 msec long. Frame
shift is 1 msec;

(ii) Apply 1024-point FFT on each frame;

(iii) Store the power spectrum of each frame in a column vector (note that only the first
512 FFT coefficients are needed).

(iv) Append the power spectrum vectors of all frames to form super matrix S. The size
of the matrix will be 512 × no. of frames;
(v) Plot the spectrogram using the following MATLAB commands


texts: Unable to understand the time-shifting property of CTFS

texts:
The CTFS of $x(t)$ is $c_{k}$ the Fourier series coefficients. Furthermore, $x(t-t_{0})$ is known to be $e^{-j\omega t_{0}}c_{k}$, the proof is given as follow :
$$
\begin{aligned}
\mathscr{F}\left(f\left(t-t_{0}\right)\right) &=\forall n, n \in \mathbb{Z}:\left(\frac{1}{T} \int_{0}^{T} f\left(t-t_{0}\right) e^{-\left(i \omega_{0} n t\right)} \mathrm{d} t\right) \\
&=\forall n, n \in \mathbb{Z}:\left(\frac{1}{T} \int_{-t_{0}}^{T-t_{0}} f\left(t-t_{0}\right) e^{-\left(i \omega_{0} n\left(t-t_{0}\right)\right)} e^{-\left(i \omega_{0} n t_{0}\right)} \mathrm{d} t\right) \\
&=\forall n, n \in \mathbb{Z}:\left(\frac{1}{T} \int_{-t_{0}}^{T-t_{0}} f(\bar{t}) e^{-\left(i \omega_{0} n \bar{t}\right)} e^{-\left(i \omega_{0} n t_{0}\right)} \mathrm{d} t\right) \\
&=\forall n, n \in \mathbb{Z}:\left(e^{-\left(i \omega_{\mathrm{o}} n \bar{t}\right)} c_{n}\right)
\end{aligned}
$$
I did not understand what happened in the second step. Furthermore, in the third step why did we replace $t-t_{0}$ by $\overline{t}$ without modifying the boundary of integration and replacing $dt$ by $d\overline{t}$? Any help is much appreciated and thank you.


texts: Deriving the frequency spectrum graph from the graph of a spectrogram and vice versa?

texts:
I have a signal's spectrogram and frequency spectrum (which, if i'm not mistaken, is its the signal's fourier transform) as given below:

I understand that the spectrogram plots the frequency (y-axis) vs time (x-axis) and that the colors represent the amplitude.  I also understand the frequency spectrum as the plot of amplitude vs. frequency.  But I'm not quite sure how to produce one graph from the other.   Since there is no time axis on the frequency spectrum, surmise that it is impossible to create the spectrogram from a frequency spectrum.  It seems plausible to derive the frequency spectrum from the spectrogram, but I'm not quite sure how to remove the time parameter.
Any help with this would be greatly appreciated.


texts: What is difference between Signal frequency and data rate

texts:
I read somewhere the below two line and got confused what is the actual difference between the two line. These two lines are related to CAN

1.Maximum Signal frequency used is 1 Mbit/sec

2.Typical maximum data rate achievable is 40KBytes/sec.

If anyone knows about it please share the answer.


texts: How to compare 2 MFCC (compare them if they where created from same speaker)

texts:
There are multiple speakers.
Each speaker generates multiple MFCC.
If I'm getting two different MFCC, can we know if those MFCC came from 2 different speakers or same speaker ?

How can we compare them and check this ?


texts: Apply a filter according to some function

texts: I'm fairly new to digital signal processing. I've been trying with limited success to apply a time-varying bandpass filter to a signal (question at stackoverflow). Instead I thought I'd try a different approach. Say I have a function which approximates the data I'm trying to filter from my signal. Is there a technique -- perhaps some sort of optimisation -- that can take this estimation as a "template" for a filter design, rather than specifying strict filter parameters, as when one designs a Butterworth filter, for example.


texts: Why is the coherence function unity at all frequencies when only one reading is done?

texts: Several papers on the internet states that the coherence function is unity for all frequencies if only one reading is done, and that the coherence function requires an average of two or more readings of the input and output in order to get a valid result. Why does not the coherence function give a valid result for only one reading of the input and output? And what is the effect of dividing the readings into several segments?


texts: What do colored noises look like in the time domain?

texts: I understand that the time domain representation of white noise looks like impulses. How do colored noises like brown, pink etc. look like when we perform an inverse Fourier Transform on them ? What could be some sources of colored noise that may affect speech signals?


texts: What is the relationship between frequency vector and the peak frequency in FFT?

texts: I am fairly new to both Matlab and FFT. I would like someone to explain to me the relationship between the frequency of the wave being processed, the number of point (usually called NFFT), the Nyquist Fs and frequency vector. Basically how do you find the peak frequencies? how does FFT represent the frequencies? Any and all help is welcome. Thank you


texts: Why are some Shannon's limit plots exponential rather than logarithmic?

texts:
This diagram again. This is clearly not the shape of $\log_2(1+SNR)$ but I very frequently see this instead of this:

But this is also a stupid diagram because it doesn't cross at the origin.
Also why do the modulation techniques veer away from $\log_2(1+SNR)$, they should stay on the curve and then get suddenly capped at their spectral efficiencies.


texts: What are the largest FIR filter lengths used in practice?

texts:
This is a rather general set of questions.

I'm interested in knowing up to what orders, direct form FIR filters are considered useful for practical applications (both in hardware and software)?
What if fixed-point arithmetic is used?
Are FIR filters with several hundred or thousand fixed-point taps suitable for some problems, even if this is rare?


texts: what is the difference between buffering and queuing?

texts:
I've some problems with definition of queuing and buffering so
what is the difference between buffering and queuing ?


texts: Handling a number of simultaneous measurements in Extended Kalman Filter?

texts:
If I have a number of sensors whose measurements arrive at the same time - how can I handle them properly in the Kalman filter?

P.S.
The measurements are not necessarily taken at the same time but I only receive them batched together.


texts:
I have a camera which is providing me raw, binary data with 10 bit data. It follows the Bayer pattern RGGB, and each pixel is saved using 16 bit chunks. I am able to demosaic the image almost successfully.

The problem

The RGB image looks is almost completely black. If I multiply by 64 the raw data, the RGB image looks better but rather green. The overall intensity is very low. The camera provider has a live view of the camera and it looks much better in both aspects.

My guess

Since 10bit are saved into 16bit chunks, the tools I am using assume 16bit depth (at least Matlab and OpenCV do for sure). In order to compensate for this, I multiply by 64 (6bit shift to the left) the raw data. But still is not enough. If I multiply by 128, some pixels saturate and then the image looks weird.

What I have tried

Using Matlab image processing toolbox, Python colour-demosaicing package, and OpenCV functions, I get the same result, but they do not match the live visualization.

Update
I analyzed the histogram on the vendor tool, and those from OpenCV. I am not sure, but interestingly there are no values above 255. However, on the raw data I record from their software, there are many values above 255, but nothing compared with values below 255. Thus, if I clip the image with max value of 255, the final result looks very similar!.

Questions

Is there anything else I can verify? I assume is a problem on my end, because the three tools give same results.
Is there a better way of handling the 10bit pixels to convert to 16bit?
Is there any sense on what I discovered on the update? It seems that the two extra bits are not used for anything but noise!

Any help is appreciated. I am very sorry for not providing data or images (company privacy).

Thanks!


texts: Calculating the perimeter in binary image

texts:
After pre-processing, I can obtain the image like this:

Then, I want to calculate the perimeter of the bottom region (annotated with grey line).

I am making an ImageJ plguin. So I have to implement on my own. (firstly, I have to identify front region (in this case, bottom) and then calculate the perimeter)

Is there any idea or suggestion?


texts: Compressed Sensing vs Common Compression Approaches

texts:
I have a very basic question regarding common compressing approaches. Often, I have heard something like "The problem in our common way to compress data is, that we have to acquire a huge number of samples from our signal, because of the Nyquist-Shannon theorem. But then, when we compress these samples, we throw most of the information away."

I do not really understand the last sentence, probably because of lack of knowledge. So, my question is: what do you throw away and why?

Here are some sources:

Michael Lustig, at 0:26 he says

  Why we need to acquire all the data in the first place, and then throw most of it away.

Mark Davenport, on Slide 4 at 0:45 he says

  The very first thing that we do after we acquire some data is we compress it and seemingly throw away a lot of information that we painstakingly acquired.


texts:
Originally this question was asked EE SE yesterday but then i saw a comment about DSP SE ,so i am posting my question again here ,in hope to get much better and relevant answers

Link of EE question is
https://electronics.stackexchange.com/questions/497036/signal-processing-vs-image-processing

My question was/is

Although both are domains of EE, but what are differences between them? I am able to draw following conclusions from wikipedia article of dip and also from some other web reources

1) DIP(Digital image processing) is a subset of DSP(digital signal processing)

2)Because of above concept in (1), DIP only deals with 2 dimensional images/signals or in some case 3 dimensional images/signals(forexample RGB images) while in DSP there isn't any restriction on number of dimensions?

Please kindly guide me and correct me if i am wrong in my concepts/assumptions


texts:
Some animals are specially trained to repeat human phrases, others just make sounds that people interpret as speech.

In this video a rooster seems to say "Cristo Viene" (Christ is coming).

Taking the spectrogram of that rooster to analyze the formant position of the vowels I can't find any matches (I was using a formant position UCLA's chart from   here ), because the pitch of the animal is obviously different to formant position of human male or females.

Does anybody knows the way to find the formants position at different pitches? (I put the spectrogram of the rooster above)


texts: Calculating SNR from Frequency-time domain

texts:
I tried to analyse the time-frequency of specific appliances. As it shows in the following frequency-time graph
I have High frequency noise from different appliances here. 4096 is the number of frequency divisions. So in the data I have, across a spectrum of 0-1Mhz, there are 4096 divisions. In other words, each "bin", holds the amount of energy at that frequency. 1Mhz/4096 = 244.14Hz, thus, each bin from 0-4095 represents energy averaged over roughly 244.14Hz. (244,14 vectors per second)

I tried to analyse each bin before the time before 1.34334165, and plotted the 4096 point FFT vector as frequency vs. power. I am not sure why it is 500 Khz, but I think the High Frequency signal is sampled at 1 MHz and FFTs are computed to get 2048 frequency data points from DC to 500 kHz

So the question is, I need to calculate the SNR of each bin represented in the graph. I was following the thread here on how to calculate SNR from frequency domain signal, but I was wondering if this answer is correct. I couldn't understand the 50 leakage and, as I was wondering too, is the inputsignal the  sum of the magnitudes of all the 4096 bins?


texts: Designing a multi-band FIR filter on MATLAB

texts:
I am trying to plot the frequency response of a dual recursive running sum (RRS) filter, with the $\mathcal Z$-transform of each given by:
$$\frac{1 - z^{-L_n}}{1 - z^{-1}}$$
This is the code I've written:
% (1 - z^-L1) / (1 - z^-1) * (1- z^-L2) / (1 - z^-1)
L1 = 75;
L2 = 53;
fc = 500;
fs = 44100;

den_exp = -exp(-2j*pi*(fc/fs));
num_exp = -exp(-2j*pi*(fc/fs)*L1);
num2_exp = -exp(-2j*pi*(fc/fs)*L2);

%z transform
b1 = [1, zeros(1, L1-2), num_exp];
b2 = [1, zeros(1, L2-2), num2_exp];
a = [1, den_exp];

[hA, w] = freqz(b1, a);
[hB, w] = freqz(b2, a);
hAB = hA .* hB;

plot((w*fs)/(2*pi), 20*log10(abs(hAB)))
xlabel('Frequency')
ylabel('Magnitude (dB)')
title('Recursive filter with cut-off = 500Hz')

The frequency response appears to be off, and I can't seem to figure out why.
This is part of a project where I am trying to build a tone control system on MATLAB. I have read a couple of papers on the RRS, and I understand the idea of combining the transfer functions of high, low, and band pass with selected gains and delays, but I am struggling to implement this on MATLAB.

For example, how does one add a delay block to a transfer function, as shown here?
And how are these transfer functions added together?

I would be grateful if someone could provide some details on how to implement this.


texts:
First of all, forgive me if I sound stupid. I am still learning Audio Processing.
So I am trying to make a machine learning model for detecting a specific insect through sound.

Here is a sample raw audio waveplot using librosa library:

After some preprocessing, applying High- pass filter and normalize it here is the output:

My questions are:

The next step would be to extract features from this, do I have to frame the audio manually and extract the features from that specific frame? Like this?

How would I remove the silence where the sound of the insects is not present?
Or do I have to analyze it directly for the whole duration of the sound? I have tested Librosa's Library in generating Spectrogram, here is the output:

Any good resources you can recommend for beginners?

Thank you so much.


texts: How to flatten the image of a label on a food jar?

texts:
I'd like to take pictures of labels on a jar of food, and be able to transform them so the label is flat, with the right and left side resized to be even with the center of the image.

Ideally, I'd like to use the contrast between the label and the background in order to find the edges and apply the correction.  Otherwise, I can ask the user to somehow identify the corners and sides of the image.

I'm looking for general techniques and algorithms to take an image that is skewed spherically (cylindrically in my case) and can flatten the image.  Currently the image of a label that is wrapped around a jar or bottle, will have features and text that shrinks as it recedes to the right or left of the image.  Also the lines that denote the edge of the label, will only be parallel in the center of the image, and will skew towards each-other on the right and left extreme of the label.

After manipulating the image, I would like to be left with an almost perfect rectangle where the text and features are uniformly sized, as if I took a picture of the label when it was not on the jar or bottle.

Also, I would like it if the technique could automatically detect the edges of the label, in order to apply the suitable correction.  Otherwise I would have to ask my user to indicate the label boundaries.

I've already Googled and found articles like this one:  flattening curved documents, but I am looking for something a bit simpler, as my needs are for labels with a simple curve.


texts: Order of applying two Butterworth filters (distributivity)

texts:
I have a function $f(a, b)$ that applies a linear transformation on a signal $a$, given another signal $b$.

I would like to filter the result of $f$ using a 2nd order Butterworth low-pass filter ($\mbox{butter}()$).

My question is, would first applying the filter on the individual signals give the same result as applying the transformation on the raw data and filtering afterwards?

In other words, does the following hold: $\mbox{butter}(f(a, b)) = f(\mbox{butter}(a), \mbox{butter}(b))$ ?

PS. would this property be called distributivity? I can't really figure this out..


texts: Is it safe to call this WSSUS channel a Gaussian process?

texts:
BACKGROUND:

Equation (3.6) of Wireless Communications by Goldsmith gives the baseband impulse response of a time-varying channel as:
$$
c(\tau,t) = \sum_{n=0}^{N(t)}\alpha_n(t)e^{-j\phi_n(t)}\delta(\tau-\tau_n(t)),
$$
where $N(t)$ is the number of multipath components ($n=0$ is the line of sight path), $\alpha_n$, $\phi_n$, and $\tau_n$ are the amplitude, phase, and lag of the $n^\text{th}$ path, respectively.  If $u(t)$ is the baseband transmitted signal, then the received signal $r(t)$ (at baseband) would be:
$$
r(t) = \int_{-\infty}^\infty c(\tau, t) u(t-\tau) d\tau
$$

Frequently the impulse response $c(\tau,t)$ is modeled as a zero-mean wide-sense stationary uncorrelated scattering (WSSUS) stochastic process. Coupled with this is frequently the assumption that $c(\tau,t)$ is a complex Gaussian random process, which gives a Rayleigh fading channel as the result.

Normally when a stochastic process $x(t)$ is called a Gaussian process it is because the marginal distribution of $x$ at any time $t$ follows a Gaussian distribution.

In the case of $c(\tau,t)$, the "value" of the random process is "infinite", due to the multiplication with the Dirac delta above (which is not actually a function, but a distribution).

QUESTION:

If a Gaussian random variable is multiplied by a Dirac delta distribution, is it still fair to call it a Gaussian random process?  Does it still have all the "nice" properties that a Gaussian random process has, such as:

Being completely specified by its first and second-order statistics
Any linear transformation being done on it still resulting in a Gaussian distribution at the output


texts: How to simulate High Power Amplifier(HPA), like Solid State Power Amplifier (SSPA)

texts:
I cannot understand how to simulate Solid State Power Amplifier (SSPA). When I directly write the Rap's SSPA model in Matlab, it does not produce BER of OFDM like published papers by other researchers'. Even no change is observed between BER with and without SSPA. But theoretically there should be significant changes between these (for low nonlinear parameter r, Asat). I have seen several matlab code in Matlab fileexchange, but those could not produce BER like published papers.  What is the wrong in my code given below.

Please help me out.


texts: What is meant by "complete set" in the context of affine wavelets?

texts: In the book by Sayood on compression, he says "if the set is complete, it is called affine wavelets".  I want to know what is meant by completeness of wavelets.


texts: CWT coefficients as features for ML algorithms

texts: I use CWT coefficients as features in ML algorithms and then I did the feature selection using the chi-square test but recently I figured out that the chi-square test can only be applied for categorical variables. But, can we assume the CWT matrix values as categorical features and then apply the test?


texts: converting block diagrams with delays to equations

texts:
given this block diagram:

can someone please clarify how to interpret the second delay (the one prior to $Y$)? to convert this block diagram into a simple equation, I interpret the diagram as:

bottom path: take input at $n$, multiply by $-1$ and delay by $1$, gives: $-1x[n-1]$
top path: take input at $n$ and sum it by result of bottom path, gives: $x[n] + -1x[n-1]$
take sum of bottom and top path and delay it (?) - this is the part I'm confused about. it doesn't make sense to write: $(x[n] + -1x[n-1])[n-1]$ which is what the diagram looks like to me.

what is the right way to read this diagram?


texts:
I am calculating different attributes for connected regions of the image, with the final goal of classification. One of the attributes I am working with is a sparsity measure, calculated as the ratio of the area of the region (in pixels) and the area of the region's convex hull.

For now, I am doing this with OpenCV:

std::vector <cv::Point2f> region;
std::vector <cv::Point2f> convex_hull;
// fill the region ...
cv::convexHull(cv::Mat(region), convex_hull, false);

double ratio = (double)(region.size()) / std::abs(cv::contourArea(convex_hull));

The problems with this approach is that pixels are considered to have an area of 1 when calculating the region area, but are treated as points in convex hull calculation, causing disparity.
An example would be a 4-pixel rectangle with the pixels coordinates ((1,1), (1,2), (2,1), (2,2)). Convex hull contains the same 4 points. But, the area of the region is calculated as 4 (counting the pixels), and the convex hull area as 1 (a 1x1 rectangle with corners in (1,1), (1,2), (2,1), (2,2)).

Can anybody suggest a way to compute these two areas in the same way, so that the range of my sparsity measure is in fact [0,1] and the region area never gets calculated as larger than convex hull area?


texts:
If $N$ is discrete Fourier transform's frame length, and $N/2$ is half the frame length, how would you call $\frac N2 + 1$?

frame_length      = N      ;
frame_length_half = N/2    ;
?                 = N/2 + 1;


texts:
I just studied about SURF and I'm going for its implementation, but I still didn't understand why we use descriptors.

I understand what keypoints are and their purpose, but when we extract the keypoints than why do we need to use descriptors ? What is their importance and role in recognition?


texts: Relationship between Carrier Frequency Offset and the Constellation Diagram

texts:
As part of a project I am doing, I have to investigate how having a carrier frequency offset would affect the constellation pattern of the received signal.This question has got me baffled because to me a carrier frequency offset should not affect the constellation pattern because any offset would be dealt with on the receiver side.I might not be understanding some concepts very clearly.

ie.  On Transmit side we transmit

$$
    s(t) = x(t)\cos(2 \pi (f_c + f _\phi) t)
$$

then on receive side

$$
    r(t) = 2 \text { LPF  } (s(t) \cos(2 \pi (f_c + f_\phi)) t) = x(t)
$$

So regardless of the offset we have on the carrier frequency there should no be no effect on the constellation diagram.Any help will be appreciated?


texts:
i cant see the logic of defining the route location is the code bellow.
for example _I2C_ROUTELOC0_SDALOC_MASK:
at first we have 1F which is 0001,1111 we take its inverse 1110,0000 and we or'ing with 0001,1111.
I cant see what its doing.
_I2C_ROUTELOC0_SDALOC_MASK   is       0x1FUL
I2C_ROUTELOC0_SDALOC_LOC16    is     (_I2C_ROUTELOC0_SDALOC_LOC16 << 0)
_I2C_ROUTELOC0_SCLLOC_MASK    is    0x1F00UL
I2C_ROUTELOC0_SCLLOC_LOC14     is   (_I2C_ROUTELOC0_SCLLOC_LOC14 << 8)
    // Enable pins at location 15 as specified in datasheet
  I2C0->ROUTEPEN = I2C_ROUTEPEN_SDAPEN | I2C_ROUTEPEN_SCLPEN;
  I2C0->ROUTELOC0 = (I2C0->ROUTELOC0 & (~_I2C_ROUTELOC0_SDALOC_MASK)) | I2C_ROUTELOC0_SDALOC_LOC16;
  I2C0->ROUTELOC0 = (I2C0->ROUTELOC0 & (~_I2C_ROUTELOC0_SCLLOC_MASK)) | I2C_ROUTELOC0_SCLLOC_LOC14;

page 524
https://www.silabs.com/documents/public/reference-manuals/efr32xg14-rm.pdf
page 154
https://www.silabs.com/documents/public/data-sheets/efr32fg14-datasheet.pdf


texts: Fourier series - time and frequency domain confusion

texts:
I am computing the fourier series of the following function between $[-0.5, 0.5]$
$$\displaystyle f(t) = \frac{1}{2} - |t|$$
According to the definition of Fourier Series the coefficients are given by
$$\displaystyle \hat f_n = \frac{-(-1)^n}{2\pi ^2 n^2} + \frac{1}{2\pi ^2 n^2}$$
That's easy to calculate. So far so good.

With the coefficients I know I can do the approximation of the function $f(t)$. But then how to plot, the frequency spectrum??

For example, I defined the function $f(t)$ in matlab and plot it from $-0.5$ to $0.5$ and got the triangle function. Now, I have the coefficients that depend on $n$ but what's the range of $n$? Plotting the coefficients will give me the frequency spectrum?

Please help me clarify this I'm really confused, seems I can't get the relation.


texts: Translation property of 2-D discrete Fourier transform

texts:
I am studying the 2-D discrete Fourier transform related to image processing and I don't understand a step about the translation property.

In the book Digital Image Processing  (Rafael C. Gonzalez, Richard E. Woods    ) is written that the translation property is:

$$f(x,y)e^{j2\pi(\frac{u_0x}{M} + \frac{v_0y}{N})} \Leftrightarrow F(u-u_0, v-v_0)$$
and
$$f(x-x_0,y-y_0) \Leftrightarrow F(u,v)e^{-j2\pi(\frac{x_0u}{M} + \frac{y_0v}{N})}$$

So if I want to translate the Fourier Transform in the center of the center of the frequency rectangle, I had to consider $u_0=M/2$ and $v_0=N/2$.
So the first line becomes:

$$f(x,y)e^{j2\pi(\frac{M}{2}x\cdot\frac{1}{M} + \frac{N}{2}y\cdot\frac{1}{N})} \Leftrightarrow F(u-\frac{M}{2}, v-\frac{N}{2})$$

$$f(x,y)e^{j2\pi(\frac{x}{2} + \frac{y}{2})} \Leftrightarrow F(u-\frac{M}{2}, v-\frac{N}{2})$$

$$f(x,y)e^{j\pi(x+y)} \Leftrightarrow F(u-\frac{M}{2}, v-\frac{N}{2})$$

Then the book draws this conclusion:
$$f(x,y)(-1)^{x+y} \Leftrightarrow F(u-\frac{M}{2}, v-\frac{N}{2})$$

Why? What are the steps it did? I know that $j$ is a complex number then $j^2=-1$.


texts: Kalman filter continues to update position even though speed is zero

texts:
Background
I set up a conventional Kalman filter that makes use of smartphone GPS only (no inertial sensors). That is, it uses the position, doppler speed, and course, in order to create positions that represent a more accurate track.
When the device is stationary (i.e. the smartphone is placed on a table), the GPS drifts, and the doppler speed reports 0 m/s, as expected.
Problem and expected outcome
Given that the doppler speeds are all 0, I expect that the Kalman filter would "dismiss" subsequent position measurements and retain the original position measurement.
Details

I convert GPS coordinates from geodetic coordinates to NED (Cartesian) coordinates, $p_x, p_y$, relative to an initial coordinate
$\psi$ is course
$\sigma_h^2=h_{\tt accuracy}^2$, where $h_{\tt accuracy}$ is the horizontal accuracy, in meters, and represents 68% probability that the position is within its radius
$\sigma_s^2=s_{\tt accuracy}^2$, where $s_{\tt accuracy}$ is the speed accuracy, in meters/second, and represents 68% probability that the speed is within its range
$H=I$

Here are the Kalman filter equations, step by step:
$F=\begin{bmatrix}1&0&\Delta t&0\\0&1&0&\Delta t\\0&0&1&0\\0&0&0&1\end{bmatrix} \tag{1}$
$\hat x^-=F\hat x\tag{2}$
$Q=\begin{bmatrix}\sigma_h^2&0&\sigma_s^2&0\\0&\sigma_h^2&0&\sigma_s^2\\0&0&\sigma_s^2&0\\0&0&0&\sigma_s^2\end{bmatrix} \tag{3}$
$P=FPF^T+Q \tag{4}$
$R=\begin{bmatrix}\sigma_h^2&0&\sigma_s^2&0\\0&\sigma_h^2&0&\sigma_s^2\\0&0&\sigma_s^2&0\\0&0&0&\sigma_s^2\end{bmatrix} \tag{5}$
$K=PH^T(HPH^T+R)^{-1} \tag{6}$
$z=\begin{bmatrix}p_x\\p_y\\s\cos(\psi)\\s\sin(\psi)\end{bmatrix} \tag{7}$
$\hat x^+=\hat x^-+K(z-H\hat x^-) \tag{8}$
$P^+=P^--KHP^- \tag{9}$
Question
If $\sigma_h^2$ is large (poor accuracy) and $\sigma_s^2$ is low (good accuracy), I expect that the predicted position will not change, but it continues to be influenced by the measurement and drift. Why is that?


texts:
Usually I/Q sampling is performed on two signals with a 90° phase shift using separate ADCs. Suppose I have only a single (fast) ADC available to perform I/Q sampling, which approaches do exist? Is this an entirely stupid idea?
A bit of background: I've been toying with the idea of building an amateur radio HF receiver. Yesterday the Raspberry Pi Pico microcontroller board was released. However I was disappointed to learn that it has only a single 12 bit, 500kS/s ADC, making it impossible to implement a conventional I/Q baseband receiver with dual ADCs.
There are two approaches I found:

Connect the in-phase and quadrature components to two different pins. Alternate between the components of the signal in the ADC. Then interpolate the signal to remove the phase shift between the samples.
Mix the signal with a higher intermediate frequency and filter it in such a way that successive samples are equivalent to the I, Q, -I, -Q components of the signal at the desired frequency. See the drawing and explanation on the first page of this paper:
"Ziomek, C., & Corredoura, P. (1995, May). Digital i/q demodulator. In Proceedings Particle Accelerator Conference (Vol. 4, pp. 2663-2665). IEEE." (PDF)


texts: Concept check on doing multiply in time with circular convolution in frequency domain

texts:
So I think I have my thinking correct on what I'm trying to do, but I just want to make sure I'm not assuming something that isn't true. Below is what I'm currently doing in the time domain.

$r(t)$ is my received signal
$T$ is my period
$MultCurrent = r(n)\cdot r(n-T)$
$MultPrevious = r(n-T)\cdot r(n-2T)$
$Average(i) = Average(i-1) + MultCurrent - MultPrevious$

The average should be acting as a low pass filter. I'm using this to get my original data message back. This is working for me, but I'd like to do things in the frequency domain. Am I doing this correctly?

I'm assuming $x(n) \cdot y(n)$ is equivalent to $X(f)\star Y(f)$ where the convolution is a circular convolution.

$N= 32$
$cconv()$ is the $N$ point circular convolution of two sequences
$fft1 = fft(r(n)$ from $n$ to $N)$
$fft2 = fft(r(n-T)$ from $n-T$ to $N)$
$fft3 = fft(r(n-2T)$ from $n-2T$ to $N)$
$ConvCurrent = cconv(fft1,fft2)$
$ConvPrevious = cconv(fft2,fft3)$
$Average(i) = Average(i) + ConvCurrent(0) - ConvPrevious(0)$

$ConvCurrent(0)$ is bin 0 of the result of the circular convolution (DC component). This is because i'm wanting the low pass filtered result. Is this the correct way to think about it? From what i'm thinking, i should need to transform back into the time domain. Also, if i'm wanting to filter my results before i do the circular convolution, can i just zero out all the frequency bins except for the frequency I care about? I'm not sure if this would cause any problems. Thanks a bunch!


texts: PSD estimate using FFT - scaling and units

texts:
I know that similar questions have already been asked – I have read the answers, yet I am still not sure if I understand the topic properly at some points.

I want to use FFT to calculate PSD estimate. FFT gives me a set of complex numbers that I want to transform into the PSD values. I am aware of the fact that only the first $N/2 + 1$ values are useful, and that the other half are complex conjugates of the first half.

I know that I will need to take the magnitude squared of each (useful) complex number the FFT gave me in order to find the PSD values. I also found out that I should incorporate some scaling/normalizing of the result. It is at this point that I am unsure. In some of the replies to similar questions it is said that the magnitude squared should be multiplied by $1/N$ only, while in others it is said that it should be multiplied by $1 / \left(N\cdot F_s\right)$.  I have not been able to figure out which of these two should be used when. Can anyone explain?
The sampling frequency of my signal is $128\textrm{ Hz}$. The length of the signal to be transformed is $256$ samples. In this case I found out that the distance between the resultant values of the FFT (or PSD values) should be $128/256 = 0.5\textrm{ Hz}$. Is that correct?
The original signal is in $\mu V$. In what values will the result of the PSD be? Is it $\mu V^2$ or $\mu V^2 /\textrm{ Hz}$?
(There might be a connection here with what I am asking in 1), am I right?)


texts: Confusion about hough transformation for ellipse

texts:
I saw the following sentence from Feature Extraction & Image Processing, 2nd Edition

  $$
x = a_0 + a_x\cos(\theta)+b_x\sin(\theta)
$$ $$
y = b_0 + a_y\cos(\theta)+b_y\sin(\theta) $$

  This equation corresponds to the polar representation of an ellipse.

I don't know this meaning. If you need extra information, I'll add it.


texts: Why do we use window in time domain rather than do FFT modify the spectrum and than inverse FFT

texts:
I thought that DSP would be done by using FFT of portions of a signal, modify the samples that result from FFT (since they represent the spectrum of our signal + noise) and remove any unwanted signals and than do an inverse FFT to get a time domain representation of the filtered signal (noise has been removed now). This however is not done, instead we do all the work in time domain using window functions. Why?

If we multiply window function in time domain than we are convolving the window function's frequency response with spectrum of our signal in frequency domain, how does that work out? I mean if we just did all the work in frequency domain by multiplying our signal with the frequency response of the filter, that would be like filtering right? But here we do all the stuff in time domain instead using window.

->Lets see where my confusion comes from. For analogue filters e.g low pass filter, we have this pulse like frequency response. When we filter a signal, we are effectively multiplying our signal's spectrum with the pulse like frequency response of the filter. This will reduce all frequencies in our signal above a cut-off to 0. This is how a low pass filter works in essence. Why not do the same with digital filters as well?


texts: What is Maximally Stable Extremal Regions (MSER)?

texts:
In the paper , MSER is being defined. Please help me understand what is MSER and how to implement it.
The paper says,

  The regions are defined solely by an extremal property of the
  intensity function in the region and on its outer boundary.

What do mean by extremal and intensity function? What kind of intensity function is the paper referring to?
According to the paper,

  The concept can be explained informally as follows. Imagine all
  possible thresholdings of a gray-level image I: We will refer to the
  pixels below a threshold as ‘black’ and to those above or equal as
  ‘white’. If we were shown a movie of thresholded images It; with frame
  t corresponding to threshold t; we would see first a white image.
  Subsequently black spots corresponding to local intensity minima will
  appear and grow. At some point regions corresponding to two local
  minima will merge. Finally, the last image will be black. The set of
  all connected components of all frames of the movie is the set of all
  maximal regions; minimal regions could be obtained by inverting the
  intensity of I and running the same process.

I could not picture out the things the author wants to relay. Can anyone describe it to me in simple terms or a demonstration will also do. Formal definition of MSER is shown in the image below.


texts:
I have a series of aerial images from which I would like to get disparity maps for every consequent pair. In order to do that I do a stereo rectification.

The problem is that sometimes rectified images are tilted at a large angle. For example:

My questions are:

What is the reason behind this?
What can I do in order to get better results?

Here is what I expect my rectified images to be:

What I tried:

Using different feature detection methods of opencv, like ORB, SIFT, SURF.
SURF is giving the best results of them, but still some images get skewed.
Played with different models' parameters.
Some tweaking had positive effect, like decreasing hessianThreshold of SURF, but nothing really provided 100% of good results.
Implemented an algorithm that would select keypoints scattered over the original image. This mostly had a good effect. Thire was a significant improvement for ORB and a small one for SIFT and SURF. But results are still not ideal. I asked a separate question about the algorithm on Code Review Stack Exchange: Efficiently selecting spatially distributed weighted points

Edit:
I asked a related question on SO: How to prevent rectified images to be cropped?
 (now deleted, but I saved a copy here: link)


texts: how can I plot a power spectrum for 150 range bins with 512 fft points

texts:
This is my code for plotting... However when I plot my spectrum data using this code, it is showing only 1 row. How can I plot all 150 rows? Can anyone help me to solve this?

 for i=1:length(dataheader.nrgb)
   plot(freq,arraydata(i,:)+height(i))
end


texts:
Given the CTFT pair above, I am trying to find a Fourier transform of

I thought I could multiply both sides(time domain and frequency domain) by  to get the CTFT pair in the following form:

But that does not give me the correct result.

Could you please explain why? I thought it would've been okay to do so since  is nothing but a constant..

Edit:

This result is different from


texts: Can I control per-pixel contrast in an image?

texts:
Is there any way to control per-pixel contrast? E.g., a way to set an upper or lower limit on the contrast between pixels?

The closest thing I've found is a high-pass filter of an n-pixel radius, inverted and applied as an overlay layer in Photoshop. Other kinds of filters, such as median, blurs, and traditional contrast adjustment, produce a result which is similar to my goal in some circumstances, but for the whole image, rather than only pixel pairs over a given contrast threshold, or proportionally based on contrast.

Does this concept have a name? Is there an easier way to do what I'm attempting?

[Edit: And is there any free or affordable software which can be coerced to do this?]


texts: I have a system that delays the input with k samples and concatenates the new input with delayed one so that y = [x(n) x(n-k)] so if the input comes with n samples the output should be k+n samples. How to express that in a clear mathematical expression.


texts: What is the difference between MFCC features and Mel Filter Banks (FBANKs)?

texts:
I haven't been able to find any source explaining what the FBANK features are.
As a reference, I have been reading this paper here which mentions that they have used 20 MFCC coefficients from 40 mel filter banks. You can also find libraries in python for extracting such FBANK features such as this one.
The aforementioned paper mentions:

we extract 20 coefficients from 40 mel filter banks (FBANKs)

Are FBANKs features produced during the procedure of extracting the MFCC features from a signal? Can someone explain what those features are?


texts: The physical meaning of comparing the phases of two signals with *different frequency*?

texts:
I was examining my simulation data about vibration. I was trying to compare the displacement phase difference between two cylinders; the cylinders carry out nearly sinusoidal vibrations. However, I just figured out that at certain conditions, the dominant displacement frequencies of two cylinders are different (i.e. C2 has dominant frequencies at both equivalent and two times of the C1's frequency), although in most cases, their frequencies are essentially the same.

So my question is: is the phase difference (e.g. in phase, in anti-phase) still physically meaningful when the frequencies are different?

Appreciate any explanation. (I think some physical examples would be very helpful)

Edit: found a discussion here, but still trying to understand.


texts: I am currently working on a sensor that visualizes an ECG signal and visualizes its data. Its principle is that it has 3 electrodes that must be placed in specific parts of the body .... I would like to know, please, is a sensor can work on some people and not work on others (because I tested it on a lot of people and it never returns the right signal except in one and only one person, I find it very bizzare)


texts: What is the minimum and maximum cutoff frequencies for the antialiasing filter for this ADC?

texts:
https://www.analog.com/en/products/ad9675.html

https://www.analog.com/media/en/technical-documentation/data-sheets/AD9675.pdf

It says in the data sheet that the Anti-Aliasing Filter has :
"Programmable second-order low-pass filter (LPF) from
8 MHz to 18 MHz or 13.5 MHz to 30 MHz and high-pass
filter (HPF) "

So does that mean the minimum cutoff frequency is 8MHz and the maximum is 30MHz?

And also making sure but the min sampling frequency is 20.5 MHz, max sampling frequency is 125 MHz, and the dynamic range is 75 dB, right?


texts:
Please help me sort this issue out.
The integration property in Fourier series is as follows:

So, for proving the above property, i took this approach:

This is where my doubt is. Some books and websites just put upper limit (ignoring the lower limit) and compare with (1) to conclude that

However, when the lower integral limit is substituted, we get

This value cannot be evaluated. Though some websites say that this corresponds to the "initial value"(?) and that is zero... etc., how does one justify this mathematically?
Any help is appreciated. Thank you.


texts:
I am trying to learn aspects of space/satellite communications. So Amplitude-Phase Shift Keying is quite popular in this domain.

APSK over Non Linear channels has worse performance than the earlier used PSK. Which is important because to non linear effects caused by the power amplifier on board. To counteract the effects of non linear distortion, one of the techniques used is Pre Compensation at the modulator.

This involves constellation predistortion. What does this mean?

Does this refer to error control encoding schemes like convolutional coding, tcm, turbo coding etc?


texts:
I wanted to write a code to detect baby cry sound.
I am using Windows as platform.  Presently, I am able to get audio samples and its frequency plot(using FFT) but not sure how to proceed forward.

I wanted to ask what steps I should follow to detect the baby cry sound given its time-frequency plot.

I saw some methods such as median filter followed by HMM in speech recognition. But for simple sound detection do I need to go for such sophiticated method?

I will be very grateful if you could help me.


texts: Spectral analysis with high selectivity but low number of points

texts:
I'm trying to create spectral plots similar to one below (it's from the datasheet of an AD1986 sample rate converter, page 8):

In the comments below the plot, it says "Wideband FFT plot, 16K points".
I'm particularly interested in having high spectral selectivity (if that's the right term), with the 1kHz peak being very narrow, with 'only' having 16K FFT points.
I'm doing my exercise on a 1000.621 Hz sine wave, quantized to 16 bits with a 44.1kHz sample rate.
This code to create all the plots below can be found here.
Step 1: straightforward FFT of 1s of samples, with and without window:

There are 2 issues with this:

there's a lot of variability in the noise
there's still a lot of spreading around the peak, despite using a Blackman window

Step 2: Average 100 FFTs over 100s of samples

This averages the noise, and it overlays perfectly with the original FFT in terms of signal power.
Step 3: Do a single FFT over 100s of samples

Increasing the number of samples by 100, has reduced the width of the FFT bins.
Of course, the noise isn't averaged, so I'm back to square one on that one. What's more, the noise floor due to quantization will be lower than for step 2, due to the increased number of bins.
Step 4: Merge 4410000 FFT bins of step 3 back to 44100 FFT bins
I could average a bunch of these to reduce the noise, just like in step 2, but the AD1896 image says it's a 16K point FFT. Which means that they used a different method.
So I think that I should also be able to merge 100 FFT bins back to 1 bin, so that I get the combination of both a narrow peak and a noise floor that that is similar in value to the one in step 2.
Here's the result after adding the absolute values of each bucket of 100 FFTs bin into 1 FFT bins:

This is starting to look good, but the peak value is now well above 0dB. And the noise floor around ~-128dB is much higher than the one that was around ~-145dB of step 2.
What I really want is the result of step 2 with the same level of noise floor, but without the wide peak of step 3.
I have the feeling that adding the absolute values of each bin is not the right approach, but I don't know which would be the right approach, and why?


texts: How do I find the coefficients to know if this color combination is realizable? What am I doing wrong in my solution?

texts:
I tried to solve the following problem:

Part A was solved without any problem, however with part B there is a problem:
Second the digital signal processing, to be more specific, image processing, I know that:
$$
\begin{bmatrix}\beta_1\\ \beta_2\\ \beta_3\end{bmatrix} = \begin{bmatrix} \alpha_1(P_1) & \alpha_1(P_2) & \alpha_1(P_3)\\\alpha_2(P_1) & \alpha_2(P_2) & \alpha_2(P_3)\\ \alpha_3(P_1) & \alpha_3(P_2) & \alpha_3(P_3)\end{bmatrix}^{-1} \cdot \begin{bmatrix}\alpha_1(C)\\ \alpha_2(C)\\ \alpha_3(C)\end{bmatrix}
$$
With the data of the problem I got the following conclusion, as \$S_i(\lambda)\$ is constant in the range \$[\lambda_0, \lambda_f]\$ so:
\$
\int\limits_{\lambda_0}^{\lambda_f} S_i(\lambda).P_k(\lambda) ,d\lambda =  S_i\int\limits_{\lambda_0}^{\lambda_f} .P_k(\lambda) ,d\lambda= S_i\$
So
$$
\begin{bmatrix}\beta_1\\ \beta_2\\ \beta_3\end{bmatrix} = \begin{bmatrix} S_1 & S_1 & S_1\\ S_2 & S_2 & S_2\\ S_3 & S_3 & S_3\end{bmatrix}^{-1} \cdot \begin{bmatrix}\alpha_1(C)\\ \alpha_2(C)\\ \alpha_3(C)\end{bmatrix}
$$
I thought it would solve the problem, but mathematically the result is not doing well. I'm getting very strange solutions, the determinant of the matrix A (the matrix 3x3) is practically 0 and the solutions are something of 10^{34} order. What am I doing wrong, and how to solve correctly part B of this question?