texts: Is there a meaningful way to compare coherence in segments of different length?

texts:
I am wondering if I can compare the coherence in some meaningful way between two segments of data that have the same sampling frequency but different length.
I set up the following toy example to explain:
import numpy as np
import scipy

# one segment of length 1s, one of length 0.1 s, both sampled at 1000 Hz
t_high = np.linspace(0,1,1000)

t_low = np.linspace(0,0.1,100)

#Creating identical signals over the respective periods
x_1_high = np.sin(2*np.pi*10*t_high)+ np.sin(2*np.pi*12*t_high)+ np.sin(2*np.pi*30*t_high)+ np.sin(2*np.pi*40*t_high)

x_2_high = np.sin(2*np.pi*10*t_high)+ np.sin(2*np.pi*15*t_high)+ np.sin(2*np.pi*24*t_high)+ np.sin(2*np.pi*40*t_high)

x_1_low = np.sin(2*np.pi*10*t_low)+ np.sin(2*np.pi*12*t_low)+ np.sin(2*np.pi*30*t_low)+ np.sin(2*np.pi*40*t_low)

x_2_low = np.sin(2*np.pi*10*t_low)+ np.sin(2*np.pi*15*t_low)+ np.sin(2*np.pi*24*t_low)+ np.sin(2*np.pi*40*t_low)

Now I thought I could for example compare the mean of the coherence in a given frequency band between the two signals, but in the above example where one would expect similar results, this does yield something different:

bands = [[5,25],[30,50]]

f,cohr = scipy.signal.coherence(x_1_high,x_2_high,fs=1000,nperseg=50)

for band in bands:

    m = np.mean(cohr[(f>=band[0])&(f<=band[1])])
    print(m)

>>>
0.04738249799567127
0.34817543866979594

f,cohr = scipy.signal.coherence(x_1_low,x_2_low,fs=1000,nperseg=50)

for band in bands:

    m = np.mean(cohr[(f>=band[0])&(f<=band[1])])
    print(m)

>>>
0.2870929870554635
0.3526988580436088

Is there any way out of this? I.e. some quantity for comparing coherence in the above situation that would yield the same values?


texts: Changing the cutoff of an IIR lowpass filter with minimal transients?

texts:
I have a 1st order lowpass IIR filter of the form

$ H(z) = \frac{b_{0} +b_{1} z^{-1}}{1+a_{1} z^{-1}} $

implemented using the direct method my code looks something like this

state2=state1;
state1=signal x-state2*a1;
output=b0*state1+b1*state2;

that has a cutoff frequency X that has been calculated from the fundamental frequency of signal x. Now given that the fundamental frequency of signal x changes and it takes me time "t" to detect this new frequency, is there any way I can reduce the transient response that I see from resetting the states to zero and changing the a and b coefficiets (by logging the states, old filter output or other data over time "t" and using this to calculate the new states rather than resetting them to 0)   ? Or would someone be able to provide me with a signpost as to what topics i should be googling?


texts: I was wondering if there's a intuitive way to understand why sidelobes appear when performing an FFT on a signal of fixed length?


texts: Image Shadow Removal Using OpenCV and Python

texts: How do I remove a shadow after MOG2 background subtraction using OpenCV Python? I used all morphological operations, gaussian and median blur, thresholding. it removes noises but deep shadow is resulting in foreground object.


texts:
Can i track any frequency offset my increasing samples/symbol.
For example if my symbol rate is 1Msps. If my sample rate is 10 Msps.
Can my receiver correct upto 5 Msps carrier offset using FFT
I can follow it by costas carrier recovery to further correct it before timing?


texts: automatic methods to find the delay and to sync the original pleth signals

texts: I have computed the heart rate from two pleth signals (from two fingers -both are acquisition-ed from two different devices) heart rate pattern looks similar with some delay in it i could manually see the delay and add those offsets to the original pleth ...Is there any automated method to find the delay and to add those offsets  to the original  pleth signals in Matlab( both the pleth signals are  downsampled to same 10 Hz)


texts: Determining a system's causality using its impulse response

texts:
I have the following input-output relation for a system:
$$y(t) = Odd Part Of [x(t)]$$
My question is: Is the system causal?
What my approach has been:
I expressed $y(t)$ alternatively as:
$$y(t) = \frac{x(t) - x(-t)}{2}\tag{1}$$
Here, when I substitute $x(t)$ with the impulse function, I get the impulse response as $0$ because the impulse function is an even function. Its odd part is $0$. This leads me to believe that the system is causal as the impulse response is zero for negative time.
However, when I substitute $t$ with $-t$ in Eq. $(1)$, I find that for negative time, the output depends on the input at a future time. This would lead me to believe that the system is non-causal.
So my question is actually two-fold here:

How do I reconcile the two seemingly contradictory results?

Why is the impulse response of the system 0? What's the difference between this system and having no system at all?

Any help/pointers would be sincerely appreciated.


texts:
DSP is more kindred with electrical engineering than with computer science, how ever there are topics of DSP like MP3 encoding, JPEG compression and sound analysis can be understood by a computer engineer (with a previous strong math background in Z transform and Fourier series).

For a BS in computer science that only have very basic knowledge in electronic, is there a way to name that kind of specialization in DSP? I.e. someone who is looking to create DSP algorithms that can be run from a computer but not looking to implement them in a custom piece of hardware.

My question is mostly related for a computer science student who wants to apply for a master degree in an international university (no knowledge in analogic circuits, hardware description languages or microprocessors)

Would applied math, be a better approach??


texts: How can I plot Wiener filter's behaviour for different taps (memory filter)?

texts:
What's the expected behaviour of Wiener Filter for different taps (memory filter) , when input signal  is a sinusodial tone?

Do you have any idea how I can plot or simulate Wiener Filter's behaviour (estimation basically) for different value of parameter M ?
I hope my imlementation is correct. M is the filter's memory am I right ?

That's my code for Wiener Filter

clc;
close all;
clear all;

T = 1; % total recording time
fs = 500; % sampling frequency
N = fs * T; % samples
tt = (0:N-1) / fs; % time vector
fc = 10; % frequency

d = sin(2 * pi * fc * tt); % desired signal X
figure;
plot(d);

mu_w = 0;
sigma2_w = 5;

w = mu_w +sqrt(sigma2_w) * 0.5 * randn(1, N); % additive gaussian noise W * 0.5 to reduce effect
x = d + w; % signal corrupted with noise Y
l = d - x;

rr = [];
k = 1;
r = xcorr(x);
M = 25; % taps filter memory

for i = 1:1:M
    rr(i) = r(N-i+1);
end

R = toeplitz(rr);
I = inv(R);
p = xcorr(d, x);

for i = 1:1:M
    P(i) = p(N-i+1);
end

W = (inv(R)) * P';
k = 1;
y = zeros(N, 1);

for i = M:N
  j = x(i:-1:i-M+1);
  y(i) = (W)' * (j)';
  ylim([-5 5])
end

e = y' - d; % error signal


texts: How can I estimate the spatial resolution of consumer grade electronics?

texts:
I have been looking at stereo vision applications, and one working example involves using two USB web cams, mounted together and calibrated.

Is there a way to estimate the theoretical spatial resolution of such a set up?  The goal is to avoid purchasing and testing blindly but rather to be relatively confident ahead of time.

I do understand that the EXACT resolution will probably require a test setup due to lensing, etc.

What information would be needed to make this determination?  Would the minimum focal length and the maximum resolution be sufficient?  Pixel density obviously plays some role in this, and is advertised on most digital cameras (which have a much higher maximum resolution), if I was attempting to compute an estimate, how should I incorporate this?

As an example consider the following setup:

a 4" minimum focal length (MS HD Webcam focal length)
a maximum resolution of 1920x1080
object is on the order of a couple of centimeters
details on the order of tenths of millimeters
the distance between cameras and objects should be smallish, I was considering something like 15 cm to 25 cm, flexible based on the answer here
the distance between cameras, the number of cameras can be flexible but should stay in the smallish range ... if I need $10,000 in cameras, it's a bad solution


texts: How Is the Bandwidth of an Image Reduced by an Octave in Gaussian Pyramid Procedure?

texts:
Reference paper 1. For arguments sake, let's say that the maximum and minimum frequency in an image are 256Hz and 1024Hz. When I perform filtering using the gaussian function, the "bandlimit" reduces by an octave (1/2). Does this mean the new freq. range will be from 128Hz to 512Hz? Or does it mean that it will be 256Hz to 512Hz, but the bandpass signal (While calculating the Laplacian pyramid) will now have a freq. range 512Hz to 1024Hz (which is 1 octave)?

Also, apart from the low pass filtering, since downsampling is also performed, shouldnt the image bandwidth reduce by more than an octave? I'm guessing that the LPF operation is what causes the reduction in bandwidth


texts:
I have a function that performs gaussian blur on image for some specific $\sigma$ (the standard deviation).

It first computes kernel of size $\lceil 3\sigma \rceil$ and then performs convolution with that kernel.

However, I would like to specify blurring radius in pixels rather than $\sigma$.

I suppose that the blur radius (in pixels) is just $\sigma^{2}$ as this denotes variance of a random variable.

Is that right? Can the same thought be extended to 2D?

UPDATE:

The problem is that I need to do things like building a gaussian pyramid (successively blurred and downsampled image).

When the image gets downsampled to 1/2 of its width, I suppose I need a gaussian blur of radius 2 pixels ($\sigma=\sqrt{2}$ ?). And for 1/4 subsampling, I would need blur of 4 pixels ($\sigma=2 ?)$... But I am not sure about that...


texts: Output of lowpass filter with damped sine wave input

texts:
The random process $$Y(t)=\cos(\omega_0t)\cos(\omega_0t+\pi N(t))$$where $N(t)$ is a Poisson process of parameter $\lambda$ enters a lowpass filter with transfer function $$H(j\omega) =
\left\{
 \begin{array}{ll}
  1  & \mbox{if } |\omega| \leq \frac{\omega_0}{2} \\
  0  & \mbox{if } |\omega| \geq \frac{\omega_0}{2}
 \end{array}
\right.$$ If $Z(t)$ is the output of the filter, find the expectation and variance of both $Y(t)$ and $Z(t)$.

So, first we have that:

$$\mathbb{E}[Y(t)]=\cos(\omega_0t)\mathbb{E}[\cos(\omega_0t+\pi N(t))]=\cos(\omega_0t)\mathbb{E}[\cos(\omega_0t)\cos(\pi N(t))-\sin(\omega_0t)\sin(\pi N(t))]]=\cos^2(\omega_0t)\mathbb{E}[\cos(\pi N(t))]$$

Doing that expectation by definition (with the summation) we get that $$\mathbb{E}[Y(t)]=\cos^2(\omega_0t)e^{-2\lambda t}$$

With a similar procedure we find that

$$\mathbb{V}[Y(t)]=\cos^4(\omega_0t)\cdot(1-e^{-4\lambda t})$$

First I tried to find $\mathbb{E}[Z(t)]=h(t)*\mathbb{E}[Y(t)]$

So using the property that states that the transform of $x(t)y(t)$ is $\frac{1}{2\pi}X(j\omega)Y(j\omega)$ we get that

$$\mathcal{F}(\cos^2(\omega_0t))=\frac{\pi}{2}\delta(\omega+2\omega_0)+\frac{\pi}{2}\delta(\omega-2\omega_0)+\pi\delta(\omega)$$

But it is known that the transform of the exponential multiplied by the step function (the random process involved is valid only for $t>0$ by the definition of the Poisson process probability function) is $\frac{1}{2\lambda+j\omega}$ so

$$\mathcal{F}(y(t))=Y(j\omega)=\frac14\frac{1}{2\lambda+j(\omega+2\omega_0)}+\frac14\frac{1}{2\lambda+j(\omega-2\omega_0)}+\frac12\frac{1}{2\lambda+j\omega}$$

