texts:
I am doing a research project for DST (Discrete Sine Transform) versus DCT  (Discrete Cosine Transform)  image compression and for my conclusion, my supervisor told me to discuss why the differences occur, I am not entirely sure how to explain the reasons why the coefficients are spread in a specific way.

Any idea why they differ so much for coefficients?


texts: Improving the separation of a signal into source and filter

texts:
I am implementing a voice morphing system, but I am having difficulties getting a good quality output signal. The method I am using is LPC analysis and synthesis. In theory, the LPC process should split the signal into a source/filter representation by calculating a residual and a set of filter coefficients.

However, in practice, I am finding that the residual contains data which I believe should be contained in the filter.

What techniques are available for better separating an input signal into source and filter?

Cheers,
Ben


texts:
I have searched Stackexchange forums for ideas, but could not find anything useful for me. I am registering real-time stability of the He-Ne laser interferometer by analyzing interference fringe movement on CCD linear sensor. I am getting data samples every 15-20 ms, data looks like this:

Now if interference conditions changes, fringes move - phase of this modulated signal changes:

So my first quite successful method was to take one peak, fit it with Gaussian, register it's center position over time and calculate difference from the first sample, then normalize it to distance between two peaks and get phase change over time.
But now I want to calculate this more "elegantly" and to use all fringes, not only one peak. So I thought maybe I could use Fourier transform. When I use FFT, I get spatial-frequency of this modulation. The problem is, I don't how to proceed further and extract phase information, so here comes my question. How algorithm with Fourier transform should look like, or maybe there is other better methods (maybe some kind of correlation)?


texts: What Does It Mean Exactly When Two Parts of a Signal Are Correlated?

texts: I stumble quite often upon the notion that two or more parts of a signal are correlated to describe semi-formally that they belong together. For example in image processing, two pixels on an edge feature tend to be correlated whereas two adjacent parts of a 3D structure that represents water droplets in a particle simulation are less correlated. My question is what is the exact idea behind this notion.


texts:
What does it mean when an image looks pixelated after a Gaussian filter (Multivariate Gaussian Distribution filter) is applied (in context of mu, Sigma, and the meshgrid created), and what parameters can one alter to minimize this effect and make the image look smoother?

Sample code (MATLAB):

