texts: Plot the frequency response of MTI delay line canceller using Octave

texts:
I try to plot the frequency response of the delay line canceller (FIR filter which used for MTI).

The delay line canceller has the following structure:

              +-----+
              |     |
x [k] >---+---|  T  |
          |   |     |
          |   +-----+
          |      |
          |   +-----+
          |   |     |
          |   |x -1 |
          |   |     |
          |   +-----+
          |      |
          |   +-----+
          |   | ___ |
          \---| \   |---> y [k]
              | /__ |
              +-----+

Its frequency response is well known (Pg 20) and equal:

$$H(\omega) = 2 \cdot \left|\sin (\frac{\omega \cdot T} {2})\right|
\tag{1}$$

I also try obtain frequency response of the canceller using algorithm which described on this question:

$$y [k] = x [k] - x [k - 1] \tag{2}$$

$$Y (z) = X (z) - X (z) z ^{-1} \tag {3}$$

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

Now I try to plot (using GNU Octave) both of responses (1) and (4).

w = linspace (0, 2 * pi, 100);
z = exp (-j .* w);

H_z = 1 - z .^ -1;
H_w = 2.0 * abs (sin (w / 2) );

hold ("on");
plot (w, H_z, "1", "linewidth", 2);
plot (w, H_w, "2", "linewidth", 2);
title ("Frequency response of the delay line canceler.");
set (gca, 'XTick',     0: pi / 2: 2 * pi)
set (gca, 'XTickLabel',{'0', 'pi / 2', 'pi', '3 pi / 2','2 pi'})
xlabel ("Angular frequency.");
ylabel ("Magnitude.");
legend ("H (z)", 'H (\omega)');

I expect that they will be the same, but they are different.

Where is my mistake?

P.S. If I add modulus for (4) (like: H_z = abs (1 - z .^ -1);) they will became the same.


texts:
$$
\left( \sum |z_i|^a \right)^b \geq \left( \sum |z_i|^b \right)^a, \quad \forall a\in [1,2], b\in [2,+\infty)
$$

Actually this is equivalent to
$$
\|z\|_a \geq \|z\|_b \quad \forall a\leq b
$$


texts:
I wonder is there any algorithm or method that I can map two RGB images together in Matlab. I mean assume I have following images

Is there any way I find what number I should multiply each channel of one them to get the other one, or any other method.

I have tried something like: looking at destination image and see what color is dominating then adjust the other image by multiplying by different value using brute force method but that is very inefficient and tedious.


texts: Setting up RRC filter and useful equations

texts:
I have looked at previous answers but cant seem to get everything I need in one place to help me and my textbook doesnt explain this in practical terms.
Signal Parameters:

$F_s = 44100$
$R_s = 300$
$sps = F_s / R_s$

Now my Raised Cosine filter parameters I am struggling...
$$
\text{Raised Cosine} = \operatorname{sinc}(t/T_s) \cos(\pi \beta  t/T_s) / (1-( \beta t / T_s)^2) \quad\text{using}\quad \beta = 0.2
$$
I think I need the RRC filter in time domain to cross every symbol period of the signal so $T_s$ for RRC filter is
$$
T_s = sps \cdot (1 / {F_s})
$$
I also need to setup t, the time vector for the RRC filter (which is unrelated to time vector of the signal). I undertand I first need to get the number of taps to do that

$\text{upsampling} = 1$
$taps = sps \cdot upsampling +1 $

I am weary that this could be very high because of $sps$ of the signal.
 t = (-taps / 2 : 1 : taps/2)  #time vector

This goes horribly wrong and not a sinc function in time domain or the frequency response I would have thought either.
Please can you help? Is there also any equations that could also help define the passband ripple, stopband attenuation and transition width?


texts: Looking for an algorithm that computes weighted average of frequencies intensity from narrow band in spectrograph

texts:
I am searching for the algorithm that takes (audio) signal as an input and outputs weighted intensity of the frequencies of some narrow band (axis X) in time  (axis Y). Frequency in the middle of that band would have highest weight.

In other words: It is like spectrograph but I am interested only for the weighted average of small band on X axis where middle of that band would have highest weight. And to have it as function of the time.

Another try: I am looking for an algorithm that computes weighted average of frequencies intensity from narrow band in spectrograph.

I don't know if this algorithm has some specific name. I think it would include some FFT and other "magic".

The best would be to have a link to some (java) library that can do that.

I am total newbie in signal processing so please be more verbose.


texts: Skeletonization of a Circle - Image Processing

texts:
What will be the output of skeletonization of a circle?
In my class my instructor said that it will be a single dot in the center but what I found on the Internet was a cross.
I discussed with a friend of mine, and he said that the reason it will be a dot is that a smaller circle can not fit a larger circle in such a way that it touches more than one point and is not out of the boundary of the original signal.
Although I beg to differ because of the equation of finding the length of the arc.
Can anyone confirm the output of skeletonization of a circle with proper reasoning?


texts:
I have a texture that I want to perform the 2DFFT on and I am trying to understand the "Row/Column" or "Column/Row" idea but I am unsure if I have understood it correctly. Hoping some one can explain it a bit better from my current understanding because it seems my current understanding of it requires a lot of FFTs which does not seem right to me.
If I have a 256 by 256 texture and I perform a 2DFFT on the image. Lets say I chose columns/row order so I do columns first, so does that mean I first perform:
256 1DFFT's... one for each column "image.x", containing 256 samples:
1DFFT for x = 0 -> Samples: image[0,0], image[0,1] ... image[0,255]
1DFFT for x = 1 -> Samples: image[1,0], image[1,1] ... image[1,255]
...
1DFFT for x = 255 -> Samples: image[255,0], image[255,1] ... image[255,255]

Then I have to do another 256 1DFFT's along the rows "image.y", containing 256 samples:
1DFFT for y = 0 -> Samples: image[0,0], image[1,0] ... image[255,0]
1DFFT for y = 1 -> Samples: image[0,1], image[1,1] ... image[255,1]
...
1DFFT for y = 255 -> Samples: image[0,255], image[1,255] ... image[255,255]

So in total I do 256 + 256 = 512 1DFFTs ? Is that correct?


texts: Relationship between time average and cross spectrum

texts:
I have two signals $x(t)$ and $y(t)$ which I can sample at arbitrary $\Delta t$ and $N$.
I am interested to the signals product time average $\langle x(t)y(t)\rangle_t$.
In particular I want  to understand when the time average is zero in term of the discrete Fourier coefficients,  that is when the signals
can be considered "orthogonal".
For example, if $X(k)$ and $Y(k)$ are the discrete Fourier coefficients, thus the time average is well approximated by:
$$
\langle x(t)y(t)\rangle_t\approx \frac{1}{N^2}  \sum_{k=0}^{N-1}X(k)Y^*(k)
$$
Thus vanishing cross spectrum represents a sufficient condition in order to have $\langle x(t)y(t)\rangle_t= 0$.
My question is:

when this also a necessary condition?

Thank you very much


texts: Hessian Matrix. Second partial derivative test

texts:
I have a question about the hessian matrix / determinant of the hessian matrix. For the Hessian matrix, one is able to determine the local curvature around a point. And with the Second partial derivative test one can test, using the determinant of the hessian, if that point is located on an extrema, or saddle point.

My question is
Wikipedia states:

  the Hessian approximates the function at a critical point with a
  second degree polynomial.

By 'hessian' does this mean that the hessian matrix approximates the function or the determinant? (i am confused as determinant of hessian and hessian matrix are sometimes used intertwined)

thank you in advance


texts: IQ modulation: baseband to bandpass transformation

texts:
can someone explain me these doubts?

it is a baseband signal representation.
A- complex signal, R- real.

If I multiply baseband signal with FT( cos) then the signal will look like this ( on the plot the first on the left /For this case, convolution changes nothing).
[![enter image description here][1]][1]

I  shift the signal in frequency but my passband signal is still complex-valued, so it cannot be transmitted over a single channel ( Is it a reason why I can.t use multiplication with cos to modulate complex baseband signal?). otherwise, I will need two channels, one for the real part and one for the imaginary part.

if I multiply baseband only with FT(cos), why I get the same copy A-R in negative part and A-R in positive? In IQ modulation it is R-A in negative part and A-R in positive


texts:
When processing wav files, I encounter this problem: the what I extract PCM from a 8-bit encoded .wav file, I got a sequence of integers. However, when verifying my implementation with wavread in Matlab, the PCM code is represented with so-called double-precision normalized samples. My question is what's the difference between these two format. For example, the hex number is 0x80 0x81, the corresponding double-precision normalized samples are 0, 0.0078. IIRC, PCM code in .wav file records sound pressure value of audio. Is double-precision normalized samples sound pressure level? If so the value should be $10log(P_1/P_2)$ (based 10). But $10log(129/128)$is not 0.078 instead $10ln(129/128)$(based $e$) is. Anything wrong with my intuition?

Thanks and best regards.


texts: Generate signals with a particular variance and SNR

texts:
Consider a system model of the form: $y_n = ax_n + v_n$ where $x_n$ is the input that is corrupted by $v_n$ which is an Additive White Gaussian Noise of zero-mean and variance 1 for $n = 1,2,...,N$ samples. $a$ is an unknown parameter representing the channel coefficient. How do I generate $v_n$ which is White but of a different variance other than $1$ and a particular SNR?

QUESTION: I am not sure whether the following way creates a signal of non-unit variance and how to determine the variance? If I create a signal z_10 using awgn() with a particular SNR say 10 dB, then would its variance be different from another signal, z_20 created using SNR = 20 dB? What is the proper way to create signal of a particular variance and know its SNR?
y_wnoise = y + sqrt(variance)*randn(size(y))  but how do I include the SNR value?

The way I have implemented in MATLAB is as follows. Did I do it correctly?

%generate data:
N = 50; %number of data points
s = randn(1,N);
a = 0.6;
for n = 1:N
   y(n) = a*s(n);
end
SNR = [10,15]

%generate noisy signal of different variance
z_10 = awgn(y,10,'measured');
z_15 = awgn(y,15,'measured');
OR
z1 = y + sqrt(0.6)*randn(1,N);


texts: What is the slope of a transfer function?

texts:
Lets say I have a Transfer function (H) plot as below. I need to find the SLOPE of the transfer function in dB/MHz.

That is... i need a plot (db/MHz) vs frequency.

How can i go about it ?

f = 0: 1e6 : 80e6;
H_db=20*log10(abs(H));
s=diff(H_db);
plot(f/1e6,s);

Do i need steps of 1 Mhz .. then its in db/Mhz.. or do i need to divide s with something ?

or am i thinking about this all wrong ?

(update)

Lets say i have a transfer function below:

and then i find the db/mhz vs mhz plot using the following code:

step_size=1e6;
f_H = 0: step_size: fs_ADC+step_size;    % i am using 'f_H' and 'f' since with diff function in the end I am short of one index for ploting.. i hope this is correct
f = 0: step_size: fs_ADC;
H = fir1(f_H);
H_db=20*log10(abs(H));
ss=diff(H_db);  % is this correct ?
plot(f/1e6,ss)

or should i use :

ss=diff(H_db)./diff(f_H);
plot(f/1e6,ss)

Then i get the below figure: .. now i get the 10^-5 on the yaxis.

Please let me know


texts: Sparse CWT matrix-shape data lossless compression

texts:
Is there a specialized lossless compressor for sparse matrices, i.e. large fraction (>40%) of values == 0? LZ4 worked well on 1D signals, but now whether I feed a sparse 2D or an all-zeros array makes no difference, still ~2x compression.
Slightly lossy compression (<5% MAE) also suffices. If relevant, data is float32 not uint8 (.mat/.npy), and it's not actually an image but a 2D array resulting from absolute value of synchrosqueezed CWT of a signal. float16 might be an option, I've not decided, but ideally float32 is preserved in compression. Data ultimately fed to a neural net.