So what I need would be to antitransform $H(j\omega)Y(j\omega)$, and now I'm stuck. How could this be done? And regarding $\mathbb{V}[Z(t)]$, I have no idea of how to even begin to solve it.


texts:
To my understanding hardware receivers for software-defined radio applications basically take the input signal, mix it with the tuning frequency to remove the carrier frequency and then sample the resulting voltage with a sampling rate that is just high enough for the bandwidth of the payload signal. They emit those samples to the demodulation software in the form of I/Q value pairs. I'm assuming they obtain the Q value by taking another sample $1/4$ cycle (with respect to the tuning frequency) later, effectively doubling the sample rate.

Why do they use the I/Q representation?

I can see how I/Q is a nice representation (in hardware) when synthesizing signals because you can for example do frequency or phase modulation just by varying amplitudes, but this reason doesn't seem to apply to the case of SDR receivers.

So, is there anything gained by using I/Q for output instead of I at twice the sampling rate? Or is it just a matter of convention?


texts: Frequency response creates non-causal impulse response

texts:
I have frequency response data. It is output from an acoustic simulator.

I convert this into an impulse response, and get:

In that picture the blue line is the impulse response. Mostly it is hiding behind the green line (which is the impulse response if I halve the frequency resolution).

I'm sorry for an unclear picture. I will replace it in due course.

Anyway, the thing I notice of interest is that if the impulse response is regarded as a loop, the ends appear to match up.

Is there any mathematical basis for this?

It seems strange to me that the impulse response is somehow non-causal.  Because what it is modelling is a single pressure wave hitting a microphone.  Commonsense suggests to me that it should have a very sharp attack as the main wave hits followed by diminishing ripples corresponding to echoes.

So I'm quite surprised to see ripples before the main spike, let alone before t=0, as it were.

Is this some artefact of the FFT due to the fact that it is forced to sample at discrete intervals, therefore the spike cannot be completely accurate, and maybe the preceding wobbles are compensating for this.

In which case would I do better to reposition the start of the impulse response 100 samples in from the end, and have it wrap round?


texts:
I am given the following discrete system

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

where

$$x[n]=n+3$$.

Now from what I understand, since

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

therefor the system is causal as the output is depending on the past values of the input. Right?


texts: get poles and zeros of frequency response

texts:
I am working on a python based LTSPICE project.

I would like to get poles and zeros of AC simulation data. Is there a way to get them under use of the magnitude and phase out of the frequency response of my system?


texts: how to understand frequncy response and lowpass filter?

texts:
I am troubled with understanding freqency response. In lecture, my teacher talked about $H(f)$, which i know means that the response depend on frequency, $f$. But when I read text book, it uses a different notation $H(j\omega)$, which i know that $\omega$ is frequency, but what is the character of $j$ in that case? what does "$j\omega$" mean?
and why is that

?

why $V_L(j\omega)$ could be equal to $V_L e^{j \phi_H}$?

what is meant by $e^{j \phi_H}$?

and how does the first row become the second row?

I know that is a bunch of question, thank you for your effort if you could help me with this.

besides, can anyone explain to my how lowpass filter works? some one tells me that because of frequency response, the unexpected low frequency will cause open loop in RC circuit, so the when the frequency is low, the circuit is open therefore filters out the low frequency, is that right?


texts:
When finding control inputs for ODE systems, gradient based solutions are often used. With the increase computational power will these solutions still be important over things like Monte-Carlo searching and depth-first control searches?

Basically are you better off doing a gradient based optimization or attempting many depth first search runs, potentially biasing the runs towards parameters that perform well initially?


texts: How is the simplified version of the Bromwich inverse Laplace transform integral derived?

texts:
I do not understand how the last equality is derived from the previous.
Apparently the first term in the integral (involving $\mathrm{cos}$) is equivalent to the second (involving $\mathrm{sin}$)!! How so??