d1 = 20
d2 = 20
d3 = 20
mu = [0 0 0];
Sigma = 30*[1 0 0; 0 1 0; 0 0 1];
[X1,X2,X3] = meshgrid(linspace(-10,10,d1)', linspace(-10,10,d2)', linspace(-10,10,d3)');
X4 = [X1(:) X2(:) X3(:)];
p = mvnpdf(X4, mu, Sigma);
F = reshape(p,d1,d2,d3);

I am convolving the filter above with a 3-D matrix, a roughly 90*60*100 matrix.


texts: Not able to reach minimum phase using Hilbert transform

texts:
My problem is pretty simple, I've designed a magnitude response and I would like to find the corresponding minimum phase filter. I'm using the code below and unless there is a bug my eyes don't want to see, I'm pretty confident on the methodology.

nbTaps = 100;
fs = 96000;
desiredMagn_dB = [0 0 -100 -100];
f = [0 24000 26000 fs/2];

FIRFreq = (0:nbTaps/2)*fs / nbTaps;

FIRMagn = interp1(f, 10.^(desiredMagn_dB./20), FIRFreq);
FIRMagn = [FIRMagn fliplr(FIRMagn(2:end-1))];

minPhase = -imag(hilbert(log(FIRMagn)));

freqResp = FIRMagn.*exp(1i.*minPhase);

FIRCoefs = ifft(freqResp, 'symmetric');

And yet, my filter has not a minimal phase, since I have zeros outside the unit circle. I am a little bit lost, here, and I would like to understand why is so? or where I am wrong?

EDIT from r b-j:

nbTaps = 16384;
fs = 96000;
desiredMagn_dB = [0 0 -100 -100];
f = [0 24000 26000 fs/2];

FIRFreq = (0:nbTaps/2)*fs / nbTaps;

FIRMagn = interp1(f, 10.^(desiredMagn_dB./20), FIRFreq);
FIRMagn = [FIRMagn fliplr(FIRMagn(2:end-1))];

minPhase = -imag(hilbert(log(FIRMagn)));

freqResp = FIRMagn.*exp(1i.*minPhase);

FIRCoefs = ifft(freqResp, 'symmetric');

figure(1)
plot(20*log10(FIRMagn))
figure(2)
plot(minPhase)
figure(3)
plot(FIRCoefs)

i don't see anything unexpected.


texts: How to read off power at different frequencies

texts:
In MATLAB, consider a signal y and its Fourier transform Y:

y = A .* sin(2*pi*f_c*t + Phi);
Y = 10*log(abs(fftshift(fft(y))) / length(y));

Now, I plot the signal and its spectrum:

figure
subplot(2,1,1)
plot(t,y)
subplot(2,1,2)
plot(t,Y)

my question: what exactly did I plot in the second subplot? I know my $x$-axis gives frequency in $\textrm{Hz}$. But what does the $y$-axis give? I want to be able to read off the power of my signal at different frequencies - if possible in $\textrm{dBm}$. Since my signal-amplitude A is used to define y and not its power, I am unsure of what my $y$-axis yields.


texts:
I've already asked this question on SO, but didn't get an answer, I tqake a shot here.
I am trying to get the PSD of a real data set by making use of  fftw3 library
To test I wrote a small program as shown below ,that generates the  a signal which follows sinusoidal function
#include <stdio.h>
#include <math.h>
#define PI 3.14

int main (){
    double  value= 0.0;
    float frequency = 5;
    float  length = 2;
    int index = 4;
    double i = 0 ;
    double time = 0.0;
    FILE* outputFile = NULL;
    outputFile = fopen("sinvalues","wb");
    if(outputFile==NULL){
        printf(" couldn't open the file \n");
        return -1;
    }

    for (i = 0; i<=5000;i++){

        value =  sin(2*PI*frequency*zeit);
        fwrite(&value,sizeof(double),1,outputFile);
        zeit += (1.0/frequency);
    }
    fclose(outputFile);
    return 0;

}

Now I'm reading the output file of above program and trying to calculate its PSD like as shown below
#include <stdio.h>
#include <fftw3.h>
#include <complex.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14
int main (){
    FILE* inp = NULL;
    FILE* oup = NULL;
    double* value;// = 0.0;
    double* result;
    double spectr = 0.0 ;
    int windowsSize =512;
    double  power_spectrum = 0.0;
    fftw_plan plan;

    int index=0,i ,k;
    double multiplier =0.0;
    inp = fopen("1","rb");
    oup = fopen("psd","wb+");

    value=(double*)malloc(sizeof(double)*windowsSize);
    result = (double*)malloc(sizeof(double)*(windowsSize)); // what is the length that I have to choose here ?
        plan =fftw_plan_r2r_1d(windowsSize,value,result,FFTW_R2HC,FFTW_ESTIMATE);

    while(!feof(inp)){

        index =fread(value,sizeof(double),windowsSize,inp);
            // zero padding
        if( index != windowsSize){
            for(i=index;i<windowsSize;i++){
                    value[i] = 0.0;
                        }

        }

        // windowing  Hann

        for (i=0; i<windowsSize; i++){
            multiplier = 0.5*(1-cos(2*PI*i/(windowsSize-1)));
            value[i] *= multiplier;
        }

        fftw_execute(plan);

        for(i = 0;i<(windowsSize/2 +1) ;i++){ //why only tell the half size of the window
            power_spectrum = result[i]*result[i] +result[windowsSize/2 +1 -i]*result[windowsSize/2 +1 -i];
            printf("%lf \t\t\t %d \n",power_spectrum,i);
            fprintf(oup," %lf \n ",power_spectrum);
        }

    }
    fclose(oup);
    fclose(inp);
    return 0;

}

Iam not sure about the correctness of the way I am doing this, but below are the results i have obtained:

Can any one help me in tracing the errors of the above approach
and the input data look like :

Thanks in advance


texts:
I studied a bit about adaptive filter on internet and found that its a special filter which keep on updating its filter value as soon as it proceeds. It finds out the difference between input and output and using the error function and previous coefficients finds out the new filter coefficients.

But this doesn't make any sense. It always tries to minimize the difference between input and output. So, how is it of any use, if it tries to pass all the signals as it is.

Can anyone explain me how it is being used in real day applications.

It will also be good if you can help me through some links which could help me in implementation of adaptive digital filter.

please comment if I am unclear in expressing my doubt !


texts: Is it correct to call this Gaussian Mixture Model?

texts:
Some poeple claim their background subtraction algorithms use Gaussian Mixture Model,
but when I read the code, I find they actually use only one component,
and as a result EM algorithm (or its approximated version) is not taken to fit the model.
An example can be found here.
This configuration is commonly adopted when the background is strictly static,
e.g. the scenes without swaying tree branches.

More specifically, their methods use some simple criterion:
a pixel is classified as foreground if it satisfies

$$
\sum_{c \in C} w_c\frac{|I_c(x,y)-\mu_c(x,y)|}{\sigma_c(x,y)} > \text{Threshold}
$$

where $C$ is the set of channels (RGB, HSV, etc.) and $w_c$ is the weight of channel $c$.
Technically there is no mixture distribution any more.
Do you think it's still appropriate to call this model GMM?


texts: what waveform using to send qpsk signal with IQ tranceiver

texts:
I have an SDR tranceiver (AD9361 on fmcomms3) working with IQ channels, i wanted to make a c++ software that modulate and send a digital QPSK signal but i'm a beginner in digital signal processing and i'm not sure what waveforms to inject into each of I and Q channel.

Any help would be appreciated.
Thanks


texts: FIR Filter Design: Window vs Parks McClellan and Least Squares

texts:
Are there any advantages to use a window approach over Parks-McClellan (further abbreviated here as PMcC) or Least Squares algorithms for FIR filter design of a low pass filter?  Assume with today's computational power that the complexity of the algorithms themselves is not a factor.

This question is not comparing PMcC to Least Squares but specifically if there is any reason to use any window FIR design technique instead of those algorithms, or were windowing techniques to filter design obsoleted by those algorithms and relegated to didactic purposes?

Below is one comparison where I had compared a Hamming window to my favored design approach with Least-Squared, using the same number of taps. I widened the passband in the Least Squared approach to closely match that of the Hamming Window, and in this case it was quite clear that the Least-Squared would outperform (offering significantly more stop band rejection). I have not done this with all windows, which leads me to the question if you could ever out-perform PMcC and least-squares, or if there are other applications for a FIR low pass filter where a windowing approach would be preferred?


texts: Constant Magnitude Chirp across audio band (Parseval's Theorem?)

texts:
I want to excite a loudspeaker with a constant magnitude chirp that sweeps across all frequencies in the audio band. I downloaded a test file from this Audio Check - High Definition Audio Test Files to start with.
I plot the log magnitude of the file with the following code which I use for other applications as well.
[X Fs nbits] = wavread('audiocheck.net_hdchirp_96k_-3dBFS_log.wav');
X = X(:,1);
fft_prep = fftshift(fft(X));
fft_mag = real(fft_prep).^2 + imag(fft_prep).^2;
pos_fft=fft_mag(ceil(length(fft_mag)/2+1:length(fft_mag)));
db_fft=20*log10(pos_fft);
figure(1);
plot(linspace(0,48000,length(db_fft)), db_fft);

I see this graph:

I was hoping to see a constant magnitude response. A friend of mine mentioned something about how Parseval's Theorem states that there will be different energy in different frequencies. I found this link that talks about Parseval's Theorem and also says in the section "Spectral features and energy of chirps":

Important and desired spectral properties of excitation signals to improve the quality of
wideband measurement are: flat amplitude spectrum with minimal fluctuation (ripple) together with the absence of overshoots inside the generated (excitation) bandwidth Bexc =ffin - fst; steep drop-down of the amplitude spectrum outside the bandwidth Bexc; maximal energy-efficiency, i.e., the ratio between the energy lying within the generated
(excitation) bandwidth Bexc and total energy of the signal.

To avoid worrying about a chirp someone else made. I am also trying to generate a chirp in Matlab and I am seeing the following response with:
t = 0:0.001:10;      % 10 seconds @ 1kHz sample rate
fo = 10; f1 = 400;   % Start at 10Hz, go up to 400Hz
X = chirp(t,fo,10,f1,'logarithmic');
fft_prep = fftshift(fft(X));
fft_mag = abs(fft_prep);
pos_fft = fft_mag(ceil(length(fft_mag)/2)+1:length(fft_mag));
db_fft = 20*log10(pos_fft);
figure(1);
plot(linspace(fo,f1,length(db_fft)), db_fft);

How can I generate a relatively constant magnitude sweep across the audio range in Matlab like I see in figure 8 above? Any advice is welcome and I appreciate the help.


texts:
I want to convolve two large matrices and it is working fast - as long as one of those matrixes contains only separate points (point sources). If I replace the points by eg. Gaussians (line "HERE" below), it is getting terribly slow. My guess would be that Imfilter is swiching from FFT-based convolution to "normal" one.

Is there a way to avoid this? I need to use sizes up to 2^15.

% preapre image
len = 2^10; % size of both matrixes
mass = zeros (len);
mass = imnoise (mass, 'salt & pepper', 0.0001);
mass = mass.*(rand(len)).^2;
gauss = fspecial('gaussian', round(sqrt(len)), sqrt(sqrt(len)));
mass = imfilter (mass, gauss, 'replicate', 'conv'); % HERE

% prepare 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
filteredFFT = imfilter (g, mass, 'replicate', 'conv');
toc

% display results
figure('units', 'normalized', 'outerposition', [0 0.25 1 0.5])
subplot 131, imshow (mass, []); title ('Mass density')
subplot 132, imshow (g, []); title ('Green`s function')
subplot 133, imshow (filteredFFT, []); title ('Gravitational potential')


texts: What is the meaning of the delay in a FIR filter

texts:
I'm using a C# library that has the FIR filter implemented and I'd like to know what's the meaning of the ${z^{-1}}$ operation (delay) mathematically.

The triangle is multiplication, the circle is a sum, but what does the delay means in terms of mathematical operations?


texts: Is there a principled way to distinguish between these signals?

texts:
Consider these two signals:

They both describe a biological process going on in the same subject. The blue one is obtained at rest and the red one after the subject is perturbed. Is there a principled way to model change such as evinced here?

A possible approach

Just comparing the standard deviations of the blue and red actually works well in many such cases, since the red signal is somewhat "dampened" but I am not entirely satisfied with this approach.


texts: Can you please explain: why is a specific type of noise called "Gaussian noise"? Why is it relevant to call it Gaussian? Please, explain in layman's terms.


texts:
I'm trying to understand well the kalman filter, as a result i'm having this question :
Why do we represent noise with a Gaussian ? what does this really mean intuitively ?


texts:
I'm a beginner with absolutely no experience in signal processing, but it has been a long-term goal of mine to do something that mixes music (a hobby of mine) and computer science (my "expertise").  I've been thinking of doing a project that involves learning notes from music, but I don't know where to begin.

For one, there doesn't seem to be a name for this problem. However, it doesn't seem to be a solved problem.  I've searched terms including "Audio recognition," "note recognition," "chord recognition," but I've only come up with this paper: "Automatic Chord Recognition from Audio Using an HMM with Supervised Learning" by Lee and stanley.  It seems to have some good references to processing and even a pointer to a dataset I could potentially use, but one paper doesn't seem to be enough for a good understanding.  Alternatively, I could skip the processing part entirely but I can't find data sets using terms like "audio signal data set"

Signal processing seems to be a pretty broad field. To save time, I want to pick up a book more oriented towards my project.  Are there any books like this?  I've found this:
http://www.dspguide.com/ch1/3.htm but I want to know if this is relevant before I jump into this 34 chapter book.  Are they any other search terms I can use such as "audio feature extraction" to get me closer to the ML part of the problem?

Finally, to cut down on work, I want to use libraries for the signal processing part.  One library I found for Python is Pyo but are they any other alternatives for Python that people have used?

Basically, I'm a little overwhelmed by how much I don't know and I would greatly appreciate a pointer in the right direction.  Even google search words would help.


texts: What would the behavior be of an FFT without the phase (imaginary part)

texts:
If I have a sound recording with a sinusodial frequency with a constant amplitude and I do an FFT on the time domain of this recording to get the frequency back:

If I were to ignore the imaginary part and just watched the amplitude (real part) would there be anything different about it? Would it also be constant?

I'm trying to do an FFT and I notice that the frequency spike oscillates up and down as if it were a sine wave, I have ignored the imaginary part on my FFT.


texts: Understanding an alternative representation for the difference equation of a FIR filter?

texts:
I recently solved a problem which required that I compute the convolution of an input signal with the impulse response of a filter. I got the resulting discrete signal which is verified to be the correct answer:

  $$2\delta[n] + 6\delta[n - 1] + 3\delta[n - 2] + 3\delta[n - 3] + \delta[n - 4] + 4\delta[n - 5] + 2\delta[n - 7]$$

This is apparently equivalent to:

  $$2\delta[n] + 6\delta[n - 1] + 3u[n - 2] - 2\delta[n - 4] + \delta[n - 5] - 3u[n - 6] + 2\delta[n - 7]$$

Where $u$ is the unit-step.

I understand that the unit-step is zero when $u[n - k]$ has ($k > n$), and one when ($k \leq n$). But beyond that I can't understand why this representation is identical. How can I to transform my output to match this format, or to verify they are the same?


texts: How do I get the volume levels from an audio file?

texts:
I need a Linux tool to analyze Audio files for their Loudness. Maybe the average for each 100 milliseconds.
output like: (0=>-12,100=>-18,200=>-24,300=>-55)
Any Ideas


texts: What is meant by labels in 'gaussian shaped labels (reference attached)'?

texts:
I am trying to understand MATLAB code and it uses a line like:

%create regression labels, gaussian shaped, with a bandwidth proportional to target size
output_sigma = sqrt(prod(target_sz)) * output_sigma_factor / cell_size;
yf = fft2(gaussian_shaped_labels(output_sigma, floor(window_sz / cell_size)));

I am trying to understand what it means by 'gaussian shaped labels'? I understand what is a gaussian filter and the signal with peak at the centre, but I don't get what it means by label here. When I look for the definition, it says:

  LABELS = gaussian_shaped_labels(SIGMA, SZ)

  Creates an array of labels (regression targets) for all shifts of a
     sample of dimensions SZ. The output will have size SZ, representing
     one label for each possible shift. The labels will be Gaussian-shaped,
     with the peak at 0-shift (top-left element of the array), decaying
     as the distance increases, and wrapping around at the borders.

  The Gaussian function has spatial bandwidth SIGMA.

I especially don't understand the part:

  Creates an array of labels (regression targets) for all shifts of a sample

Edit 1: I am adding the code for 'gaussian shaped labels' below:

> function labels = gaussian_shaped_labels(sigma, sz)
> %GAUSSIAN_SHAPED_LABELS %   Gaussian-shaped labels for all shifts of a
> sample. % %   LABELS = GAUSSIAN_SHAPED_LABELS(SIGMA, SZ) %   Creates
> an array of labels (regression targets) for all shifts of a %   sample
> of dimensions SZ. The output will have size SZ, representing %   one
> label for each possible shift. The labels will be Gaussian-shaped, %
> with the peak at 0-shift (top-left element of the array), decaying %
> as the distance increases, and wrapping around at the borders. %   The
> Gaussian function has spatial bandwidth SIGMA. % %   Joao F.
> Henriques, 2014 %   http://www.isr.uc.pt/~henriques/
>
>
> %%as a simple example, the limit sigma = 0 would be a Dirac delta, %
> %instead of a Gaussian: %     labels = zeros(sz(1:2));  %labels for all
> shifted samples %     labels(1,1) = magnitude;  %label for 0-shift
> (original sample)
>
>
> %evaluate a Gaussian with the peak at the center element  [rs, cs] =
> ndgrid((1:sz(1)) - floor(sz(1)/2), (1:sz(2)) - floor(sz(2)/2));
> labels = exp(-0.5 / sigma^2 * (rs.^2 + cs.^2));    %
> plot(labels(1,1));
>
> %move the peak to the top-left, with wrap-around  labels =
> circshift(labels, -floor(sz(1:2) / 2) + 1); %     plot(fft(labels));
>
> %sanity check: make sure it's really at top-left  assert(labels(1,1)
> == 1)
>
> end


texts: Sign of manifold vectors in monostatic phased-array radar

texts:
I am reading some notes where the impulse response of phased-array to is given by;

$$
\beta S(\theta, \phi) \bar{S}^H(\theta, \phi) \cdot \delta(t-\tau)
$$

where

\begin{align}
\bar{S}(\theta, \phi) = \exp(+j\bar{r}k(\theta, \phi)) \newline
S(\theta, \phi) = \exp(-jrk(\theta, \phi))
\end{align}

$\bar{r}$ is a vector with the coordinates of the antenna elements of the transmitter array while $r$ is the vector of the coordinates of the receiver elements. In this case (monostatic radar) the two are the same. $k$ is the wavenumber of the wave that propagates in the direction given by $\theta$ and $\phi$. My question is why are $S$ and $\bar{S}$ defined the way they are. It would make more sense to me if they were the conjugate of that. That way the antennas that are closer to the target would receive signals with a more advanced phase which would make more sense to me.


texts: Understanding IIR , Low Pass, High Pass, Chebyshev, Elliptic Filter?

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


texts: How do I calculate the range of a fixed-point number with $a$ integer bits and $b $ fractional bits?

texts:
What does fixed-point number range represents? Why we use formula $2^a - 2^{-b}$, why minus $2^{-b}$? Where $a$ is number of integer bits, and $b$ is number of fractional bits.

If we have for example $a = 8$ and $b = 2$, don't we have a possibility to represent $2^a + 2^{-b}$ number and so that will represent the range?


texts: Can one generate a signal with an asymmetric power spectral density?

texts:
My question is as follows. I know that classically speaking, if you have some time varying signal $X(t)$ its power spectral density $S_X(f)$ will be symmetric around $f=0$ as the signal is real. This is why your spectrum analyzer only shows the positive part, the negative part is redundant.

But if one has a complex signal (such as often encountered in quantum mechanics) the PSD can be asymmetric around 0. This for example leads to the asymmetry between absorption and emission in atoms: atoms have spontaneous emission (emission in the absence of photons in the environment) but not spontaneous absorption.

What I am interested in is if there is a way to physically make such a complex signal with asymmetric PSD. Maybe this can be done by using two channels that output the signal with some phase difference? I've tried looking for some source material on this but I have not been successful.


texts: Does a phase rotation introduce a delay?

texts:
Suppose I have 2 complex time series, $x_1$ and $x_2$.

If I measure the delay between $x_1$ and $x_2$, I get $t$.

If I make $x_2 = x_2 e^{-j 2 \pi 10}$, and measure the delay between $x_1$ and $x_2$, do I still get $t$?


texts: Is it necessary to taper two ends before fft a time series?

texts:
I saw in some codes people always taper the ends of a signal using a cosine taper.

Is that necessary and why?


texts: Why the difference come of 2D Fourier Transforms from two similar image?

texts:
Here is two similar images. I did 2D Fourier Transform for both of them. But for the first image, the result shows as a ring and for the second image the 2D FFT shows as a-two-ring. Examples R listed in the following.

Input image 1 : (For this figure the FFT is a ring.)

Input image 2: (For this figure the FFT is a two-ring.)

Could someone explain the results in the view of Fourier Transform quantitatively? Maybe from the basic theory and calculation of Fourier Transform? Maybe introduction of the auto-correlation function? Any other suggestions are welcomed.


texts: Magnitude and phase response and cut-off frequency of a moving average filter

texts:
The frequency response of a typical moving average filter of length $N$ is given by $H(\omega)=\frac{1}{N}\frac{\sin(\omega N/2) e^{-j \omega ((N-1)/2)}}{\sin(\omega/2)}$. Firstly, isn't the cut off frequency of an average filter equal to 0 Hz (an average filter passes the dc value and filters the rest out)? By that notion i will get the value of $H(0)=1/N$ (using L hospitals rule).
But i don't think that's right. What am i missing here? Care to explain.


texts: What is the advantage of measuring IQ data non-digitally?

texts:
So I know In-phase and Quadrature (IQ) data can be used to analyze changes in both phase and amplitude of the signal. I also know that if I know the I component of the signal (which I could get by measuring it with one oscillator), I could digitally get the Q component using Hilbert Transform. However, I know there are devices (like RTL-SDR sticks) that have two oscillators, 90 degrees out of phase of one another, so they can measure both the I and Q data analogically.

Why go through the trouble, engineering wise, of building such a device when one could always use a computer to generate the Q component by Hilbert transform from the I data? What is the advantage of measuring both?

Thank you.


texts: Custom nearly-linear-phase IIR filter computation gone wrong

texts:
I'm using the code in this book: Algorithms for the constrained design of digital filters with arbitrary phase and magnitude responses to compute nearly-linear-phase IIR EQs.

fvtool() shows the correct Eq mag and phase, but when I try to apply the coefficients to some real sound, the output is very very high (silence due to overlimit), it seems very unstable.

Anyone could tell me why fvtool() is ok but filter() is wrong, maybe try the software?

http: vadkudr.org/Algorithms/LangIIR/LangIIR_examples.html

Jeff

EDIT:

Try these coefficients:

a =
                  1.00
  -7057018074799500.00
   7419034985051048.00
  -2710509977123811.00
   3321548070644472.50
  19380841977826980.00
 -10366336133286466.00
 -17395746351478384.00
   -241875435346629.44
   1537628108108181.70
  -7101604243654517.00
   7251792090687912.00
  23447717670347684.00
 -11610491157524712.00
 -10852963123569024.00
   5000000000000001.00

b =
        -65252253992.00
      29593281937568.00
      31626970863960.00
      -7964372882016.00
     -32245859702352.00
     -25890947971080.00
     -10668161380760.00
      -4361278103120.00
      11507726488128.00
      24495364570416.00
       6689249360480.00

and the code to write the ouput file:

input= wavread('sine+noiz.wav');
output2=filter(b,a,input);
output2=output2/norm(output2);
wavwrite(output2, 44100,  'e:\sine+noiz2_out.wav');

EDIT 2:

Here is full working code and audio files

EDIT 3:

Okay I figured out where the problem was coming from: to make a lowpass at a very low frequency, you have to add more Zeros : the lower the cutoff frequency, the higher the number of zeros necessary...so then it works
But I still don't know why fvtool() shows an ok filter but then the actual computation of an audio file fails...


texts: Difference between single channel and single microphone separation

texts: What is the difference between single channel separation and single microphone separation? Are they equal?


texts: What are the popular benchmark systems and equations in adaptive signal processing?

texts:
In various papers I met repeating equations and systems used during experimental analysis. For example AR model as follows

$x(k) = 1.79 x(k-1) - 1.85 x(k-2) + 1.27 x(k-3) - 0.41 x(k-4) + v(k)$

seems to be kind of popular "linear data generator".

I have few questions related to these popular systems:

There is unlimited number of options how to generate data for experiments, why some systems are used repeatedly?
Can you provide me some more benchmark systems, with notes/hints/informations why they are popular? Why they are selected by many authors?
If I am writing a paper about method, is there any general rule how I should choose/create the data for experiments?

I know this question is really broad, so please feel free to answer just these parts of questions that are answerable according to you. Even that can help me to understand the problem, or reformulate this question or ask more sane question on the topic.


texts:
What does the distance transform encode and how to calculate distance transfrom in the picture below?

My though is that there is a 2 in position (5,7) and the rest is 1 inside the black boundary. Outside would be 0.


texts: Using FFT to demodulated a sine wave envelope with a cosine carrier

texts:
I am trying to implement AM demodulation in Matlab by taking advantage of the fact that in the frequency domain, the spectrum of the modulated signal is shifted by the frequency of the carrier.

I wrote code in Matlab that shifts the componenets back and does an inverse Fourier Transform to reconstruct the signal. The code seems to work well enough for a cosine with a cosine envelope, but if I try using a cosine to modulate a sine, I do not get the correct signal, and my Fourier specturm seems to have  both real and imaginary components, which has me buffled: If the Fourier transform should be the spectrum of the envelope just shifted, and the envelope is a sine, shouldn't the transform be pure imaginary?

I attach my code along with a graph that shows my resultsAny help is appericiated in getting to the bottom of this.

clear all

f = 50; % Message Frequency
fc = 1000; % Carrier Frequency
Fs = 5000; % Sample Frequency
t = (0:(1/Fs):1);

L = length(t);

s = sin(2*pi*f*t); % Message Signal

mod = s.*cos(2*pi*fc*t); % Modulated Signal

% Fourier Transform
a = fftshift(fft(mod));
w = Fs*(-(L/2):(L/2-1))/Fs; % Frequency axis

%% Perform complex demodulation:

% Zero all components less than the carrier frequency
a_zeroes = a;
a_zeroes(w<fc) = 0;

% Move the spectrum back by the carrier circularly to effectivly shift
% back:
a_shifted = circshift(a_zeroes,[0,-fc]);
% Reflect
a_reflected = fliplr(a_shifted);

a_demoded = a_shifted;
a_demoded(1:floor(length(a_demoded)/2)) = a_reflected(1:floor(length(a_demoded)/2));

% Take inverse fft
demoded = ifft(ifftshift(((a_demoded))));

%% Plot fft and demodulated vs. modulated
figure;
subplot(3,1,1); plot(w,real(a),'r','linewidth',4); hold on; plot(w,imag(a),'g','linewidth',2); title('Original FFT');
subplot(3,1,2); plot(w,real(a_demoded),'r','linewidth',4); hold on; plot(w,imag(a_demoded),'g','linewidth',2); title('Shifted FFT');
subplot(3,1,3); plot(t,s); hold on; plot(t, (sqrt(2*pi)).*(demoded)); title('Original Vs. Demodulated');

Here you can see the original FFT. I reconstructed the envelope's spectrum, then did an inverse FFT, but the result has less amplitude and is out of phase.

Red is the real part, Green is the imaginary part.


texts: How do I prove that the absolute value of CTFT of a positive continuous time signal is less than or equal to its value at central frequency(0)?


texts: ROC of Z Transform of $x(n) = 2(3)^nu(-n)$

texts:
Using definition, I got its Z transform as $X(z) = \dfrac{2}{1-\dfrac{z}{3}}$ and the summation converges only when $|z|<\frac{1}{3}$. So its ROC is $|z|<\frac{1}{3}$.

But my question is: for such a left sided signal $x(n)$, its ROC should be inner to the innermost pole. But the pole of $\dfrac{2}{1-\dfrac{z}{3}}$ is $z=3$ and not $z= \frac{1}{3}$. So the ROC I found is incorrect, right?


texts:
I have many datasets which all looks roughly like this:

All the datasets have this in common. First there is an artifact around 0 with an unknown (but likely very high) intensity. Then there is some signal - in this case from ~25 to ~75. Then it's quite (between 75 and 150) and then there is another signal of an unknown characteristic.

My main goal is to analyze the signal which starts at 150, but in order to do that I want to locate a point after the first signal ends, and before the real signal start. i.e. somewhere between 75 and 150.

So far I have been using a very naive approach. Smooth/Blur the entire signal, find the first local maximum, and then locate the following local minimum. This generally works well, but once in a while you get a dataset like this one where the simple naive approach fails.

The reason it fails can be seen on the next image

I started blurring the signal with a kernel size of 5. It worked for most signals, but some signals (like this one) would have a local minimum before the local minimum I was looking for.

I then increased the kernel size to 30, which helped a lot. However, a few datasets (like this one) still managed to have a local maximum and local minimum too much.

Increasing the kernel size to 90 fixes this particular dataset, but it doesn't feel like the correct solution. I guess it's just a question of time before I find a new dataset which have the same problem again.

What would be a better approach to locate the first signal in this case?


texts: How large FFTs can pull signals out of the noise floor?

texts:
I am trying to detect unknown RF tones around -140 dBm and my scan BW is 5 MHz, going through the Noise power calculations the signal is below the thermal noise based on the scan BW. I read that using large FFTs can help to pull signals out of the noise floor. My question is how large FFTs can accomplish this?

The receiver used is an RFIC (LNA, Filter and ADC), and I was thinking FFTs of the order of 2¹⁶ or higher running on a hardware accelerator.

The unknown RF signals are ERP emissions from electronic devices which have RF circuitry.


texts: Why does this image look so bad when dithered with a certain palette?

texts:
I'm trying to write software to create a mosaic of one big image made up of a bunch of smaller images. The result is okay, but I think it would be better if I used dithering.

My problem is that dithering is giving even worse results and I don't know why.

Here's the original:

Here's the same image quantized (no dithering) with the following palette (in (R,G,B) format):

(162, 143, 66)
(128, 148, 168)
(120, 99, 100)
(31, 39, 97)
(126, 116, 103)
(203, 35, 9)
(57, 81, 43)
(104, 101, 98)

Not great, but workable. About what I'd expect.

Now here's the same image dithered using Floyd-Steinberg:

Pretty much unrecognizable. What's going on here?

To make sure my dithering algorithm was implemented properly, here's the same image dithered using 2-color and 8-color palettes.

Both of these are a whole lot better than the other one. Why is that?


texts: Transmission Bandwidth and Sampling frequency

texts:
In LTE standards, for a transmission bandwith of 2.5 MHz, the sampling frequency is 3.84 MHz. I was wondering with this choice, are we violating Nyquist theorem?

I found the details in the following link (page 15)

http://www.freescale.com/files/wireless_comm/doc/white_paper/3GPPEVOLUTIONWP.pdf

I would have assumed that with a bandwith of 2.5 MHz, then the channel sampling frequency (signal input sampling frequency) should be at least 5 MHz?

Thanks.


texts:
I am new to signal processing and just trying to understand what Baud rate really means.

As I understand it, the baud rate speed is really the time that the processor takes when it is ON and when it is OFF.  I attached an image as an example.  For a slower baud rate, a 1 is represented by ON and voltage will stay ON and OFF for a long time as compared to a fast rate where the voltage will stay ON and OFF for a short time.

Am I understanding this correctly?

I am looking at transmitting a digital signal over a long distance cable.  The problem I am having right now is I believe the signal is being distorted because it is modulating too fast.  I need the ON's and OFF's to last longer, to stretch out over time. As I understand it this would be as simple as slowing the baud rate down.

Could someone confirm this? Hope it makes sense, thanks.


texts: Compressing A Range Of Decibel Values to One "Representative" Value

texts:
Don't have any formal dsp experience - sophomore in college.

Working on constructing a 25 band bark spectrogram for psychoacoustic analysis of audio FFT data. To do this, I'm grouping all FFT frequency bins into their relevant bark band and then averaging (summing them and dividing by the total number) the db values in each band to get the representative value for each band.

Is this the correct way to represent a bunch of db values as a single value?


texts: Compare luminosity beetween groups of images

texts:
We have a set of images which are immunofluorescence stainings of mice brain slices. These image show the expression level of a marked protein.

We have two groups of mice, which underwent behavioral experiments that we suspect caused a change in the expression of this protein.

So we want to compare the signal intensity between this two groups of images. Which could be the better approach?

We thought of taking the luminosity channel of every pixel in the selected area and average it among all the pixel to retrieve a single luminosity value for the picture. Is this a correct method? Isn't it too much simple? Is there a better method to achieve more significant data?

Thanks a lot!


texts: How to get the X and Y Coordinates of the circles from an image?

texts:
I am building an simple website to show the first train arrival and last train departure timing in Singapore. I already wrote a simple code which could be found here. I am placing an circle on top of each station so when hovered
it will display the timing for each station.

Thus far I found the location(X and Y Coordinates) of each station manually added it to the code. But then I just realized that the map I am using is not the latest MRT Map. I don't want to go through the process again waste time for the new map. I am looking for a easy way to do this from the code.

There are two techniques I can think of right now:

Find Equations for each Line assuming circle as points.Then place
the circle at the x and y coordinate. I understand  that one only
Harbourfront to Punngol(Purple) line is the easiest because its a
straight line. I am not so sure what is the equations for other
lines.
Use template matching technique. Take a copy of the circle and look
for that circle in the whole image and get the coordinates.I
understand OpenCV can do template matching but how to do it in
JavaScript? Is there any simple JavaScript  image library to do
template matching?

Any other suggestions?


texts: Why is this recursive DFT algorithm not equivalent to this iterative method?

texts:
Edit 1/30 - Taking @Fat32's edits into account, it seems like there is still an issue with the scale of the frequency axis. While version 2 correctly identifies the response at 1 HZ, version 1 seems to be covering a frequency range of 1/T.

I'd like version 1 to cover the same range of frequencies as version 2. Can anyone help with this?

(End edit 1/30)

--

I have 2 DFT algorithms that I would expect to return same frequency response. Unfortunately, the more efficient recursive algorithm does not seem to behave as expected.

Version 1 - Efficient Divide and Conquer method, but output is incorrect:

function [ s ] = DFT_ver_1( x )

N = length(x);

if N == 1
    s = x(1);
    return;
else

X1 = DFT_ver_1(x(1:2:N));
X2 = DFT_ver_1(x(2:2:N));
s = zeros(N,1);

for k = 1:(N/2)
        W(k)     = exp(-1j*2*pi*(k + 1)/N);
        s(k)     = X1(k) + W(k) * X2(k);
        s(k+N/2) = X1(k) - W(k) * X2(k);
end

Version 2 - Inefficient, but generates expected results:

function [ s ] = DFT_ver_2( x , f, n)

N = length(x);

b = zeros(N,N);
b_1 = -2*pi*(f/N);

for idx = 1 : N
for jdx = 1 : N
    b(jdx, idx) = b_1(idx) * n(jdx);
end
end

anlyz_fn = cos(b) + 1i * sin(b);
s = single(zeros(N,1));

for k = 1 : N
    val = 2 * sum(anlyz_fn(k,:) * x.');
    s(k) = val;
end

end

I would expect both algorithms to return the same result. However, this does not appear to be the case.

You can see that the bottom plot (version 2) shows the correct frequency response to a 1 HZ signal, but the middle (version 1) does not:

Code to run both:

       T  = single(3.20); % (sec) time window
       dt = single(0.05); % (sec) sample time
        N = T / dt;          % (ct) num samples
        n = 0 : N - 1;       % (ct) bucket index vector
        t = 0 : dt : T - dt; % (sec) time vector
smpl_freq = 1 / dt;          % (Hz) sampling frequency
 freq_res = smpl_freq / N;   % (Hz) frequency resolution
        f = n * freq_res;    % (Hz) freq. bucket vector

x_t = sin( 2*pi*t );

subplot(3,1,1);
plot(t, x_t);
xlabel('Sample Time (sec)');
ylabel('Magnitude');

subplot(3,1,2);

s_v1     = DFT_ver_1( x_t); %, f, n );
s_v1_mag = abs( s_v1(1:N/2) )/N;

stem(f(1:N/2)/T, s_v1_mag);

xlabel('Freq. Response (Hz) v1');
ylabel('Magnitude');

s_v2     = DFT_ver_2( x_t , f, n );
s_v2_mag = abs( s_v2(1:N/2) )/N;

subplot(3,1,3);
stem(f(1:N/2) / T , s_v2_mag);
xlabel('Freq. Response (Hz) v2');
ylabel('Magnitude');


texts: What kind of signal reppresents this Power Spectral Density?

texts:
I'm sampling 8 bioelectric signals with a embedded board which use an 8-channels ADC (AD7175-8). My sampling rate for every single channel is about 6250 Hz. When move the analysis in the frequency domain, what I obtain is the power spectral density as follow

instead of an (almost) flat one as I expect. It seems that there is a square-modulated interfering signal. I want to understand the nature of this signal and for this reason I'd like to know if you can tell me what kind of signal generate this particular power density spectrum.


texts: Increasing the number of bins in DFT with limited points and high samplerate

texts:
Apologies for the potentially simple question in advance. I have a limited understanding of the subject, but need to apply this to a project on short notice.

My goal is to run a DFT on a signal with N points and sample rate of R. The signal is often much shorter than 1 second, hence R is much larger than N. This causes the resulting DFT bins to skip many frequencies I'm interested in. As I understand, bin intervals are related to R/N, so I need to either increase N or decrease R. I was thinking about trying one of the following:

Stretch the signal by adding intermediate points which are averaged between real points so that N is large enough, then transposing the resulting frequencies back down by the stretch factor.
Appending to the signal with either 0s or another copy of itself to increase N.
Downsample the signal to lower R.

Are any of these ideas reasonable? I can not gather more points of the signal.

Edit: forgot to mention that the frequencies I'm interested in are very low (~20-300hz), so lowering the sample rate (usually 44.1k) shouldn't be an issue.


texts: Spectral averaging without phase information

texts:
In the context of signal averaging to reduce uncorrelated noise:

Is it possible to perform signal averaging from just the magnitude spectrum of certain signals? Or that would only work if we know also the phase information of those signals. In that case, what would be the requirement for the signals to average, regarding phase information? I guess they both have to be somehow "related" to the same "starting point".


texts: fit theoretical spectrum to simulated one

texts:
I have a bunch of simulated time series, for which I can compute the power spectrum. Generally, the simulated power spectrum can be sketched as follows:

I now aim to calculate the features of the theoretical power spectrum. The theoretical power spectrum can be represented by:

$$ S_{th}=\frac{4\left(L/U_{hub}\right)}{\left(1+6f\left(L/U_{hub}\right)\right)^{5/3}} $$

where

$$ L = constant\ length\ scale $$
$$ U_{hub} = constant\ speed $$
$$ f = frequency\ vector $$

Given Uhub and f (they are "environtmental variables"), the theoretical power spectrum will approach, within a certain tolerance, the simulated one only for a certain defined value of L. This procedure will lead to the following figure:

Therefore, I am interested in developing a method which allows for the extrapolation of the right L value.

I have been thinking of using lsqcurvefit. Up to now I used it this way:

function p_theo = ps_th(x,f)
 L = x(1);
 Uhub = x(2);
 exp = 5/3;
 C = (L/Hub);
 f_x = 6.*f.*C;
 p_theo = 4*C./((1 + f_x).^exp);
end

lsqcurvefit(@ps_th,[330;Uhub],f,ps_sim)

But I am evidently using lsqcurvefit improperly, since only L is driving the optimization and Uhub must stay fixed.

Can anyone shed light on this problem?


texts: Compensate for phase shift of Hilbert transform

texts:
I'm using Octave and trying to use the "instfreq" function from the time frequency toolbox which requires an analytic signal input. To get this analytic signal I'm using the Octave function "hilbert" on my real valued signal thus:

analytic_sig = hilbert( my_real_valued_signal ) ;
[ instf, t ] = instfreq( analytic_signal ) ;

where instf is the instantaneous frequency I'm trying to obtain. However, the results are not quite what I expected. I suspect that the 90 degree phase shift induced by the hilbert transform is where the problem lies, so my question is how can I alter the output of the Octave "hilbert" function to compensate/adjust for this phase shift?

Edit in response to comments

With a simple test case I'm creating a signal x with instantaneous frequency ifl

octave:1> [x ifl] = fmlin(10,0.05,0.35)
x =

  -0.97815 - 0.20791i
  -0.80902 - 0.58779i
  -0.30902 - 0.95106i
   0.50000 - 0.86603i
   1.00000 + 0.00000i
   0.30902 + 0.95106i
  -0.91355 + 0.40674i
  -0.30902 - 0.95106i
   1.00000 - 0.00000i
  -0.50000 + 0.86603i

ifl =

   0.050000
   0.083333
   0.116667
   0.150000
   0.183333
   0.216667
   0.250000
   0.283333
   0.316667
   0.350000

but in my envisioned real life application I will only have data for the real component

octave:2> real_sig = real(x)
real_sig =

 -0.97815
 -0.80902
 -0.30902
  0.50000
  1.00000
  0.30902
 -0.91355
 -0.30902
  1.00000
 -0.50000

using the hilbert function I create an analytic signal from my available real data

octave:3> anal_sig = hilbert( real_sig )
anal_sig =

  -0.97815 + 0.07265i
  -0.80902 - 0.41187i
  -0.30902 - 0.92331i
   0.50000 - 0.81514i
   1.00000 + 0.04490i
   0.30902 + 0.98765i
  -0.91355 + 0.52573i
  -0.30902 - 0.89042i
   1.00000 + 0.28002i
  -0.50000 + 1.12978i

and when this is put in to the instfreq function I get the measured instantaneous frequency instf

octave:4> instf = instfreq( anal_sig )
instf =

   0.10520
   0.13131
   0.15427
   0.18209
   0.20487
   0.24755
   0.31328
   0.30974

The instfreq function returns values in the range [2:end-1] of its input, so padding to make an easy comparison

octave:5> [ ifl [ 0 ; instf ; 0 ] ]
ans =

   0.05000   0.00000
   0.08333   0.10520
   0.11667   0.13131
   0.15000   0.15427
   0.18333   0.18209
   0.21667   0.20487
   0.25000   0.24755
   0.28333   0.31328
   0.31667   0.30974
   0.35000   0.00000

it can be seen that the measured frequency is different from the true, known frequency. Thinking of a phasor diagram, I was thinking that perhaps some trigonometric manipulation of the real and imaginary components of the hilbert function output might correct this.


texts: why always structured Images are considered as 2D signals?

texts:
I am dealing with 2D signals that are random. To be more specific my input is a matrix of 1's and 0's. Moreover, at any position (n1,n2) the probability of having a 1 or a 0 is same. One example is shown below

When I look at books dealing with 2D signal processing, everything is explained wrt to image processing. In my understanding, image is a very special kind of 2D signal where one can expect to see some relationship between the pixels like EDGES. Such features are useful when doing image restoration,etc.

These books start with defining 2D signals and system but explain everything wrt to image processing application which is a bit restrictive.
Why is the case?


texts:
I looked over the other entries regarding peak detection and none seem to answer my question.

I'm working with Fourier spectra of digitized audio that can't be measured again. There are no constraints on the nature of the audio.

Finding outliers is easy. I'm worried about "fat" peaks whose contours might be made jagged by background noise. Their "summits" are peaks among peaks. So how salient and separate does a peak need to be in order to qualify?

Is there a statistical way of approaching the problem? I could do something ad hoc, but without firm theoretical grounding, I rely much more on testing to confirm the algorithm's robustness. I'd like to know theoretically, rather than empirically, that my algorithm is sound.

Also, for those who have read this far, is there a good corpus of audio test data I can use for analysis algorithms?


texts: When inverting a transfer function, solving for the input using the output does the causality status change

texts:
suppose $y(n)=ax(n-1)+bx(n-2)+\dots$  ($y$ is the output and $x$ the input). What happens if I want to solve $x(n)$ from $y(n)$?

Z transform: $$Y(z)=G(z)X(z)\tag{1}$$
then         $$X(z)=\frac{1}{G(z)}Y(z)\tag{2}$$

What are the properties of $1/G(z)$ ? If $(1)$ is causal what is the status of the inverse $(2)$? The roles  of the poles and zeros have changed.


texts: How to set borders for image translation

texts:
What i am trying to do is to build a function similar to how imtranslate works in matlab.What I have until now thanks to FAT32's answer, is a function for translation which have the following effects:

Since the limits of the image are reached when it is translated from left to right, we can see that the translated pixels are in the left side.
What should be done to prevent such phenomenon?


texts: Fourier Transform of image convoluting with kernel


texts: What effect does mutipath have on estimating optimal sampling time using the averaging method described therein

texts:
This question takes off from this question regarding syncronization of BPSK signals. For the sake of argument let us assume 10 samples make up 1 bit.

One method currently suggested is break up the envelope of the downmixed and matched filtered I and Q signals into multiple 10 sample bit intervals, Then, the average of those multiple 10-sample long vectors is taken, to yield a final 10-sample long vector. The position with the largest peak is taken to give an estimate of the optimal sampling position for a bit.

The idea in the averaging cancel out the effects of the noise in this case. Can this method be counted on to also mitigate multipath effects? If not, why not? Is it because the position will 'slip' over time? I tend to not think this will happen, but would like your inputs. Thanks


texts: What is a good example of an ergodic process?

texts:
I'm trying to find simple examples of an ergodic process. What process comes to your mind as a good illustration of its properties?

A quick research (Wikipedia, another answer) mainly gives examples of non-ergodic processes. Also, I'm wondering which real world phenomena lend itself to be modeled as an ergodic process?


texts: Moving from deterministic signals to stochastic signals in s-domain (Power Spectral Density)

texts:
Assume we have the following system (coming from control systems theory, hence in s-domain)
$ Y(s) = H_A (s) \cdot A(s) - H_B (s) \cdot B(s) $
I now wish to consider $a(t)$ and $b(t)$ as white noise of unit variance, and I'm interested in the Power spectral density of $y(t)$ (rather the RMS of y(t) derived via the integral of the PSD of $y(t)$, but regardless).
Intuition tells me, that I should get something along the lines of
$ |Y(j\omega)|^2 = |H_A (j\omega)|^2 \cdot 1 + |H_B (j\omega)|^2 \cdot 1 $
But I cannot show how. Especially the switch from subtraction to addition stumps me.


texts:
I am new to signal processing, and was reading about filters. I came upon the sobel filter which has the following forms,

From what I understand to apply this filter to a 2-d signal, place the filter's center on the correct point and multiply the coefficients with the signal at the points of overlap and add them together. So for the following example signal, applying the horizontal sobel filter from above would give:

Signal                 Output (edges are left alone)
|100|100|100|100|      |100| 100| 100|100|
| 10| 10| 10| 10|      | 10| 360| 360| 10|
| 10| 10| 10| 10|      | 10|-360|-360| 10|
|100|100|100|100|      |100| 100| 100|100|

Separable filters are more computationally efficient and the sobel filter is one of them. My problem is I can't figure out how the separable filter is applied. So, what I want to ask is how would the sobel filter be applied separably?


texts: How to undecimate and make shift invariant a Dual-tree Complex Discrete Wavelet Transform in R

texts:
I have the following vector and wavelet transform (from R waveslim package)

x<-c(0.1,0.4,0.1,-0.05,0.025,0.12,0.42,0.14,-0.15,0.25,0.35,0.23,0.11,-0.35,0.025,0.1,0.4,0.1,-0.05,0.025,-0.12,0.2,0.09,-0.05,0.05,0.15,0.13,0.21,-0.15,0.023,0.1,0.4,0.1,-0.05,0.025,0.12,0.42,0.14,-0.15,0.25,0.35,0.23,0.11,-0.35,0.025)
J = 8
Faf = FSfarras()$af
    Fsf = FSfarras()$sf
af = dualfilt1()$af
    sf = dualfilt1()$sf
w = dualtree(x, J, Faf, af)
w
#For the synthesis of w, the output is
idualtree(w, J, Fsf, sf)

Would you happen to know if there is a function or mix of functions in any R package that may undecimate and make shift invariant the above transform, I have reviewed the packages in R and could not find any of this two functions. Otherwise it will be very helpful if you could drive me over the steps to carry over the above mentioned processes.


texts: How to find a certain frequency in a signal that varies in time?

texts:
I have an EEG signal. It is amplitude verses time. I want to find out how certain frequencies in that signal vary with time.

One way I think I can do this is to do a short-time-Fourier-transform on it (that is, split it in small pieces and do a Fourier transform on each piece), then track the frequency I am interested in across the slices.

Is there a different/standard way of doing this? I only ask because Its going to be a lot of processing overhead doing it my way and I'm doing this in python.

thanks in advance

cleerline


texts:
I have a discrete-time system defined by  $y[ n]=x[5n+2]$. And an  input $x_1[n]=\delta[n-5]$.

Is the output  $y_1[n]=\delta[25n-5+2]$?


texts: Convolution theorem for "weighted" convolution?

texts:
Consider what I call a "weighted" convolution of a two-dimensional signal (image) with itself:

$f({\bf r}) = \int d {\bf r}' \,  g({\bf r}') s({\bf r},{\bf r}') g({\bf r}-{\bf r}')$