texts: What is the opposite of sampling called?

texts: We call the conversion from a continuous time signal $f(t)$ to a discrete time signal $f_s[k]$ "sampling". Is there a name for the reverse operation, i.e. creating a continuous time signal from a discrete time signal?


texts: I am pursuing a master's in signal processing and I am working on object tracking. Till now I have done object tracking using colors, background subtraction and the Lucas-Kanade method along with a Kalman filter. For my final dissertation, I want to do something new on object tracking and I have explored a lot to get some new ideas but all in vain.  If anyone is working within the same field please suggest some ideas.


texts: How to implement an improper discrete-time transfer function into Simulink

texts:
I am trying to model a discrete-time control system in Simulink. The control system contains an inner loop that utilizes the inverse of the plant model. The plant in question takes the form of:

$P(s) = \frac{3.332\times s + 4.679}{s^2+30.97\times s+45.5}$

s = tf('s');
P = (3.332*s + 4.679)/(s^2+30.97*s+45.5);

I inverted the plant, $P(s)^{-1}$:

P_inv = inv(P);

Now I have an inverted model however you cannot explicitly implement an improper function into Simulink. I followed this discussion that has been referred to multiple times scattered throughout forums.

[r,p,k]=residue(P_inv.num{1},P_inv.den{1});
sys1 = tf(r(1),[1,-p(1)]);
sysk1 = k(1)*s;
sysk2 = k(2);

Once the improper function is broken down, I discretized each component separately.

Ts = 0.005;
d_sys1 = c2d(sys1,Ts)
d_sysk1 = c2d(sysk1,Ts,'matched') % <--- problem

A problem now exists in d_sysk1. It results in yet another improper function taking the form of:

d_sysk1 =
    59.99 z - 59.99
Sample time: 0.005 seconds
Discrete-time transfer function.

In my simulation I want to implement a discretized improper transfer function, P(s). Is there something I did incorrectly?


texts: Convolution Integral of Harmonic Signal (Cosine) with the Sinc Function

texts:
I was asked to show that this convolution integral results in the answers also given in the image. Not quite sure how to approach this integral, everything seems to be coupled together.

Does anyone know how this kind of integrals is solved?


texts: Can I view every signal that has been transmitted using software defined radio as a amplitude modulated signal? For example I could make a frequency modulated baseband signal in GNU Radio and connect it to Adalm Pluto sink. Since analog part of Pluto SDR involves frequency mixing does it mean on top of FM I get AM?


texts: Output of an FIR filter has a peak at the beginning of the signal

texts:
I have a signal  $x[n]$ and I filter the signal using an FIR bandpass filter to receive $y[n]$. (implementation in MATLAB using built-in function firpm).
The filtered signal $y[n]$ is compensated for its delay of half the filter order.

The problem is that the filtered signal $y[n]$ has a major peak at the beginning that does not exist in the original signal.

What is the cause of that peak?
Is it possible to attenuate the peak?

The peak (or response) is shown in the second plot of the filtered signal between 0-0.5 seconds (Note that I only show the first few seconds of a several minute signal)

The signal is sampled at 250 samples/sec. The desired filter passes frequencies between 10-20 Hz. The code for the implementation of the filter:

fs=250; % sampling rate;
n= 120; % filter order;
freqs = [0 5 10 20 25 fs/2]/(fs/2); % normalized frequencies in Hz;
amps = [0 0 1 1 0 0 ]; % amplitudes;
b = firpm (n,freqs,amps); % define filter coefficients;
filtered_signal = filter (b,1,original_signal); % apply FIR filter;


texts: How is that after random numbers with their negatives alternating passing through 5, 4, 3 order moving average filter, become quasi sinusoidals?

texts:
I have passed random numbers $${89, 58, 13, 70, 24}$$ with their negatives alternating, through 5 order moving average filter and output was positive and negative numbers alternating. After I have passed output through 4 order mov. average filter, output was positive and negative semi-periods! although no quasi-sinusoidal. But after passing this second output through 3 order moving average filter, output was quasi-sinusoidal! How then all that happened?

Following are input signal and outputs.

Random numbers alternate with their negatives:

$${89, -89, 58, -58, 13, -13, 70, -70, 24, -24,
    89, -89, 58, -58, 13, -13, 70, -70, 24, -24,
    89, -89, 58, -58}$$

After passing through 5 order moving average:
$$2.6, -17.8, 14, -11.6, 4.8, -2.6, 17.8, -14, 11.6, -4.8, 2.6, -17.8, 14, -11.6, 4.8, -2.6, 17.8, -14, 11.6, -4.8$$

After passing through 4 order moving average:
$$-3.2, -2.65, 1.15, 2.1, 1.5, 3.2, 2.65, -1.15, -2.1, -1.5, -3.2, -2.65, 1.15, 2.1, 1.5, 3.2, 2.65 $$

After passing through 3 order moving average:

$$-1.56667, 0.2, 1.58333, 2.26667, 2.45, 1.56667, -0.2, -1.58333, -2.26667, -2.45, -1.56667, 0.2, 1.58333, 2.26667, 2.45$$


texts:
I am trying to find the image which has the optimum focus of a focus stack (10 images). I am able to find the best two images by using the minimum gray intensity values but now the problematic part comes.

All standard methods fail because I have a very strong background with sharp edges which are laying under my object, the green cell.

Best image for human eye:

Best image choose by CV methods:

I tried already many things like FFT, filters, edge detection but most of the time it fails...

Any hints would be very much appreciated.


texts: How to create a sine wave generator that can smoothly transition between frequencies

texts:
I am able to write a basic sine wave generator for audio, but I want it to be able to smoothly transition from one frequency to another. If I just stop generating one frequency and immediately switch to another there will be a discontinuity in the signal and a "click" will be heard.

My question is, what is a good algorithm to generate a wave that starts at, say 250Hz, and then transitions to 300Hz, without introducing any clicks. If the algorithm includes an optional glide/portamento time, then so much the better.

I can think of a few possible approaches such as oversampling followed by a low pass filter, or maybe using a wavetable, but I am sure this is a common enough problem that there is a standard way of tackling it.


texts: How can extract the cosine transform formula used for 2D by scipy.fft.dct

texts:
For the 1D cosine transform the documentation is clear in here, and I can reproduce it easily:
The formula is:
$$y_k= 2 \sum_{n=0}^{N-1}x_n \cos \left( \frac{\pi k(2n + 1)}{2N}\right)$$
and here it is reproduced manually, for example for the third harmonic:
import numpy as np
from scipy.fft import fft, dct

y = np.array([10,3,5])

# dct() call:
print(dct(y, 2))

# manual reproduction for k = 2:
N = 3
k = 2
n = np.array([0,1,2])
2 * (
    y[0] * np.cos((np.pi*k*(2*n[0]+1))/(2*N)) +
    y[1] * np.cos((np.pi*k*(2*n[1]+1))/(2*N)) +
    y[2] * np.cos((np.pi*k*(2*n[2]+1))/(2*N)))

in both cases I get a 9.
But there is no documentation for the 2D DCT, and my attempts at hacking the formula with a toy matrix are not working out:
Compare:
z = np.array([[ 2,  3       ],
             [ 10, 15]])
dct(z, axis=0)  # dct() call

to for instance:
N = 2
M = 2
k = 0
l = 0
n = np.array([0,1])
m = np.array([0,1])
M*N * (
    z[0,0] * np.cos((np.pi*k*(2*n[0]+1))/(2*N)) * np.cos((np.pi*l*(2*m[0]+1))/(2*M)) +
    z[0,1] * np.cos((np.pi*k*(2*n[0]+1))/(2*N)) * np.cos((np.pi*l*(2*m[1]+1))/(2*M)) +
    z[1,0] * np.cos((np.pi*k*(2*n[1]+1))/(2*N)) * np.cos((np.pi*l*(2*m[0]+1))/(2*M)) +
    z[1,1] * np.cos((np.pi*k*(2*n[1]+1))/(2*N)) * np.cos((np.pi*l*(2*m[1]+1))/(2*M))
)

for the first coefficient.
Can anyone help me reconcile the output of dct() with my attempted manual calculation?
I guess the formula is not...
$$y_{k,l}= 4 \sum_{n=0}^{N-1}\sum_{m=0}^{M-1}x_n y_m \cos \left( \frac{\pi k(2n + 1)}{2N}\right)\cos \left( \frac{\pi l(2m + 1)}{2M}\right)$$
but it would be really easy to correct if I could get the same output manually for one of the coefficients on the example matrix above.
The methods applied here make explicit reference to this author, but they don't help me understand what the function is doing.

PS The formula turns out to be spot on if it is called twice as in:
dct(dct(z.T, axis=0).T, axis=0)


texts: Channel estimation and interpolation by vector in OFDM

texts:
I have V-OFDM system (Vector OFDM) where every symbol is organized as in below figure:

The black cirles are pilots and white circles are data. First, iFFT operation it taken per column, and then collecting data is taken row-wise resulting collected data as shown in the figure right. It means first eight samples are pilot and following 24 sample are data, then 8 samples are pilot and so on. Then adding CP --> channel --> noise -->received data
In the receiver side, After usual processing of removing CP -->reshaping --> FFT column wise. We get the received data equivalent into transmitted data in above figure left. Then extract the pilots which are in our case of size $(3,8)$.
Then, LS estimation is performed, by dividing the received pilot by original pilot to get the frequency-domain estimated channel.
I ask here, how can we interpolate the channel in this case ? if I get a frequency-domain estimated channel of size $(3,8)$, what's the process to interpolate it into size of my symbol ? I think it should be vector interpolation? how can I do it in that case?
Thank you


texts: Why Wavelet based Transform Is More Suitable for Image Compression Compared to DCT?

texts: Everyone knows that JPEG2000 can obtain much better compression result than JPEG. The fundamental transform behind JPEG2000 is wavelet while the basic transform in JPEG is DCT. So my question is why wavelet is more suitable for image compression compared to DCT. Thanks.


texts: Neural Networks and Complex Valued Inputs

texts:
[not sure if this or stats.stackexchange was the correct location for this post, so put it on both for now.]

I've seen some recent papers describing complex valued neural networks like this one: Deep Complex Networks, 2017, Trabelsi et al.. What I'm wondering is, rather than invent a novel complex network pipeline that takes a complex value input as a single channel, why not just separate the real and imaginary components into two channels fed into a regular neural network, and then let the network figure out the relations, without necessarily knowing that one channel represents the real component while the other represents the imaginary component?

I assume there must be some disadvantage to doing it this way, or some relation that the neural network can't pick up on, so if that's the case would someone please provide me with a high-level explanation of why this two-channel standard network approach is inferior to the novel single-channel complex network?

(By the way, the application I have in mind for researching deep complex networks is RF signal classification.)


texts: Book recommendations on DSP, statistical SP and signal detection

texts:
I am looking for a good reference on DSP. I am a little bit more than beginner and have some experience in DPS. I think I would have to start with rather easier books where a concept of DSP is explained based on practical examples, intuitively.

Eventually I'd take more advanced books to have solid understanding of DSP, including statistical signal analysis such as power spectra, cross-spectra, coherence, autocorrelation, and cross-correlation and ultimately I'd be interested in signal, sound, noise, or speech detection.

For beginners, people recommend

Rick Lyons' Understanding DSP
Sanjit K. Mitra, Digital Signal Processing: A Computer-Based Approach
The Scientist and Engineer's Guide to Digital Signal Processing - free online book

All recommendations of advanced books are by Alan V. Oppenheim's e.g.:

Alan V. Oppenheim, Ronald W. Schafer, John R. Buck, Discrete-Time Signal Processing, Prentice-Hall Signal Processing Series.
Alan V. Oppenheim, Alan S. Willsky, with S. Hamid, Signals and Systems, Prentice Hall

There was one more recommendation:

