texts: Find tracing/plotting stacked bands/lines in an image

texts:
I have images with lines/bands, the bands/lines are parallel but can be of different gray levels, I want to extract or trace the lines/bands as single line, all lines/bands are parallel.

Source:

Output Plot:

The source image contain sine wave lines (10 pixels in amplitude) that are stacked on top on of each other forming what looks like bands. I used the location of the max of the cross-correlation of the first column with other columns of the image.

I am looking for other approaches as cross correlation is too expensive and very sensitive to noise.


texts:
A naive question I guess. Would it make a difference in the results when a system is simulated at Baseband or at Passband. If I have a plot of a BER vs SNR curve that has been plotted at Baseband, will the same change if I perform the simulation at Passband with a carrier frequency of 2.4GHz? AFAIK, it should not make a difference, but I would like to know if what I am thinking is correct.

Another question is that if I have two signals from two transmitters and add these signals at the receiver, does it make a difference if these two signals are passband or baseband. Do the results vary? Since Passband simulation consumes a lot of time, would it be correct if I simulate the behavior at Baseband and assume that the result would be almost the same at the Passband?


texts: How to construct descriptors for irregularly shaped image patches

texts:
As hinted in this answer, Perceptual hashing is a way to ascribe comparable measures (hashes) to images (rectangular patches). The images do not need to be the same size, and can be slightly distorted, according to the answer.

I might soon need a way to measurably describe image patches of different sizes, as well as irregular (not only different) shapes, and if Perceptual hashing could be adapted to work on non-rectangular image patches, it sounds interesting in this context.

I don't have any limitation to the way I describe the patches though, so any other suggestions are welcome. It does not have to be a distance measure, in other words, I just want a measure with a tendency to:

be more similar between patches of similar shape
be more similar between patches of similar content (similar subparts of the image)
still tolerate slight distortion in shapes and pixel values
can be but does not have to be more similar for shapes of similar size


texts: Picking out a signal that appears to be noise inside a large signal

texts:
I have a signal from a photodiode sensor that has two types of noise. One type of noise is ambient light white noise that gets introduced just from the surrounding environemnt. The other type of noise is due to the motion of the sensor.

Currently i don't seem to have a problem filtering out the white noise when the sensor is held still. But when the sensor is moving i get very large noise from motion, this noise is much larger than the signal i am interested in and as a result makes the signal I want look like noise.

The signal i am interested is anywhere between 0.75Hz and 4Hz, the motion signal can be anywhere from 0.25Hz to 5Hz.

I am currently using a butterworth filter between 0.5 and 4 Hz and then a moving average to smooth it out. But this causes the signal to be lost in the motion noise.

I have looked into adaptive filters but am not sure whether i should try to implement them or not because i do not have enough experience with them to tell whether they will help my problem or not.

Are there techniques that are used to pick out signals that share frequency with noise?


texts: How to synchronize audio and video streaming for not fixed FPS streaming?

texts:
It's a 3-stage process.

In the first stage, a video (with audio) is recorded at a fixed 25 FPS rate. In the second stage, it's demuxed in two different channels and the video is processed. In the third stage, the audio and video are again synchronized and muxed together.

The issue is for the third stage, the video after the processing is having varying FPS rate (like 16, 18, 30, 35 FPS). Is there any way to synchronize the audio with the video at original FPS rate. I'm trying to use FFMPEG for this but no success.


texts: Converting ADC output to fixed-point format

texts:
I want to convert the two's complement, 16-bit output from an ADC into a generic fixed-point format, $\rm Qm.n$, where $\rm m$ is the number of integer bits and $\rm n$ is the number of fraction bits.

Any hints/procedure to do this job would be appreciated.


texts: Phase diagram of a rectangular pulse with Fourier Series - help understanding

texts:
I understand perfectly fine how to plot the magnitude of a Fourier series, but I'm having serious trouble understanding how to plot the phase spectrum. Below is a picture of a rectangular pulse. The magnitude diagram makes sense to me - but how did they determine the phase diagram?

I know that the coefficient is:
$a = \frac{Asin(n*pi/2)}{n(pi/2)}$ or $Asinc(n*pi/2)$, but I'm not sure how to determine the phase spectrum from this.