where $s$ is a weighting function, with $s({\bf r},{\bf r}') = s({\bf r}+{\bf r}',-{\bf r}')$. My ultimate goal is to perform edge detection on $g$, i.e., find discontinuities in $g$, from knowing only $f$.

If $s=1$, I believe I can obtain $g$ from $f$ using the convolution theorem and a deconvolution scheme, but with a general $0<s<1$ this is no longer possible.

Questions:

Does the integral I write above have a formal name?
Is there something similar to the convolution theorem for such a "weighted" convolution?
Is there any other result that may help me perform edge detection on $g$ from knowing only $f$?


texts: FIR filter design and implementation - sample rate and number of taps

texts:
I have been designing and using IIR filters to process audio for a while now but want to design some FIR filters for delay equalization. I have done some preliminary work using the following approach:

I start with a desired "group delay EQ" curve. This starts at zero, and then has increasing delay at higher (audio) frequencies.
I calculate the corresponding phase lag by integrating, using the definition of group delay. This is still on the audio log-frequency grid.
In the next step, I interpolate the phase onto the equal-linear-spacing frequency grid that will be used for the discrete transform processing. I use 32768 samples for this step.
I then generate the real and imaginary components of the complex number that results for this phase angle, with the magnitude of the response equal to 1.0. I make sure that H(k) = H*(N-k).
I take the inverse DFT of the real and imaginary components to transform the response to the time domain. Although the output produces both a real and an imaginary component the imaginary component is essentially zero. The impulse is present in both short positive and negative times (at the beginning and end of the data set) but only spans about 20% of the full data set.
I set the imaginary component values all to zero. I manipulate the real component of the time domain response (the impulse), shifting it "to the right" to move the part of the impulse that is at small negative times (at the "end") to positive time. I then apply a rectangular window to the data, setting everything outside the window to zero. From what I understand, the remaining non-zero values are the FIR filter coefficients.
To find out what the filter response will look like I perform the forward DFT on the shifted, windowed impulse to bring the data back into the frequency domain. I then calculate and plot the filter magnitude (SPL), the phase, and finally the group delay.

The above procedure seems to give me the FIR filter response that I want to achieve. I can see the tradeoffs in the frequency domain when I set fewer or more taps to zero. So my approach seems to be working. Now on to the implementation and questions:

Because I am new to FIR filtering, I am confused about the data sample rate and number of coefficients calculated above and how that factors in when I want to implement the FIR filter. I may either write my own code or use some existing code or package to perform the correlation between filter and audio data stream.

Questions:

A. How will the number of bins that I use in the inverse DFT (step 5 above) influence the resulting filter? Will using more bins help to fit sharper features and vice versa? Is the number of bins usually optimized when designing a filter to keep the calculation overhead low when the filter is implemented?

B. I performed all the steps above assuming a sample rate of 48kHz. The only time that the sample rate came into play was when I calculated the frequencies of each bin (e.g., df) for the iDFT and DFT calculations. Given my final set of non-zero filter coefficients (obtained in step 6 above) is the filter simply (naively) calculated as y(n) = SUM_over_m[h(m)*x(n-m)] where 'x' is a sample in my audio data stream at the same 48kHz sample rate? That seems too easy/simple... (I understand that a practical FIR filter implementation would not carry out the calculations in this way, but would use FFT, etc.)

What really puzzles me is this: any number of coefficients can be set to zero to approximate the filter, yet you may vary the number of bins in the iDFT/DFT operations (change resolution) and then truncate the resulting filters to the same number of taps. Is it correct that the coefficients would be different even if they are the same in number, and that the coefficient values are the only thing that is "encoding" the sample rate used in the filter design and the resolution that was chosen???

Please help me understand these concepts a little more clearly. Thanks!


texts:
I have a 3D object which I have segmented and represented as a 3D binary array. I need to find the longest line which fits inside of the object in three dimensional space. What would be an efficient method I could use to approach this problem.

The following is an example of what I am trying to do but in 2 dimensions. The black part of the image is the background and the white is a segmented object. The red line is the longest line which can be drawn inside the object. I would like to find the length of this line.

I could do this by calculating the distance between each pair of two points on the surface of the object and taking the longest distance as my result, but this seems horribly inefficient particularity when solving the problem in 3 dimensions.

Is there a better way to solve this problem.

Thanks


texts: DSSS/CDMA: Number of distinguishable users with gold codes

texts:
From wikipedia, I know that Gold codes have length $2^n-1$, where $n$ is number of LFSR elements and that there are $2^n-1$ different Gold sequences for this case. E.g. assuming that $n=6$, I have a Gold sequence with a length of $63$ bits. But how many users can I differentiate with this?

On the one hand I would have said that I can differentiate $2^{2^n-1}$, i.e. in this case $2^{63}$ users because there are $63$ bits that can either be $0$ or $1$. But on the other hand, wikipedia says there are only $2^n-1$ Gold sequences with that length which would imply that I can also serve $2^n-1$ users.

Or the question asked the other way around: If I have to address $K$ users, each by means of an unique code, how many bits for the Gold codes do I need?

Edit: Moreover, I found this page that says that there are only $6$ different Gold sequences with a length of $63$ bits.


texts: How do I perform 2D Fourier domain multiplication if the filter mask doesn't match the image size?

texts:
Let's say I have an image that is 512 x 512 pixels. I've been tasked with creating two ideal half-band low-pass filters that will filter the image. The first filter is 8 x 8, and the second one is 16 x 16.
Each filter will represent the same frequency range (0 to Nyquist) and possess the same shape (half-band ideal filter). The bigger filter will feature better frequency resolution resulting in improved roll-off at the cut-off frequency.
However, let's say I wanted to do the filtering in the Fourier domain. How would multiplication work if the filters and images are different sizes?
It seems like the answer is to increase the size of the filter. Two options come to mind:

Zero pad the filter's fourier domain. However, this would result in shifting the cut-off frequency such that is no longer a half-band filter.
Interpolate the filter fourier domain. Essentially stretch out the pass-region by adding more "ones" to alter the frequency resolution. However, this would seem to alter the roll-off of the filter. Essentially the 8x8 and 16x16 filters would become the same.

So how exactly should multiplication occur if the filters don't match the input size? It seems like there are flaws in both zero padding and interpolation.


texts: How do I make sense of the cosine wave having Fourier Transform coefficients which have infinite magnitude?

texts:
To illustrate my question better, consider the Fourier Transform of an aperiodic (as a periodic cosine wave has a Fourier Transform not Fourier Series) cosine wave

$$f(x) =
\begin{cases}
\cos(2\pi f_0x),  & \text{$ 0 \le x \le 2\pi$} \\
0, & \text{else}
\end{cases}$$

$$F[f(x)] = \frac{1}{2}(\delta(f - f_0) + \delta(f + f_0)) $$

This above implies an aperiodic cosine wave consists of two Fourier Transform coefficients which have infinite magnitude (as a delta function has infinite magnitude). Therefore, does this imply that a perfect cosine wave can not be produced in real life?


texts: As known, we can get a 'phase spectrum' from the DFT of a input signal. Assume, we do a DFT on a given equal interval sampled 50Hz AC signal, the signal is a complete whole cycle, but the start sample point may at any point. And I get the amplitude and phase from the DFT, but what's the reference point of the phase?


texts: Is it possible to compute the wavelet transform of a unit step function?

texts: Is it possible to find theoretically the continuous or discrete wavelet transform of a unit step function (consntly 0 for t<0 and constantly 1 for t>=0) or of a function starting from zero and approaching 1 in a finite time? I just wonder if this is possible because these signals don't have a finite energy. Thanks. E.


texts: Oil rig real-time data processing, waves/tides elimination

texts:
I was asked to find a way to analyse/process a particular set of data collected by oil drilling rigs.

Among these real-time collected data we have the "mudflow", BUT, as the rig is floating it moves up and down due to waves and tides.

When the rig moves up the mudflow is slightly lower and when it moves down it's slightly higher.

I don't know which approach to choose to solve the problem and get rid of the "wave/tide" in the data collected to obtain a more accurate mudflow chart.

The person who gave me this task talked about Fourier transforms but I'm not sure if it's the right way to do after spending 2 days thinking/searching on this problem.

If you guys have a beginning of an answer it would be a great help for me.


texts: Digital filtering based on frequency component amplitude... why not?

texts:
I've got a very general question.
I've just implemented a filter working in frequency domain that simply cuts every frequency component whose modulus amplitude falls below a certain threshold value. As to say, "just keep the main frequencies in the signal". See example below:

Here is the effect in time domain on a noisy square wave:

It could seem to have poor performance in time domain, but this 'frequency picking' worked perfectly for my particular problem.
However, it seems to me that this is not so usual in DSP, and, since I'm not a DSP expert (I'm a physicist and not an electronic engineer), I wonder if this kind of approach (i.e. select the frequencies to keep based on their amplitude in the transformed domain and discard all the rest) is a known method in literature and, if it's so, what's its name. Or, on the contrary, I would be curious to know if there are some general reasons to avoid such a criterion.
I found no reference on the web...