I DO understand how the integral range is halved (since $F(s)^*=F(s^*)$; where $F(s)$ is the Laplace transform of $f(t)$.
Any help would be appreciated since this form is used often in numerical inverse Laplace transform algorithms.

[Note: $\hat{f}(s)$ below represents the Laplace transform of $f(t)$]

This quote is from the web source Abate and Whitt, 1995.


texts:
I would like to detect and track the following target to land an UAV. Target size is $1\rm m \times 1\rm m$.

I have tried SIFT + FLANN but there is too few keypoints to have a good match.

Have you any idea on which algorithm I should use ?


texts: Why does OFDM use cyclic-prefix while QPSK uses root-raised cosine filters?

texts:
My understanding is that BPSK/QPSK/... are often implemented with root-raised cosine (RRC) filters to reduce ISI and bandwidth.

OFDM can be understood to be BPSK/QPSK/... implemented on multiple orthogonal carriers, with some additional complications like cyclic prefixes, pilot tones, and implementation using FFT/IFFT.

From what I've read, it seems OFDM doesn't usually use RRC filters.

Why is it that BPSK/QPSK/... use RCC while OFDM doesn't use RRC and instead uses a cyclic-prefix to combat ISI?  In other words, why isn't OFDM implemented the same way as BPSK/QPSK/... just with multiple orthogonal carriers?

Please let me know what I'm missing! :)  Thanks.


texts: Frequency domain to time domain conversion-(varying sample count)

texts:
I need to convert 150 Frequency domain samples to the time domain. The problem is, I have been provided with 250 time domain samples for comparing my results.  How am I supposed to relate the 150 samples to 250 samples? I can't find any relationship like interpolation/decimation between the two.

Does this have anything to do with windowing (hamming,hanning,etc), sampling frequency, min and max frequency in the original signal?

--

@Jim: I have 150 frequency domain samples and i need to get 250 time domain samples using them. If I do a normal iFFT, I would get only 150 TD samples. So I tried to append 100 zeros to the FD samples and then did the iFFT. But then, my samples are different from the original answers.

The input set I have is : 150 TD samples, sampling frequency=10GHZ, Min and Max frequency of the original signal = 500MHZ and 3050 MHZ, Window= Kaiser (beta=6)

I believe that I have been provided with either insufficient or incorrect data.
Am i right?


texts: how can I design Chebyshev filter with 5th-order polynomial and 0.001%-allowed ripples?

texts:
I'm very beginner in signal processing. I need to design a Chebyshev filter with 5th-order polynomial and 0.001%-allowed ripples by using matlab as I found in a paper. I'm filtering pressure data inside combustion engine. In matlab I've to define normalized passband edge frequency and peak-to-peak passband ripple.
I don't know what did the paper's author mean by 0.001% allowed ripples?

Any help would be appreciated


texts: Why oversample data before using raised cosine filter?

texts:
In the process of creating a baseband signal, the complex symbols are filtered using a raised cosine filter to perform pulse shaping (I'm following some literature as a guide). The pulse shaping is performed with the code:

%Create the filter
over=16;
pulse=rcosine(1,over,'normal',0.35);
[trash, pos]=max(pulse);

%Oversample the symbols
sig=kron(sym,[1 zeros(1,over-1)]);
sig=filter(pulse,1,sig);
sig=sig(pos:end);

So the sampling frequency of the filter is 16, which requires 15 zeros be added between all of the symbols. What is the purpose of this? How does this not introduce "extra data" into the original message?


texts:
Suppose you transmit at a single tone $\omega\textrm{ rad/sec}$ and you have two receiving microphones $i=1,2$ which sample at $r$ samples per second. Assume you have a direct path with coefficients $h_{d,i}$ and a delay of $\tau_{d,i}$ and one reflected component with coefficients $h_{r,i}$ and a delay of $\tau_{r,i}$ at each microphone.

How does the received signal look in analog and digital time domain and also how does the FFT look like?
Do we still perceive only one spike in a particular bin in FFT? Or should you sample appropriately to achieve this?
How does the FFT look if we have two tones?


texts:
I have a YUV 420NV12 image. I'm using ffmpeg to convert the YUV file to PNG and then back again to YUV.

ffmpeg -s 640x480 -pix_fmt nv12 -i testold.yuv test-640x480 test.png
ffmpeg -i test.png -s 640x480 -pix_fmt nv12 testnew.yuv

When I compare the two YUV files, there are few differences. I expected PNG to be a lossless compression. What is the reason for difference in two files?


texts:
Let`s say I have a signal

$m(t)=\cos(4\pi t) + \cos(6\pi t)$

so we can say the signal is containing frequencies $f_1= 2\mathrm{Hz}$ and $f_2= 3\mathrm{Hz}$. The cut-off frequency of the low pass filter is equal to $f_c= 3.5\mathrm{Hz}$, and the sampling frequency is $5\mathrm{Hz}$.

Is there an overlap (aliasing error) when receiving the original signal (After LPF)?


texts: Scipy.signal.dimpulse(system): how to translate a StateSpace to a "system"?

texts:
The command scipy.signal.dimpulse(system, x0=None, t=None, n=None) does not seem to accept a scipy StateSpace as an input to its system parameter.

Here is my code, and the error. The goal is to generate a series of k-th order Laguerre basis functions.

k=5
num_points=100
alpha = 0.01

# create sys1
nn = np.sqrt(1-alpha**2)
n1 = [0,nn]
p1 = [1,-alpha]
sys1 = control.tf2ss(n1, p1)

# create sys0
n0 = [-alpha, 1]
p0 = [1,-alpha]
sys0 = control.tf2ss(n0, p0) #type(sys0) is an "instance", not a "StateSpace"

# create k-th order series
for i in range(2, k):
    result_sys = control.matlab.series(sys0, sys1)

# generate discrete impulse response

result_lti = result_sys.returnScipySignalLti() #(maybe Lti format will work as input...no.)

y1 = scipy.signal.dimpulse(result_sys,x0=1,n=num_points+1)

The last command gives this error message:

Traceback (most recent call last):

  File "<ipython-input-8-a569a95625b6>", line 55, in <module>
    y1 = scipy.signal.dimpulse(result_sys,x0=1,n=num_points+1)

  File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/scipy/signal/dltisys.py", line 173, in dimpulse
    A, B, C, D, dt = _system_to_statespace(system)

  File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/scipy/signal/dltisys.py", line 20, in _system_to_statespace
    if len(system) == 3:

AttributeError: StateSpace instance has no attribute '__len__

Also, the control.tf2ss command returns an 'instance', not a 'StateSpace', which seems unusual.

How can I translate the outputs from control.tf2ss and control.matlab.series into acceptable input formats to the scipy.signal.dimpulse system?

Thank you!


texts: Solving for impulse response h[n] given input-output pairs

texts:
This is a homework problem that I've worked on and I want to confirm some of my reasoning.

I'm given two sets of input-output pairs of a particular system, $S$, that we know is linear time-invariant (LTI). Given those two pairs, find the impulse response h[n] of the system:

$$x_1[n] = [1, 0, 1] * S \longrightarrow y_1[n] = [0,1,0,2,0,1]$$

$$x_2[n] = [0, 1, 1] * S \longrightarrow y_2[n] = [0,0,1,1,1,1]$$

I found a linear combination of both inputs to yield the delta:

$$\delta[n] = x_1[n] - x_2[n-1] = [1, 0, 0]$$

Due to the system being LTI, the output to the delta is:

$$y[n] = h[n] =  y_1[n] - y_2[n-1] = [0,1,0,1,-1,0]$$

Since the input is 3 samples long and the output is 6 samples long, then my impulse response $h[n]$ has to be 4 samples long. So I discard the last two to finally yield:

$$h[n] = [0,1,0,1]$$

Convolving the input signals with the newly found $h[n]$ yields the given output signals. I am however uncomfortable with having to invoke the required length of $h[n]$ to yield its final form by deleting the last two samples.

Did I go wrong somewhere?


texts: Comparison Between Average Kernel (Box Kernel) and Gaussian Kernel

texts: In image processing, we have two kinds of major kernels that are average kernel and Gaussian kernel. For image segmentation, which is difference between average kernel and Gaussian kernel? I found some paper said that they are similar, and average kernel implement faster than Gaussian kernel, right?When we use average kernel


texts: Can two nonzero signals $x[n]$ and $y[n]$ give a zero convolution

texts: Suppose $x[n]$ and $y[n]$ are two nonzero signals(i.e., $x[n] \neq 0$ for at least one value of n and similarly for $y[n]$).Can the convolution between  $x[n]$ and $y[n]$ result in an identically zero signal? In other words, is it possible that $\displaystyle\sum_{k = -\infty}^{k = +\infty}x[k]y[n-k] = 0$ for all n.


texts:
I am pretty new to the field of 3D reconstruction and overwhelmed by the large amounts of different methods. I am trying to find the correct method for my use case:

Setting: I have a stationary camera. In front of this camera, an object is moving from left to right in a straight line. The camera only sees a part of the object as it is positioned near the object.

Goal: I don't need the complete 3D model of the object. I just would like to estimate the shape of the part the camera is seeing. Here: The curve of the middle of the ball.

Data: I have following information:

Frames per second the camera is taking pictures.
Rough distance from camera to object (this metric isn't constant and can slightly change).
Multiple keypoints on the object: I have a segmentation model using Deep Learning that segments parts of the object. From those segments I can obtain keypoints (e.g. top right corner of segmentation mask)

Possible Solutions: I thought of following approaches:

As I have the segmentations of different parts on the object I was thinking about using a voxel carving method (shape from silhouettes): but the angles are limited as the object moves in a straight line parallel to the camera.
The segmentation masks allow me to extract keypoints. As I also have the number of frames the camera takes pictures I was thinking that the problem may be solved using multiple view algorithms, but I don't know how to extract the camera position from the frame rates.


texts: Fourier Transformed a signal $f(t) = \cos(2\pi*4t)*5\cos(2\pi*0.4t)$ but did not get expected results. What went wrong?

texts:
I created a signal with two sinusoidal components by specifying

$$
f(t) = \cos(2\pi*4t)*5\cos(2\pi*0.4t)
$$

I expected with I used MatLab's fft function on this that signal that I would see a peak of amplitude $1$ at a position of 4Hz in the spectrum corresponding to the 'fast' signal which has frequency $4$, and a peak of amplitude $5$ at a position of 0.4Hz in the spectrum corresponding to the 'slow' signal which has frequency $0.4$.

In my code below, subplots 3 and 4 are the fft plots, 3 is the unshifted one, and 4 is the shifted one. As you can see from running the code, I do not get the results I expected!

It seems I have peaks at $4+0.4=4.4$ Hz and $4-0.4=3.6$ Hz, and although the scaling is off with the amplitude, both peaks are the same height.

I thought the Fourier Transform would pick up the oscillations at 4Hz and 0.4Hz individually, and display them with their correct (relative) amplitudes? What has gone wrong?

function FFT_4()
clc
clear all
close all

sigFreq = 4;
f = @(t) cos(2*pi*sigFreq*t)*5.*cos(2*pi*0.1*sigFreq*t);

%% Calculation for samFreq > 2*sigFreq: Higher resolution
samFreq = 12;
[t,S,omega,power,fshift,powershift] = CalcFFT(f, samFreq);
plotSignalandFFTSignal(4,t,S,omega,power,fshift,powershift)

end

function [t,S,omega,power,omegashift,powershift] = CalcFFT(f, samFreq)
t = 0:(1/samFreq):(10-1/samFreq); % time vector
S = f(t);
n = length(S);
X = fft(S);
Y = fftshift(X);
omega = (0:n-1)*(samFreq/n);     %frequency range
power = abs(X).^2/n;    %power
omegashift = (-n/2:n/2-1)*(samFreq/n); % zero-centered frequency range
powershift = abs(Y).^2/n;
end

function plotSignalandFFTSignal(figNum,t,S,f,power,fshift,powershift)
figure(figNum)
subplot(2,2,1); plot(t,S); % xlim([0,1])
subplot(2,2,2); plot(power)
subplot(2,2,3); plot(f,power)
subplot(2,2,4); plot(fshift,powershift)
end


texts:
I am asked to write a MATLAB program for the simulation of the end-to-end transmission of a JPG file through a fading channel by using OFDM technique for one of my courses' term project.

I wrote my code, that is working like a charm, through a AWGN channel. However, I have no clue about modelling fading channels with different parameters and send my JPG file through them.

Let's say all OFDM symbols are created and converted into serial data stream (as a vector) thus they are ready to be transmitted into the channel, for AWGN, I simply used a built-in function "ofdm_signal = awgn(ofdm_signal,10);". But how to add fading & shadowing effects on my ofdm signal?

Thanks in advance.


texts: Mixing signal with noise in frequency space (STFT)

texts:
I am working on a preprocessing function which is supposed to mix two audio signals clean and noise in the context of neural speech recognition.

For this I would like to augment the clean sample and mix it later with the noise sample.

Now, for efficiency reasons I would like to mix those to samples in frequency-space, as opposed to mixing them in time-space.

I wrote some Python code a while ago which mixes to signals randomly based on a given distribution and makes sure, that the noise sample does not get "too loud" relative to the clean signal:

# Calculate power of signals
s_pow = np.sum(np.abs(signal_waveform) ** 2.0) / len(signal_waveform)
n_pow = np.sum(np.abs(noise_waveform) ** 2.0) / len(noise_waveform)

# Draw SNR-value from given distribution
snr = eval('self.rnd.%s' % self.distribution)

# Calculate the scaling factor from SNR = 10 * log(P_s / P_n)
k = (s_pow / n_pow) * 10 ** (-snr / 10)
new_noise_waveform = np.sqrt(k) * noise_waveform

# Apply noise
final_signal_waveform = signal_waveform + new_noise_waveform

s = np.iinfo(signal_waveform.dtype).max / np.max(final_signal_waveform)
# Scale signal down as a whole if necessary to avoid clipping
if s < 1.0:
  final_signal_waveform = final_signal_waveform * s

However, I was wondering how this could be achieved in frequency space. Here, I would like to augment the clean sample first in frequency-space and then mix it with the stft of the noise sample:

clean_stft = spectrum.stft(clean)
noise_stft = spectrum.stft(noise)

augmented_stft = spectrum.augment(clean_stft)  # e.g. time_stretch()

# How can this be done?
mixed = spectrum.mix(augmented_stft, noise_stft)

mel = spectrum.mel_features(mixed)

The reason is efficiency here. I don't want to convert everything back into time-space only having to run stft calculations again moments later.

So: How can I mix two stft spectrograms s.t. I can also control the relative loudness?


texts: How does the intuitive notion of causality fit in with control systems?

texts:
Edit: By causality, in this question, I do not mean the traditional mathematical definition in the theory o signals and systems; I mean causality as in an intuitive 'what's moving/pushing what notion'...
I'm having trouble understanding how causality fits into our intuitive ideas of inputting our output back into the system as feedback. What does it mean physically that y, the output, is dependent on the previous y values?
I understand the control/feedback engineering intuition, but once I get into the math, what I see are neat differential equations that govern how every single component should vary under such constraints. But, I don't see how we get to talk about how a certain component's behavior is caused by others.
Take exponential growth, for example, the output's behavior is caused by the behaviors of its rate of change and of the input force. Is this causality statement really the case, or is it just nature doing its thing, or am I just mixing ideas and being way too pedantic?
Either way, I want to understand this concept to be able to fully grasp what it really means when, for example, a servomotor gives feedback information about its rotation, and how this relates to the mathematical/physical differential equation framework.


texts: Simple question about HS algorithm's formul(Optical flow)

texts: In the below pic, I can not understand what U vector is? It says flow field but I can not imagie what really is the flow field?


texts: Difference between sticky channel Poisson-repeat channel

texts:
I don't quite understand the difference between a sticky channel and Poisson-repeat channel. A sticky channel allows duplications of symbols sent
over the channel, then the block structure at the sender and receiver will be the same (Taken from "A Survey of Results for Deletion Channels and Related
Synchronization Channels" by Professor Michael Metzenmacher). But I don't understand what is meant by block structure. Is it just referring to the structure the packet, such as the overhead, the payload, etc? A Poisson-repeat channel is defined as: the sender sends a sequence of n bits, and the channel independently replaces each bit with a number of copies (or repeats) that has a discrete Poisson distribution with mean 1. Taken from this blog. But it seems as if the two channels are the same. What exactly is the distinction?


texts: Why dont sin and phase shifted cosine overlap?

texts:
I plotted a sine wave(blue) and a 90 degrees phase shifted cosine wave (red) expecting them to overlap each other.

x = 0:0.001:1;

%ploting sine
y = sin(2*pi*x);
plot(x, y);

hold('on');

%ploting cosine
z = cos(2*pi*x-90);
plot(x, z);

The two graphs do not overlap.
Whats wrong with my assumption ?


texts: What Is an Oriented Gaussian Second Derivative Filter

texts:
In the paper: Detecting and Localizing Edges Composed of Steps, Peaks and Roofs, the authors refer to an image filter as an oriented second-derivative Gaussian filter. I'm trying to figure out what this means.
From my understanding a Gaussian filter for a given standard deviation $\sigma$ of size $n \times n$ for some odd positive integer $n$ is given by the formula $g(x,y)  = \frac {1}{2 \pi \sigma^2} e^{\frac{-(x^2+y^2)}{2 \sigma ^2}}$ applied to image co-ordinates of a rectangular region of a 2-D image (ignoring padding for now).
Then there are Guassian first-derivative filters consisting of $g_x(x,y)$ and $g_y(x,y)$, the partial derivatives, which for a given angle $\theta$ can be combined into an overall oriented filter, say:
$t(x,y, \theta) = cos (\theta) g_x(x,y) + sin (\theta) g_y(x,y)$
as per the answer to my question here.
Now it seems to me there are some choices for what could be considered by the term oriented second-derivative Gaussian filter (which after some Google searching I could not find a definition of):
a) An orietned Laplacian of Gaussian (since it involves second derivatives), a.k.a $L(x,y, \theta) = cos (\theta) g_{xx} (x,y) + sin (\theta) g_{yy}(x,y)$ (where $g_{xx},g_{yy}$ are the partial derivatives twice with respect to $x,y$ respectively). This seems the most likely choice.
b) Some kind of mixed partials derivative filter like $t(x,y, \theta) = cos (\theta) g_{xy} + sin(\theta) g_{yx}$, although the mixed partials should be equal by Clairaut's theorem.
Any insights appreciated.


texts: Python library for audio filtering, gating, and sound/silence detection

texts:
Is there a Python library that can do all of the following?:

Band-pass filter;
Noise gate, with different parameters set for different segments of audio file;
Detect and count the number of discrete sounds surrounded by as few as 5 ms of silence.

I can do most of this in Audacity, but I need a more automated pipeline.


texts: Why are 2nd order edge detectors such as Laplacian more susceptible to noise?

texts: I've been told that they are influenced by noise considerably more than that of a first order edge detector such as a Gaussian. But why?


texts: Who first understood the importance of poles?

texts:
Who first understood (or at least published papers on) the importance of poles in understanding transfer functions in the frequency domain?

If I had to guess, I'd suggest Nyquist or Bode but I know very little about the history of this particular subject.


texts: Large sample rate or large number of cycles when estimating frequency?

texts:
I wish to determine the frequency, amplitude and phase of a sine wave with some noise and I can only have a fixed number of samples. Should I go for many cycles and a small sample rate or a few cycles and a large sample rate?

I know that if I choose to use a DFT to determine the frequency then the spectral resolution will be the sample rate divided by the number of points. I must avoid aliasing so this suggests I should choose a small sample rate giving for example 3 or 4 points per cycle and capture many cycles of data. It may be a separate issue but the actual frequency will probably not correspond to a line in the spectrum so there will still be the, I think, unresolved issue of finding the frequency amplitude and phase from the small cluster of points around the maximum in the spectrum.

I could also choose an alternative method where I curve fit a sine wave to the data. This should give me best estimates in the least squares sense. However, for this method it is not clear which is best many cycles with a small sample rate or fewer with a large sample rate.

Is this a known problem with a known solution? Thanks for any input.


texts: Obtaining power spectral density without having knowledge about frequency bandwidth or sampling frequency of the signal in Matlab?

texts: Is there a way to plot PSD of a signal which show true frequency amounts ( not normalized one) without having knowledge about frequency bandwidth or sampling frequency of the signal in matlab ?


texts: How does minimum-latency partitioned convolution reverb work when you receive input samples in chunks, rather than one at a time?

texts:
I'm writing a reverb system where I receive an input block of samples 480 elements long, do some operation on them, and pass the block on to the next effect.

I've been reading up on partitioned convolution reverb, and it seems to operate on the principle that you just accumulate samples until you have enough to convolve a short block of the impulse while the rest of the input comes in, getting bigger and bigger every chunk. How does this work if I can only start working on the input once it's all accumulated? How do convolution reverb plugins in DAWs work with this limitation (buffer sizes are usually lower, but never single-sample)?

For example, my impulse is 16384 samples long. I partition it into 480 + 32, then 480 + 64, 480 + 128, 480 + 256 (rounded up to 1024), etc. All the partitions add up to a length longer than it would have been if I'd just done 16384 + 480 samples (rounded up to 32768).

In my specific case, the source audio is a sample being played back at variable speed so I guess I could apply the reverb as each sample is being added to the buffer or even bake the reverb if I don't mind the room characteristics shifting with the pitch, but I'd like to understand how others do it first.


texts: Math for projecting 3d world point to VR image coordinates

texts:
Suppose, I've a 3d world point $P$ and I want to project it onto the image plane of camera, I can do it as follows
$$M = \begin{bmatrix}
R & t \\
0 & 1 \\
\end{bmatrix}$$
$$p = K \cdot M \cdot P$$
where $K$ is the camera intrinsic matrix and $p$ gives my image point in homogeneous coordinates.
Now, I want to do the same thing for VR images (360° or 180° degree). Can you provide me any links for the math involved here?
I've attached two sample images here where the camera moves forward. As you can see the change in the frames is not the same when camera moved forward in normal videos. I believe it uses some other coordinate system (may be spherical) and also the images are such that when viewed closely on a headset, it gives 3d feeling.


texts: In a periodic square wave, how to change in a particular condition?

texts:
The periodic square wave,
$$x(t) = 1, |t| < T_1 \\
x(t) = 0, T_1 < |t| < T/2$$

What I wonder is ..

(1) If $T_1$ is constant and $T \to \infty$, is x(t) a constant function?

(2) If $T_1$ is constant and $T \to 0$, is this non-sense?

(3) If $T$ is constant and $T_1 \to 2/T$, is x(t) a constant function?

(4) If $T$ is constant and $T_1 \to 0$, is x(t) a impulse function?

Actually, I am a undergraduate and it is my first class about signal. I don't know impulse function correctly. Could you explain impulse function in terms of (4) ?

The above questions are my intutitions. I don't know answers.


texts: What motion estimation techniques that could estimate the motion of every pixel?

texts:
I'm trying to estimate a motion from a video, however based on my finding, those methods usually meant for large motion and sparse in nature.

Optical flow: Sparse and fail to detect sub-pixel motion

Phase-based: Only applicable to global shutter camera for accurate displacement

Welcome any suggestion/discussion you guys have in mind that would allow me to determine sub-pixel motion for every pixel that applicable to rolling shutter camera! Thanks in advance!


texts:
I'm trying to use the STFT as an input to a neural network. After flattening, there are over 4,000 features for a few seconds of audio. Is there a recommended way of summarising these to be a more manageable/useful feature set? All I can think of is using the stats like mean, variance and perhaps the higher order stats, but I can't help but feel there must be some better approach. Even with these stats, would it be better to take them per SFTF in isolation, or calculate them across all segments?
(As an aside, since this is related and someone coming across this question might also be interested, I am also looking into normalisation: https://danielsdiscoveries.wordpress.com/2017/09/29/spectrogram-input-normalisation-for-neural-networks/)


texts:
For the difference equation below:

$y(k)=1/2{x(k)+x(k-1)}$

How i can find he z-domain transfer function?

Thanks.


texts: Anyone know good tool for manual pixel color labeling like SegNet do?


texts: Amplify a signal and phase shift it by multiplying by a complex number

texts:
Still need help 25th October 2019

I have a real time domain signal contained in an array, it's just two different frequencies summed together. If I want to amplify this signal by 10 and phase modulate it by 0.5 degrees, will this work?

Change the real signal to a complex signal. $ (e^{\omega_1t} + e^{\omega_2t})$
Multiply it by the phasor $Ae^{i \theta}$
So the calculation is $Ae^{i \theta} (e^{\omega_1t} + e^{\omega_2t})$
Where $A=10$ is an amplitude change and $\theta=0.5 \pi/180$ is the phase change caused by the equipment
Take the real signal of this calculation to get the result

The numbers I have used, 10 and 0.5, are just an example.

Please can someone share knowledge please?


texts: Comparing mechanical signals with different length

texts:
I couldn't find any solution for this that would work for me
I'm working in python.
I have two similar signals that I can plot Force x Angle. (problem simplified)
One plot (angle x force) has length 10000 and the other 40000 (hypothesis/problem simplified).
I would like to check for similarity in these two signals in relation to the angle.
My first approach was to try to correlate or convolve with scipy and numpy packages
The problem is that convolve force1 with force2 can be non-sense if they have different lenghts.
What do you think it would be a good strategy to compare both these signals?


texts:
After reading the comments$^1$ and looking through various texts, I am going to use Understanding Digital Signal Processing for my self-study (Oppenheim & Wilsky was my 2nd choice). I'm 99% sure that a solutions manual doesn't exist. But does anyone know where I can find the errata for the 3rd edition?

I saw an old thread where the author, Dr. Richard Lyons offered to send it to someone so I can email him personally, assuming I can find his address. Before going that route, I figured that someone here may have it. Thanks.

$^1$${\tiny\textrm{ Thanks to all for past threads where this was discussed and great advice given.}}$


texts: matlab How to design lpf\bpf\hpf without builtin functions

texts:
related to Filtering voice signal from randomly added frequencies

I'm trying to create a simple low pass filter but i'm not sure what is wrong.

my code:

[y,Fs]=wavread('sound.wav');
m = length(y); %30586
Fc = 500;               %% frequency cut
n = [0:m-1];            %% kernel length / samples
Fs = Fs;    %22000      %% sample frequency / (nyquist - %2*m)
Tc = 2*pi*(Fc/Fs);      %% theta c
Hm = sin(Tc*n) ./ (pi*n);
Hm(1) = Tc/pi;
figure,plot(Hm);

1.

LPF: How to get to the 0-500 range?

We used this code in the class but with Fc=45,m=100,Fs=200 and it looks ok.
but when I try this on this wav file it's not working as expected. I thought it will pass from 0-500 but instead it returns some crowled plot.

only when I set Fc to be a low number I can see the sin wave. so i've try to manipulate by setting Fc=real(ceil(m/500)). it better than nothing but it's not it.

2.

hpf = 1-lpf, right? well is seems not to be. my guess is that my lpf is wrong

3.

I will deal the ripple after i'll manage to do this


texts:
Out of curiosity, is it possible to actually reverse a filtering on MATLAB. For example, if I have

[b,a] = butter(6,0.6);
dataIn = randn(1000,1);
dataOut = filter(b,a,dataIn);

Is there some way to go from dataOut and obtain dataIn in this example? I was able to more or less get there with the very simple

dataOutprime = filter(a,b,dataOut);

dataOutprime still doesn't exactly overlay on top of dataIn though.


texts:
While going through FFT I came to know that, shifting of phase in frequency domain results on shifting of time in time domain.

According to this, in wireless communications, from the transmitter side having 2 antennas,signal s1 transmitted from Ant 1 and phase shifted version of sig2 in frequency domain transmitted from Ant2, sig2 will become a delayed version of sig1. And when both the antennas transmitting sig1 and sig2 at the same time how sig2 will become a delayed version or a multipath component to sig 1.


texts: Signal recovery from multiple noisy sensors

texts:
I'm working on detecting signals buried under the sensor noise using a multiple sensor system and using some technique (correlation?) to take what is common to all the sensors and cancel out the random, uncorrelated part of the sensors.
The signal I want to recover is some 30 times smaller than the rms noise. The smaller I could recover the better, though.
can anyone point to any technique for this case?


texts: How to implement Hilbert-Huang transform in finding image splicing?

texts:
I have some programming experiences but am really new to these kind of algorithms. I can find a few source code about implementing HHT, and most of them are written with matlab. What I am trying to do:

Apply HHT algorithm in detection of image splicing. I want to find object edges in images.
Implement this with C/C++ or other efficient languages so it can be used for real project.

But now I don't have any ideas, I don't even know how to design the function prototype for HHT, what its input/output are.

Any help are welcome, thank you


texts: Multipath resistance of spread spectrum systems

texts:
I have been reading about various telecommunications technologies and one thing keeps being repeated many times without a clear explanation - that spread spectrum is not only resistant to multipath interference, but that it can even use it to improve recovery of the data being transmitted. This is frequently mentioned in articles about LTE or DVB-T.

How does this work? I can imagine that something like autocorrelation could be used, but I'm also pretty sure that this is not the way it's done.


texts: Is there a library written in C/C++ that offers functions like QPSK modulation?


texts: Why does a pole close to the unit circle result in an enhanced Q-factor?

texts:
I have the following pole zero plot (in Z-domain) of a digital filter, where its poles lie far away from the unit  circle, with its corresponding frequency response:

On the other hand I have this one:

Could someone explain me why exactly the poles give such a change in Q-factor?
I expected that the closer a pole to the unit circle the less high the Q-factor would be.

EDIT:
a pole closer to the unit circle will on one hand mean an "stronger" presence of a certain frequency it won't be decaying exponentially. But on the other hand a pole on the circle would mean a marginally stable system. In other words this means having a frequence which is perfectly present results in a +/- unstable system. Isn't that contradictory?

Thank you


texts: Least Angle Regression (LARS) without Matrix Inversion

texts:
Sorry if this is too damned long. I did what I could to abbreviate it.

The question is about Least Angle Regression (LARS).

I'm new to numerical work with matrices.

I believe I have a way to compute Least Angle without explicit matrix inversion. I'm hoping someone with more experience can check my work to see if I'm doing anything dangerous, illegal, or otherwise ignorant.

This paper: Least Angle Regression, says:

  "...we compute $m−k$ inner products $c_{jk}$ of the non-active $x_j$
  with the current residuals to identify the next active variable, and
  then invert the $k \times  k$ matrix $\mathcal{G}_k = X'_kX_k$ to
  find the next LARS direction."

(Emphasis mine.)

They update the Cholesky decomposition in each iteration, so it seems they're doing something like this:

At $k$th iteration:
$X_k$ is a matrix formed from $k$ predictors.
$X'_k X_k = \mathcal{G}_{k}$
We already have $\mathcal{G}_{k-1}$, and $\mathcal{G}_{k} = \mathcal{G}_{k-1}$ except for a new row and column of dot products, so let's say $$\mathcal{G}_{k} = \left[ \begin{array}{cc}
\mathcal{G}_{k-1} & \mathbf{p} \\
\mathbf{p}' & x \end{array} \right]$$
We can find the Cholesky decomposition $L_k$ from $L_{k-1}$:
$$L_{k} = \left[ \begin{array}{cc}
L_{k-1} & \mathbf{r}=L_{k-1}^{-1}\mathbf{p} \\
\mathbf{r}' & y=(x - \mathbf{r}\cdot\mathbf{r})^{-\frac12} \end{array} \right]$$
Find $L_k^{-1}$. Note this explicit inversion.
$\mathcal{G}^{-1}_k = {L'}_k^{-1} L_k^{-1}$
$A_k = (1'_k \mathcal{G}^{-1}_k 1_k)^{-\frac12}$, where $1_k$ is a vector of $k$ 1s.
${\mathbf w}_k = A_k {\mathcal G}_k^{-1} 1_k$
Use ${\mathbf w}_k$ to select the $(k+1)$th predictor.

Now here's my approach:

At $k$th iteration:
Find $L_k$, $\mathbf{r}$, and $y$ as above
Define $L_k {\mathbf q}_k = 1_k$
Find $\mathbf{q}_k$:
$${\mathbf q}_{k} = \left[ \begin{array}{c}
{\mathbf q}_{k-1} \\
\text{$\scriptsize{(1 - {\mathbf q}_{k-1} \cdot \mathbf{r})/y}$} \end{array} \right]$$
$\begin{align}A_k &= (1'_k \mathcal{G}^{-1}_k 1_k)^{-\frac12} \\
                     &= (1'_k L'{_k}^{-1} L_k^{-1} 1_k)^{-\frac12} \\
                     &= \left[(L_k^{-1} 1_k)' (L_k^{-1} 1_k)\right]^{-\frac12} \\
                     &= ({\mathbf q}'_k {\mathbf q}_k)^{-\frac12} \end{align}$
$\begin{align}{\mathbf w}_k &= A_k {\mathcal G}_k^{-1} 1_k \\
                               &= A_k L'{_k}^{-1} {\mathbf q}_k \end{align}$
So solve for ${\mathbf w}_k$: $\frac{1}{A_k} L'_k {\mathbf w}_k = {\mathbf q}_k$

Comments? Does it even matter if I'm right?


texts: Can FFT Substitute Correlation for This Case?

texts:
I'm trying to determine frequency of a repeating pattern in a time series. The sampling rate 100Hz and the pattern repeats itself with periods between 0.5 second and 1.25 second. This corresponds to a frequency range between 0.8Hz and 2Hz. At each second, I want to find the period of the pattern with 10msec precision, i.e. I want to differentiate 0.7sec(1.4Hz) and 0.6sec(1.6Hz).

I can attain this goal using correlation: For possible windows lengths (periods) I calculate correlation between two successive windows with same length. The window length with highest correlation gives the period of pattern.

Can I obtain the same results by using FFT?

As far as I see if I use 128-point FFT with this 100Hz series, then it will give me 100/128=0.8Hz (1.25sec), 1.6 Hz (0.62sec), 2.4Hz (0.42 sec),... components which obviously won't meet my requirement of 10msec period precision.

I know I can increase precision by using 256-point FFT but this corresponds to 2.5-second window for 100Hz and I want to determine pattern frequency for each window of ~1second.


texts: How is frequency defined for a periodic signal?

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

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


texts: Find minimum sampling rate of non-ideal notch filter

texts:
Old test problem:

"You have been asked to design a real-time digital filtering system that eliminates a band of frequencies between 20 and 30 MHz but preserves everything else.  The system uses an analog-to-digital converter (ADC) to digitize the analog input, a digital signal processing chip (DSP) to filter the digitized signal, and a digital-to-analog (DAC) converter to convert the signal back to analog.  Assume that ideal sampling is used as well as ideal anti-aliasing and reconstruction filters.  The maximum frequency that needs to be preserved in the reconstructed analog signal is 90 MHz.

What is the lowest sampling rate allowable in this system given the above constraints and giving that the anti-aliasing and reconstruction filters are not quite ideal:  they have 6 MHz transition bands?"

If it was non-ideal it would be the Nyquist equation:

fs > 2*fmax

where fmax = 90 MHz, so,

fs > 2*90MHz

fs > 180 MHz

In the non-ideal situation, my thought would be to add the 6 MHz transition bands to fmax.  Since it is a notch filter there are two transition bands.  Meaning it would be

90 MHz + 6 MHz + 6 MHz = 102 MHz

I was told that the correct set-up to solve this problem is as follows:

fs > 2*(90MHz + (6MHz/2))

fs > 2*(93)

fs > 186

He mentioned something about not caring whether the transition bands overlap.

My question is why is the 6 MHz transition band divided by 2?  Is it because there are two transition bands?  And if it were a highpass or lowpass filter, where there is only one transition band, would it not be necessary to divide by two?


texts:
I need to detect pitch (measure signal frequency) while the musicians play music, giving a warning if they are out of tune, but music happens to be a bit too fast for FFT (Fast Fourier Transform).

Below I try to give a technical description of the problem.

Musicians play music at 90-140 bpm. This means that there are 90-140 groups of notes each minute, up to 8 (more frequently, up to 4) notes in each group (60/140/8 = 0.0536 sec, 60/90/4 = 0.167 sec), that is, notes may change at the rate of 6-19 notes per second.

The music uses a logarithmic scale (see the attached image): the range between, say, 440Hz and 880Hz is divided into 12 notes, only 7 of which are used for melody. (Basically, they use only the white keys on the piano; when they want to shift the starting frequency, they use some of the black keys and don't use some white keys.)
That is, the frequency of each next note is multiplied by 2^(1/12) = 1.05946.

To make things more complicated, the A (La) frequency may vary from 438 to 446 Hz.  The string instruments in theory can be tuned, while the wind instruments depend on the air temperature and humidity, so the frequency happens to be re-negotiated by the musicians during the sound check.

Sometimes musicians and vocalists make errors in frequency, they call it "out of tune". They want a device that would inform them of such "out of tune errors". They have tuners, but the tuners require playing the same sound for about 1 sec before they start showing anything. This works for tuning, but does not work while the music is played.

Most likely, the tuner is doing FFT, and due to the formula $df = 1/T$ waits for 1 second to get the 1Hz resolution.

For A=440Hz, the difference in frequency between two notes is 440*0.05946 = 26.16 Hz, to get that frequency resolution, one has to use acquisition time of 0.038 sec, that is, at tempo=196bpm FFT is able to just distinguish two notes, at 98 bpm it is able to tell a 50% out-of-tune error provided that it starts acquisition at the very moment that the pitch changes. If we allow the pitch change in the course of an acquisition period, we get 49 bpm, which is just too slow. In addition, it is very desirable to be more precise about the frequency, say, detect a 25% or 12% out-of-tune error.

Is there a way to measure frequency (detect pitch) better than FFT, that is, with better resolution in less acquisition time? (At least 2 times better, ideally, 8-16 times better.)
In exchange, I do not need to distinguish between notes of different octaves, e.g. both 440 and 880 may be recognized as A. I do not need the linearity of FFT output, a logarithmic scale would be better. (Probably, more trade-offs are possible, just nothing else comes to my mind right now.)

Here's a really good drawing:


texts: Is there a reason why with symmetric padding, the inverse wavelet transform is not the adjoint of the wavelet transform?

texts:
I recently stumbled upon a bothering fact when using the pywavelet library in Python. When we use the default "symmetric" padding, the inverse wavelet transform is not the adjoint of the wavelet transform (and it's not the mathematical inverse of the wavelet transform, "only in one direction").

However, if you use the "zero" padding the adjoint property is verified (not the inverse property). And if you use the "periodization" padding then all the properties are verified.

I wanted to know if there was a theoretical reason behind why the padding has such a big influence on these properties or if it was down to implementation.

You can find a code below highlighting the said issue:

import numpy as np
import pywt

wavelet_type = "db4"
level = 4
mode = "symmetric"

coeffs_tpl = pywt.wavedecn(data=np.zeros((512, 512)), wavelet=wavelet_type, mode=mode, level=level)
coeffs_1d, coeff_slices, coeff_shapes = pywt.ravel_coeffs(coeffs_tpl)
coeffs_tpl_rec = pywt.unravel_coeffs(coeffs_1d, coeff_slices, coeff_shapes)
_ = pywt.waverecn(coeffs_tpl_rec, wavelet=wavelet_type, mode=mode)

def py_W(im):
    alpha = pywt.wavedecn(data=im, wavelet=wavelet_type, mode=mode, level=level)
    alpha, _, _ = pywt.ravel_coeffs(alpha)
    return alpha

def py_Ws(alpha):
    coeffs = pywt.unravel_coeffs(alpha, coeff_slices, coeff_shapes)
    im = pywt.waverecn(coeffs, wavelet=wavelet_type, mode=mode)
    return im

x_example = np.random.rand(*coeffs_1d.shape)
y_example = np.random.rand(512, 512)
print("Adjoint:")
x_Tadj_y = np.dot(x_example, np.conjugate(py_W(y_example)))
T_x_y = np.dot(py_Ws(x_example).flatten(), np.conjugate(y_example.flatten()))
print(np.allclose(x_Tadj_y, T_x_y))
print("\n Inverse from image to image:")
print(np.allclose(py_Ws(py_W(y_example)), y_example))
print("\n Inverse from coefficients to coefficients:")
print(np.allclose(py_W(py_Ws(x_example)), x_example))

EDIT:
When reading the documentation about the different paddings, I could see that the problematic paddings compute a redundant representation of the original image (for example you have more coefficients than pixels in your original image). Therefore, it's normal that the inverse property is not verified from coefficients to coefficients (if taken at random without structure). However, this doesn't explain why the adjoint property is not verified.

Also I don't know whether this redundance is theoretical to ensure perfect reconstruction or is an implementation choice.


texts: Determining Power Spectral Density from Autocorrelation Function and Time-Series Data

texts: So I think I've confused myself a bit here. I know that taking the FFT of time-series data (wind velocities, for example) yields a power spectral density. However, I just read that taking the Fourier Transform of an autocorrelation function also yields the power spectral density. So, if one were to take the inverse Fourier Transform of power spectral density, would you get the original time series data (with the mean subtracted out) or would you get the autocorrelation function?


texts: How do I convert a real baseband signal to a complex baseband signal?

texts:
I have radio telescope observations that have resulted in two real-valued signals (corresponding to the right- and left-handed circular polarizations).

The signals are sampled at rate $2B$, and provide a bandwidth of $B$.

I wish to get the full Stokes parameters from these signals, which requires me to convert these real signals into complex signals sampled at $B$ (half that of the real signals).

However, I don't know the procedure to do this. I just know that it is possible.

In general, how do I take a real-valued baseband signal and convert it to a complex-valued signal?


texts: Fourier transform of a tilted line function

texts:
Assume a line function (line segment to ensure integration):

$$y = a\cdot x + b$$

What is the Fourier transform of the line segment? Intuitively, it may give a sinc function, but actually not.


texts: Is it possible to apply a frequency filter a time domain signal?

texts:
Is it possible to frequency filter a time domain signal, without converting the signal to a frequency domain..

My question comes in regards how MFCC according to wiki and other pages describe the extracting step.

Is this necessary though?


texts: Do integration/differentiation processes work as simple filters?

texts: How these processes are different from simple IIR 1 order filtering, FIR filters in terms of amplitude and phase characteristics?


texts: Confusion in Peak to Average Power Ratio (PAPR)

texts:
(1) What does it mean by 'a system with low peak to average power ratio requirement'? Doesn't every system idealises it to be lower? Or there are some exceptions to it?

(2) Higher PAPR can be a problem in signal carrier modulations too, I read the formula for single tone PAR, but I'm unable to visualise it.


texts: How to design a digital filter in python that will run over an uC?

texts:
I am trying to implement a digital filter over a uC (it doesn't really matter which filter and which micro controller because I'm looking forward to learn how to do it in the future with different filters and different microcontrollers).
I've been told that you can design, implement and debug a digital filter in python and when everything is ready you can port the code to C without changing anything. How can I do that? I've been searching for a while and I can not find how to do this.

Also, is there a way to plot the transfer function of an implemented fiter?. I mean the actual filter, a function made by me, that takes the input values and performs the calculations. I don't want to plot the transfer function of a filter made with functions like scipy.signal.butter. I want to plot the transfer function of a filter made with a for, some multiplications and sums.

I would really appreciate any help or information that you can provide me.


texts: Limitation on the shift theorem of DFT due to frequency resolution?

texts:
The shift theorem states that shifting a sine wave in time domain by t is equivalent to multiplying the corresponding DFT coefficient of the signal by a complex exponential e^(-jwt). Described by the following operation:

However, I realized that in order to apply the time shift precisely, the frequency of interest has to be multiples of the frequency bin size.

Here is a quick example I did in MATLAB - I simulated two signals (blue & red), red being the delayed version of the blue (with arbitrary Fs and signal length). My goal is to time shift the red signal by the delayed amount of time so that it overlaps with the blue (forget about the discontinuity caused by the circular shift property for now!!) :

In this image, the frequency of my signal (104.65Hz) is the exact multiples of my frequency bin size, therefore the shifted signal matches the original perfectly.

In this cases, the frequency of my signal (150Hz) lies in between my frequency bins. Despite the fact that 150Hz is very close to 104.65Hz, the shift is off from my desired delay amount.

Now imagine if I have a slightly more complicated signal with multiple sinusoidal components, and I would like to shift each of them by a different t. It is virtually impossible to choose my frequency bin such that it can be divided nicely by all these frequencies. What should I do in that case?

I guess I was wondering:

If someone can explain to me where exactly does this kind of shift offset come from.
If I have a more complicated signal described above and I want to shift different sinusoids by different amount, how can I get around this problem?

Many thanks!


texts: QPSK Data Rate vs Bandwidth at Passband: Why can it only transmit 1 bit per Hz and not 2 bits per Hz?

texts:
1) This is a follow up question to the most up-voted answer to this question.

2) The accepted answer is that "QPSK transmits 1 bit per Hz at passband".

3) The theory found in books seems to agree with this answer.

4) But this defies my logic and my experience.

5) My logic and experience tells me that QPSK transmits 2 bits per Hz at passband.

6) From experience, I know that in order to acquire 1 MHz of complex bandwidth (at baseband), I need to set the IQ rate of my receiver to 1 Mega samples per second. (i.e. IQ rate = Complex Bandwidth, and keep in mind that the IQ rate usually needs to be slightly higher to account for the roll-off of an anti-aliasing filter. But let's assume that there is no filter for simplicity.)

7) At baseband, this is the equivalent of 500 KHz of bandwidth if you don't consider the negative frequencies.

8) And at passband, the total bandwidth will be 1 MHz because the negative frequencies "appear" as the frequencies on the "lower" side of the carrier frequency and they are now taken into consideration on the amount of bandwidth, effectively "doubling" the bandwidth.

9) With an IQ rate of 1 Mega samples per second, I can send 2 bits on each sample (because it is QPSK).

10) So the effective data rate is 2 Mbps for a bandwidth of 1 MHz at passband (in my experience).

11) Refer to image below, describing relationship between data rate and bandwidth in my experience.

12) Other people seem to have obtained similar results to mine:

A) Refer to the last video on these student experiments: They show a transmission of 2 Mbps with a 1 MHz QPSK signal.

B) In this video a 4 KHz data rate signal results in a 2 KHz QPSK 3dB spectrum.


texts: how to plot amplitude and phase of IMDs from their fft values?

texts: i have my output as vector of 60000 complex number representing 10 sequence in frequency domain , each of length 6000. i need to plot the phase and amplitude of intermodulation distortion from this output. can anyone suggest me how it can be done. i tried with magnitude and angle unwrap in matlab selecting particular bins in a particular sequence where the IMD tones are located but it seems its not working. Can anyone offer a different approach? ITS urgent :(


texts: How to randomly generate a realistic hourly temperature series given historic data

texts:
I have 20 years of historic hourly temperature data in Omaha. I want, given just a seed, to be able to generate a pretty realistic year of hourly temperatures. (I have a program that takes such temperature series as an input, and the ability to randomly generate these would help in analyzing this program's performance.)

I don't need these generated temperature signals to depend on solar information, climate change, or anything like that (i.e., I'm not forecasting weather). I just want it to be a believable year-long Omaha temperature signal.

This problem is new to me, but I've tried a few (totally uninformed) things:

Random linear combinations of each historic signal (this blends out longer-term anomalies).
Random walk that trends towards the average of the historical signals (perhaps there is hope yet in this method, but it's hard to tune to look realistic).

Does anyone have any ideas or perhaps resources on this topic that they could link me to?


texts: Relation between impulse response and Region of convergence?

texts:
Is there any relation between impulse response and Region of convergence?Means position/location of ROC depends upon impulse response or not??

Please kindly guide about cases for both continuous and discrete time?


texts: Determine if an impulse is minimum phase and compute a zero-phase equivalent

texts:
The impulse is given as a sequence: $x: {10; -3; -1}$. To determine if it is minimum-phase I compute the $Z$-transform (the geophysical case, positive powers of $z$) of it: $X(z)=10-3z-z^2$. Then I factor $X(z)$ into dipoles $(a_0+a_1 z)$: $X(z)=10-3z-z^2=(5+z)(2-z)$. Then I observe that all the dipoles satisfy the $|a_0|>|a_1|$ thus being minimum phase, so the whole sequence $x$ is minimum phase.

Here I'm stuck about the zero-phase equivalent. I can evaluate the spectrum and it's magnitude by evaluating $X(z_k)$ at $z_k=e^{2 \pi i \frac{k}{N}}$, where $k=\{0,1,\dots,N-1\}$, and $N$ - length of the impulse.

From this point on how can I find the respective zero-phase impulse that has the same spectrum magnitude $|X(z_k)|$?


texts: How would Fourier and Cosine Transforms responds to summation of cosines with same frequency but different phases?

texts:
For example, if I have two signals, $\cos(2\pi ft+\frac\pi4)+\cos(2\pi ft+\frac\pi3)$, what would be different in both transforms (Fourier and cosine) how would the spectrum changes?

And What would happened for a signal like $\cos(2\pi ft)+\cos(2\pi ft+0.99\pi)$.


texts: What Is the Definition of Linear Predictive Coefficients When the Optimal Value Aren't Unique?

texts:
Linear predictive coefficients of signal y are defined as the best $k$ coefficients $a_i, i = 1, \ldots, k$, that will approximate $y_n$ by $-\sum_{i=1}^k{a_iy_{n-i}}$. (Best approximation is that which minimizes the sum of squared errors.)

How are LPCs defined when this problem has multiple solutions, e.g. when y$$ is constant zero?


texts: with SciPy, how to generate waveform with common pulse shapes?

texts:
With Python/Scipy, if I have a simply BPSK signal sequence [1, -1, -1, 1, ...], how can I generate a real-valued baseband waveforms with oversampling rate m, and common pulse shapes such as root raised cosine, Nyquist, etc.?

In Matlab I found this fdesign.pulseshaping function, is there an equivalent function in SciPy? If not how can I implement this myself?

I think in other words, how can I find filter coefficient b and a of root raised cosine or Nyquist filters so I use signal.filtfilt?


texts: What could cause fast Fourier transform to give complex conjugate of the intended result?

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


texts:
I have to design 2 IIR bandpass filter with the following specifications:

Sampling frequency 1000 Hz
Pass-band 50 Hz to 200 Hz
Order 6
using bilinear transform and impulse invariance with Butterworth prototype analogue filter.

I'm confused, because the two methods I've got for producing the filters have different results.

fs = 1000;
fNq = fs/2;
f1 = 50/fNq;
f2 = 200/fNq;
[z,p,k] = buttap(6);
[A,B,C,D] = zp2ss(z,p,k);
[zd,pd,kd] = bilinear(z,p,k,fs);
Bw = f2-f1;
Wo = sqrt(f1*f2);
[At,Bt,Ct,Dt] = lp2bp(A,B,C,D,Wo,Bw);
[b,a] = ss2tf(At,Bt,Ct,Dt);

[Ad,Bd,Cd,Dd] = bilinear(At,Bt,Ct,Dt,fs);
[bz, az] = ss2tf(Ad,Bd,Cd,Dd);
fvtool(bz,az);

(I think that) The above code creates an analogue prototype, transforms to a state-space form, applies the bilinear transform, transforms the low-pass filter to a band-pass filter, transforms to a transfer function and the plots it.

My problem is that it is noticably different to:

[num,den] = butter(6, [f1, f2], 's');
[B,A] = bilinear(num, den, fs);
fvtool(B, A);

I have similar problems with the impulse invariance method.

Could someone please give me a hint as to what I'm doing wrong?


texts: Which Anisotropic Diffusion Method is Best for Denoising Now?

texts:
The best standard may be varying from PSNR to human's visual feeling. Any one is OK.

I have tested J.Weickert's tensor diffusion and P&M's, they all can't satisfy me.

Is there any anisotropic diffusion method now is best for denoising, especially in tensor diffusion, others like the KAD, MAD and so on is ok as well.

Thanks for reading~


texts: Signal amplification when summing low SNR images

texts:
I'm trying to add up a few black & white images of the same object in order to amplify the SNR. I'm working on relatively low SNR images (about 1.1) and I wish to amplify it somehow.

My first try was to add up the images grey-levels while removing the noise through a simple threshold but this isn't really working since this threshold isn't quite well defined.

Are there any known algorithms for this kind of task? If so is there any pseudocode or even open source code somewhere?


texts: Questions about autocorrelation, correlation, and randomness

texts:
I'm learning about autocorrelation functions and trying to calculate some from a time series. Conceptually, what is the difference between the following two autocorrelation functions?

$$g_{1}(\tau)=\frac{\big\langle (A(t)-\left \langle A \right\rangle)(A(t+\tau)-\left \langle A \right\rangle ) \big\rangle}{\big\langle (A(t) - \left \langle A \right \rangle )^{2} \big \rangle}$$

$$g_{2}(\tau)=\frac{\big\langle A(t)A(t+\tau)\big\rangle}{\big\langle A(t)^{2} \big\rangle}$$

My understanding is that the autocorrelation for the second equation will asymptotically go to zero if there is no correlation between the events in the time series. Is that the case? What about for the first equation? And why?

For the first equation, is the average value $\left \langle A \right \rangle$ the average over all of $\tau$, or do you need to take a running average and calculate it for each time $t$ when doing the calculation?

What happens if the time series is correlated? Will it never approach zero (in the case of the second equation)?

Is there any a priori way of determining how far to take the lag time $\tau$?

Finally, how does all of this relate to randomness?


texts: Phase Modulation and Intermodulation Anomaly ? (Spectrum plots inside - **Updated**)

texts:
I have a MATLAB script for modelling a two tone signal (a sum of two sinusoids) going through a non linear transfer function (such as an amplifier). The amplitude of a signal is amplified non linearly, and also the phase is modified depending on the input power of the signal.

The two sinusoids used are at 20 Hz and 21 Hz.

With just amplitude modulation, the output spectrum looks as expected (first two plots) Its non linear so 3rd order and fifth order intermods can be seen around the frequency of the two sinusoids, aswell as harmonics. I know the amplitude modulation is correct because I obtain the correct third order intercept for the amplifier model. Upper graphs are in volts, lower graphs in dB Watts

However, when phase is adjusted depending on the input signal power, the spectrum looks like this... and my fifth order intermods are lost (again upper graph in volts, lower graph in dBW)

I have an idea but I am not confident with the explanation of this and was hoping someone with a trained eye can assist or offer advice

How its coded --> My script looks at each point on the input signal, reads its amplitude and adds a phase adjustment to it during reconstruction of the signal, as shown in the phase transfer plot below (which shows the effect the equipment will have on any signal going through it). So if the amplitude (input power) of the signal is -70 dBW then a phase of 0.01 radians is added to the reconstructed signal at that exact point... then it looks at the next sample point and adds a phase to that. So if the amplitude of the wave is at -70dBW then the reconstructed waveform is cos(2*pi*f + 0.01).  Adding 0.01 in phase is an I and Q modulation when cos(2*pi*f + 0.01) is written with the trig identity to get the IQ form.

Confident I have not made any mistakes with unit conversion (again because third order intercept is correct).

Look at the input signal, output signal and the phase deviation added to the signal in time domain... it looks good


texts:
Let's consider the cyclic frequency transform and let's try to make it so that the transform of the function is itself.

t=linspace(-32,32,4096);
dt=t(2)-t(1);
fq=linspace( -1/(2*dt) , 1/(2*dt) , length(t) + 1 );
fq=fq(1:  length(t)  );
x=exp(-pi*t.*t);
X=fftshift(fft(x)).*exp(-1i*2*pi*fq*t(1))*dt;
plot(t,real(X));hold on;plot(t,imag(X));hold off;

Now this actually works, and believe me it was not easy for me to get these right. I basically resorted to trial and error, tried adding $\pm 1$ everywhere until I got something that looked reasonable at all. I would like to learn the method behind this madness.

Is is a good idea to use something like t=linspace(-32,32,4096);
Considering how the frequency is asymmetrical, perhaps time should be as well?
What frequencies does the result of X=fftshift(fft(x)) actually correspond to?
Any other suggestions, etc.?


texts:
I am working on a sinusoidal encoder & decoder to compress .wav files. For now I am trying to regenerate the audio by combining all the frequencies of the original .wav file.
Here is the code I am using:

[x fs] = wavread('clip.wav');
x  = mean(x,2);
NFFT = 1024;
hop = NFFT/2;
win = hann(NFFT);

[S F]= spectrogram(x, win, hop, NFFT, fs);
freq = linspace(0, fs/2, hop + 1);
numFrames = size(S,2);
mag = abs(S);
phase = angle(S);

%Decoding
output = zeros(size(x));
t = 0:(1/fs):(((NFFT-1)/fs));
sumOfCosine = zeros(1, NFFT );
frameStart = 1;
frameEnd = NFFT;

%f = frame
for f = 1:numFrames
    sumOfCosine = zeros(1, NFFT );

    %k = sinusoids in each frame
    for k = 1:hop+1
       sumOfCosine =  sumOfCosine + (mag(k,f)*cos(2*pi*F(k)*t + phase(k,f)));
    end

 sumOfCosine = sumOfCosine.*win';
 a = hop;
 % Normalize the window
 sumOfCosine = (sumOfCosine./a);
 sumOfCosine = sumOfCosine';
 output(frameStart:frameEnd) = ((output(frameStart:frameEnd)+ sumOfCosine));
 frameStart = frameStart + (hop);
 frameEnd = frameEnd + (hop);

end

When I play play output, there is still some noise in it. I tried comparing the original matrix x multiplied by the window, win to the output frame by frame, and I can see that output represented by green doesn't completely overlap with the original windowed signal. I am pasting the images for the first three frames below.

As it can be seen there is some error due to the overlapping of windows maybe? I'd appreciate help in fixing this and make the output sound cleaner. Thanks!


texts: 2D Convolution in MATLAB Causes Artifacts (Boundary Issues)

texts:
I`m trying to do a 2D fast convolution in Matlab of large matrices. If I use FFT version based on convolution theorem ( https://en.wikipedia.org/wiki/Convolution_theorem ), there are some artefacts in the image. Only imfilter produces correct results, but it is working ~100x slower, than the FFT version (conv2fft).

What can be done to avoid these artefacts? I do know that in 1D we need to zero-pad, but here both the image and the kernel have the same size.

% generate image
len = 2^10;
CICcut = zeros (len);
CICcut = imnoise (CICcut, 'salt & pepper', 0.0001);
CICcut = CICcut.*(rand(len)).^2;
gauss = fspecial('gaussian', round(sqrt(len)), sqrt(sqrt(len)));
CICcut = imfilter (CICcut, gauss, 'replicate', 'conv');

% generate kernel
g = zeros(len);
lenMone = len-1;
for i = 1:len
    for j = 1:len
        g(i, j) = ((i-1)/lenMone - 0.5)^2 + ((j-1)/lenMone - 0.5)^2;
    end
end
g = -log(sqrt(g));

% convolution
tic
filtered    = imfilter (g, CICcut, 'replicate', 'conv');
toc
tic
filteredFFT = conv2fft (g, CICcut, 'same');
toc
tic
filteredN   = convn (g, CICcut, 'same');
toc

% display
figure('units', 'normalized', 'outerposition', [0 0.25 1 0.5])
subplot 151, imshow (CICcut, []); title ('Mass density')
subplot 152, imshow (g, []); title ('Green`s function')
subplot 153, imshow (filtered, []); title ({'Gravitational potential' 'imfilter'})
subplot 154, imshow (filteredFFT, []); title ({'Gravitational potential' 'conv2fft'})
subplot 155, imshow (filteredN, []); title ({'Gravitational potential' 'convn'})

Best regards,
Alex


texts: Algorithm for detecting the time where the signal is above a threshold

texts:
I need to detect the time window where a 1D-signal is above a certain threshold. If it dips below the threshold briefly I'd like to merge the two windows, if it dips below for a longer time, split them. The data are received digitally as array $S[t]$ with equally-spaced $t$ intervals and represent precipitation forecasts from a weather model.

I want to find $t_{on}$ / $t_{off}$ in signals like the following:

I know this isn't terribly hard and I can probably come up with an algorithm myself, but I thought this is a problem that smarter people than me have already thought about.

The algorithm will be implemented in software and run on general-purpose datacenter servers (no specialised hardware). It doesn't have to be crazy fast, "reasonable" is good enough (we have a few 100k time series to process at once every now and then; each series has probably less then 1000 points).

I'd welcome algorithm suggestions, Google keywords, book/article recommendations. I'm rather new to data processing, in case it isn't blatantly obvious.

Edit:
Thanks everyone for the great comments and answers. This question really couldn't have turned out much better. What I'm worrying about the most is how to handle pathological cases, like "oscillations" around the threshold.

My own idea was having separate on/off-thresholds, with $ thresh_{off} = f * thresh_{on} $ (with $f$ in the range of [0.5, 0.99]). I also really like Marten's idea of temporarily modifying the threshold value after the signal crosses the threshold in a hysteresis-like manner.

Are there other strategies to handle this issue that I should know about?

Are there other potential issues that I need to know about?


texts: How to reduce PAPR with constellations choice?

texts: How to tune constellations mapping M ary-psk or x-qam to reduce PAPR ?


texts:
Context

I need to extract the parameters of a single harmonic in a signal.

For instance if

$$
x(t) = A \sin (\omega_0t + d_0) + B \sin (\omega_2t + d_2)
$$
then $f(x, \omega_0) = (A, d_0)$. This can be done offline.

Please consider the fact that $t$ does not cover a full number of periods!

Of course I used a fft() and then extracted the coefficient corresponding to the interesting frequency. The problem is that I compute the whole spectrum when I'm interested in only one value.

What I tried and read

I first tried to use the definition of the DFT (or to project my signal on a sine/cosine plane) by using:

$$
A e^{jd_0} = \frac{2}{N} \sum_t e^{j\omega_0 t} x(t)  ,
$$
with $N$ the number of samples of $t$.

This is what is proposed here:
FFT for a single frequency

This works however only for a full number of periods of the interesting frequency: I can cut my signal to get reasonable results but I'd rather not (and it's not always possible)

What can I do else?


texts: Does Gamma Correction Interfere with Sub Pixel Motion Estimation?

texts:
Advanced Video Coding (AVC) and High Efficiency Video Coding (HEVC) work on gamma corrected, non linear, colors.

When interpolating the value at subpixels, a multi tap algorithm processes the gamma corrected values of the original pixels directly, without converting into linear space and back, like a GPU does when doing texture mapping.

Isn't this wrong?


texts:
So, in my class I have to learn how to derive the power relation in a Double Side Band, Full Carrier Amplitude Modulated Wave However, I have hit a wall somewhere.

The basic equation is this :

$P_{total} = P_{carrier} + P_{lower-side-band} + P_{upper-side-band}$
Then,

$P_{carrier} = \frac{E_c^{2}}{R}$ where $E_c$ is amplitude of carrier.
Now , when converting to R.M.S, I divide the numerator by $\sqrt2$   and I get: $\frac{E_c^2}{2R}$

$P_{lower-side-band} = P_{upper-side-band} = \frac{(\frac{mE_c}{2})^2}{R} = \frac{m^2E_c^2}{4R}$

The problem is that the notes provided to me by my teacher state the numerator is $8R$ and I do not know why. Can someone please tell me if I have made a mistake somewhere.


texts: Level Correction For Digital Down-Convertion?

texts:
I am trying to understand a subtle (sorry if this is obvious) difference in the computed output power after a DDC process. Here is the story:

Suppose I generated a 10 MHz signal from a microwave source at -10 dBm and feed it to the a digitizer. This corresponds to a peak-to-peak voltage of 200 mV as measured by an oscilloscope for 50 Ohm lines and termination.

With the digitizer and by performing DDC, I am getting around +4 dBm as a result, 14 dBm above the expected -10 dBm of the source. Why is that?

I tried to go through the math step-by-step:

With the 200 mV input peak-to-peak signal, by multiplying this signal with a cos (for I) and -sin (for Q) with amplitude equals 1, I will obtain (suppose the signal has zero phase) I_DC = 50 mV and Q_DC = 0 mV after filtering out the high frequency part, just by trigonometry.

The power is then computed as P=I^2+Q^2= 2.5 mW. Taking log, we get P_log = 10*log(2.5mW) ~ -26 dB = 4 dBm. This is around 14 dBm higher than what I originally generated (-10 dBm).

If I wasn't missing something in the calculation, it seems I need a level correct factor of 14 dBm. But where did this gain come from?
I guess by duplicating the signal to generate the I and Q there is a 6 dB gain. Then where is the remaining 8 dB from?

Appreciated if you can shine some light on it.

Edit1: (Answer?)
Following the first reply, I might need to consider the 50 Ohm, so it will bring the power down by a factor 10*log(1/50), and it gives now P_dBm = 10*log(2.5e-3*1000/50) = -13.0103 dBm. I am now 3.0103 dB off, and it seems it comes from the trigonometry factor of half. By putting it back, I come back to the -10 dBm as desired.


texts:
I am using Matlab Simulink to analyse Amplitude Modulation in Noise. I attached my system below.

My problems:

1)In the mixer I am using a bandpass filter and another one after the envelope detector and I need to determine the minimum and maximum frequencies allowed depending on these parameters( I attached screenshots too) since I tried using mathwork site but it was not helpful regarding these values.

2)Also I need to know what needs to be changed in the model if the AM channel has a different carrier frequency.