John G. Proakis, Dimitris K Manolakis, Digital Signal Processing: Principles, Algorithms and Applications, Prentice Hall

These books are usually quite expensive which is fine but I would not like to buy something I'd be disappointed with. If you could recommend or say whether the books I listed are worth the price, I'd be grateful :)

Thanks.

EDIT.

I have decided to buy and go through "Understanding Digital Signal Processing" by Rick Lyons. I am still waiting for it but have had a chance to read through first two chapters via Kindle App. I must say I am already happy and don't regret this purchase. I'd recommend this book for all starters.


texts: What is the difference between the sampling rate and the bandwidth of a DAC? I have found in one paper a DAC speced as 15GHz 3dB bandwidth, and 64GS/s sampling rate, and I haven't been able to relate them to each other in any way...


texts: Direct Digital Frequency Synthesis, NCO and negative frequencies

texts:
I need to translate a frequency band generated by a DDFS designed in a FPGA (using Xilinx DDS Compiler). My output to the NCO is in I/Q format.
I chose to use a NCO to perform the frequency shift but I am wondering what is the best solution to do this:

Is it better to define the frequency band generated by the DDFS around the center frequency 0 Hz and defining in the NCO the center frequency?

OR

Is it better to define the frequency band from 0 Hz and shifting it using the startband frequency?

And why?

In the DDS Compiler documentation, p.27, example 2 provides the way to describe negative frequency by using aliased positive frequency (Fs + (negative frequency)). But as these frequencies are high and close to Fs clock, will there be enough data points to correctly describe the signals for these frequencies?


texts: Low dimensional system identification algorithms

texts:
I'm a physics Phd student and just have a self-taught knowledge about lti-systems. After a while I found out that several techniques such as heat capacity or thermal-conductance measurements can be modeled as lti-systems. The current approach to estimate the physical quantities is a nonlinear fit of the solution of the differential equations to the data.

But knowing that the system can be modeled as an lti-system, it's equivalent to estimating the state space matrices A, B, C, D. After some research I found out there are several techniques such as subspace identification which do not need non linear regression.

My question is what are the state of the art techniques for identifiing low dimensional models with only a few in- and outputs?


texts: How to calculate the power of a finite length signal?

texts:
I am confused with these concepts. If the signal is expressed as r(t), I know the power of the signal is given by:

But if the the length of signal T is finite and cannot approach infinity, how can I calculate the power? Can I say the power is approximately equal to the following equation?


texts: How to detect, using matlab, the center of the biggest circle?

texts:
The goal is to preprocess an image in a way that outside the circle isn't in the region-of-interest so set its value to 0 (black). That way the followed step of segmentation will be easier to analyze all the blobs that exists inside that circle.

My instance isn't this one in particular, but this example is somewhat close enough

I was thinking of applying an X across the whole picture, and detecting the outer most intersection of the the X and O, then from there calculate the center, assuming there's no noise on the edges of the rectangle in which the circle is in.

OR is there a way in Matlab that can already assist me with this?


texts:
MIT has been making a bit of noise lately about a new algorithm that is touted as a faster Fourier transform that works on particular kinds of signals, for instance: "Faster fourier transform named one of world’s most important emerging technologies". The MIT Technology Review magazine says:

  With the new algorithm, called the sparse Fourier transform (SFT), streams of data can be processed 10 to 100 times faster than was possible with the FFT. The speedup can occur because the information we care about most has a great deal of structure: music is not random noise. These meaningful signals typically have only a fraction of the possible values that a signal could take; the technical term for this is that the information is "sparse." Because the SFT algorithm isn't intended to work with all possible streams of data, it can take certain shortcuts not otherwise available. In theory, an algorithm that can handle only sparse signals is much more limited than the FFT. But "sparsity is everywhere," points out coinventor Katabi, a professor of electrical engineering and computer science. "It's in nature; it's in video signals; it's in audio signals."

Could someone here provide a more technical explanation of what the algorithm actually is, and where it might be applicable?

EDIT: Some links:

The paper: "Nearly Optimal Sparse Fourier Transform" (arXiv) by Haitham Hassanieh, Piotr Indyk, Dina Katabi, Eric Price.
Project website - includes sample implementation.


texts:
I'm asked to design FIR filter, an ideal low pass filter.

I'm given with pass band frequency (wp) and stop band frequency (ws). Now, I have to choose Ns points from stop band and Np points from pass band. Taking the inverse will give me impulse response.

The problem is, Ns points are equally spaced and Np points are equally spaced. But the spacing of the points in pass band and stop band differ. How do I find the filter coefficients?

Thank you.


texts: How to average coherences estimated using Welch's method in MATLAB

texts:
I'm trying to estimate the average coherence of discontinuous snippets of a signal in MATLAB. For Welch's spectrum estimates, the following works:

w = blackmanharris(50);  % window
n = numel(w);            % fft length
o = 0;                   % overlap

x = rand(200,1); x1 = x(1:100); x2 = x(101:200);

s  = pwelch(x,  w, o, n);
s1 = pwelch(x1, w, o, n);
s2 = pwelch(x2, w, o, n);
sa = (s1+s2)/2;

max(abs(s-sa))  % almost zero

However, when estimating coherences using Welch's method, the arithmetic mean yields an incorrect result:

y = rand(200,1); y1 = y(1:100); y2 = y(101:200);

c  = mscohere(x,  y,  w, o, n);
c1 = mscohere(x1, y1, w, o, n);
c2 = mscohere(x2, y2, w, o, n);
ca = (c1+c2)/2;

max(abs(c-ca))  % very different from zero

How can I average two coherence estimates correctly?


texts: Using all-pole filter to model the Room Impulse Response

texts:
Why is all pole model pretty useful in modelling room acoustics?

Is it related to reverberation?


texts:
I'm new to to DSP in general and have been trying my hand at making some very simple VST's just for practice purposes.

I am trying to convert the stereo channels into Mid (in the left channel) and Side (in the right) without using a placeholder to store output. Here is a very basic version of the code I am currently trying:

    *LeftSample = (*LeftSample + *RightSample) * 0.5;
    *RightSample = (((*LeftSample * 2) - *RightSample) - *RightSample) * 0.5;

The first line assigns the mid output to the left channel, but in the second line I am trying to reverse the mid conversion so that I can use the left channel's original output when performing the L-R operation to create the side channel in the right output.

Am I missing something in thinking that this should be achievable? Is there some reason that

    (*LeftSample * 2) - *RightSample

does not reverse the mid conversion, (L+R) * 0.5? Is it not possible to derive the original left channel using the mid signal and the right signal?

Again, I'm new to this, so I apologize for any errors in terminology I have made, and for anything that has been poorly communicated. I appreciate all feedback and criticism (please, tear any errors I've made to pieces). I've looked around quite a bit, and haven't had any luck; if anyone has any resources or directions to point me in, I would greatly, greatly appreciate it!


texts:
How would you get the DTFT from the DFT samples?

How will the DFT indexes map to the discrete frequency and what kind of an interpolation would be required?


texts: Question about Fourier descriptor and the physical meaning of the coefficients

texts:
I would have some questions about the Fourier descriptor and the physical interpretation of the individual coefficients. I'm rather new to this concept, so I would be looking for a simple answer.

To start with I have a curve in xy [mm] coordinates (188x2 points). To calculate the descriptor I use the function found in R.C. Gonzales 'Digital Image Processing using Matlab' (p. 629). From that I get a vector with the descriptors An (188x1).  As far as I understand the concept of the descriptor I can 'filter' out the high frequencies by reconstructing the shape again with only a handful of descriptors.

Here are my questions now:

I read that, the DC component A0 is the position of my shape in the image and its the mean values of the x,y coordinates. I understand that, I could calculate the position directly form my x,y coordinates, but I was wondering where this DC component is in the descriptor vector, since its a even number of values. Is it the term with the highest value?
Which brings me to my second question. If I recalculate the shape with only 2 descriptors I obtain a circle around the mean position with a certain radius. Is the radius then the second highest value?
Last question. Im mainly interested in the ellipses that is created with recalculating the shape with 4 factors. But I would also like to understand the whole concept correctly. I read that the A-1 and A1 coefficients represent the major (d) and minor (e) axis of this ellipses. And that with d = 2(|A-1| + |A1|) and e = 2(|A-1| - |A1|) the axis can be calculated in a length unit. Do I have to scale these values somehow? Because if I pick the third and fourth highest values, the result is not what I expect.

I hope someone can help me better understand this. Thank you in advance.


texts: How we can quantize a sampled signal in MATLAB?

texts:
I have a continuous time signal $x(t)=\sin(2πft)$ where $0 \leq t \leq 3$.

I want to sample the continuous time signal and then quantize that sampled signal and then plot both sampled and quantized signals in MATLAB.

I have written code for sampling section/part but I don't know how to go with quantization part/section.

My MATLAB code is follow:

sampleRate = 500;
samplePeriod = 1/sampleRate;
signalFreq = 20;
nT = 0:samplePeriod:3;
signal = cos(2*pi*signalFreq*nT);

figure
stem(nT, signal)
grid on
xlabel('Time (sec)')
ylabel('Amplitude')


texts:
I'm trying to use ORB features with a cv::BFMatcher. ORB is based on binary descriptors so HAMMING must be the choice, but I'm not sure I understand the difference between NORM_HAMMING2 vs NORM_HAMMING and witch one is the right choice.

I made some test but I couldn't find any reliable  difference.


texts: Take a wavelet function as a transfer funtion

texts:
Is there anyone having the experience of taking the wavelet funtion as a transfer function?

That is:
if we have $\psi_{m,n}(x)=a^{-m/2}\psi(a^{-m}x-nb)$, $\psi_{m,n}$ is the dilated and shifted version of a mother wavelet function $\psi(x)$, $m$ and $n$ are the scale and time variables respectively. Then we take $\psi_{m,n}$ as a transfer function and its input is function $f(x)$, and output is $g(x)$: $g(x) = \psi_{m,n}(f(x))$.

My question is:

for particular input $f(x)$, if there is some relationship between $g(x)$ and $\psi_{m,n}$?
Is there any research field which are focusing on the properties and applications of the transfer function?


texts: what is the correct order of applying a nonlinear operation and downsampling (with anti-aliasing)

texts:
In UltraSound imaging, after beam-forming and obtaining the envelope, Log-compression which is a non-linear operation and scan conversion which is a 2D interpolation (with inherent down-sampling) is performed. I was wondering what would be the correct order of log-compression as a nonlinear operation and the 2D interpolation which inherently down-sample the signal.
Generally if we perform some non-linear operation and down sampling what would be the correct order?


texts: 16-APSK NDA Carrier Synchronization Problem

texts:
I'm working on a DVB-S2 Symbol Timing + Carrier Synchronizer with a focus on 16-APSK | 32-APSK modulation Scheme.
I understand that the first section could be achieved using a Polyphase Clock Sync approach (i.e. as implemented in GNURadio), the second functions is usually done using a Costas loops
(i.e. in the simple case of M-PSK modulation scheme)
Moreover, The Costas Loop used for carrier synchronization are designed to only accommodate PSK modulations. As such, a Costas loop used on any of the APSK modulations, may try to lock on to any of the PSK modulations corresponding to any of the constellation rings, each of which is a PSK constellation in itself. For example, for 32-APSK, a Costas loop may try to lock on to the 4 points in the inner ring, the 12 points in the middle ring, or the 16 points in the outer ring. The result will be an overall failure to achieve any reasonable carrier synchronization lock (figure represent the output of a 4-order Costas Loop after the Polyphase Clock Sync Scheme)

I'm interested in understanding the NDA or NDA-DD signal processing scheme behind and if there's some implementation for GNURadio environment.


texts: Automatic MRI Segmenation of Heart over Dicom Image