Thanks!

Federico


texts:
I have a noisy signal that roughly switches between two distinct amplitude levels, i.e. looks like a pule train with irregular pulse with and small variations in the "on" and "off" amplitude over time, part of it could look something like this:

I'm looking for a robust algorithm that will produce a "good" (I'm not sure what criterion to apply here) binary decision threshold from this signal such that signal samples with amplitude above that threshold correspond to plateaus and samples with amplitude below the threshold correspond to minima.


texts: Generating audio clip by superposing two files

texts:
I'm currently trying to generate a set of audio files where some audio events (e.g. dog bark) are immersed in a background audio scene (e.g. crowd noise).

I understand that if the event would have happened in the original scene, then there would also be some components due to the interaction between the sound and the environment. In other words, this should be, from my understanding, a convolutive mixture.

My question is, if I approximate the mixture by summing the two signals, thus doing an instantaneous mixture, am I losing a crucial part of the audio signal? In which circumstances is this a reasonable assumption, if any?
My final objective is to train a classifier with the resulting audio.


texts: Understanding what channel gain is and why it is important side information

texts:
I have a two part related question. Channel gain is often being considered the side-information that the Rx and Tx usually know. Why is channel gain such an important side-information? And second, what exactly is channel gain?

I am reading many definitions of it, but I don't have a solid understanding. I've been told that it's a measurement of how well the power works given all the different impediments, such as hardware imperfections, noise, etc. This sounds a lot like SNR. Are they the same or is there a distinction between them?