3)What does 999e3 evaluate to?

Thanks a lot!


texts: Finding values of DTFT without explicitly computing

texts:
My attempt :

a) Summation of all values?

b)c)d) Failed

e) Parserval's theorem


texts: Resampling time series to regular array, then downsampling (Butterworth)

texts:
Long time reader, first time poster.  I have a few very simple questions that are troubling me and I am hoping that one of you guys can help me out.

Setup & Aim: I have a time series that I want to downsample, and I simply want to run a lowpass filter on it before doing so to avoid aliasing. I am using Python (SciPy) but it looks like MATLAB behaves similarly, neither are really relevant for these questions.

My original time series is sampled at $0.5\textrm{ ms}$ ($2000\textrm{ Hz}, f_{\rm Nyquist}=1000\textrm{ Hz}$) and I want to resample to $2\textrm{ ms}$ ($250\textrm{ Hz}, f_{\rm Nyquist}=250\textrm{ Hz}$), so I must apply an anti-alias filter that cuts off any frequencies $> 250\textrm{ Hz}$, and then downsample. So far, so good.

In Python, it looks like a Butterworth Filter is the way to go, which requires a normalised frequency $\omega_n$.  My understanding is that in my case $\omega_n = 250\textrm{ Hz}/1000\textrm{ Hz} = 0.25$.