texts:
I have a bunch of short axis MRI images of the heart(Left Ventricle), in dicom format.
I want to do a Automatic segmentation of various structures in these images.
Does anyone know of a program I could use? (a C# would be fine also)
I basically just need a program which allows me to select a couple of
points on the images and then automatically saves the coordinates of those
points in a file.
Any help would be most appreciated.
Thanks


texts: Why are low frequency peaks not sharp in scipy fft?

texts:
I am using numpy/scipy to plot graphs of sine waves. frequencies at 15 Hz or higher give nice, sharp peaks, but at lower frequencies, the peaks are smeared and the actual peak frequency can't be seen in the graph. Why is that happening and how do i stop that?

    import numpy as np
    import matplotlib.pyplot as plt

    tmin = 0
    tmax = 0.5
    N = 10000 #No. of samples
    t = np.linspace(tmin, tmax, N)
    T = t[1]-t[0] #sampling interval
    fs = 1/T #sampling frequency
    print(fs)
    # x1 = np.sin(2*np.pi*5*t) + 0.8*np.sin(2*np.pi*10*t)
    x1 = np.sin(2*np.pi*20*t) + np.sin(2*np.pi*30*t) + np.sin(2*np.pi*5*t) + np.sin(2*np.pi*3*t)
    x2 = x1 + np.sin(2*np.pi*50*t) + 0.8*np.sin(2*np.pi*100*t)
    x2_fft = fft(x2)
    plt.plot(np.abs(x2_fft))
    plt.title(r'fft of $x_2(t)$')
    plt.show()

    xf = np.linspace(0, fs/2.0, N//2) #Create frequency axis
    plt.plot(xf, 2.0/N * np.abs(x2_fft[0:N//2])) #plot only +ve frequencies
    plt.xlim([0, 120])
    plt.xlabel('Frequency (Hz)')
    plt.ylabel('Amplitude')
    plt.title(r'fft of $x_2(t)$')
    plt.grid(True)
    plt.show()


texts: Mathematical justification for zero padding?

texts:
This question asks what's the point of zero padding. The accepted answer is certainly very insightful, but I don't understand a big chunk of it:

  Zero padding allows one to use a longer FFT, which will produce a
  longer FFT result vector.

  A longer FFT result has more frequency bins that are more closely
  spaced in frequency. But they will be essentially providing the same
  result as a high quality Sinc interpolation of a shorter
  non-zero-padded FFT of the original data.

  This might result in a smoother looking spectrum when plotted without
  further interpolation.

  Although this interpolation won't help with resolving or the
  resolution of and/or between adjacent or nearby frequencies, it might
  make it easier to visually resolve the peak of a single isolated
  frequency that does not have any significant adjacent signals or noise
  in the spectrum. Statistically, the higher density of FFT result bins
  will probably make it more likely that the peak magnitude bin is
  closer to the frequency of a random isolated input frequency sinusoid,
  and without further interpolation (parabolic, et.al.).

What exactly is the meaning of "resolve" and "resolution" here, and how, mathematically, is it apparent that zero padding does not increase resolution.
Dually, how is apparent mathematically that zero padding means interpolation?


texts: What techniques/algorithms can I use to reduce noise when recording audio?

texts:
I'm making a handmade guitar chords dataset by recording 20480 samples of a 44.1kHz microphone to later on make a chord classification using CNN.
But there's a problem... I'm making this dataset on my room. Quiet.
When other noise enviroments comes to the case the classifier will give poor results. I want to apply some technique to reduce the noise, even if little.
Do window functions reduce noise? Can someone help me by some advice of techniques/algorithms? Using Python, if possible...


texts: Low-pass filter parameters for image downsampling

texts:
I need to downscale an image in a factor of $s_x$ horizontally and $s_y$ vertically ($s_x$, $s_y$ < $1$).

I want to use a finite $n\times m$ low-pass filter before downsampling.

How should I determine the low-pass filter parameters ($n, m$ and the Gaussian $\sigma$) to get it as a function of $s_x$ and $s_y$?

Specifically, I'm interesting in the case where $s_x=s_y=1/\sqrt{2}$.


texts: orthogonal family and pulse shaping filter

texts:
I am a beginner in digital communications and I have a question on the pulse shaping filter.

For example, I have an orthogonal family $ \{s_1,...,s_N \}$. Can we preserve the orthogonality with a pulse shaping filter $g$ as a raised cosine filter, that is to say the family $ \{ g(n) \ast s_1(n),...,g(n) \ast s_N(n) \}$ is orthogonal?


texts: Does the channel impulse response change over time?

texts: Let's suppose we have an emitter and a receiver in fixed positions the emitter sends a signal $s_1(t)$ and after a period $T$ it sends $s_2(t)$, the receiver receives $r_1(t)$ and $r_2(t)$. My question is if $s_1(t)=s_2(t)$, is it true that $r_1(t) = r_2(t)$?


texts: Image reconstruction using Laplace pyramid

texts:
Given a sub-sampled Image $P_n$ belonging to layer $n$, a Gaussian kernel $G$ and a Laplace Layer $L_{n-1}$ of layer $n-1$, my efforts to create $P_{n-1}$ of previous layer $n-1$ have failed.

This was what I attempted.

Created a staging image $S_{n-1}$ by padding alternate row and column of $P_n$ with $0$.
Convolved $S_{n-1}$ with $G$ resulting in say $B_{n-1}$. This was done with the intention of interpolating and replacing the $0$s with approximated values.
Added $L_{n-1}$ (Missing Information) to $B_{n-1}$ hoping that the result would resemble the original $P_{n-1}$.

Two Gaussian kernels ($3\times 3$ and $5\times 5$ with $\sigma=1$) were used in my application.

The resulting image is hopelessly dark.

Are the steps 1-3 correct?
Should I use an alternative interpolation technique such as cubic instead of convolution in Step-2 before adding the Laplace layer?


texts:
I have a signal that has both AC and DC components and both a re varying with time. How can I extract the varying DC wave from the signal?

eg: A PPG (Photopletysmography) signal extracted from a healthy patient.


texts: Relation between continuous time transfer function and sampled approximation

texts:
Suppose I have some continuous time system and associated transfer function:
$$ y(n)=x(n)+x(n-1)$$
$$ H(j \omega) = 1+e^{j \omega (-T_s)} $$
Now suppose I create a discrete-time approximation of this system like this:

The digital system contained within the converter blocks has the transfer function:
$$ H(z) = 1 + z^{-1} $$
I know that the actual transfer function from $V_{in}(t)$ to $V_{out}(t)$ is something else entirely, but is there any meaning in saying that if $H(z)$ is "evaluated" for $z=e^{j \omega T_s}$, then $H(z)=H(j \omega)$? What is the significance of this observation, if any?


texts:
Evaluating a volume flow incremental sensor does not deliver expected results.

The pump of which the volume flow is to be measured has a hand-calculated flow rate of

$$Q = \dfrac{n}{ 60 \;\mathrm{s/min}}   e \pi\left(\frac{d}{2}\right)^2  \approx 2 \;\mathrm{cm^3/s}$$

where $n$ is the rotational speed of $2000 \;\mathrm{1/min}$, $e$ the excentricity of the pump of $1.1 \;\mathrm{mm}$, and $\pi\left(\frac{d}{2}\right)^2$ is the area of the piston with $d = 8 \;\mathrm{mm}$.

Now the sensor (VSE, Type: VS 0,1) delivers 10000 impulses per liter.

The calculation counts the "Delta Impulses", call it dI, and divides by the time delta dt in milliseconds.

$$\dfrac{dI}{dt} = \text{impulses/ms}$$

Now I say that $10$ impulses mean $1 \;\mathrm{cm^3}$ as the spec says ($1 \;\mathrm{liter} = 1000 \;\mathrm{cm^3}$).
So
$$1 \;\text{impulse} = 0.1 \;\mathrm{cm^3/ms}$$

Further with $1000 \;\mathrm{ms} = 1\;\mathrm{s}$, it is  $100 \;\mathrm{cm^3/s}$.
I can multiply the $\frac{dI}{dt}$ with $100$ and get the flow in $\mathrm{cm^3/s}$.

$$1 \frac{dI}{dt} = 100 \;\mathrm{cm^3/s}$$

Is that correct?

Now this calculation is done within the program. The factor $100$ is given as a parameter that I have set to this value to translate the flow into $\mathrm{cm^3/s}$. The program always uses milliseconds (PLC-Control with $1\;\mathrm{ms}$ cycle, increments time ticker each time +1).

I don't know the values of the used impuls count, but the result in $\mathrm{cm^3/s}$ is about $10$ times higher than the hand-calculated flow rate. I can't find a logical mistake. Do you?


texts: What are some current algorithm(s) for finding if two images are copies of each other?

texts:
Could anyone enlighten me on what are the current best ways to detect if two images are the same (i.e. a copy or edited copy of each other)? What feature detection method do they use (SIFT, DWT, pixel intensity, etc.)?

I've read a lot of algorithms that focus on detecting similar objects and so on, but I am interested in reading on some for detecting whether two images are copies of each other. I've done some googling and most algorithms/papers I've found are pre-2014 or are about detecting similar images, not exact copies.


texts: how to get an input test signal for convolution/ distortion method

texts:
i am trying to do some experiments with Total Harmonic Distortion.
According to Simultaneous measurement of impulse response and distortion with a swept-sine technique
i have to use the deconvolution method to get distortion harmonics.
The problem i have is that i don have any experience with the mathematics behind deconvolution. So i want to test it with some known signals.
but i have the problem i need thus some signals with known distortion to try out... How do i make this kind of signals.

Input signals

sine wave ?
chirp

added distortion

specific filters
sine waves
chirp ( how to add this frequency specific...)

I use python with numpy and scipy


texts: What are F0 counters in Speech signals? What is represented by F0?

texts: I can't find any dedicated definition for Frequency F0 counters. Can anyone tell me what does F0 exactly mean, I am confused about that.


texts:
I would like a pair of complementary IIR filters (lowpass/highpass). By complementary, I mean, when the output from the two filters is summed, the original signal is recovered. I thought I could build such pairs with butterworth filters but using a little math, I discovered only 1st order filters were complementary. I thought I'd done this before, but I'm forgetting how.

Is something wrong with my math? Is there an easy solution I'm forgetting about?

Thanks!


texts: What is the function of init in Active Contour Model

texts: In practice of image processing using scikit-image, I didn't understand the role of constructing init numpy array in Active Contour Model example. Is it the red section drawn in the example astronaut image?


texts:
I have been asked to calculate the power of a speech signal given by the following:
$$\ p(x)= \left(\frac a2\right)e^{-a\mid x \mid}$$

I know the formula for the power of a signal to be the following:

$$\frac{1}{T}\int_\frac{-T}{2}^\frac{T}{2}p(x)^2dx$$

Only this is not a periodic signal so I don't know where to set the upper and lower limits. I have tried taking the Fourier transform and evaluating but that gives me $\ P(f) = \frac{a^2}{a^2+2\pi f^2} $. If anyone would be able to guide me through a solution to this I'd really appreciate it. Simon.


texts: How do I interpret this block diagram correctly?

texts:
I am reading notes ahead of the class and have encountered this particular slide:

While I completely agree with the first block diagram, I am at a loss trying to understand how the second block diagram is equivalent to the first.

Here's how I interpret the first diagram:
x[n] enters H1 and H1 outputs b0 x[n] + b1 x[n-1].
The output of H1 enters H2, and H2 outputs -a1 y[n-1] + b0 x[n] + b1 x[n-1]

Here's how I interpret the second diagram:
I am actually lost! I have no idea how to make sense of it.

I understand how the "simpler" diagrams work, for example the multiplication and addition components. But this is Greek to me, and it seems like I cannot find any list of rules to interpret this.


texts: Comparing band-pass filters and convolutional kernels?

texts:
I am currently working on extracting features for speech recognition purposes.
I wanted to try an approach similar to MFCC features in which the center frequency of each band pass filters are placed a distance of x mel displaced of each other.

But instead of looking at the audio in 1d I see it in 2d using the spectrogram as representation, and I was thinking of using a CNN instead of using band pass filters , with different weight for sets of frequencies, as they are interpreted differently, and some more distinct than others.

Elaborate on some are more distinct than others:

Consider the normal mel scale.  Frequency between 0 - 1000 are interpreted linearly increasing, and above as logarithmic increasing. The way I interpret this is that the ear is more susceptible to differences in the lower range (<1000), and not so much in the higher range (>1000). So in my head it makes sense to place the weight as higher in the lower range, and decreasing the higher range.

But what about the kernel size and the center frequency?.. As I enter the logarithmic range, will the band pass filters used in the MFCC become wider, which in this case should result in larger kernels, but what about the center frequency?.. Where or how should i place a kernel such that a term such as center frequency would make sense related to kernels?... is it even possible, or am I just being silly?


texts: What is Super Resolution in the Context of Windowing?

texts:
I have been trying to understand what super-resolution is, in the context of DSP/DIP. What criteria is being maximized/minimized, and why?

Most of my online searches yield super-res techniques from the optical physics stand point, however I know anecdotally that they have been used in image processing, and in some doppler-radar processing as well.

One particular instance of Super-Res I remember seeing was in the design of a windowing function, where the main lobe was the same width as that of a boxcar, while simultaneously having very low and fast degrading side lobes, similar to a hamming window. In this sense, the 'super-res' came from the fact that frequencies very close to one another were able to be resolved due to the low main lobe width, and a very high dynamic range. Is this what super-res really amounts to?

Is there an explanation that, (perhaps), likens it to a form of de-noising, or sparsity pursuit? Or is it a different animal altogether?


texts: how do you compute the channel gain from path loss index in wireless communication?


texts: Numerical error while implementing a periodic pulse signal

texts:
I'm trying to illustrate the principle of constructing a periodic signal using an elementary pattern. This is the code I use (python 2.7 + numpy + scipy.signal) :

import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack as sfft
import scipy.signal as spsig

plt.close('all')

npts = 2**14 #number of points for both time-domain signals and FFT's
tsim = 100e-9 #ending time (in s)
fs = npts/tsim #sampling frequency

t = np.linspace(0,tsim,npts) #time bins vector
t1 = 30e-12 #pulse rise time
t2 = 80e-12 #pulse fall time
delta_t = 200e-12 #pulse width (including t1 and t2)
fsig = 1e9 #pulse repetition frequency
A = 1. #pulse amplitude

# here I construct the elementary pulse signal, it works fine
sig_elem = np.zeros(t.size)
sig_elem[(t>=0)&(t<t1)] = (A/t1)*t[(t>=0)&(t<t1)]
sig_elem[(t>=t1)&(t<delta_t-t2)] = A
sig_elem[(t>=delta_t-t2)&(t<delta_t)] = (-A/t2)*t[(t>=delta_t-t2)&(t<delta_t)] + (A/t2)*delta_t

periode = 1/fsig #this is the pulse repetition period
comb = np.reshape(np.array([np.round(t*1e9, 2)%1==0]), (npts,)) #this is where I construct the comb, I use numerical tricks to make it work
sig = spsig.fftconvolve(sig_elem, comb, 'full') #and the convolution itself, which should give a periodization of my elementary signal

##### FIGURE ####
plt.figure(1)
plt.plot(t*1e9, sig_elem, 'r',lw = 0.8)
plt.xlabel('t (ns)')
plt.xlim(-10,100)
plt.ylim(-1,5)
plt.grid(True)

# single sided FFT of the elementary signal. I restrict the plot frequency at 50 GHz since the sampling frequency is insanely high
sig_elem_fft = np.abs(sfft.fftshift(sfft.fft(sig_elem, npts)))
plt.figure(2)
plt.plot(sfft.fftshift(sfft.fftfreq(npts, 1/fs))*1e-9, sig_elem_fft, 'b',lw = 0.8)
plt.xlabel('f (GHz)')
plt.xlim(0,50)
plt.grid(True)

#plot of the dirac "comb". It seems good
plt.figure(3)
plt.scatter(t*1e9, comb)
plt.grid(True)
plt.xlim(-10,110)
plt.ylim(-0.5,1.5)

# plot of the convolve result, this is where I don't understand what's happening
plt.figure(4)
plt.plot(sig, 'r',lw = 0.8)
plt.xlabel('t (ns)')
#plt.xlim(-10,100)
#plt.ylim(-1,5)
plt.grid(True)

What I'm doing is defining a trapezoidal pulse :

$$
\begin{cases}
s(t) =
\frac{At}{t_1} & \text{ if }0 \leq t < t_1\\
A & \text{ if } t_1\leq t < \Delta t-t_2\\
\frac{A}{t_2}\left(\Delta t - t\right) & \text{ if } \Delta t-t_2 \leq t < \Delta t
\end{cases}
$$

$t_1$, $t_2$ and $\Delta t$ being respectively rise time, fall time and total pulse width. A is an arbitrary amplitude.
I implement it on $2^{14}$ (16384) points, making the total duration equal to 100 ns. Which makes the sampling frequency around 164 GHz.

This is what I get, the rest of the signal being equal to zero.

After creating this elementary pulse, I create a "dirac comb", using the same number of points, and using a 3 GHz repetition frequency.
Then, both signals are convolved using an FFT method (meaning both signals FFT's are calculated, multiplied element-wise and the result IFFT is computed afterwards).

What I should get is a periodic signal consisting of $s(t)$ defined above being repeated each 1 ns.
However, I get a strange signal, where the amplitude is sometimes A, sometimes 2*A. The period is however consistent.


texts: Determine line rate and frame rate of a system

texts:
I have as a homework to determine the line rate and frame rate for a system described above:

Heigh of monitor:             40cm
Screen Aspect Ratio:          16:9
Pixel Aspect Ratio:           4:3
Progressive scan
Viewing distance from screen: 0.6m
Active line period:           15μs
Horizontal Blanking:          5μs
Vertical blanking lines:      20

I search for the definitions in order to understand the system:

Line rate: It indicates the actual speed with which the bits are sent onto the wire

Frame rate: frequency at which an imaging device produces unique images(frames)

Progressive video: is the method by which all lines (whole frame) are captured at the same instant, representing a single moment in time

The screen aspect ratio is width divided by height, and the same for the pixel aspect ratio.

Horizontal blanking interval refers to a part of the process of displaying images on a computer monitor or television screen via raster scanning. CRT screens display images by moving beams of electrons very quickly across the screen. Once the beam of the monitor has reached the edge of the screen, the beam is switched off, and the deflection circuit voltages (or currents) are returned to the values they had for the other edge of the screen; this would have the effect of retracing the screen in the opposite direction, so the beam is turned off during this time.

Vertical blanking interval is an interval of time between the last line of a given frame and the beginning of the next frame, during which the incoming data stream is not displayed on a CRT  screen. It is the time interval allowed for the analog TV electron gun beam to move from the bottom of the current frame to the top of the next one as it scans images. This requires the last 45 lines of each 525-line frame.

My problem is that i cant find a proper way to calculate the line rate or frame rate from the above. I didn't find any equation or a guide. Can someone help me or point me a tutorial? I assume that the line rate has something to do with the horizontal blanking and vertical blanking because the electrons that need to provide through the wire, but still i need an equation.


texts:
Im working on a small project and I'm using the DSP library from Texas Instruments. Working on an Hercules MCU.
The library comes with RFFT and CFFT, implemented with a radix-4 algorithm. The library is limited to a buffer of length up to 2048 or 512 or 128 (the real one). And the complex support lengths of 16, 64, 256, 1024.
The problem Im facing is that I have a buffer of 5120 (real).
I tried to do two FFTs os 2048 and two of 512 and then concatenating them to get the bigger Fourier. The problem is that it obviously didn't work (I already realize that hehe)

the question here is How can I concatenate them correctly??
or should I modify the library to take the amount of data I need?

Thanks!!


texts: Continuous-time vs Discrete-time Fourier transform

texts:
case 1) to calculate the Fourier transform of discrete-time signal(sampled signal) we use Discrete-time Fourier transform.

but my question is:

case 2) if I consider that discrete-time signal as continuous-time signal which is multiplied by Dirac comb(impulse train) then we produced a sampled signal but in continuous mode
now we apply continuous Fourier transform to this signal.

notice that in both case we have the same sampled signal(the only difference: in first case signal is in discrete form and in second signal is in continuous form)

the result of "case 1" is equal to result of "case 2"?
if not,what does cause it?


texts: Filters applied separately to right and left channel of stereo microphone yielding inaccurate results

texts:
I must estimate the direction of arrival of an acoustic source, and I hope to distinguish between a voice input and musical input using a frequency cutoff. In order to do this, I apply the same bandpass elliptic filter on the left and right channels of the stereo microphone. I have applied the filter to white noise and verified using a spectrogram that the filter does indeed retain the frequencies that it is designed to retain. I calculate the power after filtering, and use a power threshold to decide whether the frame of data is noise or not. I then use cross-correlation between the left and right channel, to estimate the time delay between left and right channels, and use that to calculate the angle of arrival.

I had first simulated the situation with two signals in numpy, with random noise added to it, and delayed by a certain number of samples. I then applied the same filter to the 'left' and 'right' channels, where the 'right' channel was simply delayed by a certain number of samples from the 'left', and random noise added. I was then able to compute the correct delay between the signals by giving the filtered 'left' and 'right' channels as input to the cross-correlator.

In real time, however, after applying the filter to the left and right channels, the time  delay is neither accurate not consistent. Could it be possible that the process of computing and applying the filter (in python) is interfering with the acquisition of signals, thereby adding some random time delays and making my time delay measurements entirely inaccurate? If so, how would I go about resolving the issue?


texts: Understanding FFT for a vibrational analysis experiment

texts:
I am trying to understand how FFT works in order to measure the vibrations of a 3D printer. I will be doing this with an Arduino Nano and a MPU6050 accelerometer.
In order to program the Arduino correctly I need to understand some things about FFT first. So various sources state that FFT works with 2^n samples, for example "The FFT-algorithm works with a finite number of samples. This number needs to be 2^n where n is an integer (resulting in 32, 64, 128, etc)". What does this actually mean? From my understanding, if I will be measuring accelerations at a constant sample rate of 600Hz for 10 seconds, I will end up with 6000 samples. Does this mean that I will have to remove some of the measured data in order to end up with 4096 samples, which meets the 2^n samples condition? Or fill up my samples with zeroes to end up with 8196 samples, which also meets the stated condition?
Thank you!


texts: Why the power of periodic signal is square?

texts:
I have DSP in my academics and while going through the video lectures i am stuck regarding power of periodic signal.

Its mentioned as

$$P_{\text{avg}}= \frac{1}{N}\sum_{n=0}^{N-1}|x(n)|^2$$

my doubt is why we have to mention $|x(n)|$ as square ?

Note: I am having format issues please edit my Question and put it in format. thank you.


texts: A question about sampling rate of cosine signal

texts:
Given $$c(t) = \cos(2\pi\cdot 30 \cdot t) $$

If we sample this signal at the Nyquist rate 60 Hz and at a higher rate of 80 Hz, we get the following:

There is no aliasing as $f$ = 30 Hz is less than or equal to the folding frequency, 30 Hz and 40 Hz, respectively.

Why does sampling at a rate of 80 Hz result in this "distorted" cosine signal, although it is higher than the Nyquist rate? (I know if we go way higher than 80 Hz the signal will look better.)


texts: Finding symmetric regions/patterns in image

texts:
I have a set of images representing the mean curvature of a human back surface.

What I want to do is to "scan" the image for points which have similar, reflected "counterparts" in some other part of the image (most likely symmetrical to the midline, but not necessarily since there might be deformities). Some image-stitching techniques use this to "auto-detect" similar points between images, but I want to detect them for both sides of the same image.

The ultimate goal is to find a continuous, most probably curved, longitudinal line that adaptively divides the back in symmetric "halves".

A sample image is placed below. Notice that not all the regions are symmetrical (specifically, just above the center of the image, the red vertical "strip" deviates to the right). That region should receive a bad score, or whatever, but then the local symmetry would be defined from symmetrical points placed farther away. In any case, I'll have to adapt any algorythm to my application domain, but what I'm after is som correlation/convolution/pattern-matching strategy, there must already be something around, I think.

(EDIT: there are more images below, and some more explanation)

EDIT: as requested, I'll include more typical images, either well-behaved and problematic. But instead of colormapped images, they are grayscale ones, so that color relates directly to data magnitude, which didn't happened with the colored image (provided just for communication). Although the gray images seem to lack contrast compared to the colored one, the data gradients are there and can be brought up with some adaptive contrast if desired.

1) Image of a very symmetrical subject:

2) Image of the same subject at a different moment. Although there are more "features" (more gradients), it doesn't "feel" so symmetric as before:

3) A thin young subject, with convexities (bony protrusions, denoted by lighter regions) at the midline instead of the more common concave midline:

4) A young person with spinal deviation confirmed by X-Ray (note the asymmetries):