I thought of using Euler's formula to convert the sine function, but then I'm a bit lost on how to use the exponential values to find the phase (if that's even correct?). So I got it to look like this:
$$a = \frac{A(e^{jn*pi/2}-e^{-jn*pi/2})}{(2jn*pi/2)}$$

But then.. I'm not really sure? Because in the diagram the angle is pi, but I can't see how to get that.


texts: How does subcarrier correlation affect the BER of OFDM?

texts:
I am studying the OFDM system and would like to examine it under different subcarrier correlation scenarios. I have calculated BER for the uncorrelated scenario and now I have rewritten it for the correlated channel.

If there is no noise, BER shoud be 0. It works for the uncorrelated scenario.  Why does it not work for the correlated scenario?


texts: Compare Overlapping FFTs to a longer FFT

texts:
How would you compare the SNR gain from a longer FFT (more samples) to overlapping FFTs? Given the choice, which one would you pick and why?

Update: Suppose you have 2048 samples of a signal. Assuming the sampling rate divided by the fundamental frequency is an integer, compare/constrast the SNR gain/noise variance reduction of the following:

A single 2048 point FFT.
16, 128 point FFTs added coherently.
16, 128 point FFTs added incoherently.
24, 128 point FFTs (50% overlap), added incoherently.


texts: How is a continuous spectrum for the DTFT possible?

texts:
So we that a complex sinusoid of the form $e^{j\omega_0n}$ is periodic over $N=2\pi/\omega_0$ only if $\omega_0$ is a rational multiple of $\pi$, otherwise the exponential is not periodic. (see EDIT!)

Then we got to the DTFT, specifically the synthesis equation:

$$x[n]=\frac{1}{2\pi}\int_{2\pi}X\left(e^{j\omega}\right)e^{j\omega n}d\omega$$

Here $X\left(e^{j\omega}\right)$ if a function that's continuous over $\omega$, and $X\left(e^{j\omega_0}\right)$ is how much a complex sinusoid $e^{j\omega_0n}$ contributes to $x[n]$.

But that confuses me, because I feel like not all sinusoids should be able to contribute to $x[n]$ since not all complex sinusoids are periodic. Or are aperiodic sinusoids actually the key to the DTFT?

EDIT: I should clarify that in that first bit where I talk about complex sinusoids being periodic, I'm talking about discrete complex sinusoids, $x[n] = e^{j\omega_0n}$ where $n\in\mathbb{Z}$. For $x[n]$ to be considered periodic there must be some $N\in\mathbb{Z} \mid x[n+N]=x[n]$. For such an $N$ to exist, $\omega_0$ must be a rational multiple of $pi$.

My confusion comes from the fact that the synthesis equation includes values of $\omega$ that are not rational multiples of $\pi$, so aperiodic discrete sinusoids are contributing to synthesizing $x[n]$.


texts: How can I comprehend the complex coefficient of complex Fourier series?

texts:
Is there a way to understand visually the complex coefficient of Fourier series (shown as $C_n$ in many sources)? I mean something similar to  this which represents $e^{j\omega_0 t}$: .

$\omega_0 \triangleq 2 \pi f_0 .$

But when I read $C_n  e^{jn\omega_0 t}$ my mind shuts down. Here is complex Fourier series: http://www.thefouriertransform.com/series/complexFourier.jpg.
And its one element is $C_n e^{j n \omega_0 t}$. How can I visualize this element? And does $C_n$ have a meaning besides being a coefficient?


texts: confidence interval estimate for coherence

texts:
Is there any solution for estimating Confidence interval of coherence derived by Welch method with overlapping segments?

Moreover, the window length is not same for all the observations, only the number of segments are fixed for all observations


texts:
I have some frequency based data that I'm plotting with Octave's semilogx that looks like this:

The amplitude of peaks does not increase with frequency over the linear scale. But with a log scale, data density increases and makes the data appear larger at high frequencies.

Is there a method of smoothing, like you might do with sgolayfilt, where low frequencies are filtered less than high frequencies so as to compensate for the higher frequency data being more dense due to the log x scale?


texts: Implementing headphone transfer function (HPTF)

texts:
This document on HRTFs, A Spherical Far Field HRIR/HRTF Compilation, of the Neumann KU 100, talks about headphone compensation filters.

Searching Google returns http://www.ak.tu-berlin.de/fileadmin/a0135/Publikationen/2010/Brinkmann_2010_On_the_effect_of_individual_headphone_compensation_in_binaural_synthesis.pdf

These are technical documents, and I am not an expert in the field, I have no training in signals processing, so it is difficult for me to see what is being said.

Does this mean that I could improve my HRIRs by getting hold of a HPTF filter suited for my headphones, and convolving them with it?

Is there any chance such a transfer function might be available for these particular headphones (Apple EarPods)

π


texts:
I have a 2D array/matrix (something like an image, but it's not an actual image) with values from 0 to X (in this case 180). and I have a 1D array/Vector that has the occurrence frequency of these values in the 2D matrix (I think it's like Histogram, but I've done that manually).

so the 1D array can look like this.

I want to segment it based on peak values. I mean I want to get each mountain separately. so let's say every cell (or pixel in the 2D array) that has a value between 0 and 30 will have the label 1, and the values between 30 and 150 will have the label 2, and the values from 150 to 180 will have the label 3. (that's in case of 3 labels only -which is fine-).
but I could want to do it with more than that for example from 0 to 5, then from 5 to 18 etc. so segment each peak separately. I used the findpeak matlab function, but I've only got peaks (which represent the center of my range). I thought of getting every 2 consecutive peaks and then segment based on half the distance between them, but that will give a bad result between 20 and 150 for example.
looking for local minima might be useful but I think there's no function in matlab for that. and if I want to go in this approach I'm afraid of getting too many results in the long valley range (which I don't need).
I don't know if there's a better idea. so to reformulate the question, eventually I want to segment a 2D array based on the most occurred values.

Any ideas or scientific keywords can be helpful, because I'm a newbie in this area.

(and here's another example)

and the function I'm using to show the peaks for now:

[pks,locs] = findpeaks(data, 'MINPEAKHEIGHT', 200);


texts: Apparent frequency due to aliasing - proof

texts:
I know that If we are trying to sample frequencies above the Nyquist frequency, aliasing will occur, and the apparent frequency we get is given by:

$f_{alias}(N) = |f-Nf_{s}|$

where $f$ is the frequency of the signal we are trying to sample, $N$ is an integer and $f_s$ is the sampling frequency. However, does anyone have a link to a proof for this? I am sure there is something very intuitive behind this that I probably overlook, but if someone can either present a proof or link one to me, then I would really appreciate it!


texts: BPSK and pulse shaping (square-root raised cosine)

texts:
I'm trying to make my own transmitter & receiver in MATLAB, starting with the basics and adding more complex stuff as I progress. So I have a few questions regarding pulse shaping and more specifically, about SRRC.

I'm using BPSK. I'm generating random 1 and -1.

1) I know there are several options when it comes to choosing a pulse to shape the data. I've read here and there that a cosine would also be a valid option. So I'd have something like BPSK_data*cos(2*pi*n*Ts) (and n would be n=0:length(BPSK_data)-1). Would that be correct? And if I wanted to use a carrier, I'd do BPSK_data*cos(2*pi*n*Ts)*cos(2*pi*n*Ts*fc). Not sure if this would be the best way though, cause I'm sending a symbol every sample period.

2) Let's say I decide to use a square-root raised cosine. I've found a very interesting function in MATLAB called rcosdesign which will return the filter coefficient depending on this parameters rcosdesign(beta,span,sps,'sqrt'). I know what beta means (roll-off factor) but I have some doubts about span and sps. According to MATLAB doc "The filter is truncated to span symbols, and each symbol period contains sps samples". The part I don't get is the span one. I guess if I set sps=5, I'd have to do upsample(BPSK_data, 5) right? And then filter(b,1,BPSK_data). But what about span?

Thank you!


texts: LoG filter creating additional maxima in scale space

texts:
To create a scale space, I applied a Laplacian of Gaussian filter on the following image:

After the scale space was created, I plotted circles around local maxima in scale space. However, instead of $9$ circles, I got many more as shown below(image below not to scale).

The following video shows the LoG filter responses as scale is varied from $\sigma=1$ to $16$ in steps of $0.01$ -- http://youtu.be/m4LyXBI_6w0

It shows additional maxima being created at higher scales. But this should not be the case since LoG was especially chosen so as not to create additional maxima. What could be the explanation here ?

NOTE: Thresholding the magnitude of scale space responses eliminates the additional maxima as shown below. Could it be that the additional maxima being absent holds only up to a certain degree ?


texts:
I am learning about HOG and I understand it from here. A well-explained page with an example. I am not understanding this concept that how it works

  A 16×16 block has 4 histograms which can be concatenated to form a 36
  x 1 element vector and it can be normalized just the way a 3×1 vector
  is normalized.

How this 36*1 came and how we calculated it? and is it compulsory that we always need 9 bin vector? Is it a fixed size for HOG?

came?


texts: Wavelet transform wavdec returns matrix of the wrong size

texts:
I have a question regarding the wavdecand dwt functions in MATLAB.

I am using wavdec(y,3,db4) on a size 1024 signal, which means I am trying to compute the third level db4 transform of the size 1024 signal y. If I am thinking about this correctly, theoretically the returned matrix after the transform should also be of size 1024.

However, when I perform the transform, the matrix I get returned is size 1044, which is 20 samples bigger than my original matrix.

Would anyone please be able to explain to me why this is happening?


texts: Cross Correlation as Noise Reduction, is this possible?

texts:
If I have two sensor measuring the same signal but from two different locations from the source, and I get two different readings of the signal, each with slightly different noise.

Is there a way to use the cross correlation of the signals to get a third signal which represents the components of the signal which are common across both measurements?

The reason I ask is that I have tried to do this, and I can get the cross correlation signal, but I can't figure out how to use this to get back to something that looks like the original signal, see below

i.e. How can  I get something which looks like a mix of the green and blue signals from the red one?


texts: Magnitude of the Gradient in Frequency Domain

texts:
I'm learning some basics of image processing. Recently I've read about image filtering and two-dimensional Fourier transform, because I'm preparing for exam. And I have one question I don't know answer for: is it possible to do filtering in frequency domain (by using Fourier transform), which in spatial domain is implemented by computing magnitude of gradient of the image?

I know that gradient operator is defined:
$$
\nabla f \equiv grad(f) = \begin{bmatrix}g_{x} \\ g_{y}\end{bmatrix}
$$
and the magnitude of gradient:
$$
M(x,y) = \sqrt{g_{x}^{2} + g_{y}^{2}}
$$
In spatial domain we can use gradient to find edges. High frequencies are responsible for edges. High frequency means the rate of change is high, thus gradient has high value.

But can we do similar thing in frequency domain? Has the magnitude of gradient operator any equivalent in frequency domain?


texts: Spectrum in real life with Spectrum in theory

texts:
as you know it is possible to measure the power spectral density ($|X(f)|^2$) of a certain voltage signal $x(t)$ through a Spectrum Analyzer.
As far as I'm concerned, the simplest spectrum analyzer does not perform the Fourier transform X(f) of the input signal to evaluate the power spectral density. On the contrary, it simply selects each harmonic of the input signal through a tuned filter (or a tuned demodulator) and measures the power of the selected harmonics. The measured power is plotted against all the possible frequencies in the display.
This is what I've seen when I used a 2GHz sine wave as input signal.

It is fine because it is similar to an ideal dirac-delta what I would have expected from theory.
But, there is something I cannot understand. The Fourier transform $X(f)$ (and hence the power spectral density $|X(f)|^2$) is something that may be evaluated only by knowing the full signal behaviour on the infinite time interval $[-\infty;+\infty]$. And the resulting quantities $X(f)$ and $|X(f)|^2$ are obviously constant in time.

However, in real world we cannot know the future and we are sending to the Spectrum Analyzer a real time signal. And it does provide a real-time spectrum, which is not the result of a Fourier Transform evaluation (which wouldn't be possible as we do not know the future values of the signal) but of a simple power measurement.
So, my question is: why does this power measurement (which is an instant function of time: if I stop the input signal, the spectrum becomes 0) coincide with the theoretical power spectral density $|X(f)|^2$ (which is not function of time and which is a pure ideal quantity which requires we to know the signal behaviour also in the future)?


texts: FASTICA algoritm produce independent components does not equal to the dimensionality of EEG signals

texts:
From my knowledge about independent component analysis the number of channel or variables will not be affected by this algorithm and the number of independent components will be equal to number of variables. But when I tried to run FASTICA algorithm on EEG signal matrix which has 14 channels (or 14 variabls), the number of independent components was 9 not 14,  which is confused me.

Does anyone have a clarification about this?


texts:
I have a problem with Otsu's method. I would like to implement histogram to compute how many ones' and zeros'. For Otsu's method, I have a code from a book and it is running without problem. This is the picture

.

I've implemented a code to compute the histogram. This is the output of my code.

------------------
    0 : 14332
    1 : 2102
    2 : 1387
    3 : 745
    4 : 221
    5 : 117
    6 : 27
    7 : 9
  248 : 6
  249 : 12
  250 : 48
  251 : 162
  252 : 396
  253 : 830
  254 : 1377
  255 : 28554
------------------

Here's my code:

I = imread('images.jpg');
level = graythresh(I);
BW = im2bw(I, level);
imshow(BW)
imwrite(BW, 'img.jpg');

This is my C++ code.

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv\cv.h>
#include <map>
#include <iomanip>

std::map<int, int> computeHistogram(const cv::Mat& image)
{
    std::map<int, int> histogram;

    for ( int row = 0; row < image.rows; ++row)
    {
        for ( int col = 0; col < image.cols; ++col)
        {
          ++histogram[(int)image.at<uchar>(row, col)];

        }
    }

    return histogram;
}

void printHistogram(const std::map<int, int>& histogram)
{
    std::map<int, int>::const_iterator histogram_iter;
    std::cout << "\n------------------\n";
    for( histogram_iter = histogram.begin(); histogram_iter != histogram.end(); ++histogram_iter)
    {
      std::cout << std::setw(5) << histogram_iter->first <<  " : " << histogram_iter->second << "\n";
    }
    std::cout << "------------------\n";
}

int main(int argc, char **argv)
{
    cv::Mat img = cv::imread("img.jpg", CV_BGR2GRAY);
    printHistogram(computeHistogram(img));
    return 0;
}

Why this is the result? What I'm expecting is how many 255 and 0 (black and white only). Moreover, if I run another picture, I get another results with the range 0-255.


texts:
I'd like to compare 2 speech similarity and show it in terms of 0-100%.
Here's my approach:

1: Convert 2 audio waveform into audio spectrum by Fast Fourier Transform (FFT)
2: Use Dynamic Time Warping to compare 2 spectrums

Everything is fine when converting them into audio spectrum
But how to show the similarity in terms of percentage?

I've read this site: https://stackoverflow.com/questions/2168027/dynamic-time-warping-to-compare-two-audio-recordings

I'm working on exactly the same things with him.
However I have no idea about the answer.

Could anyone please help me?
Thanks!


texts: Baseline correlation for template matching

texts:
In normal cross-correlation or convolution between a signal and a template(say a small portion of the signal) the template is moved along length of the signal without changing the amplitude offset of the template. But is there any function (in MATLAB or general) that alters the amplitude offset of the template according to the changes in the amplitude of the signal during cross-correlation or convolution?

For example, consider the following ECG signal which is has a large amount of baseline wander due to motion artifacts. The sharp peaks and trough are the heartbeat signals. The beat signal contained in the red box is taken as a template to perform cross-correlation with the full ECG signal.

Due to the large baseline wander, after doing normal cross-correlation, the heartbeat peaks are getting de-emphasized.But, there is strong possibility that the heart-beats will be emphasized if the amplitude offset(offset along y axis) of the template follows the signal amplitude during correlation. In other words, the template must be more or less alighted with the heart-beat in both time and amplitude during convolution or xcross operation. I hope the above illustration adds clarity to the question and the requirement. If there is any alternate method for template matching that will give better results for the above scenario, please do suggest the same.


texts: Sinc interpolation formula for signal reconstruction in frequency domain from bipolar samples

texts:
As per the title, I was wondering if there was a $\operatorname{sinc}$ based interoplation formula for reconstructing a signal in the frequency domain which has been sampled with respect the bipolar coordinate system?

For instance, we all know the $\operatorname{sinc}$ based Whitakker-Shannon interpolation formula for reconstructing signals from their samples in the time domain is:

$$x(t)=\sum_{n=-\infty}^{\infty}x[n]\cdot\operatorname{sinc}\left(\frac{t-n\Delta t}{\Delta t}\right)$$

provided that certain criterion are satisfied. This can quite easily be extended to higher dimensions so that if, for example, $\phi$ is now a function and $\boldsymbol{x}\in\mathbb{R}^n$ then

$$\phi(\boldsymbol{x})=\sum_{k\in\mathbb{Z}^n}\phi(k\Delta\boldsymbol{x})\cdot\operatorname{sinc}\left(\frac{\boldsymbol{x}-k\Delta\boldsymbol{x}}{\Delta\boldsymbol{x}}\right),$$
where we define $\operatorname{sinc}(\boldsymbol{x})=\operatorname{sinc}(x_1,...,x_n)=\operatorname{sinc}(x_1)\cdot...\cdot\operatorname{sinc}(x_n)$.

One can also find a similar $\operatorname{sinc}$ based interpolation method in the book 'Advanced Topics in Shannon Sampling and Interpolation Theory' which allows one to reconstruct a signal in the frequency domain from samples taken in the polar coordinate system $(\rho, \theta)$

  Let $\phi(x,y)$ be space-limited to $2A$ and $\hat{\phi}(\rho,\theta)$ be angularly band-limited to $K$. Then $\hat{\phi}(\rho,\theta)$ can be reconstructed from its polar samples via

  $$\hat{\phi}(\rho,\theta)=\sum_{n=-\infty}^{\infty}\sum_{k=0}^{N-1}\tilde{\hat{\phi}}\left(\frac{n}{2A},\frac{2\pi k}{N}\right)\operatorname{sinc}\left[\frac{2A(\rho-n)}{2A}\right]\cdot\sigma\left(\theta-\frac{2\pi k}{N}\right),$$
  where $N$ is even,
  $$\sigma=\frac{\sin\left[\frac{1}{2}(N-1)\theta\right]}{N\sin\left(\frac{\theta}{2}\right)},$$
  and
  $$\tilde{\hat{\phi}}\left(\frac{n}{2A},\frac{2\pi k}{N}\right)=\begin{cases}
\hat{\phi}\left(\frac{n}{2A},\frac{2\pi k}{N}\right),& n\ge 0,
\\
\hat{\phi}\left(-\frac{n}{2A},\frac{2\pi k}{N}+\pi\right),& n<0.
\end{cases}$$

However, for if we take samples in the bipolar coordinate system $(\sigma,\tau)$ and we want to reconstruct $\hat{x}(\sigma,\tau)$ from $\hat{x}(n\Delta\sigma,m\Delta\tau)$ then I can find absolutely no such formula, despite scouring the internet for literature. Now that I mention it, for my intents and purposes, it would be more helpful to find such a formula for the coordinate system $(a,\tau)$, where $\tau$ are our isosurfaces and $(0,-a)$ and $(0,a)$ are their respective foci.


texts: Determining if the system is linear and time invariant

texts: The Fourier transforms of input $x[n]$ and output $y[n]$ of a discrete-time system are related by the following equation: $$Y(e^{j\omega}) + (e^{-j\omega})Y(e^{j\omega})= X(e^{j\omega}) - X^{'}(e^{j\omega})$$ Determine if the system is (i) linear (ii) time-invariant.


texts: recognizing frames as voiced/unvoiced/silence

texts:
i have to implement a function in matlab,for labeling silenced,voiced and unvoiced frames in signal.
I mean i want to specify each frame as a voiced or unvoiced or silenced frame by using
pitch frequency and zero processing rate and energy.
how can i calculate pitch frequency?
where should i start from?
Thanks


texts: Gradient of Total Variation (TV) Norm in Total Variation Denoising

texts:
In this link, it says that the gradient is as follow

  The Gradient of the TV norm is
  $$
\mathrm{Grad}J(f)=\mathrm{div}\left(\frac{\nabla f}{\lVert\nabla f\rVert}\right).
$$

From this other link, it also mentions that the derivative is as follow

  Formally, we can write $\partial J(u)=-\mathrm{div}\left(\frac{\nabla u}{\lvert \nabla u\rvert}\right)$

I know how to calculate divergence, but I don't understand how the gradient of total variation is related to divergence.


texts: $|X(e^{jω})|^2$ - Power or Energy Density?

texts:
If $x(n)$ is an aperiodic signal and $X(e^{jω})$ its DTFT, then, what is $|X(e^{jω})|^2$? Power or Energy Spectral Density? My understanging of Fourier transforms so far tells me that its energy spectral density and not PSD.

But, while studying Spectrum Estimation, I am getting confused as I am seeing $|X(e^{jω})|^2$ being treated as PSD everywhere. Here is an example -

In the above example, $|G_i(e^{jω})|^2$ was treated as PSD, otherwise the relation wouldn't make any sense (at least to me).

I would be grateful if someone could explain. Thank you.

I don't have problem understanding $P_x(e^{j\omega})$. My problem is only with $|G_i(e^{j\omega})|^2$. How come it's the PSD of $g_i(n)$. Or is it not?


texts: Generating smoothed versions of square wave, triangular, etc

texts:
I'm trying to get functions depicting smoothed out versions of wave forms(triangle,square, sawtooth, reverse sawtooth) which have the same amplitude and frequency as $cos(x)$.

I found a few trigonometric functions depicting such wave forms:

$\delta=0.05$,

$Square_{smooth}=2.1\tan^{-1}(\sin(\pi x/3)/\delta)/\pi$

$Triangle_{smooth}=1.25-5\cos^{-1}((1-\delta)\sin(\pi x/3.2))/(2\pi)$

$h=12.5$,

$ Sawtooth_{smooth}=-1.5 + 3((x/6-0.5) -(\tanh((((x/6-0.5)+0.5)-\lfloor{(x/6-0.5)+0.5}\rfloor-0.5)h)/(2\tanh(0.5h))+\lfloor{(x/6-0.5)+0.5)}\rfloor-0.5))$

but they do not have the same amplitude or frequency unfortunately. I think $-cos(x)$ might work for $Triangle_{smooth}$, but I'm still looking for ways to fix $Square_{smooth}$ and $Sawtooth_{smooth}$, anyone have any ideas?


texts: How do you choose a size for a windowing function in FFT?

texts: How does one choose the proper windowing function to apply in an FFT? What are the benefits of larger sizes and smaller ones? Which would be the best for pitch estimation? Also which window function would be best for pitch estimation?


texts:
So I understand how Convolution works but Circular convolution seems a bit messy to me, all the examples seems to have even series of number like h(n)={1,2,3,4} &  x(n)={1,2,3,4} and they are all starting from n=0.

This is from my last exam and I'm trying to figure out e)
(My exam is tomorrow and I just realized I had missed to study on this, hence I won't have time to respond with Latex etc since I don't remember that and figuring it out would mean that I won't have time to study for my exam.

My attempt so far, but I don't know if I need to do zero padding (as I understand you only need to do it if you want to do the FFT). And I don't know if you are supposed to start from x(0)*h(-1)..

Grateful for all help, I have tried to search on the forum and to google it and searching on youtube.

BR Rickard


texts: On the use of Permutation matrix to perform iFFT

texts:
I have a question about using the permutation matrix for performing $iFFT$ for such matrix and then reshape it row-wise and column-wise way.

Let's say that we have a random matrix $x$ whose size is (32,8), so that matrix can be written as below:

where $x_k$ represents the column $k$ of matrix $x$ with size of 32 for each column.

$1$- Let's take column wise $iFFT$ for matrix $x$ and then reshape it row-wise resulting matrix $Y$ as below matlab code

x = randn(32,8);
y = ifft(x);
Y = reshape(y.',[],1);

$2$- let's manipulate that using another way of permutation matrix. first we can reshape the matrix $x$ column-wise into (256,1) as below:

Then performing $iFFT$ operation with size of $32$-point is corresponding to:

$F$ is the Fourier transformation matrix
In order to get the equivalent matrix of Y representing the reshape of $iFFT(x)$ in row-wise, we can multiply the matrix Z with permutation matrix P resulting vector $Y2$ which should be similar to vector $Y$ in case $1$. That can be done by matlab as:

z = reshape(x,[],1);   %
X = kron(eye(8),dftmtx(32));
Z = X*z;

P = zeros(m*n);       %Building the permutation matrix P
col = 1;
for i = 1:m
    for j = 1:n
        E = zeros(m,n);
        E(i,j) = 1;
        P(:,col) = E(:);
        col = col + 1;
    end
end

Y2 = P*Z

So, for $(1)$ and $(2)$,   $Y$ should be similar to $Y2$. Is that right? but what I get is different results!  My question is that calculation right? why do I get different results ?


texts:
I am looking for a method to make a multi-user channel estimation with CDMA.

Here is my question:

Is there a way to estimate multi-user channels with their spreading codes? If yes, what is the method?


texts: How are these two discrete time signals equal?

texts:
How are these two signals equal?

What I have tried:

$ x[n] = (-3)(-2)(-2)^{n-1}u[n] + (-2)^{n-1}u[n] $

I am not sure how this leads to the answer.


texts: Golay complementary sequences in 802.11ad

texts:
The Golay complementary sequences consist of two sequences of the same length $N$ such that there acyclic autocorrelation sequences have sidelobes equal in magnitude but opposite in sign. So, when the two autocorrelations are summed up, the result has a peak of $2N$ and zero sidelobe level. As an example, $Ga_{128}$ and $Gb_{128}$ are two complementary Golay sequences of length 128. If I sum up the autocorrelations of $Ga_{128}$ and $Gb_{128}$, the sidelobes are exactly zero.

The IEEE 802.11ad protocol uses Golay sequences for channel estimation. However, it doesn't simply use the basic $Ga_{128}$ and $Gb_{128}$ sequences. Instead it concatenates these sequences to generate following longer sequences:

$Gu_{512} = [-Gb_{128}\phantom{1} -Ga_{128}\phantom{1}  Gb_{128}\phantom{1} -Ga_{128}]$
$Gv_{512} = [-Gb_{128}\phantom{1}  Ga_{128}\phantom{1} -Gb_{128}\phantom{1} -Ga_{128}]$

(a) However, when I add the autocorrelations of $Gu_{512}$ and $Gv_{512}$, I don't get zero sidelobes. So, what is the value of such longer sequences?

(b) Regardless of the sidelobe performance, I would assume that only $Gu_{512}$ and $Gv_{512}$ sequences should be transmitted. However, the IEEE 802.11ad single-carrier (SC) modulated signal transmits a third sequence consisting of $-Gb_{128}$. Any explanation why this different length signal should be transmitted for channel estimation apart from $Gu_{512}$ and $Gv_{512}$?

Any explanation would be greatly appreciated.
~ryan


texts: Is spectral density conserved after aliasing?

texts: Will the integral of the PSD of a down-sampled signal still equal the variance in all cases


texts:
Welch's method has been my go-to algorithm for computing power spectral density (PSD) of evenly-sampled timeseries.  I noticed that there are many other methods for computing PSD.  For example, in Matlab I see:

PSD using Burg method
PSD using covariance method
PSD using periodogram
PSD using modified covariance method
PSD using multitaper method (MTM)
PSD using Welch's method
PSD using Yule-Walker AR method
Spectrogram using short-time Fourier transform
Spectral estimation

What are the advantages of these various methods?  As a practical question, when would I want to use something other than Welch's method?


texts: How to convert magnetometer readings into orientation?

texts: I have a magnetometer sensor, obtaining the reading with $50$Hz rate. Unfortunately, the data is not labeled: I just know that these are $x$,$y$,$z$ axes, and that the reading are in $\mu$T (micro Tesla). How can I obtain from this data the orientation of the sensor board (in relation to north pole) in degrees or radians?


texts: What could cause a phase difference between a FPGA implemented FFT and numpy.fft.rfft

texts:
We have a FPGA system which takes input from an ADC and calculates a FFT.  The system identifies the location of our frequencies of interest and sends the coefficients from those bins to my software.  In addition to the coefficients I am sent the time series data
While the hardware guys were working on the hardware I developed additional signal processing code.  To enable testing and development I wrote some code to synthesize the signals I expected to receive from the hardware and that works fine.  Not unexpectedly now that I have live data nothing works.
In the process of debuging the problem I am taking the real world time series data and using np.numpy.fft.rfft to look at the spectrum.  When I plot the spectrum I see our frequencies of interest in the correct FFT bins. I normalize the PSD and the Python's FFT and the hardware FFT match well.  The problem I see is the phases of the coefficients do not match.  The difference in phases don't look ordered.  (Just looking at the phase difference in a plot).
When I compute a FFT on the time series provided by the FPGA (this is the real world data) using numpy.fft.rfft I expect the coefficients at my frequencies of interest to have the same phases as the coefficients calculated by the FPGA FFT which is operating on the same time series.
Does anyone have an idea of what could cause FFT's on the same real world time series data to have different coefficient phases?
Thanks
Justin


texts: Extracting different frequency bands (alpha, beta, gamma) from brain activity data

texts:
I am new to signal processing and despite googling about my question, I still couldn't find the solution.

I have an Electrocorticography (ECoG) dataset. This consists of recording brain activity from many channels. The data is stored in a matrix. Data in each row relates to the brain activity recorded from each channel. Brain activity data was recorded with 10kHz frequency (Therefore, the continues 10,000 elements of each row is the brain activity data of 1s)

Similar to many analysis such as, I need to extract powers of different frequency bands (1-8 hz, etc) from this data and run some regression anlaysis.

For example, as a sentence from a previous study:

  A fast Fourier transformation (FFT; EEGLAB v5.03) was performed for each 1-secondsignal to obtain the power of each of the 3 frequency bands(2–8, 8–25, and 80–150Hz) for each electrode

I am still confused how should I apply the fft function of matlab to correctly obtain power of different frequency bands.

Considering I only have this matrix of dataset (each row: brain activity recorded from each channel) and also the fact that I am not very familiar with methods in signal processing, I appreciate if someone can kindly help me how should I do such an analysis.


texts: How to make sinewives with array input, for-loop functions and operate array with others [matlab]?

texts:
Thanks to previous question, I got some clues to resolve this one.
But, I still get some problems here.

Ts = .001;
N = 1000;
t = (0:999)*Ts;
 make_an_array = [2 10 15 20 30 40 50 60 80 90 100 150 200 300 400];
 f = make_an_array;
for i=1:length(t)
input(i)=sin(2*pi*f(1)*t(i));
end
[b,a] = butter(4,.02,'High');
[b1,a1] = butter(2,0.12);
input = filter(b1,a1,input);
output = filter(b,a,input);
for i=1:length(output)
G(i) = 20*log(output/f(1));
end
semilogx(f,G,'x')
xlabel('frequency in Hz')
ylabel('Gain dB')
A = max(output);
grid on
disp(A)

This is a brief explaination about what I am trying to find:

1. Amplitude of the output with max operator (variable A)
2. Sine wives using input frequencies in an array (variable f) and use a for-loop (input (i))
3. Plot the 20 log of the output values against the frequency array using the semilogx.
4. I dont know about how to 'store the maximum values of the flter’s output in an array for plotting'.
5. And then, I got error message "Subscripted assignment dimension mismatch."
6. Part of codes is already on the book:
   [b,a] = butter(4,.02,'High');
   [b1,a1] = butter(2,0.12);
   input = filter(b1,a1,input);
   output = filter(b,a,input);

I think I got wrong on trying to find the value of G, how to operate value with array function (like in input(i) and G(i)).


texts: Spectrum of windowed version of original continuous signal

texts:
Suppose we have the complex signal $x(t)= \exp(j\omega_0 t)$. Using the properties of Fourier transform we can prove its CTFT is Dirac $\delta$ function.

If any one ask me about the spectrum of $x(t)$ "Does $x(t)$ has continuous spectrum or discrete spectrum", my answer will be "The spectrum of $x(t)$ is discrete".

Now, if I apply a rectangular window to the complex exponential $x(t)$ in the time domain and then take CTFT I will end up with $\mathrm{sinc}$ function. Now the spectrum of the windowed complex exponential is continuous and not discrete.Is this interpretation true?


texts: In computer stereo vision, what does it mean to "look in"?

texts:
In trying to understand this answer to my earlier question, can someone explain why it is important that the cameras are not in the same plane when the focal distance is large compared to the separation between the cameras and the object?

What is meant by "looking in"?

Does this change if the number of views/cameras increases?


texts: Prove that, in DFT, Upsampling in time domain is equal to replication in frequency domain

texts:
Given:
$x[n]$ is an $N$-point sequence whose DFT is $X[k]$
$$x[n]\xrightarrow{\mathcal{DFT}} X[k]$$
then,
Prove that: DFT of the same sequence after insertion of $(M-1)$ zeroes between successive samples is $M$ times repetition of DFT of original Sequence .
$$\begin{aligned}x\left[\frac{n}{M}\right]\xrightarrow{\mathcal{DFT}}\{&X[0],0,0,\dots,0,\\&X[1],0,0,\dots,0,\\&X[2],0,0,\dots,0,\\&\vdots\\&X[N-2],0,0,\dots,0,\\&X[N-1],0,0,\dots,0 \}\end{aligned}$$
My attempt:
$$ \mathcal{DFT} \left\{x\left[\frac{n}{M}\right] \right\}=\displaystyle\sum_{n=0}^{n=MN-1}x\left[\dfrac{n}{M}\right]W_{N}^{nk}$$
replacing $n\to{ nM}$
$$\text{LHS}=\displaystyle\sum_{n=0}^{n=N-\frac{1}{M}}x[n]W_{N}^{Mnk}\neq \big(X[k]\big)^M$$
I'm doing some mistake that is why i'm not getting $\text{RHS}=\big(X[k]\big)^M$.
Can anyone help me in proving this property?
Note:
$x[n]$  have period $ N$ so, $x[\frac{n}{M}]$ will be having period $MN$.
$W_{N}$ is twiddle factor $=N$ th root of unity$=\exp\left(-j\tfrac{2\pi}{N}\right) $


texts: Using the traditional instruments for measuring high frequency signal

texts:
All we know that we can not use the probe for measuring the high-frequency signal (microwave signals). I still can not understand the reason. I have read that the reason because of the wavelength size of the microwave signals is comparable to the electronic components, but this does not make any sense to me as the wavelength of the 1GHz is about 20 cm which is already comparable to the size of the electronic components.

Could any of you please explain to me in more details why we can not use the probe for measuring the high-frequency signal.


texts: Value of power spectral density $N_0$ or effect of scaling bandwidth to SNR

texts:
I want to compare performance over AWGN channel of two systems that are exactly identical but their bandwidth. I will talk only about baseband system for sake of simplicity. For more details about notations, please take a look at this online course MIT DSP course.

Call $P$ the signal power (joules per second).

First, considering a system using bandwidth $W$. According to sampling theorem, the orthogonal basis set contains $2W$ vector. The single side power spectral density of white Gaussian noise $N(t)$ is defined as $N_0$ if its projection $N_k = <N(t), \Phi_k(t)>$ is set of i.i.d Gaussian variables with zero mean and variance $N_0 / 2$.

Sampling interval is $1/2W$, there is $2W$ signal symbol per second, then a symbol has power of $P/2W$. A noise sample has power of $N_0/2$ by definition, the $SNR = (P/2W)/(N_0/2) = P / N_0 W$. Well-known results !!!

Next, I wonder what happens if I increase the bandwidth, say double it, to $2W$ in the same physical environment.

Double bandwidth, half symbol duration. In one second, I have doubled the number of discrete symbol to $4W$. The signal power per discrete sample is now $P/4W$.

Question 1: But what happens to white Gaussian noise sample ?

If I understand $N_0/2$ as noise power per Hertz, does doubling bandwidth to $2W$ doubles noise power per sample ? If yes, SNR should be decreased by factor 4 (2 of reducing signal power per sample and 2 of increasing noise power per sample). I doubt this.
If I use the projection of the same $N(t)$ to the new orthogonal basis set. Number of vector in the set has increased twice from $2W$ to $4W$. Does projecting the same signal to more basis vectors reduce the power of each projected coordinate ? If yes, is it true that the noise sample $N_k$ now have variance $N_0/4$ instead of $N_0/2$ ? And SNR does not change because $SNR = (P/4W) / (N_0/4) = P/N_0 W$.

Question 2: Is $N_0/2$ watts per Hertz ?


texts: How can I measure the harmonicity of an audio spectrum?

texts: I would like to estimate the "harmonicity" (harmonics-to-noise ratio ?) of an audio signal from its spectrum. What kind of algorithm can I use?


texts: Image Processing method for spiky selection

texts:
I have an input as a 3D binary image and the preferred output below:

Input:

Preferred Output:

What image processing methods should I look for if I am to have only the spiky object(s) remain, just like the preferred output above?


texts:
The following is a plot of the FFT of a noisy electronic component. It's not white noise, but is stochastic in nature.  I used Python's matplotlib plt.magnitude_spectrum(...) function. It was a 1MHz sample rate.

What is the actual magnitude?  Is it the top or the bottom of the purple? Or am I supposed to interpolate a mean through the middle?  Or something else?


texts: Polynomial division to separate FIR and IIR in cascade

texts:
I have a FIR filter $L(z)$ and an IIR filter $H(z) = \frac{B(z)}{A(z)}$ which are cascaded together as $L(z)H(z) = L(z)\frac{B(z)}{A(z)}$.

For specific reasons I want to calculate a parallel topology that is equivalent to the original $L(z)H(z)$. I can achieve this using long division to divide $L(z)B(z)$ by $A(z)$ to obtain:

$L(z)H(z) = \frac{L(z)B(z)}{A(z)} = Q(z) + \frac{R(z)}{A(z)}$

Where $Q(z)$ is the quotient and $R(z)$ is the remainder of the long division of $L(z)B(z)$ by $A(z)$.

However, the resulting IIR, $\frac{R(z)}{A(z)}$, has a delay equal to the number of taps of the original FIR $L(z)$

Is it possible to do some clever re-arranging before the division so that the resulting IIR part of the long division is not delayed?

Of course one approach is to flip the filters so the magnitude of the poles are greater than one and perform long division using an unstable filter and flip back (which is a simple change of variable $z \to \frac{1}{z}$ and back again), but this isn't a useful solution.


texts: What differences or other criteria can be used to help decide between using overlap-add and overlap-save for filtering?  Both overlap-add and overlap-save are described as algorithms for doing FFT based fast convolution of data streams with FIR filter kernels.  What are the latency, computational efficiency or caching locality (etc.) differences, if any?  Or are they the same?


texts: How to solve Lorentzian equation in matlab with once unknown variable

texts:
I am trying to solve Lorentzian in maltab but unable to get expected result.
My equation is as follow -

K = [0:0.1:1]
T=0.010;
tauc = unknown (need to find for all value of K)

I should get the plot something like this -

Thanks for help in advance


texts:
I have a time series and apply the FFT to get a spectrum.

Let's assume that my sampling frequency and the length of the time sample are chosen such that I end up with a $\Delta f = 0.1$ Hz.

As this is still rather noisy, I'd like to change $\Delta f$ to 0.5 Hz a posteriori.

How do I combine the fourier components of the adjacent bins? Am I right to just sum them? Or do I take the square root of the sum of squares?
Is there a term for what I am trying to achieve, so that I can find some references on my own?


texts:
Many times we have a stream of video to process without access to camera. Having access to camera matrix would be beneficial for various processing techniques. Is it possible to hack camera calibration without having access to the camera?
I have a stream of video from a single camera mounted on a moving car recording the road (Hence multiple parallel lines on the ground plane, corners from lane markers but no circles). I want to create a top-down view of this but I do not have access to the camera. Is it possible? If so how?
I understand from Learning OpenCV: Computer Vision with the OpenCV Library book that I need the following matrices:

Intrinsics, and
Distortion

.. to cv2.undistort() the image, compute homography cv2.getPerspectiveTransform() and cv2.warpPerspective() to finally get the topview.
Question

How can I compute/approximate/guess Intrinsics or Distortion Matrices/parameters? Are all parameters important?
Would it be okay to copy parameters from other cameras (like OpenCV source code samples)?

Prior Research:

OpenCV Python Camera Calibration Tutorial - Requires Access to the Camera
Camera AutoCalibration - Gives hope "calibration may be obtained if multiple sets of parallel lines or objects with a known shape (e.g. circular) are identified"
Attempting to understand camera calibration related answers[1][2][3] on SO trying to find answers to my problem.

Any ideas? Appreciate your help in advance!

Update 1: Perspective Transform Experiment
I had attempted using getPerspectiveTransform(pts1,pts2) and dst = cv2.warpPerspective(img,M,(x,y), flags=flags) to match four points of input image to get a sort of top-down view. But I am not sure how to handle the distortions:
Selecting Points: First, I zoomed in on the input and tried to precisely select matching exterior points on the lane markers to create the Homography Matrix and previewed the perspective transformed image with warpPerspective. I saw the lanes were distorted but didn't know how bad. To get an idea I chose points further out by delta (50px) flat on each end. This is what I get:

Can I fix the distortions without having access to the camera? Is there any other way to fix this.
Few input images to play with:

Update 2: Non-Parallel (Scattered) Optical Flow in Top-Down View
Is this due to distortion or something else?:


texts: Frequency magnitude distribution of noise

texts:
By the Wiener-Khinchin theorem, we have a straightforward way to calculate the power spectral density for stationary noise.  If we know the bandwidth of a system, we can further calculate the variance of the noise since it turns out that $v_{noise,\ RMS} = \sigma$ (standard deviation) for zero mean noise.  Therefore, at each point in time we know the probabilistic distribution of noise as shown in this video:

However, can we determine anything about the distribution of noise magnitude at each point in frequency from a noise source with known power spectral density?  I believe this could be related to power spectral density estimation?

This video says that power spectrum realizations are proportional to the square of the underlying PSD, though I am not sure if that is just an artifact of using periodograms.  In any case, 'variance proportional to the square' is still not a precise probabilistic distribution.


texts: Relation between frequency spectrum and PDF of a random variable

texts:
I have a random variable that is being generated according to some probability distribution function (e.g. a Gaussian PDF).

When looking at the frequency spectrum of the generated data does the knowledge of the exact distribution function have any constraints/give any information about the frequency spectrum of the samples?
In other words, would the PDF of a random variable constrain the possible frequency spectra the resultant random process may take?
Is this a reasonable question?


texts:
I have this confusion. I was reading this paper. It says

lets say I have a n dimensional vector X and I take its DFT i.e DFT(X). Then the n Fourier coefficients have the same L2 norm as X. How is it true? I tried on a vector

X = ones(100,1). Applied DFT to X i.e, DFT(X). But norms are not equal


texts: How do you map indices to twiddle factors in FFT

texts:
I am kinda lost on how to map my indices for each stage to my look up array of precomputed twiddle factors.
For an $N=8$ point FFT i have $N/2$ twiddle factors in total:
${
[0] = W_8^0, [1] = W_8^1,  [2] = W_8^2, [3] = W_8^3
}$
With this look up table available how do you calculate, which index matches with each other and which twiddle factor index in the array is needed and whether its negative or positive.
I want to be able to recalculate all of this.
For example:

Lets say as a random choice, I'm on the second stage and on index 3. From this map it shows that:
Stage 2 :: Index 3:: $[1] - W_8^2 * [3]$
So i need to know that I pair with index 1, the twiddle array index is [2] and that the sign for it is negative since i am on the bottom half of the wing.
The butterfly images that every website shows - seems to gloss right over how you actually calculate the mapping of it all.
Does any one know the math that links it up as you iterate the indices for each stage?


texts: How come FFT window give half size frequency bands when filter can seems to have an infinite precision?

texts:
I don't really understand maths behind filtering but use it lot in music production and i'm a total newbie to DSP.

Usually parametric filters let you filter frequencies with a precision that seems almost infinite. But when using a FFT or DFT the taken window size gives n / 2 + 1 frequency bands.

Are the two related ? if so how can a filter get so much precision when Fourier Transform doesn't?

That may seem a dumb question but when I look at spectrograph in sound softwares they always looks much more precise than the buffer I've choosed (usually 256 samples).


texts:
So I am solving receiver figure of merit. I have gain in dB and noise temperature in K.

I know

[G/T] = [G] - [T] dB/K

Here should I need to take T in dB or just as K?


texts: FFT frequency domain averaging and zero padding

texts: I'm trying to get the average frequency response of an entire piece of audio by splitting it into segments, doing an FFT on each one, and averaging the magnitudes together. Its working great until I get to the last segment, which nearly always is shorter than my FFT size, so I pad it with zeros until its the right size. This gives me the right response, but it is reduced in magnitude. I compensate for this by multiplying each value by the square root of my dft length divided by the last segment's length. This seems to give me the correct rms value for a sine wave and very nearly the same peak as the other segments. The problem occurs when i average this last segment with the others. The average rms and peak comes out significantly off. It gets better the greater the ratio of signal to zero padding there is in the last segment, but of course i'd like it to work for any amount of signal to zero padding. Any idea what might be happening?


texts: What are the properties of continuous-time improper systems?

texts:
I am trying to better understand the properties of improper systems $H(s) = \frac{b(s)}{a(s)}$, for which the order of the numerator $b(s)$ is greater than the order of the denominator $a(s)$ (in the broader context of continuous-time linear time-invariant systems). I have trouble reconciling the application of region of convergence (ROC) rules and my intuition.

Let us take the simplest example that is the pure differentiator, i.e.,  $H(s)=s$.

Application of ROC rules

Causality. The system has a pole at $s=\infty$. Thus, the ROC is not a right-sided plane. So the system is not causal.
BIBO stability. The ROC includes the imaginary axis $s=j\omega$. The system is BIBO stable.

My intuition

Causality. The differentiator can be expressed as the limit of a forward difference or as the limit of a backward difference. So depending on how we define the differentiator, it can be a causal system or an anti-causal system.
BIBO stability. I have two intuitions here.

(1) The derivative of a bounded input like the step function can be unbounded as it gives the Dirac function. So the system is not BIBO stable.

(2) The impulse response of the differentiator is $h(t) = \delta'(t)$, i.e., the derivative of the Dirac function. This is not an absolutely integrable function as $\int_{-\infty}^{\infty} |\delta'(t)| dt = \infty$. See
https://en.wikipedia.org/wiki/Unit_doublet. So the system is not BIBO stable.

How can I reconcile the ROC analysis and my intuition? Where am I wrong?

Definitions

Causality. A LTI system with impulse response $h(t)$ is said to be causal, that is, it has the property that the value of the output at time $t_0$ depends on the values of the input and output for all $t$ up to time $t_0$ but no further, i.e., only for $t \leq t_0$, if and only if $h(t)=0$ for all $t < 0$.

BIBO stability. A LTI system with impulse response $h(t)$ is said to be BIBO stable, that is, it has the property that its output $y$ is bounded whenever its input $u$ is bounded, if and only if
$$\int_{-\infty}^{\infty} h(t) dt \triangleq \| h \|_1 < \infty $$
in which case we can bound the peak of the output by
$$ \| y  \|_\infty \leq \| h  \|_1 \| u  \|_\infty $$
where $\|u\|_\infty \triangleq \mathrm{sup}_{t\in\mathbb{R}} u(t)$.


texts:
it could be a donkey question but I'm a little confused.

I have this signal $w(t)=sin({\pi}0.1f)$. I have to calculate the period of this signal.

$w(t)=sin(2{\pi}\frac{1}{20}f)$

the period of this signal is: $20s$ while the frequency is $\frac{1}{20}Hz$

is it correct?


texts: How is data compression possible for audio?

texts:
I understand that compression works by exploiting certain psycho-acoustical characteristics of our auditory perception, but I'm still confused. I mean ultimately, the waveform must be recorded regardless of what has been done to do it, and I was under the impression that all waveforms were born equal? Does removing a band of bits needed to store that information?

I'm confused?


texts: What algorithms are there for 1-d median filtering (sliding median, rolling median, running median), similar to MATLAB's medfilt1? Of interest would be a reference implementation written from scratch, preferentially for MATLAB.


texts:
Let's define the relaxation time of a filter as the delay needed for the impulse response of a filter to reach and remain under an amplitude threshold.

Is there a closed-form solution to the computation of an estimate or boundary of the relaxation time of a discrete recursive (IIR) filter from its poles/zeros or from the coefficients of its difference equation, except by computing a reasonable length of its response and checking the absolute value of the response?


texts: Nyquist Rate of cosine modulated function

texts:
Here's my understanding:

$$y(t) = x(t)~ \cos(\Omega_0 t)$$

I take the Fourier transform of y(t) and I get this result:

$$Y(\Omega) = \frac{1}{2}X(\Omega - \Omega_0) +  \frac{1}{2}X(\Omega + \Omega_0)$$

If the Highest frequency of $X(\Omega)$ is $\Omega_{N_X}$ ,shouldn't the highest frequency of $Y(\Omega)$ just be:

$$\Omega_{N_Y} = \Omega_0 + \Omega_{N_X}$$

instead of:

$$\Omega_{N_Y} = \Omega_{N_X} + 2 \Omega_0$$

as the textbook claims?


texts: Questions on Need of filtering before decimation?

texts:
This is a question related to the need for filtering before decimation. I understand that there are many questions likewise in this forum. I have gone through these and still little confused (or) may be overthinking about it.

I have a test sequence(1x1000)sampled at 176.4 KHz(example) and I need to decimate it to let's say 44.1KHz. (the maximum frequency component in the sequence is 20KHz, I am taking examples from audio freqs).
The way I understand decimation is, any sequence with sample rate Fs is decimated to Fsd(=Fs/D) ... then there is a higher chance that it violates the Nyquist sampling theorem and information is lost in the original sequence(if we don't think about filtering and just decimate it).
In my example, if I decimate (by factor 4) 176.4Khz to 44.1Khz, it still satisfies the Nyquist sampling, so there will be no concept of aliasing since Fsd>2*20Khz ------ **In this case, do I need to apply LPF before Decimation. If Yes why ?*
If I want to decimate by factor 16, i.e. 176.4KHz to 11.025Khz, it doesn't satisfy Nyquist sampling (as my new Fsd<2*20KHz).. aliasing occurs.So, we (undesirably) remove the higher frequency components in my test sequence by applying LPF (with cutoff freq ≤ 5.515 (F_coutoff ≤ Desired_sample_rate/2) )

LPF is applied such that there are no frequency components higher than 5.515KHz
Is this how I need to choose my cut-off ??


texts: Matlab fast fourier transform (FFT) function and time in hours frequency : hertz or millihertz?

texts:
I have a function of type

$$C(t)=0.31 \left(e^{-0.267t}-e^{-1.72t}\right)$$

Where $t$ is in hours

The function represents the evolution in a window of 24 hours of a drug blood concentration, after a dose of a drug is given at  $t = 0$ to a patient. I would like to use Fourier transform, to identify th best sampling step to reconstruct the concentration curve. Because it is a human whose blood we are sampling here I would like to reduce the sampling as much as possible, with a reconstruction error of around 20%.

I am using Matlab FFT function to compute the function's Fourier transform and plot the spectrum.

However I am not sure if my frequency are in Hertz or Millihertz. Because I am sampling in hours, I am expecting lower frequencies (millihertz), but I am not sure of the logic.

Here is my Matlab Code

clear all; clc;close all;
%% Time-domain signal
Ts=0.25; % time discretization step
t=0:Ts:24 % in hours
C=0.31* (exp(-0.267*(t))-exp(-1.72*(t)));

figure,plot(t,C);

title('Time domain signal');
xlabel('Time in hours ')

%Frequency domain signal Via Matlab FFT function
F2=fft(C);
L=length(F2);
figure,plot((0:L-1)*(1/(L*Ts)),abs(F2));
title('Frequency domain signal via FFT of C(t)');
xlabel('Frequency in Hz or Millihertz?')


texts: How to use MATLAB's $\tt xcorr$ to find index of a section inside a whole recording?

texts:
Trying to find the index offset of a short section of an audio I have taken out of my recording with cross-correlation, but this method sometimes succeeds finding the index of the short section sometimes fails, seems that it depends which sections are being compared and the length of the section made.

My question is what makes the xcorr lose its accuracy ? And if is it dependable ?

clear all;
close all;

[A,fs]=audioread('hendrix.wav'); % some random audio

offset=36644-(784/2); % here I define the offset for my selection.

B=A(offset:offset+784); %here I make selection from A 784 samples long...

[c,lags] = xcorr(A,B);  % c is the correlation, should have a clear peak

c=c((round(length(c)/2):round(length(c)))); %positive coefficients

[ff,ind]=max(c); % finding the index of the offset

M=A(ind:ind+(length(B))-1); % the selection from A based on the new index

plot(B);
hold;
plot(M);


texts: How many moments are needed for a discrete distributions

texts:
I am doing a project on imaging and I have a more general question about imaging.

In general we use the moments of the distribution of the object imaged, because the capture information about the image. If our image is continuous then we will need in general infinite number of moments to describe it correctly. (Because if we consider the image as a function and we take the Taylor expansion in moments we will need all of them).

My question is, if we have a discrete distribution, 2 or 5 points that we want to image, how many moments do we need? Do we still need infinite of them or just 2 or 5?

Thank you!


texts: Discrete time sine wave generation near nyquist

texts:
I'm trying to wrap my head around how to generate sine-waves out of a DAC near the Nyquist frequency (or determining how close I can get for reliable results). So if I want to generate a 499 Hz sine wave using a 1 kSPS DAC, I will calculate each sample:
$$y(t) = \sin(2 \pi 499 \ t) $$
Converting this to discrete time:
$$ y[k] = y\left( \tfrac{k}{1000} \right) = \sin \left(2 \pi 499 \frac{k}{1000} \right)$$
I end up with something like this:

The red line shows the 499 Hz signal, while the blue dots show the DAC sample. I get these large amplitude fluctuations. I know it's common to use a reconstruction filter to get rid of DAC images, which I always thought of as a low-pass filter from DC to Nyquist, which wouldn't really help get rid of the amplitude fluctuations...or would it?
Is there a better approach for generating sine waves? Or is there just simply a limit I cannot exceed (and what is the limit)?


texts: How to find the lower eyelid in an image?

texts:
I have an image of 480x360 px that contains eye portion only i.e., sclera iris, pupil, eyebrows  etc. Now I have to find the lower eyelid in the image.

What I've done till now is that cut the image in 2 parts upper and lower half. Now apply edge detector (Canny) on lower part and then parabola fitting on the resultant image.

I am getting ok results but eyelid is not parabola so sometimes  the parabola goes into the sclera region also.

I am thinking to doing curve fitting but a better idea looks like funding a curved line in the edge map.

Can you help in finding the curved line in the edge map ?


texts: Delay signal according to normal distribution

texts: I am trying to delay a signal by a certain number of samples. This certain number, I would like to generate using a random normal distribution in Matlab. I am using the following for generating the number of samples r = randn(1,1)/sampleTime. This however generates negative numbers too. In order to avoid the negative numbers, I am taking the absolute value of r but I know that this is not the right way, since in this case I would be ignoring the left part of the distribution. Is there a way I can use just positive samples without shifting the mean too much?


texts:
I am making an low-frequency oscillator (LFO) that should be able to output different kinds of waveforms.
If I, say, want to be able to create a smooth transition from a sine wave to a square wave, what would the best approach be?
I have thought about creating several hardcoded lookup-tables and "scroll" between these, but I am worried about the transition not being smooth enough, unless there are many of these tables.

If anyone knows about the best way/usual way to solve this problem, I would be happy to hear about it.


texts: Cross-correlation estimation in MATLAB using a method similar to pwelch for the PSD

texts:
Is there a function in MATLAB to estimate the cross correlation function of two wide-sense stationary signals (or the autocorrelation of the signal with itself) in a way similar to the estimation of the PSD using PWELCH?
I mean an estimate using shorter overlapping intervals and an averaging process to reduce noise .


texts: Fourier Transform within a certain Limit

texts:
I want to evaluate fourier transform within a certain limit in MATLAB,the expression of which is
$$X(f) = \int_{1}^{4}{x(t)e^{-i2\pi ft}}\,dt$$
I have to find value of the above expression within limits which are definite in nature.
I came across this post on MATLAB discussion forum which says to multiply the function by dirac(x-lowerbound) * dirac(upperbound-x) and then use fourier to calculate the desired results,but i am not getting the desired results.
What else can I try?
https://in.mathworks.com/matlabcentral/answers/16049-need-command-for-continuous-time-fourier-transform


texts: How does sampling rate impact Discrete-Time Kalman Filter state space modeling assumptions?

texts:
Consider a very simple, discrete-time constant position-type model for state updating in a Kalman filter:

$$
x_{k+1} = x_k + w_k
$$

The Kalman filter will be run with update interval $T_s$ such that $x_k$ represents position at time $t=kT_s$.

Typically, the process noise $w_k$ is modeled as a zero-mean, white stationary random process of variance $\sigma^2_w$.

Now, assume that the position time series is strictly band-limited with bandwidth far lower than the Nyquist frequency $1/(2T_s)$.  This corresponds to a high degree of oversampling.

In principle (say, with zero measurement noise), the process noise could be recovered by applying a simple differencing high pass filter with transfer function:

$$
H(z) = 1 - z^{-1}
$$

to the position time series.  However, if the position time series is strictly bandlimited, then the recovered process noise is strictly bandlimited, which violates the white process noise model.

Does this mean that the Kalman filter needs to use a correlated process noise model for highly oversampled systems?

In my case, the state space model (which, in fact, is constant velocity not constant position) describes the time evolution of a certain biological quantity.  The discrete-time state space model has not been chosen from a precise description of the dynamics of the underlying physical (physiological) phenomena,  (This is because such descriptions are complex and require access to additional biological quantities which are rarely knowable in practice).  Rather, the constant velocity model is a common choice in the literature motivated primarily by expedience, simplicity, and good tracking results.

In the literature, all results seem to be reported for near-Nyqvist sampling. Some studies in the literature analyzed real biological data (again, sampled near Nyqvist) and claimed that the process noise for this model was white.  In my case, for historical reasons, I am oversampling by a good factor of 15.  When I analyzed a very clean sample signal, I found that at the oversampled rate, the process noise was highly correlated.  A decimated-to-near-Nyqvist version of the signal gave rise to a significantly lower amount of temporal correlation in the process noise.  This is what motivated my question.


texts: What does the amplitude in a frequency response of a signal signify?

texts:
Well according to my understanding it tells the concentration of signals at a particular frequency but what does the number really mean? Suppose in a frequency response graph i have such a relation ::
"a1"(amplitude) at "f1" (frequency)
a2 at f2 , a3 at f3. What do i infer from it?


texts: What is difference between along the edge and across the edge

texts:
I am trying to implement a paper called structured tensor based image interpolation. In the paper I came across a concept called tangent direction and normal direction. What they mean is tangent direction is along the edge and normal direction is across the edge. Can anyone help me to find out what the tangent and normal direction the author is talking.
The paper link is below:-
https://arxiv.org/pdf/1402.5564.pdf


texts: Designing High Pass Filter to Remove DC Offset from a Signal

texts:
I want to design a high pass filter (f0*S/1+f0*S) in order to remove the dc offset from a signal ? (i.e. how to choose the frequency f0).

Thanks,
Hacene

Ps : the filter is for MATLAB implementation, this is why i would like to have it in continuous time.


texts: Efficient audio power spectrum estimation

texts:
I am working on a small personal project where I want to control a matrix of roughly 100 actuators with an audio stream. The goal would be that the user can see/feel the music features in the movement of the actuators. I am still at a early stage, so I can't be very specific about what I need (for now)

What I had in mind was to extract a series of frequency band and map the power estimate to the intensity of one/many actuators. For instance, very low frequency could control the center of the matrix, the range from C3 to B6 would be mapped to arbitrarily selected actuators and very high frequency would be spread all across the matrix, so that sounds with high component such as synth sound would give a "buzz" effect.  Well the strategy has to be elaborated more with some trial and errors I guess and a lot of human intepretation.

Nevertheless, one thing is sure, is that I will need to extract the power estimate of some frequency bands, and I want to go for the most CPU efficient technique possible as this will be run by an embedded device. Here's some technique I considered:

Doing an STFT (or a moving DFT as this will be real time). I could multiply the STFT result with a mapping matrix of $N \times M$ (where $N=$ number of FFT bins and $M=$ number of actuators) to get a vector of intensity value that could be sent to the hardware controlling the actuator. The amount of calculation will of course depend on the amount of non-zero value in the matrix, which I suspect will be high.
Wavelet transform : Probably a more efficient way of doing #1, trading precision at high frequency for lower cpu operations. Still, this would imply a downsmapling filtering as well.
Doing a filter bank of bandpass filters. I did a quick estimate of the amount of operation needed. With an IIR bandpass filter with a 40dB attenuation at the neighbor demi-tone. I find roughly 16 multiplication ~10 addition per sample at low frequency and 30 multiplication, 20 additions at high freq. Which we can approximate ~1350 Multiplications and 720 additions if we consider 48 actuators and the average values of low and high freq requirements.

So, the question goes as follow : What technique should I mostly look for?

Even if there is still requirements to define, is there a technique that is to be avoided? Or maybe a similar application?

Right now, the wavelet approach seems to me like the most appealing approach.

Note that I may move some load on a FPGA if I get too short on CPU power.


texts: Is linear convolution same thing as aperiodic convolution?

texts:
I am reading an online article and what i understood from there is that linear convolution is aperiodic
Is it right?
I have also attached snapshot and higlighted two instances


texts: How can I specify the scale parameter of the wavelet in PyWavelets (pywt)?

texts:
When computing wavelet transforms with PyWavelets (Discrete Wavelet Transform in Python), e.g.

import pywt
cA, cD = pywt.dwt([1, 2, 3, 4], 'db1')

>> print 'cA', cA
cA [ 2.12132034  4.94974747]

>> print 'cD', cD
cD [-0.70710678 -0.70710678]

how can I specify the scale parameter of the wavelet?

In Matlab for example using cwt() I can specify the scale(s) I want in the parameters, and it will return all possible shifts:

x = [1, 2, 3, 4];
scales = [1, 2, 3];
wavelet_name = 'db1';
coefs = cwt(x,scales, wavelet_name);

>> coefs =

   -0.0000   -0.0000   -0.0000    0.0000
   -0.7071   -0.7071   -0.7071   -0.7071
   -1.1553   -1.1553   -1.1553    1.7371

(I'm basically trying to find an equivalent of Matlab's cwt() in Python with a decent amount of wavelet functions available unlike scipy.signal.cwt.)


texts:
When a note is played on the guitar, is the fundamental frequency always the strongest one or could a harmonic be the strongest one (in terms of amplitude). When could that happen? Also, when playing a note of, for example, 440Hz, is 220Hz also a harmonic or only larger multiples?

When I produce a spectrogram of a B3 guitar note I get this:

As you can see, the frequency of B3 (246Hz) does not seem to be the strongest frequency. Its approximate half (near 130) seems to be the strongest one.

This is the audio file (the B3 note is clear).

To generate the spectrogram, I use a STFT taken from the Librosa library:

import plot as plt

def transcribe(filename):
  y, sr = librosa.load(filename, sr=40000)

  D = librosa.stft(y)
  plt.plot_spectrogram(D)

The plot.py module:

import matplotlib.pylab as plt

def plot_spectrogram(stft_output, xlabel='Time', ylabel='Hz'):
  plt.figure()
  librosa.display.specshow(librosa.amplitude_to_db(stft_output,
    ref=np.max), y_axis='log', x_axis='time')
  plt.title('Power Spectrogram')
  plt.colorbar(format='%+2.0f dB')
  plt.tight_layout()
  plt.savefig('static/plots/' + 'spectrogram.png')


texts: Do the DCT coefficients correspond to particular pixels?

texts:
Getting the DCT coefficient based on what I've read, is usually done through a matrix, usually 8x8 or 16x16 using these formulas:

$$B_{pq}=\alpha_p\alpha_q\sum_{m=0}^{M-1}\sum_{n=0}^{N-1}A_{mn}\cos\left(\frac{\pi(2m+1)p}{2M}\right)\cos\left(\frac{\pi(2n+1)q}{2N}\right),\quad

\begin{align}
&0\leq p\leq M-1\\
&0\leq q\leq N-1
\end{align}
$$

$$\alpha_p=\left\{
\begin{array}{ll}
1/\sqrt{M},& p=0\\
\sqrt{2/M}, & 1\leq p\leq M-1
\end{array}\right.
\quad
\alpha_q=\left\{
\begin{array}{ll}
1/\sqrt{N},& q=0\\
\sqrt{2/N}, & 1\leq q\leq N-1
\end{array}\right.
$$

However, I would like to know if it is possible to determine the corresponding DCT coefficient of a pixel or of the edges of an image? Is there a way to detect edges through DCT coefficients?


texts: Finding the input bit rate of an analogue input

texts:
Suppose I have 4 of 300bps synchronous digital input and 1 of analogue input with a bandwidth of 500Hz. The analogue input is sampled at 4bit using PCM. All the channels are multiplexed with TDM.

As one of the input is of analogue, I need to convert that to digital input first before TDM can be carried out. Since the analogue signal will be sampled at 4bits, my initial idea was to use the Nyquist sampling theorem to have 500Hz × 2 = 1000 samplings per second. But on a second thought, this is merely the bandwidth and I cannot do this unless it is said that the highest frequency is 500Hz.

However, then how should I find out the input bit rate of the analogue input channel for the TDM multiplexing?


texts: Separability vs. Resolution - Synonymous terms?

texts:
In terms of discrete representation of a variable, let's say time measurements in absolute values in [seconds], is there a difference between separability and resolution? When do speak of either aspect? Or are those terms used synonymously?

  Example: Measuring arrival time of two physically distinct flights
  landing, are there examplary different contexts, in which we would
  distinguish between time separability of flight arrival times and time
  resolution?


texts: Is there an algorithm for computing auto-correlation in a frame-based manner?

texts:
I am trying to find out if an algorithm similar to the Overlap-And-Add method that enables frame-based computation of convolution and cross-correlation exists.

When I say frame-based computation I am referring to having a very large input signal vector, subdividing it into smaller frames, processing the autocorrelation of those frames, and then concatenating all of the frame results plus any extra magic to form the overall auto-correlation result as if I had computed the whole thing at once.

Working through toy examples by hand for auto-correlation I quickly realized the normal Overlap-And-Add method doesn't work due to the correlation "template" changing every frame vs generally being fixed in the cross-correlation and convolution cases.


texts: Extended Kalman Filter (EKF) for Non Linear (Coordinate Conversion - Polar to Cartesian) Measurements and Linear Predictions

texts:
I'm new to Kalman filtering and state estimation and I'd like some guidance on EKFs.

Currently, I'm trying to use a linear prediction model coupled with nonlinear measurements to estimate the state of an object. My state vector ($\bar{x}$) is:

\begin{bmatrix}x\\y\\v_x\\v_y\end{bmatrix}

and my state model is (with no process noise ($W_k$) or process noise covariance ($Q_k$)):
$$
\bar{x}_{k_p} =
A\bar{x}_{k-1} \ +
B\begin{bmatrix} a_x \\ a_y \end{bmatrix}
$$

$$
P_{k_p} = AP_{k-1}A^T
$$
where
$$
A = \begin{bmatrix} 1 & 0 & \Delta T & 0 \\
0 & 1 & 0 & \Delta T \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \end{bmatrix}
$$
and
$$
B = \begin{bmatrix} \frac{1}{2}\Delta T^2 & 0 \\
0 & \frac{1}{2}\Delta T^2 \\
\Delta T & 0 \\
0 & \Delta T\end{bmatrix}
$$

I have simulated some measurement data with Gaussian noise. The measurements are outputted as $\begin{bmatrix}r\\\theta\end{bmatrix}$, and this is the graph of the generated data:

To account for the polar coordinates, I was going to use a function $h(z)$ that transformed from polar to cartesian coordinates in my state update equation $\bar{x}_k = \bar{x}_{k_p} \ + K_k(h(\bar{z}_k)-\bar{x}_{k_p})$? This seemed like the simple thing to do, but this post does say that if I did so, my filter wouldn't work as the polar to cartesian transform isn't a linear transform.

To resolve this, I want to use an EKF to linearize the measurements, and after reading a few articles online, my gain calculation and update step are as follows:

$$
K_k = P_kJ(\bar{z}_k)^T \ (J(\bar{z}_k)P_kJ(\bar{z}_k)^T + R)^{-1}
$$

$$
\bar{x}_k = \bar{x}_{k_p} \ + K_k(Z_k - H\bar{x}_{k_p})
$$

$$
P_k = (I - K_k J(\bar{z}_k))P_{k_p}
$$

where $K_k$ is the Kalman gain, $\bar{z}_k$ is the measurement vector outputted by the sensor, and $J(\bar{z}_k)$ is a Jacobian to linearize the polar coordinate measurements. These are all at time $k$. In addition, my prediction equations are the same linear equations as shown above.

I used $x = r \cos(\theta)$ and $y = r \sin(\theta)$ to derive the following Jacobian:
$$
J(r,\theta) =
\begin{bmatrix} \frac{\partial x}{\partial r} & \frac{\partial x}{\partial \theta} \\
\frac{\partial y}{\partial r} & \frac{\partial y}{\partial \theta} \\
\frac{\partial v_x}{\partial r} & \frac{\partial v_x}{\partial \theta} \\
\frac{\partial v_y}{\partial r} & \frac{\partial v_y}{\partial \theta} \\
\end{bmatrix} =
\begin{bmatrix} \cos(\theta) & -r\sin(\theta) \\
\sin(\theta) & r\cos(\theta) \\
0 & 0 \\
0 & 0
\end{bmatrix}
$$

Would this Jacobian and model be the correct way to go about my problem?
Thanks for your help!

P.S. I'm super new to this so if some of my lingo is wrong or weird, if I'm missing something or something makes no sense, or if you have some tips to better my understanding, please let me know. Thanks!

EDIT: I converted the polar values to the cartesian plane with $x = r\cos(\theta)$ and $y=r\sin(\theta)$, and then graphed the $x$ and 4y$ values. This is the result:

Obviously, something seems to be working, but I don't know/understand why, especially if the transform isn't linear. If someone could help my understanding of this as well, I'd truly appreciate it.


texts: I have an audio signal where most of the signal of interest is above 400 Hz but it is corrupted by heavy wind noise. What type of filter would you recommend to try to remove the wind noise considering I have audio samples of just wind but I don't have uncorrupted samples of the signal of interest. A simple high pass seems to work ok but my boss wants me to try implementing some type of adaptive or spectral subtraction type filter.


texts: Coarse summary of various methods for detecting when a signal 'starts'

texts:
My question is basically in regards to how to detect when (in time) a signal 'starts', and it might also be called 'transient detection', or, as I have read in some papers regarding music, the 'onset' of a signal.

The motivation here is ultimately a Time-Delay-Of-Arrival (TDOA) estimate between two signals, but suppose you do not have the luxury of doing a cross-correlation because the signals are either way too long, and/or there is so much multi-path corruption that the cross-correlation method doesnt work. In this case my belief is to look for where a signal 'starts' and go from there.

I am looking for more breadth than depth here, as in, a survey of possible/common methods used in doing such a thing.

Thanks!


texts: Where can I find a table of $z$-domain coefficients for Butterworth filters?

texts: The primary source lists Butterworth polynomials in s-domain and provides a link to bilinear transform for digital implementation. But, who needs analog specification in our digital world? Why should everybody get involved into the quite laborious bilinear transform, which, additionally requires frequency pre-warping? Meantime, looking at example bilinear transform in Butterworth design, I see that sampling frequency, T, cancels out, leaving you with a nice polynomial, after the monstrous transform. Why nobody can just conduct those monstrous computations only once and publish the z-polynomials, likewise s-polynomials are provided? Where can I find a table of z-polynomials not to be bogged down with the terrible pre-warping technicalities?


texts: Why would amplitude modulation result in change of frequency?

texts:
Question: (single choice correct; source: JEE Main 2015)

  A signal of $5 kHz$ frequency is amplitude modulated on a carrier wave of frequency $2 MHz$. The frequencies of the resultant signal is/are:

  2 MHz only
  2005 kHz, and 1995 kHz
  2005 kHz, 2000 kHz and 1995 kHz
  2000 kHz and 1995 kHz

My attempt:

I understand that amplitude modulation is the superimposition of an audio-frequency on a radio frequency carrier wave, in such a manner such that the frequency of the modulated wave is the same as that of the carrier wave, but its amplitude varies in accordance with the instantaneous amplitude of the modulating wave (message signal).

Note the part I highlighted, because, based on that part, I believe that the answer to the quoted question should be (1). However, the official answer was given as (3), and I have no clue why. It might have been correct in frequency modulation, but I am not sure why it's true in amplitude modulation as well.

Note that this is high-school level question, please answer accordingly. Many thanks!


texts: Zero Frequency Basis Equation for Discrete Sine Transform

texts:
So, I'm evaluating the Discrete Sine transform Basis functions and I found on the internet the following picture:

So, I may be getting the point wrong, but, if the 2D DCT equation is:

Then the Discrete Sine transform shall be:

Then, it is clear that for the lower frequency (u=0,v=0) all cosines will be 1, but in the case of the sines all will be 0 (for frequency=0), therefore, the basis function for the lower frequency, in the sine case, will be zero, right?

Is the upper left image (u=0,v=0) correct? It should be constant, right? (btw: It shall also be zero, right?)


texts: Downsampling by non-integer factor Filter requirement

texts:
I am trying to implement a logic to downsample data in non-integer factor.Lets say,converting 48Ksps to 1344 samples per second.Have two step implementation of upsample by K ,and downsample by L is in my mind, such that K/L gives me the required ratio.

The thing that troubles me is the filter(if any) required in between the upsampling and downsampling. Can anyone help me understand the necessity of this filter?
Also is there any better methods to do so?


texts:
I want to create a program in matlab that could act like karaoke software. At this moment i have following lines of code:

clear all;

[y1, fs1] = audioread('miszmasz.wav');
[y2, fs2] = audioread('voice.wav');

%checking if there is an audio file
if y1 == 0
    return
elseif y2 == 0
    return
end

%spliting into left and righ
leftSignal = y1(:,1);
rightSignal = y1(:,2);
voiceSignal = y2(:,1);

leftSignalLength = length(leftSignal);
rightSignalLength = length(rightSignal);
voiceSignalLength = length(voiceSignal);

%furier transform of left, right canal and voice sample
NFFT = 2^nextpow2(voiceSignalLength);
leftSignalFFT = fft(leftSignal, NFFT)/voiceSignalLength;
rightSignalFFT = fft(rightSignal, NFFT)/voiceSignalLength;
voiceSignalFFT = fft(voiceSignal, NFFT)/voiceSignalLength;

for i1 = 1:leftSignalLength
    leftSignalFFT(i1) = leftSignalFFT(i1) - voiceSignalFFT(i1);
end

for i2 = 1:rightSignalLength
    rightSignalFFT(i2) = rightSignalFFT(i2) - voiceSignalFFT(i2);
end

leftOutput = ifft(leftSignalFFT);
rightOutput = ifft(rightSignalFFT);
finalOutput(:,1) = leftOutput;
finalOutput(:,2) = rightOutput;

%wavwrite(y_Out, fs1, 'output.wav');
audiowrite('miszmasz_output.wav', finalOutput, fs1);

unfortunately, it does not work. Any tips?


texts: OFDM time vs. frequency domain channel estimation/equalization

texts:
In OFDM, the majority of Equalizers are used in frequency domain.  I mean the signal is transmitted in time domain (after performing iFFT), then to estimate the channel we should perform FFt to use any type of equalization such that LS or MMSE.

My question, what's about if we perform the equalization in time domain? it means at receiver side, we perform any type of estimation/equalization before performing fft (estimate and equalize in time domain)?   What's the advantages of using frequency domain OR  using time domain estimation and equalization?

Thank you


texts: What is the Fourier transform of a multiplied cosine signal with rect?

texts:
I tried to find the Fourier transform for this signal, but I have some doubt about the result:

$$g(t) = \cos\left(\pi\Delta{f}t\right) \text{rect}\left(\frac{t-\frac T2}{T}\right)$$

My calculation is:

$$ \bigg \lvert G(f) \bigg \rvert = \frac{1}{\pi}\bigg(\frac{2f\sin(\pi Tf)\cos(\pi T\Delta f/2)-\Delta f\cos(\pi Tf)\sin(\pi T\Delta f /2)}{4f^2-\Delta f^2}\bigg)$$

Could you please tell me is there any coeff. of $T$ at amplitude of the final result?


texts: I am confused between symbol rate offset, symbol timing offset and sampling clock offset. Can anyone tell be the difference between these terms.


texts:
I'm working on creating a simple program to render spectrograms like this one. In this plot, the X-axis is time, the Y-axis is frequency, and the color represents the magnitude of the DFT at that frequency and time.

I have most of this working, but I'm not exactly sure how to interpret the magnitude value. I'm computing it as follows:

real * real + imaginary * imaginary

(Note that I'm not square rooting it, since Wikipedia indicates that the spectrogram should be related to the square of the magnitude.)

I've seen certain spectrograms which work with magnitude on the dBFS scale. What's the process to translate these magnitudes to this scale? Or, alternatively, is there some easier way to go about this?


texts: What is the difference between cubic interpolation and cubic "Spline" interpolation?. How to use it for upsampling purpose?

texts:
After considering a couple of advices and suggestions for upsampling techniques here, I finally converged to use the cubic interpolation technique to estimate the voltage values corresponding to intermediate samples present between the original or previous samples. I know that spline interpolation is basically used for getting smoother curves, but what makes it different from the normal cubic interpolation technique as both of them use a 3rd degree polynomial to estimate intermediate values?.

Another implementation issue is that, for example, If I have some voltages corresponding to some samples say

    V = 3.674, 6.791, 8.888, 9.667.....
    Sample = 2, 3, 4, 5.....

Now, If we have to find the voltage information corresponding to the intermediate sample 3.5, then using cubic polynomial method, we arrive at 4 equations and 4 unknowns obtained by using the information provided by the neighboring samples closest to sample 3.5.

    V(2) = a + 2b + 4c + 8d
    V(3) = a + 3b + 9c + 16d
    V(4) = a + 4b + 16c + 64d
    V(5) = a + 5b + 125c + 125d

So, solving these equations I arrived at

   a = -4.428
   b = 4.3756
   c = -0.06299
   d = -0.04966

Using these values , we can calculate the voltage value at the sample 3.5 as

  V(3.5) = a + 3.5b + 12.25c + 42.875d
  V(3.5) = 7.186 Volts

Now my question - Is this method of interpolation suitable for large sampling rates?. How can I use this technique for upsampling a signal say from 10 sps to 100 sps for N = 1024 sample points?. I know that I have to develop a function that performs this cubic interpolation task between original samples (in C++), but I am just wondering how to implement it for upsampling for a continuous series of samples . Any suggestions, ideas or advices regarding the topic and its implementation would be appreciated. Thanks!

I understand that cubic interpolation can operate on 4 data points and the
more sophisticated technique I can think of is cubic spline. In case I am
using the normal cubic interpolation, how about I loop through the "N"
sample points i.e. 1024, for a condition below the "input sampling rate"
i.e. 10 sps considering 4 data points each and then performing the
interpolation function  based on the up sampling factor between each of
those 4 consecutive data points (Meaning - Interpolating/Estimating 10
values between each of those 4 data points) and then the function considers
the next 4 data points to perform the same operation and it goes on until a
100 samples has bee acquired i.e. the output sampling rate!


texts: What is difference between frequency and pitch?in nutshell and simple words?

texts:
Although both are some how directly related
Such that when one increases,the other one also increases

I have read different Google results but couldn't understand .

I want to know what is exact difference between both these terms?
Please kindly explain your answer with example preferably having graphs/wave forms for demonstration of difference


texts: When should we using moving average in algorithm design?

texts:
I'm new to signal processing. And I just read G.720.1. I find there is a lot of moving average used.
And I can also recall there is a lot of moving average been used in other audio processing algorithm.

For example in G.720.1, the ZCR (The zero crossing rate of the input 10ms frame) are input of moving average algorithm and the result are used for sound detect. But I assume ZCR should have big change in continues frames.

So when will you think you need moving average in an algorithm design?
And if we need one, how we should select the weight?


texts: Why does python's scipy.signal.dimpulse introduce delay in impulse response?

texts:
Consider a simple linear, time invariant system of the form:

$y_k = cy_{k-1} + (1-c)x_k$

The impulse response of this system can be computed by either dimpulse or by applying lfilter to a vector composed of a one followed by zeros:

import scipy.signal as sp_signal
import numpy as np

Ts = 1
c = 0.9
A = [1, -c]
B = [1-c]
time, imp_resp1 = sp_signal.dimpulse((B, A, Ts))
x = np.zeros(100)
x[0] = 1
imp_resp2 = sp_signal.lfilter(B, A, x)
print(imp_resp1[0][:5,0])
print(imp_resp2[:5])

which yields:

array([ 0.    ,  0.1   ,  0.09  ,  0.081 ,  0.0729])

[ 0.1      0.09     0.081    0.0729   0.06561]

Why does dimpulse introduce a one-sample delay in the impulse response?


texts: How to compute sinc period in frequency domain and width of pulse

texts:
I have an image convoluted by a rectangular PSF of a blur kernel. The fourier transform of the PSF has pattern of a sinc function: $\frac{\tau sin(\pi \tau f)}{\pi f}$. The image size is 256x256.

Would my following assumptions about the PSF on its period in frequency domain and width of its pulse in the PSF be correct:

  The rectangular pulse of the PSF will run with an impulse value of
  $f(x)=1$ from $\frac{-128\tau}{1}$ to $\frac{+128\tau}{1}$.

  So the width of this rectangular pulse in the PSF is $128 \times 2 =
> 256$ in width.

  The sinc period in the frequency domain of the PSF would be the same, running
  from $\frac{-128\tau}{1}$ to $\frac{+128\tau}{1}$. (This is my most
  unsure part)


texts:
I have a quite typical Kalman filter to design. I really read a lot of articles about the design of this filter but the performances of my filter are still quite bad.

Here is my situation. I have a quite good measurement signal of my position (let's say a very small white noise) and a pretty noisy measurement signal of my velocity (big white noise). I want to estimate a new position (which will be I guess not very different from my measurements) and my velocity as well (which will be more different)

Here is my Matlab code: (I don't want to use the Matlab Kalman function ;) )

%% Kalman Filter Design
dt = 0.01;

%% Define coefficient matrices
% x = [position;velocity;acceleration]

% True State equation
% x = F * x(t-1) + B * u + w
F = [ 1 dt dt^2/2
      0  1 dt
      0  0 1];

B = [0
     0
     0];
% Measurement of the true state equation
% z = H * x(t) + v
H = [1 0 0
     0 1 0];

%% Define noise

%Process noise(white noise)
% w = Gw * a
a = [0 ; 0 ; wgn(1,1,100)];
Gw = [0 0 0
     0 0 0
     0 0 1];

%Process noise covariance matrix
Q = Gw * Gw' * cov(a);

%Measurement noise (white noise)
v = [wgn(1,1,0.001) ; wgn(1,1,20)];

%Measurement noise covariance matrix
R = cov(v)* [0.5 0
              0  1];

%% Kalman Filter
x_estimate = [0;0;0];
P = Q;

position_estimate = [];
velocity_estimate = [];
acc_estimate = [];
P_mag_estimate = [];

predic_state =[];
predic_var = [];

z = [position_meas,velocity_meas];

for t = 1:length (z)

%Predicted state estimate
x_estimate = F * x_estimate;
predic_state = [predic_state; x_estimate(1)];

%Predicted estimate covariance
P = F * P * F' + Q;
predic_var = [predic_var; P];

%Innovation covariance
S = H * P * H' + R ;

%Kalman Gain Predict measurement covariance
K = P * H' * inv(S);

% Updated  state estimate
x_estimate = x_estimate + K * (z(t) - H * x_estimate);

%Update covariance estimation
P = (eye(size(P,2)) - K * H) * P;

%Store for plotting
position_estimate = [position_estimate; x_estimate(1)];
velocity_estimate = [velocity_estimate; x_estimate(2)];
P_mag_estimate = [P_mag_estimate; P(1)];

end

My question is: how can I find Q and R? Does it depend of what I want to do?

Thanks a lot for your help


texts: Can you do temporal frequency filtering for a spatially moving signal in image sequence?

texts:
Context :

A static camera captures video footage of a still indoor environment at given framerate (1080p@30fps or 720p@60fps)
A low power line laser projects a line shaped beam in the camera field of view. The laser line reflects on the objects of the scene, with different lighting settings
The laser line is set horizontally, and scanning the scene (vertical sweep).
The image of the laser line can be hardly noticeable because of various parameters such as : the lighting conditions, the distance between the laser emitter and the object, and the properties of the object

What we want :

We want to be able to detect the position of the laser line in the images, i.e. for a given image we want an array of (i,j) indexes such as pixel(i,j) belongs to the image of the laser line.

What we thought of :

Laser line detection with state of the art algorithm might not be sufficient. We need to improve those by filtering the images beforehand.
We can modulate the power emitted by the laser. We've been thinking of modulating the power emitted by the laser such as the power profile matches a low frequency (few Hz) sine.
The pixels belonging to the laser line would then have a periodic intensity profile over time (over a set of images, given that we have sufficient number of images). Thus we should be able to filtrate the images in temporal frequency domain.
I think this might be achievable if the laser line is still. We could compute FFT of each pixel over its intensities in different images, and then for example, apply threshold value for given frequency and discard pixels below given threshold.

The problem :
Because the laser line position in the image is changing, we can't just use the approach stated before.
I think we can categorize the problem as a signal processing one. The signal would be the sine wave of the line laser, and the medium would be the image sequence. Nonetheless we are not interested in retrieving the signal itself, but the positions of the signal in the images.
Thus the core questions are :

Can we detect a spatially moving signal in a image sequence/video ?
Is it possible to do temporal frequency filtering for a spatially moving signal in image sequence, such as we only keep the pixels transmitting the signal in the images ?

What we've found so far :

There's this article, but it deals with small binary signals, as opposed to sine wave signals, and extended ones in our case. Having said that, we are not constrained to sine signal, but I thought this might be the simplest case.


texts:
What is the definition of the central frequency of a Wavelet and the bandwidth of a Wavelet? How do they affect the resultant waveform of the wavelet?

Thanks.