Now, what I don't understand and I cannot find any information on, is as follows:

What if my original time series ($f_s=2000\textrm{ Hz}$) had been upsampled from $1\textrm{ ms}$ ($f_s=1000\textrm{ Hz}, f_{\rm Nyquist}=500\textrm{ Hz}$)? There is no extra information between $500\textrm{ Hz}$ and $1000\textrm{ Hz}$ but I don't necessarily know that and I apply a Butterworth Filter with $omega_n = 0.25$ (instead of $\omega_n = 0.5$ for $1\textrm{ ms}$ sampling).  Is it an issue? Am I misunderstanding how a Butterworth filter works?
My second question is something like "Why is this the preferred implementation of a low pass filter?" I am sure there are good reasons but I have used software in the past to just high cut filter my data knowing my new $f_{\rm Nyquist}$, so in my case.  So in my case I would use something like $0-0-200-250\textrm{ Hz}$.  Again, what am I missing? I know that maximum frequency that I want to keep.

Finally, one of the roots of my problem is that I sometimes have irregularly sampled data.  I can run an interpolation to a regular time array but when doing this I tend to oversample, to avoid losing signal  (This is where my first question comes in).  Am I wasting my time? Should I just resample to the smallest time interval in my data?


texts: 2 points and instantaneous phase sufficient to estimate amplitude and frequency of sinusoid?