5) The typical "tilted" subject (although mostly symmetrical around the curved midline, and as such not properly "deformed"):

Any help is much welcome!


texts: Differences between the mean filter, trend(mean) removal, and baseline correction filter?

texts:
I've recorded acceleration signal data using an accelerometer attached to vehicle and I want to know what the differences between the

mean filter,
trend(mean) removal,
baseline correction filter, and
filter to correct displacement for oscillation about zero baseline

are.


texts: How can I find a relation between the input and output of the overall system?

texts:
I have system for filtering a continuous-time signal using a discrete-time filter where sampling is performed by multiplication with the impulse train.
The frequency response of the discrete-time system is given as
 $$H_d(e^{j\omega})=\dfrac{1}{1-\frac{1}{2}e^{-j\omega}+3e^{-3j\omega}}$$
And I want to find an equation relating input $x(t)$ and output $y(t)$ of my overall system. It is guaranteed that input is a band-limited signal and sampling frequency is high enough. In my Signals and Systems book frequency response of the continuous system is given as:
$$H_c(j\omega)=H_d(e^{j\omega T})\left(u(\omega+\tfrac{1}{2}\omega_s)-u(\omega-\tfrac{1}{2}\omega_s)\right)\quad,$$ $T$ is the sampling period, $\ \omega_s = \frac{2 \pi}{T}$ is the (angular) sampling frequency (radian/second), $\ u(\omega)$ denotes the unit step function (taken from Oppenheim and Willsky, Signals and Systems Second Edition, p. 540, eq. 7.25).

