texts: Questions about Active Noise Cancellation

texts:
Being new to ANC, this is my understanding of how ANC works:

Ambient noise (n) is entering a geographically small zone. To suppress the noise, an interfering (corrective) sound is injected acoustically into the zone by a speaker. The interfering sound from the speaker is adaptively generated so that it - in theory - ends up being a 180 degree phase-shifted version of the noise ....When this phase-shifted signal is acoustically mixed with the ambient noise, the noise is ideally cancelled out.

So based on the above, I would need a microphone to record sound as it presents itself in the "zone" and then let that drive an adaptive process which calculates a digital speaker signal to send to the speaker. The energy of the recorded sound would be the indicator of how well the adaptive process is performing (in terms of cancelling out the noise).

My question is : what type of algorithm(s) are used for this kind of DSP scheme?

Is one microphone enough?

What if the speaker has to output more than just the noise cancelling signal? For example: A user is wearing headphones with ANC. The user is listening to music but wants the "outside" noise to be cancelled out. I can't imagine that it would work unless the headphone has an "inside" microphone and an "outside" microphone.

Does ANC work in dimensionally small setups? For example:

The speaker is connected to a tube through which the corrective sound travels. The open end of the tube is placed in a small zone where a microphone is also located. An algorithm receives audio from the microphone, calculates the speaker signal and sends the speaker signal to the speaker. Will that work? Or are there some fundamental requirements/assumptions which have to be met for the ANC to work?

I would like to hear from people who wish to share their experience and knowledge acquired from working with ANC. Any advice is appreciated.

Thank you.


texts: What is the best method for merging time lapsed photos? Accessable from python(PIL)

texts:
I have numerous photos from a still image camera that I would like to merge into one photo to allow for easy spotting of motion or new objects. There is a bit of noise across the photos but not very much movement (Cameras are focused on areas that do not expect much to change).

If you were to merge these photos into one image, what would you use to do it provided the tool or library had to be relatively easy to call from a python script.

I believe this technique is called Image stacking.

NOTES from comments

I have snapshots taken over time from an IP camera. The jpeg compression can be sett to 100% quality to prevent the noise from overwhelming the information in each picture
The camera never moves and the scene is typcially static. I can mark images that have movement or new objects. I would like to stack the images to provide a single glance report of what happend at this site
There are multiple challanges. What tool to use with python bindings, how to overcome noise in the jpeg compression, and methods for detecting big changes in the scene (objects)


texts:
I just started doing research on Recursive Least Square for filtering noises such as sensors and dc motors noises. The only thing I've seen on the internet was Theoretical information about RLS but for me, it is hard to understand and apply it on python. Is there any RLS example with numerical values?

I want to add random sensor noises by using NumPy.random.normal command. Then I want to filter it by using the RLS algorithm but I don't know what represents what because I couldn't found any examples with numerical values.
Please if you can explain to me I will be really appreciated.
Stay safe!


texts: Does DFT produces the same output as FFT?

texts:
In my journey about learning what / why / how of DFT, I tried to implement a DFT on MATLAB and then I compared its output with fft output and then I noticed it was different, does DFT produces a different output from fft?

% it creates a simple gray image (4x4)
I = [255, 255, 30, 100
    255, 50, 90, 20
    70, 70, 20, 10
    100, 20, 10, 0];
% it converts it to grayscale
I = mat2gray(I);
% shows it
imshow(I);

IDFT = [];

% DFT
N1 = 4;
N2 = 4;
e = exp(1);

for w1=1:(N1)
  for w2=1:(N2)
      % X(w1, w2)
      DFT = 0;
        for n1=1:(N1)
            for n2=1:(N2)
                Intensity = I(n1,n2);
                FirstDimension = e ^ (-1i*( (2*pi/N1) * w1 * n1));
                SecondDimension = e ^ (-1i*( (2*pi/N2) * w2 * n2));
                DFT = DFT + (Intensity * FirstDimension * SecondDimension);
            end
        end
       IDFT(w1, w2) = DFT;
  end
end

IDFT
fft(I)


texts: How can I compute the result of the magnitude of edges of an image?

texts: I have a random image with 11x11 pixels. In the center of the image is a square of 5x5 pixels. The gray level of the background is 0 and the gray level of the square is 50. How can I compute the result of the magnitude of edges given by the compass operator for this image taking into account that the image is not noisy?


texts: Implementation of the filter function (Matlab) C/C++

texts:
I am trying to apply some filtering in C/C++ code, I have designed an algorithm using Matlab and it works well, so now I am moving it to native code.

I am interested in the filter function.
In my matlab script it is used as follows.

[y_blk, fir1_state] = filter( h, 1, x.*c, fir1_state );

Where the h argument is coefficients generated by firpm function.

I have tried to find any implementation, but unfortunately no results.

I would be very grateful if someone could provide an implementation of this function

Or maybe there is an existing implementation of this function in some library.

Thanks


texts: Can we get the same result from between partial FFT?

texts:
I'm trying to implement fft and gaussian low pass filter multiplication to 16x16 image.

As I know fft can be separable. What if there are 16x16 one image, then is this the same ? between 4x4 part of the whole 16x16 fft result and  just only 4x4 fft result?

If they are same then I think that the latter method is more resource efficienciable.


texts:
I'm interested in implementing an optimized 5x decimation stage. However it seems the resources needed are significantly more than 4x or 8x composed of cascaded 2x stages. For general purpose FIR filters the interpolated (not interpolation) structure makes sense, but from what I can see this efficiency may be lost when doing decimation. I'd be interested on any suggestions or theories about this. My take - for decimation with a normal FIR only every 5th output must be computed - so say a 100 tap filter could be time interleaved to compute 20 taps per clock. However for an IFIR, which could consist of a 30 tap and 15 tap cascade - when decimating the first filter must run at the sample rate - i.e. all 30 taps per clock, and only the second stage can be decimated - or an effective rate of 30 +15/5 = 33 taps per clock.

Is this correct - that IFIR cannot be efficiently used for decimation? Are there efficient alternatives for a 5x case?


texts: Given a discrete time signal, what is the sequence of possible frequencies I can get from DTFT?

texts:
I know that when I have a discrete time signal, let's say:

$$f(t_n),\;t_n=\dfrac{n}{F_s}$$

The definition of the DTFT is given by:

$$F_n(\omega)=\sum_{n=0}^{N-1}f(t_n)\cdot e^{-i\omega_nt_n}$$

Now, my question is regarding $\omega_n$.

I know the frequencies will be discret because we can't measure lower frequencies than the difference between $t(n+1)$ and $t(n)$.

However, I am not clear how exactly this works, and how can one determine the "frequency vector". I am not sure I got the expression for $t(n)$ correct.

I am sorry this question isn't 100% clear, it's because I'm trying to make heads and tails from this definition and articles online are not very clear.

Thank you.


texts:
I have a class covering Power Spectral Density but I have no idea why it matters. Could someone provide some examples of its use?

Thanks


texts: MATLAB gradient derivative troubleshooting

texts:
I have an array $A$ having the next 145 values

I would like to calculate the $\frac{dA}{dX}$, having a 1D grid, $x$: 1:286:41468

I use the function gradient:

DA_DX = gradient(A, 41468/145)

I am trying to understand why the $\frac{dA}{dX}$ output graph has peaks which cause problems to my code. Please, do you see something wrong in my steps? Is any other way to calculate the $\frac{dA}{dX}$ without gradient function?


texts: Elegant way of calculating minimal sampling frequency without aliasing for annoying signals

texts:
Given a symmetric Fourier transform with finite support as below, there's an algorithmic procedure to determine the minimal frequency for sampling without aliasing:

Find an integer $L>1$ satisfying $f_2=L(f_2-f_1)$
The desired frequency $f_s$ is given by $\frac{2f_2}L$.
If no such $L$ exists, expand to the right or left and repeat.

The problem I was given is to find this minimal frequency for the signal below.

However, I can only manage to find the answer (which is 4) manually. Is there some algorithmic procedure again to find the answer?


texts: STFT Window Size is 2048, Why is the output 1025?

texts:
I feel like I am having a brainfart over here and can't seem to remember what's going on with STFT outputs.

Consider these two lines of code from the Python library Librosa:

# Window the time series.
y_frames = util.frame(y, frame_length=n_fft, hop_length=hop_length)