texts: If you have 2 points (x1y1,x2y2) in a Cartesian grid, there are an infinite amount of sinusoids that pass through them. But if you are also given the instantaneous phase (Th0) in radians or degrees at that point, is that sufficient to estimate the amplitude and frequency of the sinusoid that passes through these 2 points? And is there a way to find a formula f(x1y1,x2y2,Th0) where you can simply plug in these 3 variables which returns the amplitude and phase of the sinusoid, so you don't have to look it up in a table? Thanks.


texts: Time stretching allowing for pitch change

texts:
I have implemented the WSOLA time stretching algorithm for audio data, but there are still many artifacts from the stretching.

I don't actually care about maintaining pitch and am totally ok with the "chipmunking" effect. What options are available for time stretching in this case? Are there any algorithms I can use that will produce fewer artifacts?

I've only been able to find questions that DO care about maintaining pitch. I've read about resampling, but don't understand exactly how that would work when not trying to double or halve the speed of the sample.

Any information or links are appreciated!


texts: How to choose the size of a Laplacian of Gaussian kernel for filtering images fast?

texts:
I am filtering an image using a Laplacian of Gaussian (LoG) kernel. The kernel dimensions are the same as the image. The filter operation takes very long to complete. How can I speed this up while maintaining fidelity?

The LoG kernel is not separable like the Gaussian kernel. So I cannot speed it up by filtering the image with 2 vectors successively. The only other option is to resize the kernel to get rid of insignificant multipliers on the outside. Is there a rule of thumb when choosing the size of an LoG kernel (considering image size and standard deviation of LoG)?