Moreover, I would understand of the BER of the channel (w/o any error correction) is important side-information. Because that allows for correct arguments to be used during encoding and decoding.


texts: Is is necessary to learn digital signal processing before starting research in digital image restoration?

texts: I am going to start my research on digital image restoration, I just want to know that should i learn the course digital signal processing before starting my research.


texts: How sensitive is parameter estimation to uncertainty in time?

texts:
Suppose I have the following deterministic system that is a function of time:

$y = k*t + b$

Now let's say I have the ability to measure this system but there is a zero-mean noise component in the measurement. This is represented by the following:

$y_m = k*t + b + v_{noise}$

My goal is to estimate $k$ and $b$ which is represented by $\hat{k}$ and $\hat{b}$. I have access to the noisy measurement $y_m$ and time $t$. Using $\hat{k}$, $\hat{b}$, and $t$ I can predict the output:

$\hat{y} = \hat{k} * t + \hat{b}$

My estimate $\hat{k}$ is considered optimal if $(y_m-\hat{y})^{2}$ is minimized. I have essentially defined a cost function $J = (y_m-\hat{y})^{2}$.

--

Up until this point, the uncertainty I've been dealing with has been in the measurement. However, what would happen if there was also uncertainty in my time $t$?

How would I quantify how sensitive my estimate is to uncertainty in $t$? Obviously my estimate would be terrible if I had an inaccurate clock, but I'm having a difficult time determining how sensitive it would be. I'm also curious on the topic of stability for this. Assuming I could sample forever, would my parameter estimate converge?