# Pre-allocate the STFT matrix
stft_matrix = np.empty((int(1 + n_fft // 2), y_frames.shape[1]),
                       dtype=dtype,
                       order='F')

In the first line, we have a function that creates a matrix with a window length of n_fft (2048).

Then in the next line, we pre-allocate our STFT, but our window length is now 1025 instead of 1024 as dictated by the 1+n_fft // 2?  Where does this extra frequency bin come from?  Why is not just 1024?


texts:
I've recently started playing with the Kalman filter for a simple 2D (x,y,dx,dy) tracking toy problem. But I seem to have some misunderstanding on what I can expect from the filter. I'm interested in plotting the uncertainty ellipse from the corrected covariance matrix but noticed a few observations:

The covariance decreases to a steady state regardless of how much error I introduce into the measurement.

The variance for x and y are exactly the same even though I introduce more measurement errors in y.

Staring at the maths for a bit it seems that this is how the vanilla Kalman Filter works. What I'm expecting is the opposite of the two points mentioned above. In the end I want to plot an uncertainty ellipse that reflects the error I'm observing. Is this possible at all? Do I have to do some post processing on the covariance matrix?
ANSWER:
It occurred to me what I needed was a Kalman Filter that has the ability to adapt its covariance. I found this paper that details a few different methods to do this.
Evaluating the performances of adaptive Kalman filter methods in GPS/INS integration by Ali Almagbile, Jinling Wang, and Weidong Ding, 2010


texts:
I've read in multiple places that DCT decorrelates Toeplitz matrices and images usually have Toeplitz structure. Can you explain with an example how DCT decorrelates a Toeplitz matrix?
Example for DFT:
DFT decorrelates circular matrices. This is how I was able to understand that.
Suppose $X$ is a matrix whose correlation matrix is not diagonal. We want to find a transformation $Y=AX$ such that correlation matrix of $Y$ is diagonal.
$$\mathbb{E}[YY^T] = \mathbb{E}[AXX^TA^T] = A\mathbb{E}[XX^T]A^T$$
Let the Eigen Value Decomposition be
$$\mathbb{E}[XX^T]=U\Lambda U^T$$
Then
$$A=U^T \qquad\text{gives}\qquad\mathbb{E}[YY^T]=U^TU\Lambda U^TU = \Lambda$$ which is diagonal.
So given a matrix, its eigenvector matrix decorrelates it.
Consider a circular matrix
$$A =
\begin{bmatrix}
a & b & c \\
c & a & b \\
b & c & a \\
\end{bmatrix}$$
A $3 \times 3$ DFT matrix is given by
$$\begin{bmatrix}
1 & 1 & 1 \\
1 & w & w^2 \\
1 & w^2 & w \\
\end{bmatrix}\qquad\text{and}\qquad w^3 = 1 $$
We can easily see that all the columns (or rows since it is symmetric) of the above matrix are eigenvectors of the considered circular matrix $A$. Thus DFT decorrelates circular matrices.
Is it possible to show in a similar way that DCT decorrelates a Toeplitz matrix?
PS: The answers here, here and here didn't solve my doubt.


texts: Is the Bilateral Filter a Solution of Some Variational Method?

texts:
I've been watching these video lectures about variational methods in computer vision.
In one of such video lectures a it is explained for example that the Gaussian filtering is a solution of the diffuse equation (so Gaussian filtering is a specific class of diffuse filtering). I do wonder if the same applies to the bilateral filter, because if so it can means that all such filters can be derived by some functional to be minimized. This is because the diffusion equation is a solution of a variational problem like

$$
E(u) = \int_{\Omega} \left[(u-f)^2 +  \lambda\lVert \nabla u\rVert^2 \right]d\Omega
$$

Again, is the bileteral filter a similar case?


texts: Quick technique for comparing images better than MSE

texts: I have been using Structural Similarity Index (through tensorflow) for comparing images, however it takes too long. I was wondering if there is an alternative technique that doesn't take so much time. It is also okay if someone could point out a more efficient implementation of SSIM than tensorflow.


texts: Determine spectrum amplitudes for half-wave rectified sine

texts:
I am trying to learn how to solve a bunch of digital signal problems and I have trouble understanding the solutions provided by this book I'm using. Basically, this problem asks me to determine spectrum amplitudes for half-wave rectified sine, as the title mentions. The signal looks like this:

The development in complex (exponential) Fourier series will be given by:

What properties are used to get to this answer? I don't get from where did the
 came from.

Full solution:

I was missing the red n. From that and using

solved it.


texts: I want to prove that 2D Gaussian filter is separable and we can separate it into two dimensions, my problem is about the size of filters. we should prove that $G(x,y)*I$(where $G(x,y)=$$\begin{bmatrix}0.01 & 0.1 & 0.01 \\0.1 & 1 & 0.1 \\ 0.01 & 0.1 & 0.01\end{bmatrix}$,I is image and $*$ is convolution operator) is equal to $G(x)*I*G(y)$ where $G(x)=$$\begin{bmatrix}0.1 & 1 & 0.1  \end{bmatrix}$ $,G(y)=$$\begin{bmatrix}0.1\\1\\ 0.1\end{bmatrix}$ and I is image. in other words we should prove that $G(x,y)=G(x)*G(y)$ but I don't know how to convolve these filters with different sizes.


texts: Fourier coefficients of odd and even part of a signal

texts:
I have this signal  and I have to find the Fourier coefficients of the odd and even part. First I found that $$ x_p(t) = \frac{1}{2} ( x(t) + x(-t) ) $$ and I made the graphic of this part and I obtained a straight line in 1/2. I made the same thing for $$ x_d (t) = \frac{1}{2} ( x(t) - x(-t) ) $$ and making the graphic I obtained the signal $$\mathrm{rect}(\frac{ t- n \frac{T_0}{4} }{ \frac{T_0}{2} }) - \frac{1}{2} $$.

Now $$X_{pk} = \frac{1}{T_0} \int_{0}^{T_0} \frac{1}{2} e^{-j 2 \pi k f_0 t } dt $$  and I obtained that  if $$ k=1 $$ $$X_{pk} = 0 $$ and if $$  k=0 $$ $$X_{pk} = \frac{1}{2} $$. This result is the same of my book. For the odd part I should do $$X_{dk} = \int_{0}^{T_0}( \mathrm{rect}(\frac{ t- n \frac{T_0}{4} }{ \frac{T_0}{2} }) - \frac{1}{2})e^{-j 2 \pi k f_0 t } $$ and I obtain $0$ if $k=1$ and $1$ if $k=0$ but the result should be $0$ if $k=0$ and $$ \frac{-j}{k \pi } $$ if $k = 1$.


texts: factoring poles / zeros: off by constant gain compared with textbook

texts:
(From Schaum's DSP outline, 2nd edition, problem 5.32)

Book says factor it and extract H(z) from the factored product:

$$
H(z)H(z^{-1})= \frac{ \frac{5}{4} - \frac{1}{2}z - \frac{1}{2}z^{-1}  }{ \frac{10}{9}- \frac{1}{3}z - \frac{1}{3}z^-1 }
$$

ok.. no problem... so i convert to the form used by the book for nearly every problem:

$$
H(z)H(z^{-1})=  \left( \frac{z^{-1}}{z^{-1}} \right) \left( \frac{ \frac{5}{4} - \frac{1}{2}z - \frac{1}{2}z^{-1}  }{ \frac{10}{9}- \frac{1}{3}z - \frac{1}{3}z^-1 } \right)
$$

$$
H(z)H(z^{-1})= \left( \frac{ - \frac{1}{2}  + \frac{5}{4}z^{-1} - \frac{1}{2}z^{-2}  }{ \frac{1}{3}  + \frac{10}{9}z^{-1}-  \frac{1}{3}z^{-2} } \right)
$$

Then I apply quadractic formula to determine the zeros and poles:

$$zeros = \left\{ \frac{1}{2}, 2 \right\}$$
$$poles = \left\{ \frac{1}{3}, 3 \right\}$$

Then I rewrite $H(z)H^{-1}(z)$ in factored form:

$$
H(z)H(z^{-1})=\frac{\left(1-\frac{1}{2}z^{-1}\right)(1-2z^{-1})}{\left(1-\frac{1}{3}z^{-1}\right)(1-3z^{-1})}
$$

At this point I realize that I have a different answer from the book which says, the answer at this point should be:

$$
H(z)H(z^{-1})=\frac{\left(1-\frac{1}{2}z^{-1}\right)(1-\frac{1}{2}z)}{\left(1-\frac{1}{3}z^{-1}\right)\left(1-\frac{1}{3}z\right)}
$$

I think... well... ok.. it should be equivalent to my version... i can rewrite my equation to get it to match the book.. so i try that:

$$
H(z)H(z^{-1})=\frac{\left(1-\frac{1}{2}z^{-1}\right)(-2z^{-1})(1-\frac{1}{2}z)}{\left(1-\frac{1}{3}z^{-1}\right)(-3z^{-1})(1-\frac{1}{3}z)}
$$

$$
H(z)H(z^{-1})=\left(\frac{2}{3}\right)\frac{\left(1-\frac{1}{2}z^{-1}\right)(1-\frac{1}{2}z)}{\left(1-\frac{1}{3}z^{-1}\right)(1-\frac{1}{3}z)}
$$

At this point i'm scratching my head wondering why it doesn't match because its off by a different gain?  Wondering why the gain doesn't matter when picking out H(z) from the factorization of $H(z)H(z^{-1})$?  Is this good practice to write it the other way around? which way is correct?


texts: Determining how similar audio is to human speech

texts:
While looking for an answer to this problem, I found this board so decided to cross post this question of mine from Stack Overflow.

I am searching for a method of determining the similarity between an audio segment and a human voice, which is expressed numerically.

I've searched quite a bit, but what I've found so far (detailed below) doesn't really fit what I need:

One method is to use speech recognition software to obtain words from an audio segment. However, this method is unable to come up with how "similar" audio is to human speech; it can often tell whether or not there are words in the audio, but if there are no definite words, it can't tell close the audio is to having such words.Examples: CMU Sphinx, Dragonfly, SHoUT
The more promising method is referred to as Voice Activity Detection (VAD). However, this tends to have the same problems: the algorithms / programs using VAD tend to just return whether or not the activity threshold has been reached, and no "similarity" value before or after such threshold. Alternatively, many just look for volume, not similarity to human speech.Examples: Speex, Listener, FreeSWITCH

Any ideas?


texts: Finding autocorrelation matrix of an autoregressive process AR(1)

texts: Having that $\ v(n) = [x(n),x(n-1),x(n-2))]^T $, and being $\ x(n) $ an autoregressive process AR(1) with known variance $\ \sigma_v^2 $ and transfer function $\ H(z) ={ 1 \over {1-0.7z^-1}}$, how could I obtain the autocorrelation matrix $\ R_{vv} = E[v(n), v^T(n)] $ ? Any help is appreciated!


texts:
I am very surprised not to find a version of normxcorr2 for 1D signals in Matlab ! I implemented something like that by hand (with 2 for loops, and normalizing the template as well as the window under the template (in the 1D signal in which the template is searched).

Did I just not find it or does it not exist? (A normalized cross correlation (NCC) for 1D signals, i.e., like normxcorr2 but for vectors)

(cf. https://ch.mathworks.com/help/images/ref/normxcorr2.html for the 2D version )

e.g.:

template=[1 2 3]

signal=[0 1 4 8 9 3 7 7 1 2 3 0 5 5 0]

the NCC should find the max at a lag of 9 (because you can see that the pattern [1 2 3] starts at pos 9). I consider here sliding the template starting at the template positioned over the window [0 1 4] of the signal and finishes at [5 5 0] , like that I obtain an output signal of length:

 outputLen=length(signal)-length(template)+1.

P.S. and it seems clearly that corr or xcorr does not do the same thing even with the 'normalization' argument because what I am looking for is something that normalized the kernel and the window in the signal at each step, which is quite cumbersome but needed for the NCC as mentioned in : http://www.cse.psu.edu/~rtc12/CSE486/lecture07.pdf for example)


texts: Identify which of the three signals is closest to a sinusoidal curve

texts:
I have some acceleration values from a sensor. These values are reported as x, y and z components of the acceleration. As can be seen in the attached figure, it is clear that the z signal has a clear sinusoidal curve present. Is there any algorithm to quantify the "sinusoidalness" of a curve. I am trying to write an algorithm that would identify the z signal of the attached image to be the most sinusoidal.

Another example is shown in the figure below: For this image the x-axis contains the < most sinusoidal > signal and the algorithm must be able to identify the x-axis as the correct axis.

Edit: The variation could indeed be greater in any of the axes without the most sinusoidal signal. The original problem being solved here is to count the number of breaths in the accelerometer signal. To do this first the axis containing the breathing signal must be identified. From the image it is obvious that for the first image the z-axis has the breathing data and for the second image the x-axis has the breathing data


texts: calculating similarity scores between similar and different classes?

texts:
I have images for 99 person for each person i have 5 images .
i have this function

[similarity] = ssim(img1, img2, K, window, L);where K,window ,L are previously determined with their values.

now , i need to use this function to measure intra-class similarities and inter-class similarities .

i mean i need to measure the similaity within and outside the class and put the results in 2 matrices , one contains the results of similarities within the same classes , and the other contains the results of similarities among the determined class and all other classes.

i wrote this in matlab :

%%%%for intraclass

K = [0.05 0.05];
window = ones(8);
L = 100;
img1=imread('E:\matlab\images\0001hv1.bmp');
img2=imread('E:\matlab\images\0001hv2.bmp');
img3=imread('E:\matlab\images\0001hv3.bmp');
img4=imread('E:\matlab\images\0001hv4.bmp');
img5=imread('E:\matlab\images\0001hv5.bmp');
[s1] = ssim(img1, img2, K, window, L);
[s2] = ssim(img1, img3, K, window, L);
[s2] = ssim(img1, img4, K, window, L);
[s3] = ssim(img1, img4, K, window, L);
[s4] = ssim(img1, img5, K, window, L);
intra_class=[s1 s2 s3 s4];
histintra_class=hist(intra_class);
plot(histintra_class);title('intra_class');

%%%%for interclass

K = [0.05 0.05];
window = ones(8);
L = 100;
img1=imread('E:\matlab\images\0001hv1.bmp');
img2=imread('E:\matlab\images\0002hv1.bmp');
img3=imread('E:\matlab\images\0003hv1.bmp');
img4=imread('E:\matlab\images\0004hv1.bmp');
img5=imread('E:\matlab\images\0005hv1.bmp');
[s1] = ssim(img1, img2, K, window, L);
[s2] = ssim(img1, img3, K, window, L);
[s3] = ssim(img1, img4, K, window, L);
[s4] = ssim(img1, img5, K, window, L);
inter_class=[s1 s2 s3 s4];
histinter_class=hist(inter_class);
plot(histinter_class);title)'interclass');

now how can i implement this on all my images automatically , i mean how can i read all images and finding intra and inter class similarities and get automatically the 2 matrices which are inter class and intra class

regards


texts: What would be the proper notation for denoting part of signal that satisfies a condition?

texts: I have a signal $E(t)$ which start at $t=0$ and dies out overtime. What would be a proper notation to specify part of which is above a certain threshold (say for e.g. C)?. Is $E_{interested} = E(t)>C$ a proper notation?


texts:
So it appears that Linear Prediction as performed via Durbin Recursion is sensitive to additive noise. What are some techniques for linear prediction that may be more robust? Can anyone supply a link that discusses the noise sensitivity of linear prediction?

I am trying to perform inverse filtering of a voiced speech signal by finding the linear prediction coefficients. It honestly doesn't work too bad, even in the presence strong pink or brown noise, but I have a feeling there are some more robust ways to get these coefficients.


texts: How can we do exact simulation for digital systems?

texts:
In digital control system, there are two basic techniques for finding the best digital controller.

First, called the discrete equivalent, we find the continuous compensation and then discretize (best approximate) that compensater. We can verify our design by simulation. However, this technique may need some tuning to the digital controller but it simulates the real implementation.

Second, called the exact discrete design, we approximate the plant model to a discrete model so the whole system will be in the Z-domain. Then, we design the controller using the discrete tools and techniques.

This technique has a drawback. It approximates the plant via one of the approximation methods such as ZOH, Tustin, etc.

From simulation perspective, it may not reflect the exact real implementation. The only way to have a simulation that match the real implementation is to have a combined continuous (plant) and discrete (controller) blocks as we have.

Thus, after the design process, I may have to run a simulation with the digital controller as well as the continuous plant that really reflect the real implementation. Some tuning may be required.

Is the exact discrete design (all blocks in Z-domain) simulation identical to the real implementation as I understood from few books which did not mention that drawback ?


texts: How is GPS used to synchronize oscillators in a distributed system?

texts:
I heard that it is important to have all oscillator clocks at different places be synchronized for example in a geographically distributed system such a telecommunication network. Of course to some error margin.

They fix GPS receivers in the base stations to synchronize the oscillators. I know GPS transmits time, as in our watches.

Could someone please explain what does this time of the day has to do with synchronizing oscillators?

Thanks a lot.


texts: Relationship between the carrier frequency and the propagation distance?

texts:
For electromagnetic waves, Is there a relationship between the carrier frequency and  the propagation distance?

When transmission distance increases the signal tends to lose power, so carrier signal is added along with the message signal ( to strengthen the original message signal). Is that true?


texts: How to prove that the peak of the autocorrelation function is at zero lag?

texts:
Show that for a signal $f(\tau)$ with finite energy and energy autocorrelation function $\phi^e_{ff} (\tau),$$$|\phi_{ff}^e (\tau)| \leq \phi_{ff}^e (0), \ \ \forall \tau.$$

According to my textbook the total energy is given by $\phi_{ff}^e (0),$ but it does not provide any proof. The two energy auto-correlation functions here would become:

$$\phi_{ff}^e (\tau) = \int^\infty_{- \infty} f^*(t) f(t+ \tau) \ dt,$$

$$\phi_{ff}^e (0) =\int^\infty_{- \infty} f^*(t) f(t) \ dt.$$

I was told that we must use the Cauchy-Schwarz inequality for this proof. But I am not exactly where to apply it. Any help would be appreciated.


texts:
Are the actual 1023 bit sequences for each of the 32 GPS satellites available to consumers? I found the IS GPS 200 but it doesn't list the entire sequences. Are verified sequences available for download anywhere online?

I'm trying to validate my python CA PRN generator. Also, what does the last footnote (**** The two-tap coder utilized here is only an example implementation that generates a limited set of valid C/A codes.) mean? Which codes is it valid for?


texts: how sobel edge detector as a first order derivative is turned to a 2 dim filter?

texts:
I want to know theorem behind sobel operator. basically a first order derivative is -1/2 0 1/2 . its a vector. the question is how this vector is turned to a matrix below and what was theory and reason behind that?
-1 0 1;
-2 0 2;
-1 0 1;


texts: Determining the covariance of point clouds in real-time

texts:
So basically I have a set of multidimensional data that I need to determine the covariance of between dimensions in real-time. Each point that comes in is a vector. I have gotten the mean and variance per dimension using this answer:
Determining the mean and standard deviation in real time. But I also need to find the covariance between dimensions, resulting in a covariance matrix. Each vector is 3 dimensional and is a point in space.

Does anyone know how to do this and does this?

To explain further, I want the covariance matrix so I can then use the eigenvalues and eigenvectors to characterize a point cloud. The point clouds are segments of a scanned environment using the Kinect. I need to make sure the segments are labelled consistently over frames. I will do this by matching the mean and covariance eigenvectors/eigenvalues of segments between frames. I am working with unity.

Edit:

Or what would be equally useful would be how to get the covariance from just the variances and means that I already have.


texts: How does carrier frequency offset effect the constellation diagram in OFDM?

texts:
In the case of OFDM modulation, if the carrier frequency is slightly off  then how does that effect the constellation diagram ?

Is there some general rule how it will change (such as rotate) ?

Or is it more or less arbitrary ?


texts: Differences in transforming a sinc FIR filter from lowpass to highpass using spectral inversion and spectral reversal

texts:
I have designed a lowpass sinc 1023 tap FIR filter with a Blackman window and this works fine.
I understand there are then two ways to transform this lowpass filter to a highpass one.
One is spectral inversion where you invert every coefficient and add 1 to the centre coefficient.
https://tomroelandts.com/articles/how-to-create-a-simple-high-pass-filter
The other is spectral reversal where you invert every other coefficient but only after generating a new lowpass filter with the frequency reflected about Fsample/2.
https://tomroelandts.com/articles/spectral-reversal-to-create-a-high-pass-filter
Both methods work well, giving similar though not quite identical results in the passband.  But the stopbands are quite different, with spectal reversal having much deeper rejection in the stopband.   However I cannot find any literature explaining why there is a difference.  Any suggestions on why the two methods are different or where I can read up more about them ?   Thanks in advance.


texts: Calculating Stability of Phaser Feedback Loop

texts:
I have been doing some experiments with phaser programs. I really like setting the phaser feedback to really high levels, such that the effect is really metallic and resonant, almost like a physical modeling instrument. The problem with this is that it's easy to go overboard and get runaway feedback which gets harsh extremely quickly.

I am wondering if there is a way to calculate the point at which self oscillation will occur, given the number of phaser poles, the cutoff frequency of the allpass filters, and the feedback level.

The phasor I am using uses a variable number of 1 pole allpass filters in series, each defined by the equation:

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

where:

$$A = \frac{1 - \pi \cdot \frac{cutoff}{SampleRate}}{1 + \pi \cdot \frac{cutoff}{SampleRate}}$$

Here is a signal flow diagram:

Ultimately what I am looking for is an equation I can use to calculate the following:

Given a phaser with x poles with y cutoff, self oscillation will being at feedback level z

Can anyone recommend a good method or some resources I could use to figure this out?


texts: Complex Cepstral Transform on Audio in MATLAB

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

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

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

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

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

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

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


texts: Shifted output of input vs output of shifted input

texts:
As I understand it, shifted output means first getting the output and then shifting it. We feed in $x[n]$, and get our output as $x[2n]$. Then we shift it by $k$ to get $x[2n-k]$. This is the shifted output.

Now, for output of the shifted input, we shift the input to get $x[n-k]$, then feed it as input to get output as $x[2(n-k)]=x[2n-2k]$

However, the text in the image has these answers reversed. Is there something I'm not getting?


texts:
im new into systems and im supposed to solve if the system has memory, us causal, linear, stationery, BIBO stable...The problem is i have never had experience with this type of system where the actual m is squared.
I tried to put in some reasoning and my guess is that system does have memory (it is integral after all), but i cant decide if it is causal.
I think i proved successfully that this system should be linear.
I tried to prove that system is stationary but in the very first step i dont even know how to substitute , and when it comes to BIBO stability i am lost because i cant decide if i should suppose that  is boundary or  is boundary.


texts: Most reliable way to decode PAM2 signal with unknown signal levels?

texts:
I assume this is pretty much a standard problem. I have a PAM2 signal that comes from a complex envelope (i.e., it is not zero-centered) and is heavily imposed by noise.
This shows 20 different examples of my signal:

What is the most reliable approach to convert these to $00000001000100000101\cdots$?

The standard approach seems to be to subtract the mean value. However, this is only reliable when ones and zeros are balanced (not the case for me).

Right now, I subtract half of the maximum value and add half of the minimum value. If this value is greater than zero, I interpret it as one, otherwise as zero. This gives decent (but I feel still sub-optimal) results and I wonder what is the most reliable way to do this.


texts: Signal remains constant when implementing FSK

texts:
I am trying to implement FSK Modulation. For bit 0 and 1, I defined a frequency wave (for instance, for bit 1, c = cos(2pift), with t = 0 : 1/fs : (1/fs)*N - 1/fs, where fs is the data rate). When I'm simulating, c is remaining constant (only value 1 for cosinus).

Why ? Because If a use a sinus, it is not remaining constant.

Thanks for avance.

Regards.

Code :

N = 1000; % number of bits
R = 1000; % bit rate
fs = 1/R;  % sampling rate

t = 0 : fs : N*fs - fs;
bits = round(rand(1,N));

f1 = R * 6;
f2 = R * 4;

c1 = A*cos(2*pi*f1*t); % bit 1
c2 = A*cos(2*pi*f2*t); % bit 0


texts:
I have some data from a position encoder, so naturally i want to estimate its speed.  However, the data is very quantized, so it's difficult to smooth enough to differentiate easily:

Each step level is about 70-140 data points long on average, so my usual tricks of savitzky-golay filtering aren't up to it.  I've played with piecewise splines as well, but not had much luck; there's a lot of ringing.

Is there a straightforward way to draw the obvious line through the trace?


texts: Region of Convergence for pole at z=-1 ?

texts:
I am caught up in a following question:

I have a mixed (causal + anti-causal) input to a system whose output is causal, with system having transfer function with pole at z=-1 and zero at z=1. What is the ROC for the system (if any) ?

Thanks a bunch.


texts: Image Gradient: Light to Dark, Dark to Light

texts:
From link:

  Black-to-White transition is taken as Positive slope (it has a
  positive value) while White-to-Black transition is taken as a Negative
  slope (It has negative value). So when you convert data to np.uint8,
  all negative slopes are made zero. In simple words, you miss that
  edge.

So all i want is to write a function so i can keep negative gradient values.
I know how to use Sobel.

Here is the sobel link where I got to know light-to-dark, dark-to-light are gradient directions, which are also referred as $+\text ve$ and $-\text ve$ directions.

IMPROVED Question:
Please Suggest me a logic of the function to retain only $-\text ve$ values and clip $+\text ve$ values to zero?

My code:

Sobel(grayImg, grad, CV_16S, 0, 1, -1, BORDER_DEFAULT);
         gradCpy = grad.clone();
         for(uint64_t i=0; i <(gradCpy.rows); i++)
    {
        for(uint64_t j=0; j<(gradCpy.cols); j++)
        {
            if ((gradCpy.data[((gradCpy.step/gradCpy.elemSize()))*i+j]) > 0) {(gradCpy.data[(gradCpy.step/gradCpy.elemSize())*i+j]) = (int32_t)-0.0;} ///nega gradient img
            //if ((gradCpy.data[((gradCpy.step/gradCpy.elemSize()))*i+j]) < 0.0) {gradCpy.data[((gradCpy.step/gradCpy.elemSize()))*i+j] = (int16_t)+0.0;}   ///pos gradient img
        }
    }
    convertScaleAbs(gradCpy, opImg2);
    imshow("negative grad", opImg2);

But i am not getting expected results. As per Sobel link, I want to get edge at black-to-white that is $+\text ve$ gradient and another one at white-to-black that is $-\text ve$ gradient


texts: What Does the Total Variation Norm Mean in the Context of Image Processing

texts:
What is the notion of total variation and how is total variation norm calculated in an image?

More exactly, I want to calculate and understand the meaning of $ \left \|X \right \|_{TV} $ if $X$ is an image.

If I optimize:
$$ min_{X} \left \|X \right \|_{TV} + {other . terms} $$ how will $X$ look like and what properties would be exaggerated in image, $X$ ?


texts:
For example, in a PSK modulation. I saw that to plot the BER curves as a function of the noise, we never took into account the pulse shaping filter. More precisely, the signal is not filtered by the pulse shaping filter. In practice, it is necessary to filter the signal to have a limited bandwidth.
Why then is the pulse shaping filter not used to filter the sent signal in order to draw the BER curve?


texts:
What is the rationale for the two-step process the MP3 format performs, first decomposing the input into 32 subbands of 6/18 samples each then performing MDCT on each subband individually?
Why not simply perform a single MDCT?
Is this simply due to the non-power-of-two block size MP3 uses (no idea if there is a fast DCT algorithm for that size off the top of my head), or is there some more theoretical reason?


texts: i have N samples obtained by sampling a signal with lot of frequency contents. How will i apply daubechies wavelet transform to obtain the frequency and its location? i need to write a program which will process the signal and gives the frequency and location as the result.


texts: Can I use more than one Window on an FFT?

texts:
I was wondering if it is possible to take a signal and run it through an FFT multiple times with a range of different windows, and then combine/average the results to get a more accurate Signal analysis than just one window. For example, could i run my signal through a Hamming window to predict the component frequencies and then run a copy of the signal through a Flat Top window to get better amplitude predictions. combine the two data sets with some math and achieve a more accurate overall picture.
Are there any major flaws in this method? Are there better methods?


texts: What is the name of this very simple spectral subtraction technique?

texts:
Let $S = X + N$ be the sum of two audio signals $X$ and $N$ which are both stationnary (let's think X is a constant volume 440 Hz sinusoid and N is constant volume noise).

If the sum S has a -20 dB volume and N has a volume of -30 dB, what is the volume of X?   (could be RMS or peak volume, it doesn't matter here).

The answer is

20*log10(10^(-20/20)-10^(-30/20)) ~ -23.3

i.e. X has a peak volume of -23.3 dB.

(of course this is not true if X and N have phase-cancellation, but except this case, it works).

Question: what is the name of this computation? i.e. find the volume of X given the volume of N and X + N?

I'm using an application of this for STFT denoising (with a noise template which is N):

if a FFT bin has -20 dB amplitude (signal S), and the noise has amplitude -30 dB amplitude for the same bin (signal N), what would be the amplitude of the denoised signal X ? Answer: -23.3 dB, thus this FFT bin should be lowered by 3.3 dB.

It works quite well for my noise reduction application (again here X is nearly a constant sinusoid and N constant noise), but I haven't found a name for this simple technique. What would be the name?


texts: Precalculate the Normalization of a filter size

texts:
If we have an Image I and a Gabor filter created at specific size and orientation, assume that is 11x11.

I saw some persons who normalize the size of the filter, but i didn't understand what was meant by "precalculate the normalization of the filter size". And within the normalization, they square the image, for example : Isquare = I^2. So why the image is squared ?


texts: Why noise canceling headphones do not attenuate the signal itself?

texts: Noise canceling headphones use a microphone to capture noise in order to cancel it. How is it guaranteed that the microphone will not record the actual signal and attenuate it?


texts: How is it possible plotting frequency vs. time in audio?

texts:
Something which makes me confused is how it is possible to create plotting of frequency vs. time domain.

Isn't time domain is opposite of frequency domain and the only way is to plot amplitude vs. frequency or amplitude vs. time?

What is the main target of this plotting time vs. frequency of audio signal?


texts:
On the one hand covariance matrix can't contain negative values by definition, but as far as state covariance matrix innovated by subtraction:

$$\mathbf{P} = \bar{\mathbf P} - \mathbf K\mathbf P_{z}\mathbf K^\mathsf T$$

it's possible to get negative value.

Can state covariance matrix in Unscented Kalman filter contain negative values?


texts:
Suppose I have a discrete time signal $x[n]$ of length 32 and I take it's 32 point DFT $X[k]$. Then I upsample this by a factor of 2 to get $Y[k]=X[k/2]$ and then take 64 point IDFT to get $y[n]$.

What will be the the relation between $y[n]$ and $x[n]$?

By upsampling in frequency domain, I know that $x[n/2]->X[2k]$. So by duality, $X[k/2]->Nx[-n2]$? What will $N$ be here, $32$ or $64$? I am confused on how to apply duality and whether it is required or not?


texts: Bit scrambling as last state of transmitter - what advantages are there?

texts:
I believe that I read, for digital modulation with multiple levels, that the AGC makes use of the fact that the symbol sequence, before noise etc., can be modeled as a uniform distribution.

$$\text{Source $\rightarrow$source-coding $\rightarrow$FEC$\rightarrow$ interleaving $\rightarrow$ bit-scrambling $\rightarrow$ modulation $\rightarrow$ channel}$$

What other advantages are there to bit scrambling (not for privacy/security).

Chris.


texts:
I am facing an interesting problem: I have a signal in the time domain. In order to avoid discontinuities at the edges of the signal --- which would lead to artifacts when calculating the FFT --- I apply a window function, like e.g. hann or hamming. Then I perform the FFT of this windowed signal.
To preserve the energy of the signal after the FFT, I calibrate the FFT of the windowed signal with the RMS of the window function. However, the strange thing is that the energy (=area under the curve) of the windowed signal in the frequency domain is substantially different (about a factor of 2) compared to the FFT of the unwindowed signal.
Do you have an idea where this issue could originate from?
Thanks a lot in advance!


texts: Bandpass filter vs sequential high and lowpass filter in Matlab: weird difference

texts:
I am trying to bandpass a neural signal acquired at 20kHz between 0.5 and 100 Hz. I have tried to do it in two ways. The first way is to sequentially highpass and lowpass the signal and the second one is to use the bandpass function in Matlab. To my surprise, the results were dramatically different. See image below:

Here is the code:
clear
close all
load('bandpass_vs_seq_lo_and_hi_pass','tr','fs') % loads variable called tr and fs
% tr is the signal vector and fs is the sampling rate, 20kHz
padlen=0.01; % padding length in secs to remove transients at signal start and end
padn=padlen*fs; % padding length in samples
f_lo=0.5; % lo cutoff
f_hi=100; % hi cutoff
tvec=(1/fs:1/fs:1/fs*length(tr));

figure
ax1=subplot(3,1,1);
ax2=subplot(3,1,2);
ax3=subplot(3,1,3);

% sequential highpass and lowpass filter
    % hipass filter
      nutr=[flipud(tr(1:padn));tr;flipud(tr(end-(padn-1):end))];  % prefixing and appending signal
      [filtr,~]=highpass(nutr,f_lo,fs);
      filtr=filtr(padn+1:end-padn); % removing prefixed and appended parts
      tr1=filtr;

       % lopass filter
      nutr=[flipud(tr1(1:padn));tr1;flipud(tr1(end-(padn-1):end))];
      [filtr2,~]=lowpass(nutr,f_hi,fs);
       filtr2=filtr2(padn+1:end-padn);
       tr1=filtr2;

 % bandpass filter
      nutr=[flipud(tr(1:padn));tr;flipud(tr(end-(padn-1):end))];
     [filtr,~]=bandpass(nutr,[f_lo,f_hi],fs);
     filtr=filtr(padn+1:end-padn);
     tr2=filtr;

 plot(ax1,tvec,tr)
 plot(ax2,tvec,tr1)
 plot(ax3,tvec,tr2)

 xlabel(ax3,'Time (s)')
 title(ax1,'Original signal, fs=20kHz')
 title(ax2,'Sequential high pass and lowpass (0.5 to 100 Hz)')
 title(ax3,'Bandpass (0.5 to 100 Hz)')

Can anyone shed light on what is going on here?


texts:
I have peformed different form for input/output relation to determine a system, but seem to be missing some theory which input will be the most will excite enough modes such that the models which i end up with will be accurate..

I tried Impulse response, step response and sine sweep.

Could somebody provide me with some litterature which explains discusses these method, and which one will create an accurate result.
I feel like the sinesweep is more accurate, most because it has excited all the modes/configuration of the system, and the impulse and step haven't seem to be doing so.. but still litterature would be appriaciated.


texts: Time-bandwidth product and uncertainty on harmonics

texts: For a signal that is not corrupted with noise, how is the time-bandwidth product affecting the uncertainty or error introduced when extracting the fundamental frequency ? I mean, instead of choosing the fundamental frequency of the signal at $f_0$, you choose a harmonic $f_k$ at $k\cdot f_0$ and divide by $k$ to get $f_0$. How is the uncertainty related to $k$ for a given frequency resolution ?


texts: I have a wav file which is gained by playing 2 different wav files with 2 speakers and recorded with mic. If I want to get one of the original signals using the resulting wav file and the other original wav file, is it possible to do this? I checked online and only got blind signal separation algorithm. Thank you in advance!


texts:
In the MPSK Modulations,  Cyclic Spectrum Density method can give a peaks, for example for the QPSK:

But in the FSK signal, this peaks do'nt appear. How to solve it?


texts: Conversion of transmitter power from Watts into dB

texts:
I've been practicing problems relating to the dB conversion and came across this interesting example problem.

In the above example Tx power is defined in Watts and the conversion from the Watts to dB is done. However, so far according to my understanding of the definition of dB, is defined in relative to receiver power too. But in the above example the calculation was done just by considering the Tx power.

Can some one enlighten me? If I'm understanding it wrong or the example is wrong?

Thanks in advance.


texts: Use of Long Training Field (LTF) of 802.11 standard

texts:
In 802.11a/n the preamble part has L-LTF(Legacy-Long Training Field) and HT-LTF(High Throughput-Long Training Field). I want to clarify my understanding of these two fields:

Are the only difference between these 2 fields are the number of subcarriers used and the symbols used?
This field is mainly used for Channel estimation. What method is used to do this estimation (say on our home wifi router), is it LS/MMSE/MLS or any other in 802.11a and n? If possible can you explain how is it determined?


texts: How does Jpeg encoding affect the final file size of 24BPP RGB and 8BPP grayscale image?

texts:
The reason I'd like to know this is because of a file size problem. I am trying to reduce an image's file size from converting it from TIFF to JPEG. A user challenge me that he notice a RGB TIFF image is three times the size of the same image but in grayscale TIFF version, but the post-convert grayscale version of the JPEG image is almost the same size as the RGB JPEG version.

He insist that a 8BPP grayscale jpeg should have ~1/3 of the size of the 24BPP RGB jpeg.

Then I have been told by some technical adviser afterward that JPEG will ever only exist in the form of 24BPP file, and that the grayscale jpg images I found online are all lying in their image meta data saying bit depth is 8. But so far I haven't found any proof online that confirm nor deny that claim.

At this point I have no idea if my conversion method is flawed and inflated the file size, or the fact that the so call "8BPP JPEG that takes only 1/3 of the file size" doesn't exist from the beginning.

Is there any documentation regarding this issues online?


texts:
Suppose that ${X_n; Y_n}$ is a random process with a discrete alphabet, that is, taking on values in a discrete set for $n$ data length. They correspond to the input and output of a communication process. Assuming Y to be the discretized output, what is meant by Shannon's source entropy for a given discretization bin $k$ : $H_{source} = lim_{k \rightarrow \infty} \frac{1}{k} H_k$ where
 $H_k$ stands for Shannons entropy. I found this in the paper. Now, problem_Set also mentions about source entropy but the formula is very different! Its the same as Shannon's entropy. So,what exactly is Source entropy? Is it the entropy of X or Y or is it the same as Shannon's entropy


texts: Are all of the edge descriptors necessary to differentiate edges?

texts:
My question is about edge descriptors produced from an edge detection method applied on an object image. As we know, an edge has four descriptors edge normal, edge direction, edge position, and edge strength.  These descriptors are used for differentiating between the detected edges.

Are all of this descriptors are necessary? When can I dismiss any of these descriptors?

I am thinking about assumptions based on the properties of the input image, e.g., if the input image has no noise, can I neglect the edge strength and assume that all resulting edge points are true edges?


texts: Fourier transform of moving image sensor

texts:
Consider an image sensor that is moving with some velocity $\mathbf{v}(t) \in \mathbb{R^3}$, and an orientation $\mathbf{R}(t) \in SO(3)$. Treat those vectors as fixed. At a specific time $t$ the projection of the scene on the sensor is:
$$u_{\mathbf{v},\mathbf{R}}(t)$$
The sensor pixel data is now sampled in a series fashion. This means that each pixel will be sampled at a different time $t$.

Now suppose that you want to calculate the Fourier transform of a frame. How would you do it? Can you do it without interpolation? I'm after accuracy here.

Furthermore, what is the effect of the lack of sample synchronization on the FFT i.e. If you just take the FFT without first synchronizing the pixels. Is there a rigorous mathematical treatment of this subject? What is the frequency representation of the sampled data?

Edit

This is for a rectangular image sensor in an interferometry application. This means that although the velocity is small $v \approx 1 \mathrm{m/s}$, the image changes rapidly.

I thought about it some more and I guess what you would have is aliasing for each pixel equal to the frame rate, and each pixel will have a different amount of phase shift equal to the pixel clock.


texts: What is meant by a system's "impulse response" and "frequency response?"

texts: Can anyone state the difference between frequency response and impulse response in simple English?


texts:
I read lots of things about Kalman filtering, but in order to fully understand it, I would probably need to see it working on some data.

Would you have a minimal example (Python code or any other language) showing what it does on some real data $x[n]$, where $n$ is the time?


texts: What is the interpretation of the discrete-time spectrum?

texts:
The CTFT of an analog signal is a representation of that analog signal in terms of the frequency parameter of sinusoidal (cosine specifically) functions whose weighted sum make up that signal. The cosines are continuous functions of time and the amplitude of a particular cosine at a given frequency is given by the amplitude of the spectrum at that frequency.

Is the interpretation for the DTFT of a sampled signal analogous where the spectrum indicates the frequency of (discrete-time/sampled) cosines that sum to the sampled signal, the spectrum amplitude indicates the magnitude of that cosine, etc.?

For instance, if $F=100\textrm{ Hz}$ and $|X(F=100\textrm{ Hz})| = 50$, then we know we have the component cosine signal: $50\cdot\cos(100n)$. Assuming $X(F)$ is the DTFT of $x(n)$.


texts:
Hello I just started learning Signals and Systems and I have a question regarding periodic signals.

For instance:
$x(t) = \cos(3.2t) + \sin(1.6t) + e ^{j2.8t}$ is periodic because of the HCF of the frequencies.($0.4$ rad/s)

and $x(t) = \cos(4t) + \sin(\pi t)$ isn't because of there is no common factors between $4$ and $\pi$.

But what about this:
$x(t) = 6 \sin (12 \pi t) + 4 e ^{ j (8 \pi  t + \pi /4)} + 2$

How do I determine whether it is period and its fundamental frequency?

Any help is appreciated!


texts:
I need to represent my signal as a set of transitions from one level to another, and I am interested in transitions that have relatively big amplitude 2000+.

I applied median filter to get rid of the high frequency part of the signal and result looks like this. Now I can take gradient and get set of transitions, and based on the magnitude of these transitions, keep only big one. So, I will get transition, corresponding to the left side of this peak, I will filter out transitions from the top. But I would like to have right side of this peak also to be represented as one nice 2000+ transition. But as you can see on the picture, there is small kink in the middle of the right side that will break my transition into 2 parts.

Is there some kind of a filter that will transform my signal and remove this kink?


texts: Reconstruct $x(t)$ from $y(t)$ and $z(t)$

texts:
Let $x(t)$ be band-limited signal with $X(j\omega) = 0$ for $|\omega|\gt \omega_M$. We use $$s(t) = \sum_{k =-\infty}^{+\infty}(-1)^k\delta(t - \frac{kT}{2})$$ for sampling. So we have $z(t) = x(t)s(t)$. The first question is to find $Z(j\omega)$ and the appropriate system for reconstructing $x(t)$ from $z(t)$. I've found $$Z(j\omega) = \frac{2}{T}\sum_{k = -\infty}^{+\infty}X(j(\omega - \frac{2\pi(2k-1)}{T}))$$So the condition for preventing aliasing is $\omega_s = \frac{2\pi}{T} \gt \omega_M$ and we need a filter which has gain $\frac{T}{2}$ and shifts the spectrum by $\omega_s$. I don't know what is the expression for $H(j\omega)$.
In the second part, let $y(t) = z(t)\star h(t)$ where $$H(j\omega) = \begin{cases}
e^{\frac{-j\omega \pi}{200}},  & 90\lt \omega \lt180 \\
e^{\frac{-j\omega \pi}{200}}, & -180\lt \omega \lt-90 \\ 0 & \text{O.W}
\end{cases} $$
And $T = \frac{\pi}{45} , \ \omega_M \lt 90$.
The question is finding $Y(j\omega)$ and the system which reconstructs $x(t)$ from $y(t)$. I've found $$Y(j\omega) = \begin{cases}
\frac{90}{\pi}e^{\frac{-9j \pi}{20}}X(j(\omega -90)),  & 90\lt \omega \lt180 \\
\frac{90}{\pi}e^{\frac{9j \pi}{20}}X(j(\omega +90)), & -180\lt \omega \lt-90 \\ 0 & \text{O.W}
\end{cases} $$
It means we have two halves of $X(j\omega)$ scaled and separately in intervals $-90-\omega_M\le\omega\lt-90$ and $90\lt \omega \le 90+\omega_M$. Because in general $x(t)$ can be complex-valued so we need both of them. I don't know how to construct the system such that brings together these halves while multiply the first one by $\frac{\pi}{90}e^{\frac{-9j \pi}{20}}$ and the second one by $\frac{\pi}{90}e^{\frac{+9j \pi}{20}}$.

I think it's not possible to construct such system because it needs to create new frequencies which doesn't exist in the input signal.


texts: How to extract the vein pattern from an IR image of finger?

texts:
I am trying to isolate (or segment to be precise) the vein pattern from Infra red image of a finger (using MATLAB) like shown below:

So my output will be a binary image like (not the exact dimension of image shown):

I tried histogram equalization to make the veins more visible, but it was not that successful. Any help to proceed further would be very helpful.


texts: Multiplying the imaginary part of DFT with a linear ramp to get a derivative

texts:
I am trying to understand the statement in a relatively old publication from 1970s, when Fourier transforms found applications in chemical analysis. The author quotes the derivative theorem citing Bracewell of 1965 (I could not locate this exact statement in later edition of Bracewell).
Edits: As discussed in the comments, the approach as literally suggested does not work universally for example a Gaussian peak will have zero imaginary parts. However the idea is neat to differentiate experimental data while filtering the noise.


texts: Simulating Effects of Sampling after Butterworth Filter

texts:
Is there anyway to simulate the effects of sampling an analog signal with Python/MATLAB? I am trying to show what happens to the frequency domain (magnitude and phase) of the analog signal after it has been passed through an analog Butterworth filter and that subsequent signal is sampled.
How would I simulate sampling the frequency spectrum shown below?
W = np.arange(-1*(10E3)*2*np.pi, (10E3)*2*np.pi, 1)
b = [3.93785014e+24]
a = [1.00000000e+00, 4.85527277e+04, 1.17868368e+09, 1.81406467e+13,
1.86130267e+17, 1.21074613e+21, 3.93785014e+24]

fig = plt.figure()
fig.suptitle('Butterworth [n=6, f_3dB=2kHz]')

plt.plot(w / (2*np.pi), 20 * np.log10(abs(h)))
plt.xlabel('Frequency [Hz]')
plt.ylabel('Amplitude [dB]')
plt.grid(which='both', axis='both')
```


texts: Analytical expression for step response of digital bessel filter

texts:
If I apply a digital Bessel filter to a perfect step function, I get something that looks like the following:

The green line is the input step response data sampled at 500kHz, the red line is obtained using the scipy.signal.lfitler routine with a 8-pole Bessel low-pass filter at 10kHz, and the blue line is the result of the same filter but using the scipy.signal.filtfilt.

Given the signal (either red or blue) is there an analytical form for the response that would allow me to extract the cutoff frequency using a nonlinear fit? Both functions look like a sigmoidal of some kind - is there an analytical formula for it?

The form

seems to fit both cases quite closely, but not perfectly, and it's not clear what relation the time constant bears to the cutoff frequency.

If I fit that form to the filtfilt data, I get a linear relationship between the time constant for the fit, and the time constant for the filter (1/fc), with a slope of about 1/35. I imagine that slope will be a function of the filter order. Can anyone suggest a better analytical form for the fit function?


texts:
I am trying to code a QPSK transmitter in VHDL but first I want to create one out of Simulink blocks and translate it into VHDL code. I am using an example project for the PlutoSDR as a guide.

This is the block diagram:

I ran into the following error for which i used Simulink's "fix" option and got this project to compile:

When i run this project this is the output i am seeing on Constellation Diagram 1 & 2:

What's happening is the points on the diagrams are continuously moving in a "circular" way. I've uploaded two GIFs of the constellation diagrams 1&2 from my Simulink project.

Constellation Diagram 1:

Constellation Diagram 2:

The output of Constellation Diagram, however, does not move and looks like this:

This is the output of the example on the Mathworks website (guide) seen as "Constellation Diagram" in the block diagram above.

My questions: Why did i have to put "Single Task Rate Transmission" boxes into my project as suggested by Simulink? Why do Constellation Diagram1 and Constellation Diagram2 "dance" around like this? What am i missing?

Thank You!


texts:
Ok, I'm new to the whole Dsp thing, so sorry if the question is a lame one

I'm trying to extract frequencies from a signal provided by a radio Device (Win Radio G31DDC- IFstream).

The radio provides a 16-bit  signal stream with 50MHz bandwidth and 100MHz sample rate.
when I set my FFT length to 32768 everything seems to work fine and the spectrum view is very similar to bundled application with radio, however the precision of 3051.75Hz (100Mhz/32768) is not enough for my needs, so I increased FFT length to 65536, but at this length I got mirrored data in real part of FFT result.

I suppose I should be able to increase the length to provided sample rate

I'm using NAudio.DSP library for FFT calculations and using Hamming window with length of FFT

Here is the code:

_fftLength=32768;
_m = (int) Math.Log(_fftLength, 2.0);

for (var n = 0; n < e.RawData.Length; n ++)
{
   var r=e.RawData[n];
   var i=0;

   _fftBuffer[n].X = (float) (r*FastFourierTransform.HammingWindow(n,_fftLength));
   _fftBuffer[n].Y=i;
}

FastFourierTransform.FFT(true, _m, _fftBuffer);

Can someone explain what I'm doing wrong here, please?


texts: Why the frequency response plots (of causal filters) only show positive frequency?

texts:
Take an example of the below plot for an LPF (Source : WikiPedia)

The plot starts from $0$. We know that the fourier transform of any signal brings in negative frequencies due to complex exponentials (which are just as real as positive frequencies, just to be clear) but most of the frequency response plots I have observed for practical causal filters, they start from $0$.

Indeed, the frequency response of an ideal LPF is a rectangular function symmetric about the $jw$ axis and the impulse response is a non-causal sinc function.

I have the following questions: Why do we represent/plot the frequency response of a causal filter with only positive frequency plane? Does it have to do something with making the non-causal ideal sinc filter, a causal one? (But don't we have to make the impulse response [time domain] causal in order to achieve that? [although I don't know what's the frequency response of a causal sinc]) or is it understood that there is a symmetric negative frequency  part and we just ignore it?


texts: Fourier transform of a periodic/aperiodic signal

texts:
Generally speaking, I know that periodic signals (continuous-time domain signals) with period 2pi/wo have a spectrum with equidistance Delta-impulses of distance w0.

My question is that, if we have a spectrum with equidistance Delta-impulses of distance w0, does it necessarily means that the time domain signal is periodic? Or for example, if our time domain signal itself is not periodic, like a sin(wt) when w is not a rational ratio, will the spectrum be periodic?!

Also, does a one-sided spectrum with equidistance Delta-impulses of distance w0 correspond to a periodic signal in time domain?


texts: If I can make a call to another city, why does wifi only reach 50 meters?

texts:
What makes it possible for me to communicate with someone in another city when my phone can only reach the modem / wifi networks that are within 50 meters?

The signal may be sent between multiple destinations before reaching the final destination / end point, but I assume the first destination is still more than 50 meters away.


texts: Detect the beginning of an increasing signal

texts:
After denoising and cleaning, I get amplitude signals like this (y-axis: dB):

On bottom left of each of these 3 graphs, you can see a noise floor (nearly "horizontal line"). This noise floor fluctuates in a range < +-1 dB.

How to detect when the real signal begins, i.e. when the signal starts increasing?

Here is what I've tried:

Let $t_i$ be the first time the signal goes higher than $noisefloor + i \  dB$. For example $t_4$ is the first time the signal goes 4 dB more than the noise floor.

Let's do a quadratic or cubic interpolation $f$ of the curve going by $(t_2, floor+2)$, $(t_4, floor+4)$, $(t_6, floor+6)$, etc.

Than let's check when the polynomial $f$ crosses the horizontal line $y = floor$.

It sometimes works, and better than all I've tried so far. But it's not perfect:

Here the place where the green interpolation crosses $y = floor$ (dashed line) for the first time is more or less what I'm looking for, but there are 2 crossings, how to select the best? Sometimes it's the first to choose, sometimes it's the second..., it's quite random.

Here the place where the green interpolation crosses $y = floor$ (dashed line) does not exist! so it doesn't work at all:

How to do better than this?

Note: a simple threshold-detection of when the signal goes higher than $noisefloor + 0.5 \  dB$ as "the time when the signal starts" is not precise enough for my application.


texts: Video compression - why not just sending the changed parts?

texts:
I'm trying to understand how video compression through dense optical flow works (I'm a newbie with video compression).

I easily understood what optical flow is, the thing I can't understand is why a simple video compression could not just send the parts of a frame marked with a "motion vector" (as you would send only the parts that have moved to or from a position from frame to frame).

I mean: MPEG is way more complex than that, what's the catch with sending parts of a frame that have changed to "stick them over it to get the next one"? Is this a technical flaw (i.e. too much data to be transferred) or is there something else involved that invalidates this simple reasoning?


texts:
I have never used a Kalman filter. Is it possible to implement a Kalman filter using only location information?

In addition, if you can implement it, what kind of procedure should be used to program it?
It would be helpful if you could provide a helpful description or site.


texts: If an autocorrelation function of a process is a rectangular function, then is the process deterministic?

texts: I would like to clarify one doubt regarding autocorrelation function $R_x (\tau)$ of a process $X(t)$. Suppose $R_x (\tau) = \Pi (\tau)$, where $\Pi (\tau)$ is the rectangular function. Then is the process $X(t)$ deterministic.


texts:
i have to do a project for university which is basically to program a tool to classify small greyscale images like those below into person or non-person, in C.

The project is scheduled for around 2 months of work.
However, the approaches i found on the internet all use high-level tools like Matlab or Python with OpenCV. Using those, i will get the job way too quickly and easily.

So i need an idea on how to do a lower level implementation in C, that will take me like 1-2 months.

Maybe someone can help me out with a useful approach.


texts:
How come are the units of convolution for LTI system not consistent?

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

$y(t)$ unit is volt, whereas the RHS has volt.time unit!!!!


texts: Notes or books to quickly get started on the basics of signal processing or wireless communication

texts:
I'll soon start working in signal processing, specially wireless communication systems. Hence I'd like to get a quick understanding of MIMO and related systems, for example, the topics like:

1) where and how the model $y=Hx + n$ arise,

2) fading, Rayleigh fading,

3) channel capacity, channel state information,

4) other basics one must know

etc.

Note that, I'm not asking for the mathematically rigirous literature; I'm aware I'll need to work with large dimensional random matrices and I'm familiar with the random matrix side of things (I'm a mathematcian), but I'd like to know something bit more basic and applicartion-oriented, for example, where those random matrices actually arise, how the models are formulated etc.

An intrductory (easy to understand) material that'd help me gain all these necessary basics in a week (or say ten hours) would be greatly appreciated. Thank you in advance!


texts:
What's the best way to incorporate polynomials or sinusoidal equations into a linear model to predict a future amplitude in this sort of data? You can see that if those polynomials continued to go on, they wouldnt be anywhere close to fitting the final location. Im trying to use the greeen shaded area to predict the non shaded area.

Those light grey lines are polynomials like this: $$y_1 = a_1(x)^2 + b_1(x) + c_1\\$$ that are fitted to different sections of the data. Do I just use the a b and c variables from each polynomial, or do extrapolate out and use some other value?


texts:
I'm not sure if this is right platform to post . I am researching on WiFi Localization algorithms using Machine learning and was wondering if anyone knows any dataset  which is publicly available. Some companies do post them online   - > https://www.deepsig.io/datasets   (datasets here are generated on GNURadio )

The dataset I'm looking can be like this

AP_location | Rssi of Client | Client_location | PhaseValues(if avaialable)

Thanks


texts:
I am taking the convolution of $x(n)=\left\{2,1,-1,-2,3 \right\}$ with $n=0$ at the third position with $h(n)=\left\{1,2,0,3 \right\}$ with $n=0$ at the second position. The answer is $y(n)=\left\{2,5,1,-10, -10, -3, 6, -9 \right\}$ with the $n=0$ at the fourth position. I studied convolution more than a decade ago and I used a table to do the convolution sum as follows:

There used to be a simple rule to obtain the location of the $n=0$ position of the output $y(n)$ from the table itself or perhaps from $x(n)$ and $y(n)$. But alas I cannot remember it. Grateful for any suggestions.


texts: How to tune PID parameters to track a family of reference signals?

texts:
I have a system that is controlled by a PID controller. I tune the controller to track a reference signal that is a unit step function.
Is there a way to extend the obtained results to be able to track any step function with arbitrary start end end value that occurs at an arbitrary time instant?


texts: Measurement of moving objects using computer vision

texts:
I am working on a project to measure lengths of the black objects and distance between them using computer vision (Shown below in the fig.). These objects are moving on a conveyor shown in the blue color. The speed of the conveyor belt is known(0-1m/s) at every instance.Due to limited field of view of the camera, its not possible to have complete object length in a single frame , how can I measure the object lengths in this case?
As I have very little knowledge of computer vision, I am finding it difficult to search the algorithms relevant for solving this problem. Any help with keywords, algorithms, resources is appreciated.

My first instinct is to use line detection algorithms for detecting object edges and calculate distance between them, based on speed and time.Also, how difficult is it to stitch multiple images based on speed to get a complete object?


texts: Is this possible to direct trans modulate DVB-S/S2 -> QI into -> DVB-C/C2 signals without doing it the way DVB-S/S2->Demodulator.ic-Transport Stream -> Modulator.ic-Transport Stream -> DVB-C/C2 ? Qpsk and Qam are similar, rf tuners the same, trouble within IQ. Direct conversion should be multichannel and cheaper within CATV systems.


texts: What does this signal filter do? (coming from finance)

texts:
In finance, many "indicators" are used in order to make prediction about if a price has an increasing or decreasing trend over time.
Among them, MACD is a popular one. There are many slighlty different definitions (standard rolling mean vs. exponential rolling mean, etc.), but one of them is :

the price is $x[n]$   (let's say the sampling rate is 1 second, but we could also use 1 day...)
$y_1[n]$ is the 12-period rolling mean, $y_2[n]$ is the 26-period rolling mean, i.e. :

$$y_1[n] = \frac{1}{12} x[n] + \frac{1}{12} x[n-1] + ... + \frac{1}{12} x[n-11]$$ and the same for $y_2$.

the MACD is defined by $y_1 - y2$, i.e. :

$$macd[n] = \frac{7}{156} x[n] + \frac{7}{156} x[n-1] + ... + \frac{7}{156} x[n-11] - \frac{1}{26} x[n-12] - \frac{1}{26} x[n-13] + ... - \frac{1}{26} x[n-25]$$

Question:

How to have a signal processing interpretation of what's going on with $macd[n]$? I can see it's a linear filter, but how to know what it is doing? Can we draw a frequency response?
It also seems that, because of rolling mean, some lag / delay is introduced.

Remark: When people use MACD, they don't stop with $macd[n]$: they define $signal[n]$ as the 9-period rolling mean of $macd[n]$:

$$signal[n] = \frac{1}{9} macd[n] + \frac{1}{9} macd[n-1] + ... + \frac{1}{9} macd[n-8]$$

and the indicator which is finally used is  (this sounds like a magic trick! why these choices?):

$$h[n] = macd[n] - signal[n] =
-\frac{14}{351}x[n]-\frac{49}{1404} x[n-1]-\frac{7}{234} x[n-2]-\frac{35}{1404} x[n-3]-\frac{7}{351} x[n-4]-\frac{7}{468} x[n-5]-\frac{7}{702} x[n-6]-\frac{7}{1404} x[n-7]+\frac{2}{27} x[n-12]+\frac{7}{108} x[n-13]+\frac{1}{18} x[n-14]+\frac{5}{108} x[n-15]+\frac{1}{27}x[n-16]+\frac{1}{36}x[n-17]+\frac{1}{54}x[n-18]+\frac{1}{108}x[n-19]-\frac{4}{117}x[n-26]-\frac{7}{234}x[n-27]-\frac{1}{39}x[n-28]-\frac{5}{234}x[n-29]-\frac{2}{117}x[n-30]-\frac{1}{78}x[n-31]-\frac{1}{117}x[n-32]-\frac{1}{234}x[n-33]$$

When $h[n]$ is positive the trend of $x[n]$ is more or less increasing, and when $h[n]$ is negative, the trend of $x[n]$ is more or less decreasing.

Question:

What does $h[n]$ do, with a DSP point of view?


texts:
$$y[n]=(-1)^n w[n]+w[n]$$

$n$ ranges from $-\infty$ to $\infty$

where $w[n]$ is output of  frequency response block with cutoff frequency = $\pi/2$, and input is unit impulse function.

I know output of frequency response block is $w[n]$ is $h[n]$
because $\delta[n]$ conv with  $h[n]$ =  $h[n]$  since delta exists only at zero

May be we can solve this in frequency domain?


texts: How identify echo patterns in audio samples

texts:
How do I estimate if in recorded sound samples is present an echo caused from walls reflection ?
(maybe there are multiples echoes: delayed, attenuated versions of the signal itself).

I'm recording several sound samples in my room and I suppose that in the recorded audio samples is present an echo image of the original sound.
How do I verify if this is true and in case, how can I calculate the samples delay (ms echo reflection time from the walls) ?

I plot the cross-correlation of the samples with itself (xcorr in MATLAB, about 40000 samples, ~1 second) but I don't know which pattern to look for to check if one or more echoes are present.

If I can understand the presence of the max peak in the middle of the graph, what are all the others equally spaced peaks on the both sides of the xcorr plot ?
Eventually, how do I estimate the echo parameters from the recorderd samples (ms delay or samples delay) ?


texts: Converting from stereo to mono by averaging

texts:
Hi I'm doing a past exam question about converting from stereo to mono.  The scenario is below:

The first question is:  Explain why would this result in a noisy encoding.  How is the noise introduced and what does it sound like?

Second Question:  What would you do to prevent such noise being introduced?

Answer 1:

The only thing I could think of on this is that the two channels could be slightly out of phase and therefore interfere destructively when summed.  I'm not sure what this would sound like but I guess the amplitude and frequency are being changed by this so I know it wouldn't sound right!

Answer 2:

We would have to do something to remove the phase difference, right?


texts: What is the no overload region of a quantizer?

texts: I was watching a video on quantization noise and the instructor kept referring to the "no overload" region of a quantizer? Could anyone please explain what that term means?


texts: How do you simultaneously undersample and oversample?

texts:
"Undersampling" and "Oversampling" are common terms when referring to the choice of sampling frequency for analog to digital data conversion.  Is it possible to Undersample and Oversample a waveform at the same time? Examples showing why or why not will be helpful.

The system in question has one real passband analog input and one real passband digital output. This is a practical example of a technique used in digital radio receivers.

Please preface your answer with spoiler notation by typing the following two characters first ">!"


texts:
I have a long audio file (12+ hours). I know that there are some unknown small (2 minutes each or thereabout, it varies) repeating (not bit by bit: it is recorded with a mic) chunks in it, repeating not periodically.
My question is: is there a completely automated way to find these chunks their offset in the main audio file and the times they occurr - with offsets for each occurrence?

I've heard about autocorrelation for similar problems, but I guess it is useful for small local chunks, not long sequences like mine.


texts: Bandwidth required to transmit a binary sequence

texts: Does a digital binary number have any bandwidth? I explain suppose T want to express the number 10  in binary digits:  1 0 1 0 would that digital number have any BW in frequency domain? I  would say the question has no meaning as frequency is the dual in time and a number 5 whether expressed in decimal or analog is not a quantity changing with time. am I right?


texts:
I understand the mathematics behind the use of image averaging for gaussian noise. Why can't it be used for impulse noise ? Would it be because there is no way to prove that impulse noise is additive ? And that it has no mean ?

Also, am I right to say that impulse noise does not affect every pixel in an image, as opposed to gaussian noise ?

Thanks !


texts: How to implement Discrete time FIR Hilbert transformer filter?

texts: I want to implement FIR Hilbert transformer filter in Matlab.


texts: Is it possible to get a 2D Fourier Transform by first taking 1D Fourier transform in first dimension and then performing another 1D Fourier Transform in the other dimension? If yes, can you explain


texts: Is there a public repository of labeled sound files coming from an industrial area?

texts: I know about the UCI Machine Learning Repository for ML datasets; Where could one find sound files e.g. in wav format, which are partially or completely labelled?


texts: Calculating spatial width from power spectrum HWHM

texts:
Say I have a 1D (spatial) signal (resolution = $1000$) which is zero everywhere except from $x = 250$ to $750$, where it equals one.

I ultimately want to calculate the spatial width of this signal using FFTs. Of course we know the width here to be $500$; in actuality, I am dealing with a signal that evolves with time and wish to calculate the average "pulse" width over all the time frames, so I do not know the widths. I have opted to use FFTs in this pursuit, so I must conduct a "sanity check" to make sure the method works. This method was suggested to me by a colleague whose intuition is many leagues farther than my own, so if someone could explain the intuition to me, I would appreciate it a lot.

Step 1: Subtract the DC background (subtract the mean from every point of the signal).
Step 2: Take the FFT of the signal, then the power (the Fourier transform times the complex conjugate of it). Normalize the power spectrum.
Step 3: Calculate the half-width at half-maximum (HWHM); here half-width is the half-width of the peak in k-space, of course.
Step 4: Convert this k-space HWHM back to real-space: real-space width = 1 / (HWHM / resolution).

When I do these steps for the signal above, I calculate a real-space width of $1189427$, laughably off from $500$. Where does the method go wrong?


texts: Why is it necessary to have two state variables

texts:
I am learning about control theory.
Let's consider this system.

$$
m a(t) + b v(t) + k x(t) = f(t)
$$

$a$ is acceleration
$v$ is velocity
$x$ is displacement
$f$ is external force

In my textbook, in chapter about "state space model" , two state variables ($x$ and $v$) are necessary
to completely describe this system.
However, I think $x$ can completely describe this mass's motion by itself.
If we know $x$, $v$ can derived from $x$.
So I have two questions.

Why two variables are needed.
Why "$x$ and $v$" ?  Can "$v$ and $a$" or "$x$ and $a$" also describe this system ?


texts: Sampling of a continuous function: Kronecker's or Dirac's delta?

texts:
I've been reading some papers in signal proccesing and I'm very confused about the issue in the title of my question. Consider a continuous function of time $t$, $f(t)$, that I sample at uneven times $t_k$, where $k=1,2,...,N$. To me, it makes sense that the sampled function is:
$$f_s(t)=\sum_{k=1}^N\delta_{t,t_k}f(t),\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (1)$$
where $\delta_{t,t_k}$ is Kronecker's delta (equals $1$ when $t=t_k$, zero elsewhere). However, in this paper, the author defines the sampled signal as:
$$f_s(t)=\frac{1}{N}\sum_{k=1}^{N}f(t)\delta(t-t_k),\ \ \ (2)$$
where $\delta(t-t_k)$ is Dirac's delta function and I really don't get why the $1/N$ appears here (the author claims that the sampling function is actually a weighted sum of delta functions
$$s(t)=C\frac{\sum_{k=1}^{N}w_k\delta(t-t_k)}{\sum_{k=1}^{N}w_k},$$
and here he choose $C=w_k=1$. I really didn't understand why). This last statement doesn't make much sense to me: the sampled signal would have infinite amplitude at $t=t_k$!

Despite of all this, it is much easier to define the Fourier Transform of $f_s(t)$ in the second case (equation $(2)$), because it is just the convolution of the window function (the FT of the Dirac comb) and the FT of the continuous signal $f(t)$, while on equation $(1)$ the FT is a bit more complicated because we have an integer function (Kronecker's delta) multiplied by a continuous function ($f(t)$). Any highlights on this?


texts: Why is the last value of an RFFT always real?

texts:
I am using numpy to do FFTs of real-valued data. And I don't understand why the Nyquist frequency is always real (or has zero phase).

So, say A = rfft(data) then A[-1] is always a real value, and not complex. Is this the correct value for that frequency? Or is this a computational artifact that can be fixed?

The explanation given in the documentation is:

  A[-1] contains the term representing both positive and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely real.

Is there a way to extract only the positive frequency and get rid of the degeneracy in the imaginary component caused by the Hermitian nature of the real FFT?


texts: Frequency response of a (rectangular) integrator

texts:
A very simple question which can't really figure out:

I have a simple discrete time rectangular integrator with Z transform H(z) = 1/(1-Z^(-1))

Plotting the frequency response with Matlab using freqz shows what it looks like a kind of low pass filter response.

However, when finding the freq response by sending an delta pulse through the integrator via filter Matlab function, and performing the FFT on its output, I just get a pulse (with amplitude equal to number of FFT points) followed of zeroes.

I guess this kind of makes sense mathematically, as the output of the integrator is a step function, which, after FFT, is the addition of as many samples of the step output as the FFT length.

However,

Why does the freqz method does not match the impulse response + FFT approach?
Am I wrong in trying to look at an integrator as a digital filter?

Thanks a mill

PD:
I forgot to mention that this is the closest to this question I could find on the site... However it is a leaky integrator not a rectangular (i.e. feedback multiplier is 1) integrator

Is a leaky integrator the same thing as a low pass filter?


texts: Concept of finding forced response from difference equation?

texts:
I know how the process works, first from difference equation make a homogeneous equation and then find natural response , then find a particular response (in the form of input) substitute it back in the equation and find constants.  And we get a forced response.  I have a doubt in finding constants.
This example is Drill problem 2.12 in "Signals and Systems" by Simon Haykin:

For the equation:
$$y[n] - (0.25)*y[n-2] = 2*x[n]+x[n-1]$$
find a forced response for $x[n]=u[n].$

I have found the natural response and for particular response. Say, $y[n] = k*u[n]$
Now the equation is:
$$k*u[n] - 0.25*k*u[n-2] = 2*u[n] + u[n-1]$$
The answer according to the book is $k=4$, but that is true only for $n>=2$. Can somebody explain what happens if $2>n>0$; $k=4$ does not seem correct in this case, as $u[n-2]=0$ for $n<2$ and $u[n-1]=0$ for $n<1$.
Why can we just substitute all $u[n-c] = 1$, in the difference equation for finding value of constants in particular solution?


texts: Can some one give me an example of cross correlation's high value where template matches with image?

texts: I find it difficult to understand how result of cross correlation of a patch of image and image is high at matching point? what if patch contains small values and other non matching point contains very high values.


texts:
I've always taken the definition of noise and SNR for granted in doing BER simulations in an AWGN channel. I would usually use the AWGN noise function and make a loop with varying SNR values.
However, I am looking at other coding examples and I found this:

sig= 1/sqrt(2*SNR);
n1 = randn(NN,1);
noise1=sig*n1;
N0=2*(sig.^2);

Is this the definition embedded in the AWGN function in MATLAB?
If not, then what is it and why is sig defined this way and what is it in relation to N0?


texts: How is RMS and Peak-to-peak of white noise calculated

texts: I have seen some devices which specify their internal noise in RMS or Peak-to-peak value. How does one calculate RMS or p2p values for white noise?


texts: Question on the definition of one-sided PSD in AWGN channel

texts:
I am currently simulating the following in a telecommunications exercise in Python:

  Consider a binary sequence $m[n]$ that is being modulated with QPSK
  (Gray-mapped) that is being transmitted via an AWGN (additive white
  gaussian noise) channel that adds complex noise of the form $$n = x +
 jy$$ such that $x,y$ are independent with $x  \sim \mathcal N(0,
> \sigma_x^2), y \sim \mathcal N (0, \sigma_y^2)$. The variances should
  be selected in a way that the one-sided PSD of the white noise is $N_0
 / 2$.

I am a little bit confused by the definition of one-sided PSD:

Since the one-sided PSD is $N_0 / 2$ the two sided PSD must be

$$S_{n} (f) = \frac {N_0} 4$$

The inverse-DTFT transform gives us the discrete autocorellation function $$R_n [m]
 = \frac {N_0} 4 \delta [m]$$ which means that $\mathbb E[n^2] = N_0 / 4$

$$\mathbb E[n^2] = \mathbb E[x^2 + 2jxy + y^2] = \sigma_x^2 + \sigma_y^2 =  \frac {N_0} 4$$

So we can select $$\sigma_x^2 = \frac {N_0} 4, \sigma_y^2 = \frac {N_0} 4$$
for simulating $n = x + jy$

My question is: Have I understood the meaning of the one-sided PSD correctly (and therefore are my assumptions correct)?


texts: Determining the noise floor of a signal in the frequency domain

texts:
Is there an accepted way of determining the noise floor of a signal by looking at it in the frequency domain?  Is it a matter of averaging all the bins, or median, or some more complex calculation like those described in the question below?

What's the best criterion for determining a frequency peak?

I want to determine the noise floor to set a threshold for determining whether or not my signal contains a given frequency.


texts: Applying a 2D band pass filter (Butterworth ?) to an array with NaNs

texts:
I am trying to filter out the low frequencies of an array looking like this :

For now, I am taking transects of this array and applying a 1D - butterworth band pass filter :

import numpy as np
from scipy.signal import find_peaks, butter, sosfiltfilt, sosfreqz

def Transect_angle(A, angle, Sp, length):
    x0, y0 = Sp[0], Sp[1]
    x1, y1  = x0 + cosd(angle)*length, y0 + sind(angle)*length
    return Array_transect(A, [y0,x0], [y1,x1], 'nearest'), [x0,y0], [x1,y1]

def butter_bandpass(lowcut, highcut, fs, order=5):
        nyq = 0.5 * fs
        low = lowcut / nyq
        high = highcut / nyq
        sos = butter(order, [low, high], analog=False, btype='band', output='sos')
        return sos

def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
        sos = butter_bandpass(lowcut, highcut, fs, order=order)
        y = sosfiltfilt(sos, data)
        return y

transect, p0, p1 = Transect_angle(Array, angle, start ,length)
tr_withoutnan = transect[~np.isnan(transect)] ### removing nan
filtered = butter_bandpass_filter(tr_withoutnan, low_freq, High_freq, 1)

I would like to apply the same kind of filtering but directly in 2D to my array.
I have two main problems :

For me, filtering is basically a convolution between data and a filter. Based on this, I can directly make the convolution of my array with a butterworth filter having an axial symmetry. However, in my function butter_bandpass_filter, I am using sosfiltfilt, which mention that the filter is appplied forward and backward. I don't know what that means it terms of convolution, but I remember that someaone mentioned it was important in a topic I read a long time ago.
Ho should I deal with the Nans values (in white in my image) ?

Finally, I use a butterworth bandpass filter because I read that it was the filter that was the least likely to produce artefacts. I am open to any suggestion !


texts: Coefficient Scaling of IIR filter to obtain unity gain response

texts:
I am designing a 2nd order IIR digital filter :
My tf equation with coefficients is
b = [0 1.209e09]
a= [9.2175   -2.6952    1.0000]
sys=tf(b,a,0.1,'Variable','z^-1')
bode(sys)

I have couple of questions :

How to get unity scaling .. as a formula... so that i can always multiply it with the 'sys' tf.
I usually seen that coefficients are less than 1 , is there a way i can make them so ?
My coefficients are calculated from some adaptive filter optimization algorithm, so they keep on changing, is there a way i can reduce the filter to filter coefficients changes to a a minimum.?


texts: Kalman Filter Parameter Definition for Vehicle Position Estimation in Python

texts:
I'm relatively new to Kalman filter concepts and I would like to use it for estimating and tracking the accuracy of the position of a vehicle with GPS measurements (As a first step). However, I am not sure of the assumptions and parameter values that I have considered , and would like to know by other users if I'm headed in the right direction.
Thanks!!

I've considered a standard motion model: Constant Velocity (Assuming that acceleration plays no effect on this vehicle's position estimation) and therefore, my states consist of only position and velocity.
+1 =  + ˙ Δ
 ˙+1 = ˙

Therefore, the state transition matrix would be (Considering 2D positioning (x,y) with latitude and longitude coordinates):

A = [[1.0, 0.0, Δ, 0.0],
     [0.0, 1.0, 0.0, Δ],
     [0.0, 0.0, 1.0, 0.0],
     [0.0, 0.0, 0.0, 1.0]]

Since we only have position measurement data available, we can correspondingly write the measurement matrix as:

H = [[1.0, 0.0, 0.0, 0.0],
     [0.0, 1.0, 0.0, 0.0]]

Initial Conditions:
For the initial starting vehicle state x0, I assumed all zeroes for the position and velocity (I did read a couple of implementations where they've entered a non-zero value for the position (Usually set to 100), but am not sure about the reason for this)

For the initial uncertainty P0, I assumed an identity matrix with diagonals set to 100 since we are uncertain about the initial position and velocity. Should this value be set higher? What exactly does it mean when the initial position and velocity are known perfectly with respect to the model? Is it the world coordinates or just some arbitrary position?

Time Step ( Δ ):
Since GPS updates at 1 Hz or every 1 second, I have correspondingly assumed the same for the time step of the filter

Noise Values:
Process Noise: I just assumed an identity matrix for the process noise of the model. But in other implementations, it is also assumed that process noise is zero. Does that mean, there are no random fluctuations of the system states?

Measurement Noise:
Since GPS is the measurement under consideration, the standard deviation for a GPS reading is approximately 6 metres and is considered to be the measurement noise for the system.

Measurement:
I'm using a GPX file exported from an app (Strava) that gives the positioning for latitude and longitude. Should this be converted to metres or can I directly use the positioning data from the GPX file?

Please let me know if the above assumptions and implementations are correct :)

UPDATE

As David pointed out, I was carrying out my implementation by directly considering the lat long coordinates as measurement data without first converting them to Cartesian. My filter was therefore showing an incorrect behaviour and this is now rectified by converting the lat long data to projected 2D cartesian coordinates through the UTM package. While the Kalman filter is behaving as expected, there are still a lot of question marks with regards to the values to be set for the initial uncertainty, process noise and the measurement noise.

In the initial uncertainty, should the position values Px and Py be set to 0 since we already know the first position from the measurement? Should the velocity be set to a very high value to account for unknown initial velocity?
For the values of the process noise, should we consider that the velocity can change even though we assume a constant velocity model and therefore, needs to be set to a high value? And the position is also affected by the change in velocity (As defined in the Kinematic equation) and hence, needs to be set to a suitably high value?
With regards to the measurement noise, should we consider the Standard deviation of signal received at the GPS receiver (Usually about 6 metres) as the measurement noise or is it to be calculated from the data points (Eg: Calculate from 100 points)?


texts: Difference between these frequency response curves

texts:
I am thinking about a simple mass-damper system response. Most single DOF systems show a frequency response plot that looks like this:

Note how increasing the damping ratio always reduces the output response, and at high frequencies, the response approaches the same line regardless of damping ratio.

But, the way I am used to thinking about it, the response should really look like this:

Note how the increasing the damping ratio reduces the response below $\omega/\omega_0 \cdot  \sqrt{2}$, but increases at frequencies above $\omega/\omega_0 \cdot  \sqrt{2}$.
The response does not approach a downward sloping line as damping ratio increases.  Rather, it approaches $1$ as damping ratio increases.

So what am I missing here?  What is the difference in these two curves?

Thanks


texts: Elementary proof of Fourier domain formula of multidimensional downsampling by $M$

texts:
I am trying to prove a well-know formula for the multidimensional downsampling by arbitrary downsampling integer matrix $M$ in $d$-dimensional case. The formula is

$$
\hat{y}(\omega)=\frac{1}{\textrm{det}(M)}\sum_{k\in \mathcal{N}(M^T)}\hat{x}\left(M^{-T}(\omega-2\pi k)\right)
$$
where $\omega\in\mathbb{R}^d$, $y[n]=x[Mn]$ for $n\in\mathbb{Z}^d$, $M^{-T}=(M^T)^{-1}$ and $\mathcal{N}(M^T)=\{ M^Tt; t\in [0,1)^d\}\cap\mathbb{Z}^d$. The key step of the proof is to prove the following equation

$$
\frac{1}{\textrm{det}(M)}\sum_{k\in \mathcal{N}(M^T)}\exp\left(-2i\pi m^TM^{-1}k\right)=\begin{cases}1\quad & m\in\mathcal{L}(M^T) \\
0\quad &m\notin\mathcal{L}(M^T),m\in\mathbb{Z}^d
\end{cases}
$$
where $\mathcal{L}(M^T)=\{M^Tn;n\in\mathbb{Z}^d\}$. The $1$-dimensional case of this equation
$$
\frac{1}{M}\sum_{k=0}^{\textrm{M}-1}\exp\left(-2i\pi \frac{mk}{M}\right)=\begin{cases}1\quad & m|M=0 \\
0\quad &m|M\neq0
\end{cases}
$$
 is simple to prove because $m$ is a sequence of integer numbers and the sum can be calculated using geometric series sum formula. But for $d$-dimensional, $m$ is a set of vectors which I can't see a pattern from. I learnt a kind of advanced proof from the problem $12.29$, page 657, multirate systems and filter banks by Vaidyanathan. It uses delta function and fourier transform to prove the second equation. I think it will be more appealing to use a elementary approach similar to $1$-dimensional case to prove it. Any tips?


texts:
I have an circularly symmetric image in Fourier space:

where the 0-frequency is in the center. Now, I want to take the FFT of this image. Having numpy's FFT conventions in mind (i.e. 0 frequency at (0,0)), I first apply the the inverse-fftshift, and then apply the inverse-fourier transform. As follows:

image = np.fft.ifft2(np.fft.ifftshift(FT_image))

This results in the following real space image:

But I can't really wrap my head around this result. It looks as if another fftshift would be in order, but in real space this shouldn't be necessary.
I would expect a radially symmetric transform, centered in the center of the image.

Is this expectation wrong, or is my computation wrong? And either way: can you explain why?