I am using this picture (633x900):

Filtering this in matlab using Gaussian vs. LoG gives vastly different times with the same kernel size:

>> I = imread('PICTURE.jpg');

>> tic;imfilter(double(I), fspecial('gaussian', [633,900], 50)); toc
Elapsed time is 1.129423 seconds.

>> tic;imfilter(double(I), fspecial('log', [633,900], 50)); toc
Elapsed time is 253.447840 seconds.

I just started with image processing so please excuse me if I missed out on something glaringly obvious. Thanks!


texts:
In this research paper, Section 4.1 talks about a filter called "Oriented Band-pass Filter".

What does it actually mean by 'Orientation'?

Also, the article gives a function,

$$H(u, v) = \frac{1}{1 + 0.414(\sqrt{\frac{u^*}{D_h} + \frac{v^*}{D_v} })^{2n}}$$

Can you please explain this function in layman's terms?

What are $u$, $v$?


texts: Why is Error Vector Magnitude (EVM) measured as an RMS value?

texts:
I do understand Voltage/Current measurement of a Sine Wave is in RMS, as average yields a zero, and RMS gives a true 'DC equivalent' value. But I do not understand why an EVM measurement could be in RMS, and not simply Average.

Is it because, similar to a sine wave, as symbols are mirrored in the IQ constellation plane, their individual EVM values when averaged yield a zero as well?