texts:
How to constrain the object detection problem?

It would be tempting to ask for precision such as: "It depends, does it have to be viewpoint invariant, is there going to be viewpoint changes, etc.?" Actually, it is exactly what I want to know. I have a specific application in mind and I need a structured way to help me constrain and define correctly the problem. I am pursuing a graduate degree but I am new to the field.

I mean, at first I read the literature about things such as binary keypoint descriptor, etc. but in the end, I am putting the cart before the horse, not having constrained my problem correctly, I cannot know or prove whether binary keypoint descriptors or else are a good starting point for my application...

Unfortunately my adviser is unavailable for a week or two and my colleagues are not specialized in that field.


texts: image analysis: Drawing lines on curvlinear structures and dots on the tips of branches

texts:
I want to make an algorithm for:

From vascular images like this:

I want to plot lines and draw points on the tip of branches like this:

Is there any literature or reference? or any idea?

I don't know how to approach.

--
(added)

FYI, the definition in the paper is like this:

Green dots: We want to know just the number of filopodia

Red line: goes up and down to the very tip of the sprouts and connects the edges of the sprouting ECs, and calculate its length

Blue line: line connecting the bases of the sprouting ECs


texts: Narrowband DOA Beamforming techniques on Wideband signal

texts:
I'm trying to implement a tracking system (undergrad thesis) using DOA of acoustic signals. I'm testing this by playing a 2kHz sound and receiving the signal with four microphones in a ULA.

So, the band I'm interested in is narrowband but naturally the signal received is wideband.

I have been able to successfully implement a time delay beamformer however when I have tried to implement a phase shift beamformer I have failed.

My suspicion is that you can only perform phase shift beamforming techniques on narrowband signals and will not work even if you are looking for a narrowband within a wideband signal. Am I correct?

If so, will a simple filter be good enough to correct this issue to transform the signal into a narrowband one?


texts:
When energy is referred to as the square summable sequence, is that energy a representation of the power of the signal? How is the energy of frequency determined?

E.g. what if an audio signal has high energy on the higher frequencies and another has high energy on the lower, bass, frequencies, how is this determined?

What exactly is the power from the square summable series representing then and is it useful for audio?


texts: Inverse of Wavelet Transforms - Background and Noise Removal

texts:
Main Problem: How can you inverse Wavelet Transforms
(Using the data given by signal.scipy.cwt)
I was wondering if anyone understands the scipy.signal.cwt() function well enough to use it to remove backgrounds and noise from data.
I have seen where Matlab has an inverse continuous wavelet transform function which will return the original form of the data by inputting the wavelet transform, although you can filter out the slices you don't want.
MATALAB inverse cwt funciton
Since scipy doesn't appear to have the same function, I have been trying to figure out how to get the data back in the same form, while removing the noise and background.
How do I do this?
I noticed that the wavelet has negative values, when the original data is made of Gaussian-like feautures, so I tried squaring it, but this gives me values way to large and not quite right.
I tried reading about the transforms but everything is very complicated which was difficult to parse in order to figure out what I needed to do.
Here is what I have been trying:
# Compute the wavelet transform
# I can't figure out what the width is or does?
widths = range(1,11)
# Ricker is 2nd derivative of Gaussian
# (*close* to what *most* of the features are in my data)
# (They're actually Lorentzians and Breit-Wigner-Fano lines)
cwtmatr = signal.cwt(xy['y'], signal.ricker, widths)