I have found the difference equation which stands for the discrete-time system but I couldn't understand how can I relate it to continuous time system. I will appreciate any help.
$$y[n] − \tfrac{1}{2}y[n − 1] + 3y[n − 3] = x[n]$$


texts: I am doing data analysis. I used the wavelet transform and now I am trying the Hilbert–Huang transform (HHT). In the literature, I read that Hilbert–Huang transform (HHT) is an adaptive technique. I tried to find how it is adaptive or what is the meaning of adaptive in this context. I didn't get any answer.


texts: Relationship between the IDFT of a sampled DTFT and its discrete-time domain signal

texts:
Suppose we are given an input signal s[m,n] with DTFT $S(\omega_1, \omega_2)$.

We sample it at $\omega_1 = \frac{2 \pi k}{256}$ and $\omega_2 = \frac{2 \pi l}{256}$ to get a 256 point DFT S[k,l]. Now suppose we take the IDFT of S[k,l] to get $\tilde{s}[m,n]$

I am trying to understand the relationship between $\tilde{s}[m,n]$ and s[m,n]. My understanding is that I should be able to express $\tilde{s}[m,n]$ as a summation of every 256th sample of the original signal.

So far I have been advised to try expressing the Sampled DTFT as a dirac comb, i.e.:

$S[k,l] = \sum_{k = -\infty}^{\infty} \sum_{l = -\infty}^{\infty} S( \frac{2 \pi k}{256}, \frac{2 \pi l}{256}) \delta(\omega_1 - \frac{2 \pi k}{256}, \omega_2-\frac{2 \pi l}{256}) $

and use the definition of the IDFT:

$\tilde{s}[m,n] = \frac{1}{256^2}\sum_{k=0}^{255} \sum_{l=0}^{255} S[k,l] e^{j(\frac{2 \pi km}{256}+\frac{2 \pi ln}{256})}$

Using these two pieces of information I can get the expression:

$\tilde{s}[m,n] = \frac{1}{256^2}\sum_{k=0}^{255} \sum_{l=0}^{255} [\sum_{k = -\infty}^{\infty} \sum_{l = -\infty}^{\infty} S( \frac{2 \pi k}{256}, \frac{2 \pi l}{256}) \delta(\omega_1 - \frac{2 \pi k}{256}, \omega_2-\frac{2 \pi l}{256})] e^{j(\frac{2 \pi km}{256}+\frac{2 \pi ln}{256})}$

but I am not sure how to proceed from here. Any advice would be helpful I have been racking my brain over this for a couple hours now.


texts:
Given

$$H(z) = \frac{11 +4.6z^{-1} -26z^{-2}-3.75z^{-3}}{1-z^{-1}-8.75z^{-2}}$$

I'd like to know whether this realization:

Is equivalent to this one?

In short, is the direct form realization equivalent to the canonic one?


texts: Frequency response of chirp signal changes when extracting burst from repeating chirp waveform

texts:
I hope i can make myself clear enough, even though i might not be familiar with the right terms.
Using GNU Radio, i created a chirp signal with a sawtooth signal source into a frequency mod block, as seen below. The Cosine into the multiplier i added so i could move the chirp within the baseband, later on.
This IQ file has a length of a couple of seconds.

Replaying this file in GNU Radio with an SDR(At an arbitrary frequency of 100 MHz) gives this results when measured with my SA:

After this, i thought: Because of the 20 kHz frequency of the sawtooth, this means the chirps are repeated every $\frac{1}{20 kHz} = 50us$, meaning i should be able to extract 50us of data from the IQ file, and get the same response(utilizing that the waveform is repeating).
Using MATLAB(Script) i opened the IQ file and plotted it to find the data i wanted to extract:

Taking the data from sample 601 to sample 1800, giving 1200 samples. I used these boundries as it looks like this is where the chirp starts and stops, because of the nonlinearity in the phase. This also makes sense, because 1200 samples equals 50us at a 24 MHz sample rate:
$\frac{1200 samples}{24 MS/s} = 50 us$
However, extracting this data, saving it as an IQ file again, and replaying it in GNU Radio shows a different result:

As you can see, the peaks of the chirp has been moved. (the markers is located at the same spot as previous FFT plot)
But why? I can't figure out why the spectrum is not identical. In my head, taking 50us of data from the start and end of the chirp, should result in the same output. Why is this not the case?


texts: Alone MFCC can identify difference between sound?

texts: I am doing a project to identify different drum beats. There are lots of features like MFCC, Chroma Values, Spectral Bandwidth, Spectral Centroid, Zero Crossing Rate, etc. But most of the projects are done by only using MFCC, So can we use only MFCC values to detect the difference between all sound types and noise too.


texts: What type of information can be contained in I/Q (quadrature) data?

texts:
I am taking in regards to, for example, the signals captured using a measuring instrument such as a spectrum analyzer. Basically would the I/Q data store all the parameters that my analyzer can analyze? What is so great about I/Q data? I would like to understand because, clearly, I do not...
Thank you.


texts: Image Brightness on 2D Fourier Transformation

texts:
What effect does the brightness have on the frequency spectrum of 2D Fourier Transformation?

Example. Suppose we have a gray image and calculate 2D Fourier Transformation. Then we increase the brightness of the same image for 10% and repeat 2D Fourier how does the frequency spectrum change compare to the first one?

If I understand correctly only phase would change not frequency. Is that correct?


texts: What are the advantages and disadvantages of Kalman filter compared with FIR, IIR and low pass filter to filter data with noise?

texts:
It is known that the Kalman filter can filter the data with noise. I also find it works well after using it compared with FIR, low pass filter,etc. Now, I have a couple of questions about the advantages and disadvantages of the Kalman filter compared with FIR, low pass filter,etc. (In accordance with the conditions of using Kalman filter)

Can we deem that traditional filters such as FIR and low-pass filter are designed to be used at specific frequencies, while kalman filter can filter signals with noises at any frequency as long as the computing speed is large enough and the system model does not change?
The kalman filter can adjust the Kalman gain according to the actual measurement accuracy, so as to obtain the optimal solution. Is it right to think that Kalman filter is more intelligent than FIR?
When the measuring instrument itself has errors, is it right to think the data obtained by using kalman filter is more accurate for the Kalman filter can adjust the weights of system model and measure respectively?
When the noise of measurement is large (the instrument is not accurate), can the adoption of Kalman filter (the model is well established) obtain more accurate data than FIR, etc. That is, can the kalman filter be used to make up for the error caused by the low precision of the measuring instrument by establishing an accurate model?
The core of kalman filter is a set of iterative equations. Can we think the kalman filter has the advantages of simple design and strong universality compared with FIR? Of course, it is based on the establishment of a good system model and measurement model.

What I understand is not necessarily right or sufficient. Please help me to answer my questions or give me any suggestions. Thanks!


texts: How to use Octave ellip() coefficients for 3-band C++ crossover

texts:
I have been working on making a 3-band audio crossover in C++, with the goal of activating/deactivating a different device depending on whether the low, mid, or high range of the input is above a threshold. I got as far as using GNU Octave to generate and graph out the low, band, and high pass filter coefficients using the Elliptic IIR method. I'm pleased with the coefficient characteristics, but this is my first DSP software project so I don't know how to use them to actually implement the filter program.
I looked at a bunch of articles on the topic online, and I saw people say using the Biquad Direct type 2 form is the most efficient approach for this situation. When I looked at the math on Wikipedia I understood the concepts somewhat but became confused as to how to implement it, partially because the order of my filters is greater than 2, and partially because comparing the formulas to other sources it seems like there might even be a mistake in the Wiki source??
I feel like I am incredibly close to understanding what to do, but I need that final nudge in the right direction.
I'm not sure if it is helpful at this stage, but here is what I have made in Octave so far:
function iir_elliptic_version
  clf
  close all

  pkg load signal;
  sample_freq = 192000;

  [lp_nums, lp_denoms] = Gen_Low_Pass_Filter_Coeffs(159, sample_freq)
  [mp_nums, mp_denoms] = Gen_Mid_Pass_Filter_Coeffs(160, 1999, sample_freq)
  [hp_nums, hp_denoms] = Gen_High_Pass_Filter_Coeffs(2000, sample_freq)

  f = 0:sample_freq/2;
  W = f*(2*pi/sample_freq);
  H1 = freqz(lp_nums, lp_denoms, W);
  H2 = freqz(mp_nums, mp_denoms, W);
  H3 = freqz(hp_nums, hp_denoms, W);
  plot(f, 20*log10(abs(H1)), f, 20*log10(abs(H2)), f, 20*log10(abs(H3)))
  axis([0 4000 -60 20])
  title('Filter Frequency Response of Elliptic IIR filters')
  xlabel('Frequency (Hz)')
  ylabel('Magnitude (dB)')
  grid on
endfunction