texts: How do I calculate the bandwidth from a waveform?

texts:
Suppose I have a waveform $x(t)$
where $x(t) = 5 + 30\mathrm{cos}(2000\pi t) + 10\mathrm{cos}(6000\pi t)$ that is to be uniformly sampled for digital transmission, how do I calculate the bandwidth of this signal?

I reckon that it would $4000 \textrm{Hz}$ because we're subtracting the highest and lowest frequencies $(6000-2000)$. Is this right?

However, the answer in my book says it's $3000 \textrm{Hz}$. I do not understand how did they get this answer.

Thank you for reading


texts: How is multiplexing on FM signals performed?

texts: How does multiplexing differ from FM signals to AM signals. If both FM and AM shift the message signal in frequency, then  is there a difference between multiplexing for FM or AM signal?


texts:
According to the following paper:
Deep Residual Learning for Image Recognition Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun; Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016, pp. 770-778
Deeper neural networks are more difficult to train. A residual learning framework eases the training of networks that are substantially deeper than those used previously. The layers are reformulated as learning residual functions with reference to the layer inputs, instead of learning unreferenced functions. These residual networks are easier to optimize, and can gain accuracy from considerably increased depth.
Which is better: to use pre-trained deep residual networks based on transfer learning, or to build the network from scratch?


texts: What is the difference between time complexity and sample complexity?

texts:
What is the the difference between time complexity and sample complexity in the context of algorithm development?

I'm currently studying the sparse Fourier transform and this idea of sample complexity keeps coming up. The majority of sample complexity literature is in the context of machine learning which is not what I'm interested in.


texts: Which values do I use to filter a specific frequency with an RLC circuit?

texts:
I have a RLC circuit with transformation $$H(s) = \frac{R}{Ls+\frac{1}{Cs}+R}$$ and I know that by setting $s=j\omega$ I can obtain the frequency response of this system. What I don't understand is how I can use the frequency response graph to decide which values I should set on R and f $(L=2\pi f, C=1\mu F)$ to filter out a specific frequency from the input signal $u(t)$.

Lets say that I have u(t) which I know consists of two signals, $400 Hz$ and $800 Hz$ (by calculating the amplitude spectrum $U(\omega)$ and plotting the graph). How do I design a filter to filter out one of them?


texts: a-weighting signal without digital filter

texts:
I essentially want to a-weight a signal by using the fft in Python.
But I guess I'm making some logical faults.

My Steps:

Initialize Sine: y = np.array(np.rint(32768 * np.sin(1000 * 2.0 * np.pi * np.linspace(0,1,44100))))
take RMS: print(20.0 *np.log10(rms_flat(y))) - gives me $87\textrm{ dB}$
fft with hanning window:yf = np.abs(np.fft.fft(samples * np.hanning(len(samples))))
take RMS: gives me around $130\textrm{ dB}$ - why is it not at $87\textrm{ dB}$ anymore?
finally a-weight spectrum - see below - get Inf RMS...

import matplotlib.pyplot as plt
import numpy as np

#samplerate
Fs = 44100

#samplecount
A = Fs

#Sample Interval
Ts = 1/Fs

#Zeitvektor
t = np.linspace(0.0, Fs*Ts, Fs)

#Sinus Freq
ff = 1000

y = np.array(np.rint(32768 * np.sin(ff * 2.0 * np.pi * t)))

fig = plt.figure(figsize=(10,10))
fig.subplots_adjust(hspace=0.7)
fig.subplots_adjust(wspace=0.25)
plt.subplot(321)
plt.title("Samples")
plt.ylabel("Amplitude")
plt.xlabel("Time")
plt.plot(t, y)

def rms_flat(a):  # from matplotlib.mlab
    """
    Return the root mean square of all the elements of *a*, flattened out.
    """
    return np.sqrt(np.mean(np.absolute(a)**2))

print(20.0 *np.log10(rms_flat(y)))

def fft(samples):
    yf = np.abs(np.fft.fft(samples * np.hanning(len(samples))))
    xf = np.linspace(0.0, 1 / (2.0 * Ts), Fs / 2)
    plt.subplot(322)
    plt.title("Abs Pos Spectrum")
    plt.ylabel("Amplitude")
    plt.xlabel("Frequency")
    plt.plot(xf, 2.0/A * yf[:A//2])
    print(20.0 * np.log10(rms_flat(yf)))
    return(yf, xf)

yf, xf = fft(y)

def aWeighting(yf, xf):
    f1 = 20
    f2 = 107
    f3 = 737
    f4 = 12194
    N = len(xf)
    i = 0
    yfa = []
    while i < N:
        a = 20.0 * np.log10((f4 ** 2 * xf[i] ** 4) / ((xf[i] ** 2 + f1 ** 2) * np.sqrt(xf[i] ** 2 + f2 ** 2) * np.sqrt(xf[i] ** 2 + f3 ** 2) * (xf[i] ** 2 + f4 ** 2))) + 2.0
        yfa.append(20.0 * np.log10(yf[i]) + a)
        i += 1

    yfa = np.array(yfa)
    print(rms_flat(yfa))
    plt.subplot(323)
    plt.title("A-weighted Spektrum in dB")
    plt.ylabel("dB")
    plt.xlabel("Frequency")
    plt.plot(xf, 2.0/A * yfa[:A//2])
    plt.show()
    return(yfa, weight)

yfa, weight = aWeighting(yf, xf)


texts: formula derivation for periodic signal power

texts:
Studying DSP on my own. Taking an introductory class. Was given a formula for signal power

$$ P = \lim_{M\to\infty} {\frac{1}{2M+1} \sum_{n=-M}^M} \lvert x[n] \rvert^2 $$

I do understand why the formula looks the way it does.

But then we were given a formula for a power of a periodic signal, where $N$ is the period,

$$ P = {\frac{1}{N} \sum_{n=0}^{N-1}} \lvert x[n] \rvert^2 $$

I can't figure out how this formula is derived from the original one. How do I do it?


texts:
i started working with kalman filter lately and i am trying to understand how to rotate the scales of the measurement noise matrix.
my scenario is a plane flying on 45 degrees (2d) and i know that the measurement noise on his x (roll)(with the plane perspective) his bigger then the noise on his y (pitch) so i want to weight the noise differently but not on north east scales but on north east multiply by rotation matrix of 45 degree.
I tried to use the measurement noise matrix: [00]cosx,[01]-sinx,[11]cosx,[10]sinx but it didn't work.
I try to do it because i feel that there is info that i don't use when i use diagonal measurement noise matrix(flying angle).
thx.