# Maybe we multiple by the original data? and square?
WT_to_original_data = (xy['y'] * cwtmatr)**2

And here is a fully compilable short script to show you the type of data I am trying to get and what I have etc.:
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt

# Make some random data with peaks and noise
def make_peaks(x):
    bkg_peaks = np.array(np.zeros(len(x)))
    desired_peaks = np.array(np.zeros(len(x)))
    # Make peaks which contain the data desired
    # (Mid range/frequency peaks)
    for i in range(0,10):
        center = x[-1] * np.random.random() - x[0]
        amp = 60 * np.random.random() + 10
        width = 10 * np.random.random() + 5
        desired_peaks += amp * np.e**(-(x-center)**2/(2*width**2))
    # Also make background peaks (not desired)
    for i in range(0,3):
        center = x[-1] * np.random.random() - x[0]
        amp = 40 * np.random.random() + 10
        width = 100 * np.random.random() + 100
        bkg_peaks += amp * np.e**(-(x-center)**2/(2*width**2))
    return bkg_peaks, desired_peaks

x = np.array(range(0, 1000))
bkg_peaks, desired_peaks = make_peaks(x)
y_noise = np.random.normal(loc=30, scale=10, size=len(x))
y = bkg_peaks + desired_peaks + y_noise
xy = np.array( zip(x,y), dtype=[('x',float), ('y',float)])

# Compute the wavelet transform
# I can't figure out what the width is or does?
widths = range(1,11)
# Ricker is 2nd derivative of Gaussian
# (*close* to what *most* of the features are in my data)
# (They're actually Lorentzians and Breit-Wigner-Fano lines)
cwtmatr = signal.cwt(xy['y'], signal.ricker, widths)

# Maybe we multiple by the original data? and square?
WT = (xy['y'] * cwtmatr)**2

# plot the data and results
fig = plt.figure()
ax_raw_data = fig.add_subplot(4,3,1)
ax = {}
for i in range(0, 11):
    ax[i] = fig.add_subplot(4,3, i+2)

ax_desired_transformed_data = fig.add_subplot(4,3,12)

ax_raw_data.plot(xy['x'], xy['y'], 'g-')
for i in range(0,10):
    ax[i].plot(xy['x'], WT[i])

ax_desired_transformed_data.plot(xy['x'], desired_peaks, 'k-')

fig.tight_layout()
plt.show()

This script will output this image:

Where the first plot is the raw data, the middle plots are the wavelet transforms and the last plot is what I want to get out as the processed (background and noise removed) data.
Does anyone have any suggestions? Thank you so much for the help.


texts: An input symbol is randomly chosen from a set of symbols with known associated probabilities and encoded using a prefix code that minimizes the expected codeword length. Is it possible to further reduce the total expected codeword length by randomly choosing the prefix code from a set of prefix codes with associated probabilities?


texts:
Common non-rectangular window functions all seem to be symmetric.  Is there ever a case when one would want to use a non-symmetric window function before an FFT?  (Say if the data on one side of the FFT aperture were considered a bit more important than data on the other, or less noisy, etc.)

If so, what kinds of asymmetric window functions have been studied, and how would they affect the frequency response compared to a (more lossy?) offset symmetric window?


texts: Minimizing Time Sidelobes with Pulse Compression

texts:
I am trying to compute a compression filter function to minimize the error from a a desired pulse compression result.

The usual approach to doing this is to minimize the RMS error of the the compressed signal while it's represented in linear terms (i.e., in volts). This method handles complex signals and pulse compression for my nonlinear FM signal, and appears to work as advertised. (The method is described in the end notes of this question.)

While the method minimizes the RMS error, it leaves some individual samples larger than I'd like them to be, while producing some that are much lower than they need to be. What I'd like is a time sidelobe response that is more uniform in the time domain. Something like the sidelobes of a Chebyshev Type II filter function is what I'm looking for, but two-sided and in the time domain, not the frequency domain:

This would be much more useful for my purpose (which is for a radar application).

My first thought is to perform the RMS calculations in decibels, rather than as linear values. If I could do that, the same optimization function can be used to solve the liner equations for minimizing the error. It may work or it might not, but that's all I can think of at the moment. One problem is that I don't know how I would handle the complex signals and the complex compression function if I do this in decibels. So I'm stuck at the moment.

Can someone give my some guidelines or a solution to achieve what I'm looking for?

End Notes:

Here is the general method for minimizing the RMS error:

Given a complex pulse
$$x(n), \ \ 0 \leq n \lt N$$
and a pulse compression function $$\omega(k), \ \ 0 \leq k \lt K$$
we have the compressed pulse
$$z(n)=\sum_{k=0}^{K-1}x(n-k)\omega(k), \ \ 0\leq n \lt (N+K-2)$$

If the desired compression results is
$$d(n), \ \ 0\leq n \lt (N+K-2)$$
and the error is defined as
$$\epsilon(n)=z(n)-d(n)$$
the residues is deifned as
$$\epsilon^2=\sum_{n=0}^{N+K-2} |d(n)-z(n))|^2 = \sum_{n=0}^{N+K-2} |d(n)-\sum_{k=0}^{K-1}x(n-k)\omega(k)|^2$$

If $Z$ and $D$ are column vectors for $z()$ and $d()$, we can write
$$\epsilon^2=(D-Z)^{*}\cdot(D-Z)= D^*D-D^*Z-Z^*D+Z^*Z$$

$Z$ can be written as
$$Z=\begin{bmatrix}
X & 0 & 0      & 0 & 0 \\
0 & X & \vdots & 0 & 0 \\
X & 0 & \vdots & 0 & 0 \\
0 & 0 & \vdots & X & 0 \\
0 & 0 & 0      & 0 & X
\end{bmatrix}\cdot W = M \cdot W$$
$X$ and $W$ are column vectors for $x()$ and $\omega()$ and $M$ is a $(N+K-1)$ by $K$ matrix.

I'll omit the intermediary steps, and conclude that $\epsilon^2$ is minimized with respect to $w$ when
$$W = (M^{*} \cdot M)^{-1} \cdot M^{*} \cdot D$$

FOLLOW UP
Not sure if this is the best place to put this, but the recommendation from Matt L. to use iterative reweighted least squares did produce some improvement.

Using a weight vector $p(n)$ (I already am using $w$ and $W$), this converts to the following solution in matrix form:
$$W = (M^{*} \cdot P \cdot M)^{-1} \cdot M^{*} \cdot P \cdot D$$

And here is an example of the result for a specific case, using the matched filter, the first iteration, and the 50th iteration. What I see is great improvement in the lobes I wanted to reduce. But I had hoped it would level out the sidelobes to something more even. A few more iterations led to a singular matrix problem, so I didn't go any further.


texts:
Can someone help me understanf how to plot the next partial column in MATLAB:

while N=2001

|M|<700

ak =


texts:
I am trying to detect if a car did accelerate or did brake by using the accelerometer of the iPhone.

In the figure below I plotted the collected data. (To collect the data the phone was laying flat in the car facing the top of the phone to the front).

The issue I am having now is that visually I can clearly see where the car accelerated and where it did brake (see below). But can't figure out how to do that programatically.

What I basically want is to know how often a car did brake or accelerate during a certain time window. (Window size around 10-30 seconds).

Any help would be highly appreciated.

Thanks in advance!


texts: What does "Lag" mean in terms of Cross Correlation?

texts:
I am working on a program using the Essentia library for audio analysis. I've implemented the Cross Correlation algorithm (here: http://essentia.upf.edu/documentation/reference/std_CrossCorrelation.html), but I'm not sure if I really understand the output. Sadly, barely any of the description on that page makes sense to me. I do not have a math background, and only a cursory understanding of frequency analysis / signal processing.

So... can anyone explain what the optional parameters (minLag, maxLag) do here?


texts: Flipping the impulse response in convolution

texts: During convolution on a signal, why do we need to flip the impulse response during the process?


texts: periodicity of constant discrete time signals

texts:
are constant discrete time signals periodic?
example \begin{equation}
e^{i10\pi n}
\end{equation}
my proffesor says that this signal is aperiodic, in the discrete sense. but it seems wrong, because
unlike in the continuous case, i can calculate the smallest time period , which is 1.


texts:
I am rather new to the polyphase structure and thought I had understood, but apparently I havent.

My question is I guess very simple: what is the commutator at the input of a polyphase decimator? Is it a memory-less switch or doe it have memory at each phase output of the commutator.

More explicitly: assuming I have a polyphase decomposition of 2 phases. So that I have the P0(z) and P1(z). Assume we are at time t=0 so that the commutator is at position 0 and at this time the input of P0(z) is some value x[0]. Between t=0 and t=1, P0(z) should  be computed. at time t=1 the commutator switched and P1(z) (x[1] as input) should compute between t=1 and t=2. So here is where I am not understanding. Between t=1 and t=2 what happens to the INPUT to P0(z)? Is it 0 (as in the commutator is a simple switch without memory) or is the the previous value seen at t=0 (i.e. x[0]).


texts: Why are these results different about 'frequency shifting'?

texts:
I think 'spec_ori' & 'spec_shifted' spectrum amplitude and phase are same in below code. Because of 'spectrum shiting property' (What effect does a delay in the time domain have in the frequency domain?).
But both are different. why?

K = 4 * 10^10;
Fs = 10 * 10^6;
t_len = 40 * 10^(-6);
t=-t_len/2:1/Fs:t_len/2; % time axis in range
omega = -Fs/2:1/t_len:Fs/2;
chirp = exp(1i*pi*K*t.^2);
spec_ori = fft(chirp);
spec_shifted = fft((chirp .* exp(1i*2*pi*Fs*t)));
plot(angle(spec_ori)-angle(spec_shifted))


texts: How to calculate the steady state response $y_{ss}(t)$ of a LTI system given the Laplace transform $Y(s)$?

texts:
I am given the Laplace transform of the output of a LTI system: $$Y(s) = \frac{1}{s((s+2)^2+1)}$$ Asked is what the steady state response $y_{ss}(t)$ would be. I think that $y_{ss}(t) = \lim_{t\to\infty} y(t)$, since after waiting infinit long, the system should be in steady state. (Right?)

I thought to use the final value theorem:

$$\lim_{t\to\infty}y(t)=\lim_{s\to 0}sY(s)$$
This gives $$\lim_{s\to 0} sY(s)=\lim_{s\to 0}\frac{1}{(s+2)^2+1} = \frac{1}{5}.$$