function [nums, denoms] = Gen_Low_Pass_Filter_Coeffs( passband_end,
                                              Fs)
  %This function generates the coefficients for a low pass filter for the
  %low range given the passband end frequency, and the sampling rate.
  stopband_start = passband_end + 25;
  pass_ripple_dB = 5;
  atten_dB = 20;
  norm_pass_freq = passband_end/(Fs/2);
  norm_stop_freq = stopband_start/(Fs/2);
  [order, cutoff_radians] = ellipord(norm_pass_freq, norm_stop_freq, pass_ripple_dB, atten_dB);
  printf("The order of the low-pass is %d\n", order);
  [nums, denoms] = ellip(order, pass_ripple_dB, atten_dB, cutoff_radians);
endfunction

function [nums, denoms] = Gen_Mid_Pass_Filter_Coeffs( passband_start,
                                                      passband_end,
                                                      Fs)
  %This function generates the coefficients for a band pass filter for the
  %mid range given the passband start and end frequencies, and the sampling rate.
  pass_freqs = [passband_start, passband_end];
  stop_freqs = [passband_start - 160, passband_end + 170];
  pass_ripple_dB = 5;
  atten_dB = 20;
  norm_pass_freqs = pass_freqs/(Fs/2);
  norm_stop_freqs = stop_freqs/(Fs/2);
  [order, cutoff_radians] = ellipord(norm_pass_freqs, norm_stop_freqs, pass_ripple_dB, atten_dB);
  printf("The order of the band-pass is %d\n", order);
  [nums, denoms] = ellip(order, pass_ripple_dB, atten_dB, cutoff_radians);
endfunction

function [nums, denoms] = Gen_High_Pass_Filter_Coeffs( passband_start,
                                              Fs)
  %This function generates the coefficients for a high pass filter for the
  %high range given the passband start frequency, and the sampling rate.
  stopband_end = passband_start - 25;
  pass_ripple_dB = 5;
  atten_dB = 20;
  norm_pass_freq = passband_start/(Fs/2);
  norm_stop_freq = stopband_end/(Fs/2);
  [order, cutoff_radians] = ellipord(norm_pass_freq, norm_stop_freq, pass_ripple_dB, atten_dB);
  printf("The order of the high-pass is %d\n", order);
  [nums, denoms] = ellip(order, pass_ripple_dB, atten_dB, cutoff_radians, 'high');
endfunction


texts:
$$X(e^{j\omega}) = \sum_{n=-\infty}^\infty x[n] e^{-j\omega n} $$

The frequency term $\omega$ in DTFT is normalized as $\omega = \frac{\Omega}{f_\mathrm{s}}$

$\Omega= 2 \pi f$ is the angular frequency continuous-time Fourier Transform of $x(t)$.

A continuous-time signal that can be properly sampled will have non-zero energy components in its spectrum having frequency $|f| \lt \frac{f_\mathrm{s}}{2}$

Hence the range of $|\omega|$ should lie between $0$ through $\pi$. Given that the spectrum of a discrete time signal repeats every $2\pi$ radians, we should see this spectrum replicated from 0 to $\pi$, $2\pi$ to $3\pi$, $4\pi$ to $5\pi$ and so on.

I can extrapolate this to negative factors of $2\pi$ as well. So the spectra can additionally replicate from $-2\pi$ to $=3\pi$, $-4\pi$ to $-5\pi$ and so on.

I have however read that the range of $\omega$ is from $-\pi$ to $+\pi$. Where does this come from?


texts: An explanation of parts of the MUSIC Algorithm for someone without a background in signal processing?

texts:
I've been looking at every tutorial and paper I can find, but I keep losing the intuition behind what's going on when they get into the matrix operations.

There is a step in which the signal vector is multiplied by its hermitian transpose and the correlation matrix of the product is computed. What do both of these steps accomplish from a high level?

Where is the 'e' term arising from in the steering vector?

I also don't understand the last part about how the orthogonality of the signal and noise subspaces is used to disentangle signals. We use a function in which we have 1 divided by the product of vectors representing the signal and noise subspaces. If they equal 0, wouldn't this function be undefined since it would be equal to 1/0?


texts:
In Python, I consider a dummy signal as follows:

fs = 512
sig = np.random.standard_normal((fs,))

sig corresponds to 1s of data at 512Hz.

To check Parseval theorem on the whole signal, I do:

fft = np.fft.fft(sig)
f = np.fft.fftfreqs(sig.size, d=1. / fs)
m = np.sum((np.abs(fft) ** 2) / sig.size)
e = np.sum(sig ** 2)
print('diff = %1.5f' % (m - e))

This actually returns 0.0. Now, to compute the energy of the signal in a given frequency band (say 5Hz - 15Hz), I would filter the signal using a bandpass filter and compute its energy as above:

def _butter(lowcut, highcut, fs, order=5, btype='bandpass'):
    nyq = 0.5 * fs
    low = lowcut / nyq
    high = highcut / nyq
    b, a = butter(order, [low, high], btype=btype)
    return b, a

def _filter(data, lowcut, highcut, fs, order=5, btype='bandpass'):
    b, a = _butter(lowcut, highcut, fs, order=order, btype=btype)
    y = filtfilt(b, a, data)
    return y

filtered_sig = _filter(sig, 5., 15., fs)
e_band = np.sum(filtered_sig ** 2)

My question is: can I use Parseval theorem to compute the energy of the signal (in the 5Hz-15Hz) band using fft as above? I naively tried:

mask = np.logical_and(np.abs(f) >= 5, np.abs(f) <= 15)
m_band = np.sum((np.abs(fft[mask]) ** 2) / sig.size)

But the quantities m_band and e_band are not equal.
Where did I make a mistake?


texts:
I am a beginner to study about the filter notion and property

Being a real digital filter,
(here "real filter" I means that its impulse response is real-valued)

this formula is established.
But I have no idea how to prove it

$$ |H(\pi +w )|=|H(\pi -w)|$$

What should be $H(w)$ or $|H(w)| $ for generalized proof procedure?


texts: Conversion between DTFT in radians/sample to DTFT in cycles/sample

texts:
I have found that most commonly the DTFT is defined as:
$X(\omega) = \sum_{n=-\infty}^{\infty} x[n]e^{-j \omega n}$.

However the class I am taking frequently uses the DTFT expressed in "normalized continuous frequency of discrete signals" units i.e. cycles/sample. I am trying to understand how to convert a DTFT pair using one units to other units.

For example, the DTFT pair with $\omega$ [radians/sample]:

$$x[n] = 1  \Leftrightarrow X(\omega) = 2 \pi \sum_{k=-\infty}^{\infty} \delta( \omega-2 \pi k)$$

My understanding that this pair with $\mu$ [cycles/sample] is given by:
$$x[n] = 1  \Leftrightarrow X(\mu)= \sum_{k=-\infty}^{\infty} \delta( \mu -k)$$

I have honestly struggled to find many resources which make any mention of the latter DTFT.


texts: I am trying to find the given note in an audio file. It has been specifically told that each file contains only one note. So i directly took fft and found the corresponding frequency and then mapped it to corresponding note.Out of my test cases some are giving the correct answer, but some are not.


texts: How to characterize this whitening filter?

texts:
A little bit of background: I am interested in whitening in the least-square estimation.

In this sense, consider a univariate signal $y$.  Assuming the covariance of $y$ is $\mathbf{A}\sigma^2$.  If we knew matrix $\bf A$, then, whitenning of this signal could be done by:
$\mathbf{A}^{-1/2}\bf y$.  Since the  $\mathbf{A}^{-1/2}\bf y$ has a covariance matrix of $\mathbf{A}^{-1/2} \bf A \mathbf{A}^{-1/2}\sigma^2 = I\sigma^2$.  Thus, $\mathbf{A}^{-1/2}\bf y$ is whitened.

In practice, the $A$ is unknown but can be estimated using different methods such maximum likelihood or Yule-Walker.  Here is what I am interested to figure out.

To be more specific, for this purpose one can use Yule-Walker equation in particular and assume an AR(p) model, say order $p=1$ and estimate the model parameter of this autoregressive.

This is indeed a filter, but my question is how to characterize this filter in frequency domain?  How can I find the $H(z)$ of this filter?  Is there a way to find its zeros and poles and further know the characteristics of this filter?

I would appreciate if you could help me.


texts: Relationship Between Sampled Continuous and Discrete Time Signals

texts:
Consider the sketched system below. $x_c(t)$ is an arbitrary, continuous-time signal at the input and $s(t)$ is an impulse train, defined as $s(t)=\sum_{n=-\infty}^{\infty} \delta(t-nT)$, where T is the sampling period. Hence:

$$ x_s(t) = x_c(t)s(t)=\sum_{n=-\infty}^{\infty} x_c(nT)\delta(t-nT) $$

Now I calculate and compare the fourier transform of $x_s(t)$ and $x_c(nT)$.

$$
X_s(j\Omega)=\int_{-\infty}^{\infty} x_s(t)e^{-j\Omega t}dt=\int_{-\infty}^{\infty} \sum_{n=-\infty}^{\infty} x_c(nT)\delta(t-nT)e^{-j\Omega t}dt=\sum_{n=-\infty}^{\infty}x_c(nT)e^{-j\Omega nT}
$$

$$
X(e^{j\omega})=\sum_{n=-\infty}^{\infty} x[n]e^{-j\omega n}
$$

The results look quite similar. In fact, they are equal if $\omega=\Omega T$.

The calculation is no problem, but the issue I have is understanding what this really means. So obviously it is a scaling. If I define the angular frequency as $\Omega_s=\frac{2\pi}{T}$ and plug it into the above formula for $\omega$, I get $\omega_s=2\pi$. So it seems that through the process of discretization the actual frequency information is lost and the fourier transform goes from 0 to $2\pi$. In order to retrieve the information, I need to multiply $\omega$ with the sampling frequency. Is this statement correct? Why does this actually happen? What meaning is behind this? Probably I am missing an obvious thing, I feel like missing the forest for the trees.


texts: Sampling multiple sensors at different rates

texts:
I have a question regarding how best to sample data from multiple sensors when they are all updating at different/changing rates.  I am new to data acquisition so please bear with me.  For my Master's research, I am trying to build a dynamometer to measure the performance of a belt transmission used with the Baja SAE team at my university.  This is a VERY low budget project, so I am trying to collect data with arduino/raspberry pi if possible.  The test setup consists of a drive pulley attached to an engine and a driven pulley with a friction brake behind it.  I am trying to measure the RPMs for both shafts, and the torque on the driven shaft.  To measure RPM's, I have magnets mounted on the shaft and I am using hall effect sensors to measure the time between rotations.  To measure the torque I have strain gages with slip rings.

The problem is that all sensors update at different rates.  The drive pulley rotates at about 60Hz, and the driven can vary from 20-120Hz, with the values being measured once per rotation.  The A/D converter for the strain gages reads at a constant 125Hz (the input voltage has a low pass filter to remove engine and other higher frequency noise-I am only interested in time averages).  My goal is to be able to get a plot of the steady-state driven pulley torque vs speed.

I tried initially reading all of the sensors simultaneously with a raspberry pi, but all of the sensors are read with interrupts in the python code and the timing was off since it is not a real time device (the RPM data was VERY noisy).  If I read each RPM sensor and the A/D converter individually with an arduino, it has no problem keeping up and the data looks clean.  Now that I have all of the sensors reading, I am trying to put it all together.  Since the reaction time of the transmission to a changing load is fairly slow, I think I could capture enough information if I sampled at 20-25Hz.

My question is if it would work to have separate arduinos reading each of the sensors continually and updating global variables in their RAM, then calling these current running values from the raspberry pi at a fixed sampling rate (20-25Hz).  I didn't know if it would be a problem that I don't have timestamps for when the global variables last updated.  I will not be using any kind of frequency analysis on the data.  Also, to reduce noise from the strain gage A/D converter, could I have that global variable be a running average of the last, say 5, data points so that I am capturing information from each sample even though I am only calling values at 1/5 of its sample rate?


texts: Create an input so that poles show up as outputs?