This is different from $\frac{1}{10}$. When I let a computer algebra system calculate $\mathscr{L}^{-1}[Y(s)]
\bigg{|}_{t=\infty}$ I get $\frac{1}{10}$.
(I'm using wxMaxima and used limit(ilt(1/(s*(s^2 + 2*s + 10)), s, t), t, inf);.)

What am I doing wrong? Thanks in advance.


texts: What is the definition of a "complementary filter"?

texts:
I'm writing my MSE thesis report on an inertial navigation problem I've been working on. In my work, I use a complementary filter to track the orientation of a device. Now, since my fellow students are likely not familiar with complementary filters or Kalman filters, I wish to give a brief description of what a "complementary filter" is, in general.

A definition, if you will.

So, what defines a complementary filter? Is it any filter on the form z = a * x + (1 - a) * y, where x and y are separate measurements of a single quantity?

It's fine to define it in terms of Kalman filters if that's appropriate.


texts: Spectral entropy and moments and non stationary signal processing

texts: What is Spectral entropy and spectral moments? I know what the normal entropy of a signal is! And also what are some good time-frequency features for the analysis of non-stationary signals?


texts: what is matlab function is taking as sign of second order IIR filter?

texts:
I am getting confused from the implementation regarding matlab function filter([b0,b1,b2],[a1,a2],x) and other function similar as freqz. I do not understand which sign I must put in a coefficients, since there is two different way of writing the transfer function for the same second order filter as you see on the these pic below

when for example the besself function generate the coefficients, does it generate them as I write them $H(z)$ or I must write $1-a_0z^{-1}-a_2z^{-2}$?


texts: How to calculate an azimuth of a sound source in stereo signal

texts:
Let say we have a stereo recording of only one source.

What is a correct algorithm to calculate its azimuth using inter channel time difference and inter channel level difference?


texts: Simple technique to segment out optical disk and vessels from retinography

texts:
I'm looking for simple techniques to segment out the optical disk and vessels from a retinography. By simple I mean using techniques taught during an introductory course on Digital Image Processing.

I looked for papers on the subject but all of them included more advanced or complicated techniques.

Do you have any suggestions?

It doesn't need to achieve a very high accuracy of segmentation and it doesn't need to be extremely robust.


texts: Butterworth filter's gain formula does not agree with R's `signal` package

texts:
I'm trying to calculate the Butterworth filter gain. If I use the formula mentioned on Wikipedia:
$$
G^2(\omega) = \frac{G_0^2}
{1+\left(\frac{j\omega}{j\omega_c}\right)^{2n}}
$$
I don't get a matching result from calculating the gain directly from the filter's magnitude using R's signal package.
library(signal)

# Butterworth filter

# Gain formula from wikipedia
Butterworth_gain <- function(freq, cutoff_frequency, n = 1) {
        1/(1+(freq/cutoff_frequency)^(2*n))

}

bf <- butter(n = 2, W = .6, type = "low")
bfr <- freqz(bf)

plot(bfr$f, abs(bfr$h)^2, ty ='l')
lines(bfr$f, Butterworth_gain(bfr$f,  pi*.6, n = 2), col = 'red')


texts: How to run Welch’s method on cross-spectral density

texts:
I have a multivariate time series and I’m trying to figure out the cross spectral density of all pairs of variables efficiently. I’m unsure of how to implement Welch’s method in this context. Do I calculate the PSD of each series individually using Welch and then use those to compute the cross-spectral density or do I average the cross-spectral density of each sub-band?
If the answer is to average the cross-spectral density of each sub-bad, then how does one write an efficient algorithm to do this for a high dimension?
Thanks!


texts: Is this a correct interpretation of the DCT step in MFCC calculation?

texts:
This is a continuation of the discussion here. I would comment there, but I don't have 50 rep so I'm asking a new question.

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

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


texts: Normalisation of delay-addition comb filter implementation

texts:
I'm trying to write a tempo detection algorithm for analysis of audio samples. I'm roughly following the approach described in Scheirer, the first stages of which give me some very nice beat onset plots, which I'm happy are correct. The next stages involve the actual tempo detection process, which go something like this:

Create a comb filter with intervals corresponding to a particular BPM, e.g. for 120BPM the interval between impulses would be 0.5 seconds
Convolve the onset signal with the comb filter
Calculate the energy of the resulting signal (this will be the amount of energy the sample contains at the BPM in question)
Repeat for all BPMs of interest

Quite a neat process (I thought so, at least) and I've used it successfully. My problem stems from the fact that the comb filter convolution step is quite slow.

As I understand it, generally the fastest way to convolve two signals is to transform them into the frequency domain and then multiply, and that's what I was originally doing. While this might be much faster for complicated signals, the comb filter is not itself particularly complicated. I could achieve the same result by adding together delayed signals, where the delay is set by the BPM interval (the pulses in my comb filter are 1 sample wide and have a magnitude of 1). And this is what I've been trying to do.

I'll simplify the problem by saying that my comb filter consists of just 2 pulses, so to convolve I need to add together the original signal with a single delayed signal. For the higher BPMs the pulse interval (delay) will be less, so there will be more overlap between these two signals. This would be fine if addition was the only thing I was doing, but when I square the sum of the signals this leads to a greater total energy in the cases with more overlap. In other words the total energy increases with BPM. The plot below illustrates this effect. It uses the process I described with randomised input signal, i.e. noise. In theory it should give a (roughly) constant energy over all BPMs, but instead I get a distribution that increases with BPM.

I've tried to calculate a normalisation factor by assuming a signal of constant magnitude and calculating the energy of that for different overlaps, but that seems to skew the results the other way. So my question is essentially this:

Is there a way to normalise the total energy of a comb filter convolution, where the signals are convolved using a delay-addition approach?

Hopefully I've explained that well enough (sorry if some of the terminology isn't quite correct) and thanks in advance!


texts:
I am attempting to implement observer based state feedback in C and can't figure it out.

Here is pseudocode of the algorithm:

//Initialize Stuff

loop:

//read process variable
y = read(ch1)

//compute control variable
u = -K * xhat

//set process input
write(u)

//update state estimate
xhat = xhat + Ts * (A*xhat + B*u + L*(y-C*xhat))

// repeat loop

xhat is the estimated state
K is the feedback gain
L is the observer gain
y is the system output
u is the system input
Ts is the sampling period
A, B, & C are the state space matrices

Is this how observer feedback is supposed to be implemented?

Here is the actual code I have for the loop:

// Get Process Output from Sensors:
y[0] = sensor1();
y[1] = sensor2();

// Compute Control Variable:
u = 0;
for (i=0; i<4; i++)
    u += K[i]*xhat[i];

// Set Process Input:
write_to_DAC(u);

// Calculate: A*xhat + B*u
for (i=0; i<4; i++) {
    Ax_Bu[i] = 0;
    for (j=0; j<4; j++)
        Ax_Bu[i] += A[i*4+j]*xhat[j];
    Ax_Bu[i] += B[i]*u;
}

// Calculate: y-y_hat
for (i=0; i<2; i++) {
    yhat[i]   = 0;
    y_yhat[i] = 0;
    for (j=0; j<4; j++) {
        yhat[i] +=  C[i*4+j]*xhat[j]; // Calculate yhat = C*xhat
        y_yhat[i] = y[i]-yhat[i];     // Calculate the 'Innovation'
    }
}

// Calculate: L*(y-y_hat)
for (i=0; i<4; i++) {
    L_y_yhat[i] = 0;
    for (j=0; j<2; j++)
        L_y_yhat[i] += L[i*2+j]*y_yhat[j];
}

// Update State Estimate:
for (i=0; i<4; i++)
    xhat[i] += Ts*(Ax_Bu[i] + L_y_yhat[i]);


texts:
I measure noise in different systems by looking at voltage fluctuations. I wanted to use a Keithley SMU for that purpose, by storing the data in the buffer and then reading them out. However, I found that the data points are not measured at equally spaced points. While the difference is small, it is still visible. For example, the time intervals for a given trial where: 3.0 ms, 3.01 ms, 2.99 ms, etc, instead of a fixed 3 ms time interval.

I am wondering whether I can still overlook this error or not. If not, what is the main reason? Also, is there anything else I can do?


texts:
I am totally a newbie in signal processing. I want to generate and play sound for frequencies (1/3 octave band center frequency) 125 Hz, 250 Hz and 500 Hz respectively, each for 30 seconds and with sampling frequency of 26.5 kHz.

I came across this relevant question, however, I would like to generate sound (and plot frequency spectrum) using Python3. Does someone care to help or suggest on how to do this?


texts: Fourier transform 4 times = original function (2D and higher)

texts:
The Signal Processing SE post linked below shows how the Fourier Transform applied 4 times to a 1D function returns the original function, i.e. F{ F{ F{ F{ g(x) } } } } = g(x)

Link to 1D case:
Fourier transform 4 times = original function (from Bracewell book)

Can someone prove that this does or doesn't apply to 2D or higher functions?
In particular, if I use this method on a grayscale image, will I get back the original image? I know edge effects could be problematic, so lets say the image is a simple repeating pattern so that it is periodic. And yes, numerical/computational FFT issues might mean the image is not exactly like the original, but even if they are similar that would be pretty cool to see....


texts: Is there a theoretical limit for how much information hiding can be done through watermarking?

texts:
There is a classic channel-capacity notion that exist based on the work of Shannon that gives gives measure of amount of information that can be passed through the channel given its properties.

In the context of watermarking, the image or signal where information is hiding can be thought of as channel. While, in traditional Shannon model the channel distorts the signal if the bandwidth of channel is constrained. Here, if we keep adding more information of the watermark the channel (the host signal) gets distorted.

The question is, is there a notion of what should be the limit or capacity of information (bits) that can be added under a given host image?


texts:
Here is a question I have been trying to solve:

Estimate the "essential bandwidth" of a rectangular pulse

$$ g(t) = \operatorname{rect}\left(\frac{t}{T}\right), $$ with $T>0$, where this "essential" bandwidth contains 90% of the rectangular pulse energy.

What I have so far is that the Fourier Transform of $\operatorname{rect}\left(\frac{t}{T}\right)$ is

$$ G(f) = \mathcal{F}\{g(t)\} = \mathcal{F}\left\{ \operatorname{rect}\left(\frac{t}{T}\right) \right\} = T \operatorname{sinc}(fT) $$

where $$\operatorname{rect}(u) \triangleq \begin{cases}
0 & \text{if } |u| > \frac{1}{2} \\
\frac{1}{2} & \text{if } |u| = \frac{1}{2} \\
1 & \text{if } |u| < \frac{1}{2} \\
\end{cases}$$

$$\operatorname{sinc}(u) \triangleq \begin{cases}
\frac{\sin(\pi u)}{\pi u} & \text{if } u \ne 0 \\
1 & \text{if } u = 0 \\
\end{cases}$$

$$ X(f) = \mathcal{F}\{x(t)\} \triangleq \int\limits_{-\infty}^{+\infty} x(t) \ e^{-i 2 \pi f t} \ dt $$
and
$$ x(t) = \int\limits_{-\infty}^{+\infty} X(f) \ e^{+i 2 \pi f t} \ df. $$

Integrating $G(f)$ over $\pm \infty$ results in $1$. Also, integrating $|g(t)|^2$ over $\pm \infty$ results in $T$. This is about where I am lost.

Any help is appreciated.


texts:
I am a newbie in signal processing. I am testing the Hanning window on a signal. Obviously doing this window also means cut some energy of the signal, and when I do the DFT, the 0 frequency is not equivalent anymore to the average of the time history. Do you usually solve in some way this problem?
Can someone suggest papers or books where noise-reducing strategies for the FT of a signal are investigated? I just don't know how to start, an online search didn't give me more than basic definition (so please don't send me the Wikipedia definition of the tapering window)

Best