texts:
Let's say we have a rational, causal, stable LTI system with transfer function
$$H(z) = \frac{A(z)}{B(z)}$$
If $H(z)$ has $N$ poles, we can in theory have only 1 of those poles, $p_i$, show up at the output. So $y[n]$ is $p_i^n$ after some $n>A$. To do this we need to come up with an input $x[n]$ that is causal and has finite length, and $A$, so that we get that output $y[n]$.

How would we construct such a finite $x[n]$ to get this behavior?

Edit:
We can assume also that we know the most general form of $h[n]$ since $H(z)$ is causal, LTI and stable.
$$h[n] = a_0\delta[n] + a_1\delta[n-1]+a_2\delta[n-2]...a_A\delta[n-A]\\+b_1p_1^nu[n]+b_2\cdot n \cdot p_1^nu[n] + b_3 \cdot n^2 \cdot p_1^nu[n] + ...\\+c_1p_2^nu[n]+c_2 \cdot n \cdot p_2^nu[n] + c_3 \cdot n^2 \cdot p_2^nu[n] + ...\\.\\.\\.$$
So would there be a clever construction of a finite $x[n]$ to cancel all other poles except $p_i$? The first part of $h[n]$ gives us the finite first part of $y[n]$ until integer $A$.


texts:
According to the Nyquist sampling theorem, a sampling frequency for a periodic signal $x(t)$ with a period $T$ and bandlimited by $f_m$ Hz is given by

$$ f_s > 2f_m. $$

Is it possible to relax this constraint for periodic signals?


texts:
$y(t)=\mathcal{T} \{ x(t) \} = \int_{-\infty}^{x(t)} x(\tau) d\tau$

Is the above system time invariant ?


texts: I want to estimate the SNR of a bipolar signal. I know that each bit increases the SNR at 6 dB. Do i have to subtract one bit for sign, so that for bipolar signals the SNR is (n-1) x 6 dB ?


texts: I am new in the field of signal processing. What's the different between Hamming and Hanning window? When we use the former and latter?


texts: Source Localization in the context of EEG

texts:
I am having difficulty understanding how source localization is used in Brain-Computer Interface (BCI) as a feature extraction method.
As a bit of introduction, the measured activity (Matrix M) is a linear combination of the activation of a specific dipole at certain co-ordinate (L) on the brain multiplied by the equation resulting in the electric field at the location of the sensors (in this case electrodes) plus some noise, like this:
M = GL + ε
Where G is the lead field matrix (G(i,j) = effect of jth source on ith sensor) and L is the tensor portraying the activation of each source (each column corresponding to a set of discrete recordings).
Is it correct to assume that this is how it is used for extracting feature vectors provided that we have a predefined lead field matrix for a certain model:

First, an inverse solver is used (LORETA, wMNE, ...) to calculate L for certain classes in the BCI system
from this calculated L, a set of spatial filters are defined, through which one can find out the region of interest (probably with the highest activation).
then in real time processing, source reconstruction is carried out, the set of spatial filters are applied to the sources and the measurements are re-produced from these sources

I am failing to see how this can be used for feature extraction to be fed into the classifier. is it the source activation matrix that is used as a feature vector? or is source reconstruction done for a completely deferent purpose?
Or is it the set of spatial filters that are calculated, which then will be applied to the calculated activation matrix (L) to then be classified?


texts: How to calculate PSD if i have power vs freq spectrum?

texts:
i have a signal something like this

how to calculate PSD?
i have freq from 191000200 to 196500000
time gap or delta t = 1 or 2 sec, (what i mean is [tn] - [tn-1])
i will be computing in python any suggestion from scipy or any lib will be helpful
thanks in advance


texts: Conceptual Question on Least Squares Estimation Method

texts: What is meant  by Least square plus Gaussian method of estimating the parameters of an unknown system? I am aware of least squares  in general but some works refer it as least square+gaussian method. What is the role of Gaussian here? Is it for some kind of assumption of the distribution of the residual errors? please clarify


texts: Resources for an introduction to computer vision

texts: Does anyone have any suggestions on good resources or sites for learning about computer vision?


texts: Why do signal have mirror signal after pure frequency shift?

texts:
In my Matlab code I have a simple simulation of FPGA with the ability to simulate doppler shift, and after I and Q components plugged into IQmod with some carrier freq.

In my Matlab code when I multiply primordial signal $s_{prim}(t)e^{(jwt)}$
and have mirror signal after? And what's strange when I carrying that signal onto carrier frequency this carried signal doesn't have mirror signal.

totally working Matlab code included, will be glad to any ideas.

t = 0:0.000001:0.1;
fs = 1/(t(2) - t(1));
%ss = exp(j*2*pi*100*t) + exp(j*2*pi*200*t) + exp(j*2*pi*300*t) + exp(j*2*pi*900*t) + exp(j*2*pi*600*t); %Generating I-Q signal *.bin file for AWG

N=8;
bit_stream = round(rand(1,N));
f = 1000;
P1= 0;
P2= pi;
PSK_signal = [];

for ii = 1:1:N
PSK_signal = [PSK_signal (bit_stream(ii)==0)*sin(2*pi*f*t + P1)+...
        (bit_stream(ii)==1)*sin(2*pi*f*t + P2)];
end

ss = PSK_signal;
figure(1); plot(ss);

sp = fft(ss);
N = length(ss);
fp = ((0:N-1)/(N-1))*fs;
fp = fp(1:N/2);
sp = abs(sp(1:N/2))/(N/2);
figure(2); hold on; plot(fp,sp); %Spectre of primordial signal

w = 3000*pi*2;
t = (1:length(ss))/fs;

%Real outputs from AWG
I = real(ss); % I Input on FPGA
Q = imag(ss); % Q Input on FPGA

%Adding frequency SHIFT in Simuation FPGA plate
ss_i_real = I.*cos(w*t) - Q.*sin(w*t); % I component from FPGA
ss_i_imag = I.*sin(w*t) + Q.*cos(w*t); % Q component from FPGA

sp = fft(ss_i_real+1j*ss_i_imag);
N = length(ss_i_real);
fp = ((0:N-1)/(N-1))*fs;
fp = fp(1:N/2);
sp = abs(sp(1:N/2))/(N/2);
figure(2);  plot(fp,sp);

w = 40000*pi*2;
t = (1:length(ss_i_real))/fs;

%ss_c = ss_i.*exp(1j*w*t); %Modulation that carrying signal from FPGA on Carrier Frequency (40KHz)
ss_c_real = ss_i_real.*cos(w*t) - ss_i_imag.*sin(w*t);
ss_c_imag = ss_i_real.*sin(w*t) + ss_i_imag.*cos(w*t);

ss_c = ss_c_real+ss_c_imag*1j; % Real part of Signal onto carrier <- this is the signal that will be transmitting from modulator

sp = fft(ss_c);
N = length(ss_c);
fp = ((0:N-1)/(N-1))*fs;
fp = fp(1:N/2);
sp = abs(sp(1:N/2))/(N/2);
figure(2); plot(fp,sp); %Spectre of signal onto carrier freq

% figure(4); plot(ss_c_real); %I - component of signal onto carrier freq
%
% figure(5); plot(ss_c_imag); %Q - component of signal onto carrier freq

edit1:
What causes my confusion, when I'm using the signal:

 %ss = exp(j*2*pi*100*t) + exp(j*2*pi*200*t) + exp(j*2*pi*300*t) + exp(j*2*pi*900*t) + exp(j*2*pi*600*t); %Generating I-Q signal *.bin file for AWG

I have this nice picture:

1 primordial signal, 1 shifted signal and 1 carried onto 40KHz shifted signal.
When I'm using the BPSK signal I'm shifting this signal I have mirrored signal and shifted (i mean two signals with $F_{shift} \pm F_{prim}$)

To be simple I just want to add shift on intermediate frequency and after carry that shifted signal onto carrying frequency without clone signal at $f_{car}-f_{shifted}$ as I have now.


texts: How does the assumption that symbols are equi-probable hold

texts:
If I draw a number uniformly between zero and one, what is the probability that they are equal? Mathematically, it should be zero but I don't recall why? Can somebody please help in explaining why the probability should be zero?

For example, there is still a chance,  that when generating six random numbers they will be all 1 or all 0? So if the probability is zero then why in digital communications do we assume that the symbols are $iid$ and that if the symbols are 0 and 1, 50% of them will be 1 and the rest will be 0 i.e., why do we assume equi-probable symbol probabilities when theoretically they cannot be equal?
In Matlab, I tried my best to generate a large sequence of 0/1 but never did I get equi-probable symbol probabilities.

Am I misunderstanding some thing here?


texts: use prony method for damped exponentials

texts:
let us consider represented of damping exponential model by prony method,there is source code

y=zeros(1,N);
for i=1:N
    y(i)=x(800*i);
end
d=zeros(1,N/2);
for i=1:N/2
    d(i)=y(i+N/2);
end
D=zeros(N/2,N/2);
for i=1:N/2
    for j=N/2:-1:1
        D(i,-j+N/2+1)=y(i+j-1);
    end
end
a=pinv(D)*d';

muhat=roots([1,-a']);
U=zeros(N,N/2);
for i=1:N
    for j=1:N/2
        U(i,j)=muhat(j,1)^(i-1);
    end
end
C=pinv(U)*y';

and equation of model is following with there solving  procedures :

with their  description :

and solving strategies :

Find Roots of charactreristic polynomial formed from the linear prediction coefficients

Solve the original set of linear equations to yield the estimates of the exponential amplitude and sinusoidal phase

i want following thing: we have given signal and i want input  be it's length and  L,or function should have following form

function [amplitudes,damping_factor,phase,frequency]=prony(y,n,L)

%n-length(y)
%L-number of complex exponential,

how can i continue?how to  change given code in my case?thanks in advance


texts: What exactly is captured in a Sample of the Nyquist-Theorem variety?

texts:
I'm new to DSP and was thinking of sampling in the traditional music creation way, in that you capture a sound and play it back, warp it, etc., but when I thought about the Nyquist theorem, I realized that can't be what's happening when sound is being captured.

If we treated a sound clip that is 1 second long as its own waveform, then it's 1Hz and according to Nyquist you'd have to capture it at least at 2Hz. That's only 2 snapshots for 1 second of sound.

What are those 2 snapshots capturing? Let's say it's 16 bits of depth. What can that combination of 1s and 0s capture exactly? I've caught that the bit depth determines how many dBs you have to work with (more range), but I'm a bit lost on the rest. Is it capturing a unique waveform tone? Is it specifically a Sine wave tone? Is it multiple tones? I'm having trouble picturing what's being sampled and how it's being accurately played back.


texts: Fourier-Analysis of Stationary Random Signals

texts:
Let's say we have discrete-time stationary random signals with Gaussian PDF of mean value 0 and variance 1, whose individual signal values are uncorrelated.

For such a signal, how can we determine ACF and the PSD?


texts:
This is a very common example in most Signal Processing books I have come across.

x(n) = cos($\frac{n}{6}$) is a non-periodic discrete signal because it doesn't satisfy the periodicity condition for discrete time signals i.e, it is not of the form 2$\pi$($\frac{m}{N}$).

My question is :

the coefficient of n, i.e, $\Omega_0$=$\frac{1}{6}$ here can also be expressed as $\frac{1}{6}$ = $\frac{1}{6}$ * $\frac{2\pi}{2\pi}$ = 2$\pi$$\frac{1}{12\pi}$

Now, substituting for $\pi$ = $\frac{22}{7}$ in above, we get 2$\pi$$\frac{7}{12*22}$. So, $\frac{1}{6}$ can be written as 2$\pi$($\frac{7}{264}$), which is in the form 2$\pi$($\frac{m}{N}$) with a period N=264.

I'm sure I'm missing something which may be obvious but it would be of great help if someone could point it out and explain.