texts: How do I find Gray Level Variance of the Image?

texts: Tell me how do I find out gray level variance of the image? Is it any different from the normal variance of the image.


texts: How to add pitch-shifted version of signal to itself?

texts:
I want to write an algorithm to add pitch-shifted version of audio signal to itself (like Electro-Harmonix POG does). And I need to do it in realtime. How to implement it?

My guess is: break signal into pieces, get FFT of each piece, copy each of the frequencies in the original signal (for example, for 1 octave up shift copy 20hz to 40hz, 40hz to 80hz and so on), get the iFFT, play it back. But I don't know if I got the right idea. Will it work?


texts: I am a beginner in opencv and have started learning it using visual studio 2012 and opencv 2.4.7 . But i got stuck at very beginning .I want to know about Mat used in Opencv .It is a class and an image name is a variable of this class .i just know this .but still i am feeling like i didn't get it totally like what are its data members and member functions?


texts: Is there a way to describe the pattern of a signal as a numeric value?

texts:
I've been digging a little into signal processing and I just started a networks and telecommunications class at college. We saw there are different encode techniques Amplitude, Frequency and Phase shift keying (ASK, BFSK and BPSK). Using this techniques one can form different patterns in a signal to encode information, a "message".
I want to know if there is any numerical value that can be related to a signal pattern, to the "message" this pattern encodes. For example, if I have 2 signals with different information encoded in eachone (using the same encoded techniques and standards), is there any measure I can get from this signal, that can show the patterns are different?
I am quite new at this topics and I haven't had any luck in books and papers, I hope someone can help me.
EDIT
I'm looking for either a metric, a statistic, a parameter, a measurement that will (at least) be most likely to change if the pattern of the signal (that should depend on the information encoded in it) chage.
Here a little analogy I thought of
Let's say we have 2 signals which by any type of modulation, encode:
signal1 = [0,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,0,1,1,1,1,0,1]
signal2 = [1,1,0,0,0,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,0,0]
Both time series have the same amount of 1's and 0's, so a thing like mean or variance will not tell me if both signals encode a different thing.
I thought of meausring the average change of each time series, I think of the change as the difference of each sample with the next one (in this case difference is either 0 or 1, from 0 to 1 and viceversa is 1, and from 0 to 0 or 1 to 1 the difference will be 0). This approach does give me different values for each time series, but I am looking for a better founded approach.


texts: Slicing and Recognition of book title and author from bookshelf image

texts:
I am trying, for my own learning purposes, to develop an implementation of an algorithm that would list books, given an image of a bookshelf like the following:

The first step is to slice the image into individual books.

My algorithm, in Mathematica, is:

    img = ColorConvert[Import["http://i.stack.imgur.com/IaLQk.jpg"], "GrayScale"]

do a basic edge detection &
remove the text and try to keep the long lines

edge = DeleteSmallComponents[EdgeDetect[img, 3],Last[ImageDimensions[img]]/5]

then remove unwanted horizontal lines

lines = Sort[ImageLines[img5] /. {{0., _}, {_, _}} -> Sequence[]]
Show[img, Graphics[{Thick, Orange, Line /@ lines}]]

The results, though, are less than great:

My questions are:

How can I improve this to yield better results?
Is there a smarter way to do this?
how further should I process the images to increase accuracy at the (later) OCR phase?
How to use the color information to improve the segmentation?


texts: Laplace Transform: zeros and corresponding impulse response $h(t)$

texts:
Poles and the impulse response
If our impulse response is in the form :
$$h(t) = e^{-\sigma_0 t}\cos(\omega_0 t) \, u(t)$$
(where $u(t)$ is the unit step function)
And its Laplace transform is :
$$H(s) = \frac{N(s)}{D(s)} = \int_{0}^{+\infty} h(t)e^{-st}dt$$
$$s = \sigma + j\omega$$
Poles are values of $s$ so that $$D(s) = 0 \rightarrow H(s) = +\infty $$
But to understand this, I prefer to look at the integral : it will go to infinity (poles) when $s$ reflects components of $h(t)$. In a way, $e^{-st}$ "probes" $h(t)$. Indeed :

A single real pole ($s = -\sigma_0$) means $h(t) = e^{-\sigma_0t}u(t)$ because : $$\int_{0}^{+\infty} e^{-\sigma_0t}e^{-(-\sigma_0)t}dt = \int_{0}^{+\infty} 1dt = +\infty $$.

Complex conjugate poles ($s = -\sigma_0 \pm j\omega_0$) mean $h(t)$ is an exponentially decaying sinusoid (say $h(t) = e^{-\sigma_0t}\cos(\omega_0t)$) because : $$\int_{0}^{+\infty} e^{-\sigma_0t}\cos(\omega_0t)e^{-(-\sigma_0)t}e^{-j\omega t}dt = \int_{0}^{+\infty}\cos(\omega_0t)e^{-j\omega t}dt $$ which is infinite at $\omega = \pm\omega_0$ (Fourier transform of $h(t)$ without its exponential component, which is a sinusoid).

Complex conjugate poles with $\sigma = 0$ ($s = \pm j\omega_0$) mean $h(t)$ has no decaying component (say $h(t) = \cos(\omega_0t) u(t)$) because : $$\int_{0}^{+\infty} \cos(\omega_0t)e^{-j\omega t}dt$$ which is infinite at $\omega = \pm\omega_0$ (Fourier transform of $h(t)$ which is a sinusoid).

Zeros : a dirac in the impulse response ?
Now, let's look at $H(s)$ for a Notch filter, as shown in ch.32,p.17 of "The Scientist and Engineer's Guide to DSP" and see if similar reasoning on the integrals can be done.

Let's use the following filter (figure above for illustration only, I use different poles and zeros here) :
$$H(s) = \frac{s^2+1}{(s-(-1+i))(s-(-1-i))}$$
This filter has 2 poles and 2 zeros :

Zeros : $z_1,z_2 =\pm i$
Poles : $p_1,p_2 =-1 \pm i$

Let's find $h(t)$ and see why the integral would indeed go to 0 or $+\infty$ for these values of zeros and poles, respectively.
If it makes sense, this tool gives the following inverse Laplace transform for $H(s)$ :
$$h(t) = \delta(t) - 2e^{-t}\cos(t) u(t) + e^{-t}\sin(t) u(t)$$

Poles : for $s=p_1$ or $p_2$ in the Laplace transform, the exponentials of h(t) get canceled and remain the Fourier transform of some sinusoid which is indeed infinite at $\omega = \pm 1$ (I'm not discussing the $\delta(t)$ but I suppose it won't change this result).

Zeros : for $s=z_1$ or $z_2$ in the Laplace transform, the result is 0 if real part and imaginary of the Laplace transform are 0. Real part is :

$$\int_{0}^{+\infty} (\delta(t) - 2e^{-t}\cos(t)+e^{-t}\sin(t))\cos(t)dt$$
$$=\int_{0}^{+\infty} \delta(t)\cos(t)dt +  \int_{0}^{+\infty} (- 2e^{-t}\cos(t)+e^{-t}\sin(t))\cos(t)dt$$
with
$$\int_{0}^{+\infty} (- 2e^{-t}\cos(t)+e^{-t}\sin(t))\cos(t)dt = -1$$
Imaginary part is :
$$\int_{0}^{+\infty} \delta(t)\sin(t)dt +  \int_{0}^{+\infty} (- 2e^{-t}\cos(t)+e^{-t}\sin(t))\sin(t)dt$$
with
$$\int_{0}^{+\infty} (- 2e^{-t}\cos(t)+e^{-t}\sin(t))\sin(t)dt = 0$$
Questions

If the inverse Laplace transform is correct, how to handle $\int_{0}^{+\infty} \delta(t)\cos(t)dt$ and $\int_{0}^{+\infty} \delta(t)\sin(t)dt$ to show that $H(s)$ is indeed 0 at $z_1$ and $z_2$ ?
If all of this is correct, what does it (physically) mean for an impulse response to have a dirac in its expression ? I thought impulse response of most physical systems was only a combination of decaying exponentials and sinusoids ?


texts: Trouble showing Time Invariance of recursive system

texts:
The system is described with the following recursive differences equation:

$$y[n]-4y[n-1]+4y[n-2]=20x[n]+10x[n-1]$$

now lets say the input is delayed by k, then:

$$y[n]-4y[n-1]+4y[n-2]=20x[n-k]+10x[n-1-k]$$

and now the output by the same k:

$$y[n-k]-4y[n-1-k]+4y[n-2-k]=20x[n-k]+10x[n-1-k]$$

here is the problem , I cannot see how same expression will be acquired .
I've tried performing simple substitution of n-k=m , which leads to:

$$y[m]-4y[m-1]+4y[m-2]=20x[m]+10x[m-1]$$

which is still not quite the same.
Obviously the equation is linear differences equation with constant coefficients , therefore I suppose the system indeed TI but how to mathematically show this specific case.


texts:
How do I add odd or even harmonics to a floating point signal?

Do I have to use tanh or sin?

What I'm trying to do is achieve some very simple distortion effects, but I'm having a hard time finding exact references. What I'd like is something similar to what the Culture Vulture does by adding odd and even harmonics in its pentode and triode settings.  The float value is a single sample in a sample flow.


texts: Why does raised cosine pulse through Butterworth filter introduce (significant) ISI?

texts:
Here is a simple MATLAB experiment:

alpha = 1;
R = 10;
[b,a] = butter(7,alpha*1/R);
x = resample(sign(randn(100,1)),R,1,0); % zero-order-hold
y = filter(b,a,x);
eyediagram(y, 2*R);

With channel twice the bandwidth than the pulses (alpha=2) the eye diagram looks clean. The first thing I am concerned that the eye diagram at the critical bandwidth (alpha=1, i.e. channel bandwidth is bitrate/2) still looks reasonably clean (little bit ISI but not too much):

I would have expected significant ISI at the critical bandwidth.

Now instead of using rectangular pulses, I use a raised cosine filter:

 hcos = rcosdesign(0, 30, R);
 x = upfirdn(sign(randn(1000,1)), hcos, R);

Now the eye diagram is significantly worse:

I would expect the result to be significantly better. I played with all possible rolloff factors 0...1 and number of symbols. I also tried cutting the signal at beginning/end, thinking it may be the initial transient. No changes.

What is going on here?

(Additional info: I do not want to simulate TX/RX with raised cosine but assess a channel without having to use an equalizer - in simulation. One way to do this is using an equalizer or just using a pulse shape that works close to the theoretical bandwidth - that should be raised cosine with a low beta).


texts: Determining the period of a discontinuous function


texts: How Do I Plot Color Distribution of HSV Image in MATLAB

texts:
I have a dataset of images representing human skin. How do I plot the skin color distribution in HSV color space and YCBCR color space. However, I'd like ignore the "value" or "brightness" in both color spaces and analyze rest of the layers.

edit

The below is the code, I found to plot the distribution for ycbcr but don't understand what it means. Can anyone explain it please?

chroma = zeros(256);
cb = imycc(:,:,2);
cb = reshape(cb, 1, numel(cb));
cb = round(cb);

cr = imycc(:,:,3);
cr = reshape(cr, 1, numel(cr));
cr = round(cr);

for i = 1:length(cb)
   chroma(cb(i), cr(i)) = chroma(cb(i), cr(i)) + 1;
end
surf(chroma)


texts: Magnitude of Sobel filter result, vector or scalar?

texts:
I have a question about image gradient magnitude, given an image $I$. The horizontal and vertical derivatives resulting from Sobel filters are defined as:
$$K_x=
        \begin{bmatrix}
        -1 & 0 & 1 \\
        -2 & 0 & 2 \\
        -1 & 0 & 1 \\
        \end{bmatrix}*I;
K_y=
        \begin{bmatrix}
        -1 & -2 & -1 \\
         0 & 0 & 0 \\
         1 & 2 & 1 \\
        \end{bmatrix}*I
$$

where $*$ denotes the convolution operator. The gradient magnitudes can be computed as

$$I_{\delta}=\sqrt{(K_x^2+K_y^2)}$$.

Now, I want to "invert" the result of $I_{\delta}$, so that maximum magnitude gradient values become zero. Then the "inverting" function $g$ is
$$g(I_{\delta})=\max (I_{\delta}) - I_{\delta}\,.$$

My question is: is $I_{\delta}$ scalar or vector?
What do you think? If it is possible, could you correct help me.


texts: Fitting fixed number of complex exponentials to complex signal

texts:
I have a complex data series, and I would like to fit a fixed number (in this case, two) of complex exponentials of the form $Ae^{jBn}$, where A, B are complex. Not interested in the phase (i.e. arg of A), just its magnitude, and mainly the complex frequency. Target length is maybe 100 samples.

I would like to be able to capture the periodic destructive interference as the addition of these two fitted complex exponential signals.

Complex time-series in 3D:

I have looked into Prony-type methods and noise subspace methods, but I'm at a loss as to what is applicable here.


texts:
Recently, I am thinking about a problem regarding image projection. I have a larger picture as bellow.

I want to find the transformation matrix, x'=Hx. When the above image pass the transformation matrix H, I will get another smaller picture as bellow.

I have tried to use SIFT to find four major points and use these points to implement DLT algorithm. However, after executing SIFT, I find that there are many matching error as bellow. The distRatio is 0.5

I have thought for almost two weeks. Is there any different ideas which can be use to solve this problem. Thank you very much.


texts: Scatter plot: calculate box where 80 % of the points are

texts:
I've a scatter plot with x- and y-axis.

Now I want to calculate a rectangle which displays where 80% of the points in this plot are.

I'm not very familiar with statistics, so I don't know the method I have to use. Read something about percentiles. Is that correct?

I know I have to calculate where 80% are on the x-axis and also where 80% are on the y-axis and then I got my rectangle corners, but how do I calculate the 80%?

Sample data:


texts: Simple (Arduino) digital butterworth filter : why do I see oscillations?

texts:
I want to filter deviations from an ADC over time (low pass), not very critical. So I first tried exponential averaging, something like  y= (7*y+x)/8. That gave useful results, but there is an obvious rounding issue (no increase as long as x smaller than y+8, decrease if x smaller than y). Adding +4 doesn't really solve the problem.

So I implemented a fixed-point lowpass Butterworth third order filter, with various cutoff frequencies, based on coefficients extracted from http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html (unfortunately down since a few months).

The code looks as follows for 0.033 sampling cutoff

byte dtTI[4], // filter input (0 newest)
 dtTIFast[8]; // filter output, [0]=y, [1]=8 bit decimals
// dtTIFast[2,4,6]= previous filter outputs
dtTIFast[7]=dtTIFast[5]; dtTIFast[5]=dtTIFast[3]; dtTIFast[3]=dtTIFast[1];
dtTIFast[6]=dtTIFast[4]; dtTIFast[4]=dtTIFast[2]; dtTIFast[2]=dtTIFast[0];
unsigned long modifier = 30UL*64*(dtTI[0] + dtTI[3] + 3*dtTI[1] + 3*dtTI[2]);
modifier += 84739UL*(dtTIFast[3]/4+64*dtTIFast[2]);
modifier -= 73839UL*(dtTIFast[5]/4+64*dtTIFast[4]);
modifier += 21628UL*(dtTIFast[7]/4+64*dtTIFast[6]);
dtTIFast[0]=modifier>>21;  dtTIFast[1]=modifier>>13;  // No need to add 2^12, 0.0004deg

The output seemed to give correct results at first, but if I iterate the filter 50 times with the same input(s), I see it keeps oscillating instead of converging to a steady value, and not centered around the x input. For other values (for example 0.001 cutoff), its way worse !

Can you tell me where I'm wrong ? I checked that the sum of my coefficient is 32768, and it looks like there can't be any overflow. I use 14bits y values now, and the real values of coeffs are 2.586028659, -2.253398256 0.660048953 and 0,000915081. Should I need more precision ?

Thanks for your help


texts:
Suppose
$$Y(z) = \frac{\frac 12 z + 1}{z+\frac 12} \cdot \frac{z}{z-\frac12}\text.$$
According to Wolfram Alpha the inverse transform is, $2^{-n - 2} \cdot(5 - 3 \cdot (-1)^n)$. However, I cannot show why this is true. Could someone please guide me?


texts: Square of Frequency characteristic of the system

texts:
What does $|H(j\omega)|^2$ in $20 \log_{10}|H(j\omega)|$ mean?

Is it some ratio of energy or power? And why? How to derive it?

I'm sorry for curtness of my questin.


texts: What is the source of the vibrations apparent the FFT

texts:
I have a system which is composed of 3 Rotating components
•   Motor i.e. Shaft (running at around ~7rev/s)
•   3 Gears of x16 teeth mounted in series
•   shaft hold Bearings (number of rolling elements unknown)

I am doing an FFT using Matlab on the accelerometer readings, mounted over the shaft holding bearing.

i stack these FFTs and plot them in time(called sample in the image) and get the image below

Now my questions are 2:

This is the main question: what is the source of vibration indicated in frequency range 200-250Hz, since i know the gear meshing frequency ~120Hz (clear in the FFTs image), i can eliminate it being the gears. But maybe it is the gear in the middle meshing with the 2 other gears on each side? or is it just noise ? any help on this one be much appreciated
second question: Why do the frequencies drift to the right, i.e. the meshing frequency seems to be increasing. my take on this is the motor heating up after running and so drawing less current, therefore less torque is applied and then the motor runs at higher speed ?


texts:
I read the following in one of the research papers:
Cancelable biometrics using random projections can be implemented by multiplying a random matrix with a feature vector. The result is a cancelable biometric template.
y = M multiplied by x
where y, M and x refer to the cancelable feature vector, Gaussian random projection matrix, and the feature vector extracted from the image, respectively. My question is:
I think this is the same concept as compressive sensing, right? if yes, I know that compressive sensing is not a one-way transformation, I mean that the original image can be reconstructed from the compressed image. On the other hand, the cancelable technique must be a one-way transformation. Then, how can we say that the random projection explained by the above equation is a cancelable technique?
Also, I need to know how can we know if the transformation one-way (the inverse operation is allowed) or not?


texts:
Let's assume that a linear and time-invariant system is sampled at 2 different frequencies $F_{s}$ and $2F_{s}$ (e.g. 5Hz and 10 Hz). It gives
$$Y_{F_{s}}(z) = H_{F_{s}}(z)X_{F_{s}}(z)$$
$$Y_{2F_{s}}(z) = H_{2F_{s}}(z)X_{2F_{s}}(z)$$
where $Y_{F_{s}}$ and $Y_{2F_{s}}$ are respectively the z-transforms of the sampled signals, $H_{F_{s}}$ and $H_{2F_{s}}$ are the impulse responses of the systems and $X_{F_{s}}$ and $X_{2F_{s}}$ are its inputs. The signals $Y$ are known, the impulse response are also known :
$$ H_{F_{s}}(z) = \frac{a+bz^{-1}}{1+cz^{-1}+dz^{-2}}$$
$$ H_{2F_{s}}(z) = \frac{a'+b'z^{-1}}{1+c'z^{-1}+d'z^{-2}}$$
and the inputs are unknown.

I am wondering whether it is possible to express $X_{2F_{s}}$ in terms of $X_{F_{s}}$.

Since I am dealing with upsampling, I thought that $X_{2F_{s}}(z)=X_{F_{s}}(z^2)$ and so I had
$$Y_{2F_{s}}(z) = H_{2F_{s}}(z)X_{F_{s}}(z^2).$$ But I performed numerical simulations and it seemed to be false. So, where is my mistake and is it possible to express $X_{2F_{s}}$ in terms of $X_{F_{s}}$.

Any suggestions will be appreciated.


texts: The first graph represents mfcc plot for female and the second for male. How do I interpret this graph with colors. and what is that color scale on the right? How do I differentiate gender from these plots?


texts: Correlation Using FFT / IFFT (Convolution in Frequency Domain) in Java

texts:
I try to find about the delay between two audio files using Cross Correlation in Java. I've already done this algorithm so far that i get a idea about how many samples is the delay.

FFT x1 -> Zero Padding to length: x1.length() + x2.length()
FFT x2 -> Zero Padding to length: x1.length() + x2.length()
X3 = FFT{x1} multiply FFT{2}*
x3 = IFFT{X3}

To validate my results, i use octave. So i can see that my result is in generally correct, but the position of my graph isn't correct.

For testing i use the same files, so that this represent auto correlation function. In octave graph the maximum correlation is in the center of output vector, which seems to be right. -> so the delay is 0, because same files

In my version, the graph is at the beginning and the end.

So if i use two different signals, in octave the maximum correlation moves left/right from center. In my algorithm its going from beginning to middle or end to middle.

So it seems my graph is calculated correct, because the peak moves the amount of samples that is the difference between the files. But the position isnt correct.

It looks like i have to modify my output vector: left half <-> right half

Any ideas whats my problem ?

Edit:

public void execFastCrossCorrelation() throws FFTException
{
    // the used block size is N(x1) + N(x2)
    int blockSize = (x1.length+x2.length-1);

    // create & calc FFT with zero padding & get result

    // FFT x1
    FFT f1 = new FFT(x1, blockSize, 44100);
    f1.execFFT();
    Complex[] c1 = f1.getOutputData();

    // FFT x2
    FFT f2 = new FFT(x2, blockSize, 44100);
    f2.execFFT();
    Complex[] c2 = f2.getOutputData();

    // create output for cross correlation by using fast convolution : c3 = c1 multiply c2*
    Complex[] c3 = new Complex[c1.length];
    for(int i=0; i<c1.length;i++)
    {
        c3[i] = c1[i].multiply(c2[i].conjugate());
    }

    // create & calc IFFT  & get result
    IFFT f3 = new IFFT(c3, c3.length, 44100);
    f3.execIFFT();
    Complex[] corrResult = f3.getOutputData();

// search the maximum corrleation coefficient and his index
    double maxVal = 0;
    int maxIndex = 0;

    for(int i=0; i<corrResult.length;i++)
    {
        if(corrResult[i].abs() > maxVal)
        {
            maxVal = corrResult[i].abs();
            maxIndex = i;
        }
    }

So FFT class is done by using apache-commons-math3. Simply use the input vecotr and create a FFT for the given blockSize (rounded up/down to power of two and zero padded if necessary).

Edit:

So now i tried to flip the output (means left halft -> right half and right half -> left half)

The result matches the version of octave.

If i try this with different files, its also working like in octave, means the maximum is moving from the center to left/right. That means that my idea that the output vector has to be "mirrored" seems to be right. Do you have any idea why?


texts: Suppose that I have a $H(z)$ and I sample it to get a DFT of 15 values. Let's call this DFT $H_{1}[k]$. Then, suppose I antitransform $H(z)$ and grab the first 10 values of the sequence, and then I add 5 zeros. After this, I calculate the DFT of this new sequence. Let's call it $H_{2}[k]$. What differences would these two DFTs have between each other (if any)?


texts: Implementing an IIR filter in Pytorch using RNN with no nonlinearity

texts: Is it possible to implement an RNN layer with no nonlinearity in Pytorch like in Keras where one can set the activation to linear? By removing the nonlinearlity, I want to implement a first-order infinite-impulse-response (IIR) filter with a differentiable parameter and integrate it into my model for end-to-end learning. I can obviously implement the filter in Pytorch but I thought using an inbuilt function may be more efficient.


texts: Relation between Bandwidth and Baud-Rate for 8-PSK

texts:
I have a query on relationship between Baud Rate and Bandwidth for 8-PSK.

In 8-PSK as 3 bits together form a symbol, so Bandwidth = 2R/3 , R is Bit Rate

As bit rate is 3 times BAUD RATE for 8-PSK, hence Bandwidth has to be = 2* (BAUD RATE)

But in many places is see the below statement ::::

For PSK the baud rate is the same as the bandwidth I was going through this - This

How can this be possible.??


texts: Study resource for Digital communication

texts:
I am in my 5th semester of computer science and we have a digital communication course. All the textbooks of digital comm. available in my library demand a prerequisite of Circuit analysis and Signals and systems.
Is there any book which is self contained or at least less heavy on these background topics?


texts: Why is the concept of a "state covariance matrix" necessary in estimation?

texts:
I'm currently taking a course in optimal estimation (and it's still very early in the course).

Much of our work is based around the idea of a measurement model

$y=Hx + v$

This model assumes our measurement $y$ is a function of some "state" and measurement noise.

Now when attempting to estimate the state $x$ in a stochastic least squares sense, one of the goals is to minimize the trace of the state covariance matrix $P$.

My question revolves around the idea of a state covariance matrix. Why exactly does it make sense to assume such a thing exists? By doing so we making the assertion that our "state" is a random variable.

Let's say we are trying to estimate the resistance of an unknown resistor by inserting a known voltage and measuring the current. In this case, our "state" is the resistance. Why would it make sense to assume our resistance is a random variable?

Do we assume the state is a random variable since there might be uncertainty in our model?


texts: How to calculate the quantum of the difference between two value of clock counter where the values are divided by 64?

texts:
I have a counter in my embedded system with f = 64 Mhz.

let's say its read value is $cnt_i$
where $i$ is the index of the time I sampled it.
$$\Delta = cnt_{i+1} -cnt_i$$

let's say I take $\Delta^{'} = \Delta/64 = \Delta >>6$ where $>>$ is shift right operator.

I understand that the value of the actual counter now is equivalent to 1 Mhz but How can I show that.

$\Delta^{'} = \Delta/64 $ $[\Delta^{'}]_{sec} = \frac{\Delta}{64Mhz}*\frac{1}{64}$

but it is exactly the opposite, what do I miss?


texts: Audio: How to measure dynamic range (in sense of dynamic compression/ "loudness war")

texts:
I'm about to calculate some quality measures for audio.
One important of them is the dynamic range (in sense of "loudness war").
By which in this context is not meant the SNR but
the (naive said) "variance" of the "occuring energy".
https://en.wikipedia.org/wiki/Loudness_war
http://dr.loudness-war.info/
My idea was to take the average RMS for that and use
its standard deviation (relative to the average RMS).
But this doesn't separate the good from the bad.
If I take TT DR Offline meter it outputs DR11 for
a fine (Steven Wilson) remaster,
and DR7 for a deadly compressed one from an everyday compilation.
But the relative standard deviation of them is nearly
the same (about 69% and 65% for L and R, window = 50ms).
Are there any suggestions/ ideas how to measure it better?


texts: Effect of nonlinear transformation on digital signal

texts:
Currently, I know that by passing a band-limited baseband digital signal through a nonlinear system results in the expansion of the original signal's bandwidth and creates harmonics.

Therefore, I think that I should upsample the original signal to a certain degree in order to avoid any higher frequency components from folding down to the lower frequency band after the conversion.

My question:

How should I determine the size of the expanded bandwidth? Does it have something to do with the highest harmonic visible above the noise floor?
Are there any ways to suppress the harmonics?
Do I need to pass the nonlinearly transformed signal through some kind of filter or upsample it further if I wish to feed it to a DAC?


texts: Similarity in absolute value of nearby DFT coefficients

texts:
Is there any approximate relation in FFT coefficients?

For example, consider time domain signal $x_n$. Its $N$ point (assume $N$ to be even) DFT is given as $X_0,X_1,...,X_{N-1}$

Can I say something about the nature of $abs(X_1)/abs(X_0)$? I am trying to see the variation in DFT coeffcients and for that I thught one can sonsider the ratio of successive coefficients. My motivation is to see how similar the magnitude spectrogram at frequency $f1$ is to spectrogram at frequency $f1+1$ and $f1-1$

I tried to simplify the expanded equation but got stuck after a step -

$abs(X_0) = \Sigma_0^{N-1} x_n$

$abs(X_1) = abs(x_0+x_{N/2}+2(x_1.e^{-j.2\pi/N} + x_2.e^{-j.2\pi.2/N}+..+x_{N/2-1}.e^{-j.2\pi.(N/2-1)/N}))$

How do I (approximately) simplify $abs(X_1)/abs(X_0)$?


texts: I'm trying to do some simple filtering for an audio signal using a window-sinc low pass filter. Supposing that my buffer has M values and the filter kernel size is N, after convolving these two arrays I would obtain an output of m+n-1 values. Which part should I take into consideration? I'm asking this because, if I read a M values array I should write a M values array. I have tried to take the first M or the last M values for output, but the result is not too good. I was wondering if I have to use a circular buffer in which I put every time M+N-1 values, but I read the first M values.


texts: what is the amplitude of quantization levels?

texts: okay , so there is an 8-bit linear PCM encoder . Now this mean that the amplitude of quantization levels is 2^8= 256 or I have to measure the values from oscilloscope ? does anybody have any idea how to answer that?


texts: What is the best neural network type to classify time series

texts: I am a beginner in AI methods. I have a collection of x(t) data, where x are some signal amplitudes and t is a time. My testing data are divided into two classes, say those from good and bad experimental samples. I need to classify the signals from unknown samples as good or bad according to their similarity to these two classes. What kind of a neural network is the best in this case? Could you recommend me some example in the literature where such a problem is considered?


texts: How to estimate PSD, and time delay of a random signal?

texts:
I'm trying to estimate the power spectrum and time delay for random signals. the signals were taken from two sensors, 10 cm apart. My aim is to estimate the PSD first then estimate the time delay in order to obtain the structure velocity.
I've tried the traditional way by using matlab built-in functions like fft, xcorr. however the results were not as I expected.
is there a better way to analyse the attached signals please? Does it need filtering?

The signals represent the void fraction data that was measured for 60s with sampling frequency of 1000hz. the time delay expected to be in ms( around 500ms).

1.Cross Correlation

2.AUTO_CORRELATION

PSD

4.Cross Correlation after subtracting the average
60000 points

2000 points

HERE'S THE DATA

RUN1_P1

RUN1_P2


texts: Is there any special when all Fourier components have the same angle?

texts:
When a square wave doesn't jump, its oscillators aren't aligned:

But if they are in sync, the wave will jump to its extrema:

However this is just an example of square waves. The tool Understanding Fourier Approximations & Oscillators only have square, sawtooth or triangle wave to examine, but as how I see when they are in sync, the wave is always at the maximum or minimum. This matches the intuition when the "arm" is longest. However in the square or sawtooth wave, one position in sync yields both maximum and minimum as the same time, not one as usual. While this can be explained as they have to be close around the jump, this show me that a more rigorous mathematical description is needed. What would happen for a more usual waveform?

Do you know what special things could be when all components are in sync?


texts: Phase response of a FIR Hilbert transformer

texts:
The graph below shows a linear phase response of FIR Hilbert transformer with a constant diff of -0.06135923. I am not sure if I understand the concept of the phase response correctly, but as the quadrature is the input signal shifted by PI/2, why is the phase response not a straight horizontal line at PI/2?

The code to generate the figure was copied directly from Scipy's documentation (the example at the bottom of the page) except that I did not unwrap the phase angle and I used the following filter coefficients:

N = 10
b = [2*np.sin(np.pi*n/2)**2/(np.pi*n) for n in range(1, N+1)]
b = np.append(-1*np.flip(b, 0), np.append([0], b))*np.hamming(2*N+1)

I tried the same with different values of N and each time the behavior of the phase response line was the same, just the steepness was varying.


texts: Is applying a linear operation to the input and output of a continuous linear operator OK?

texts:
The scientist and engineers guide to digital signal processing, Steven W. Smith, p. 134-135 states:

  [...] imagine a linear system receiving an input signal, $x[n]$. and generating an output signal, $y[n]$.  Now suppose the input signal is changed in some linear way, resulting in a new input signal, which we will call $x'[n]$.  This results in a new output signal, $y'[n]$.  The question is, how does the change in the input signal relate to the change in the output signal?  The answer is: the output signal is changed in exactly the same linear way that the input signal was changed. [...] A linear change made to the input signal results in the same linear change to the output signal.'

I assume this can be written for the continuous case as:

If $g = L(f)$, then $M(g) = L(M(f))$

where $L, M$ are linear (LTI) operators, $f, g$ are functions corresponding to $x[n], y[n]$ and  $M(f), M(g)$ correspond to $x'[n], y'[n]$.

My question is: is this true for the continuous case?

Any references, or a proof would be appreciated.

This question is a near duplicate of this question (answered) and also this one (now deleted).  I am sorry about this-spent much time on the web but only found the reference I quoted-but really need an answer asap.


texts: Upsampling signal using convolution-based interpolation filters

texts:
I am currently reading this paper which discusses several image interpolation methods, such as nearest neighbor and linear interpolation, using convolution filters. I first want to do this in 1D with discrete-time signals (e.g. [0 0 1 0 0]), however, I have some trouble understanding on how to derive the convolution filters from the mathematical definitions:

$$h_{NN}(x)=\cases{
1, &if$\quad-\frac{1}{2} \leqslant x < \frac{1}{2},$\\
0, &otherwise,
}$$
$$h_{Lin}(x)=\cases{
1-|x|, &if$\quad 0 \leqslant |x| < 1,$\\
0, &if$\quad 1 \leqslant |x|.$
}$$

My main question is, how do I calculate the filter weights as well as the filter size? Furthermore, I am aware of the fact that I need to convolve the signal multiple times to upsample it, which the following equation in the paper also shows.

$$I(\mathbf{x}) = (\dots((I_s(\mathbf{p})*h(x_1))*h(x_2))*\dots)*h(x_N),$$

What are the several x in there? In case of images, they are the positions of the original image (before it is reconstructed from $I_s(p)$), but how do I apply this concept to one-dimensional discrete-time signals?

I would be thankful for any help!


texts: Proper way to detect and decode transmission in gnuradio

texts:
I am receiving AM modulated data over USRP. I successfully receive the data using an IF frequency (i.e., offset from the carrier), apply a highpass to remove RXLO phase noise and then downmodulate the signal to DC to get I/Q samples (I apply additional filtering and processing).
I am interested in the received data stream and the phase (i.e., the argument of the complex I/Q samples).

Now this is all straight forward if the data is coming in continuously. It works and I see the bits, buried in noise, rushing over my screen.

However, I am receiving the data asynchronously. So I first need to detect what is actually a transmission. Then decode the data and then process them.

What is the proper way to do this?

A simple power measurement of the signal does not seem robust to me since power- and noise levels are not static.


texts: Modelling zero padded OFDM as circular convolution between channel and FFT frame

texts:
This is meant to be a puzzle so please preface your answer with spoiler notation by typing the following two characters first ">!"

An often mentioned negative side of the zero padded OFDM is that it does not have the elegant and simple form of a modelled circular convolution between the channel and IFFT frame that a cyclic prefix OFDM provides. However, there is a way that the zero padded OFDM can be modelled as a circular convolution between the channel and signal. How can we acheive this?

Assume an L tap channel and N point IFFT.  $L<<N$.

Also what is the disadvantage to the system, after this modeling can be done.


texts: Properties of a custom wavelet family for continuous wavelet transform

texts: First of, I'm new to signal processing. I have a signal which is a linear composition of several basis signals, whereas the same basis signal can occur several times, that is translated, but not scaled. These basis signals look very similar to wavelets. I'm thinking of using a continuous wavelet transform to get the decomposition of the signal with respect the basis signals. However, I assume that a set of basis signals needs to fulfill certain properties to be considered a wavelet family. Could you please point out to me what these may be?


texts:
It is my understanding that the least squares algorithm (e.g., in equalization) minimizes the received signal error. However, minimizing the received signal error does not necessarily equate to minimizing the BER.

I was wondering why those two are not always equivalent? And how to properly gauge the performance of the least squares algorithm if BER is not the right metric?

EDIT: Simulation description

random bits --> frame bits --> NRZL --> modulator --> AWGN --> demodulator (integer multiple oversampled) --> LS EQ --> soft bits --> BER comparison

modulator: FSK and BPSK (tried both)
AWGN: Eb/No of 7dB - 20dB
frame structure: 16-bit training sequence followed by 496 random bits
Optionally add multipath delay as well (1-2 bauds).
Taps on LS EQ 3-11 bauds.


texts: Estimating Low Frequencies (including amplitude and phase)

texts:
For the past month I've been chasing the DFT/FFT rabbit.
Along the way I've been cut-n-pasting the name of other rabbits to chase later:
Autocorrelation, Phase Vocoder, Parabolic Approximation, Wavelet Transform

Here's my problem.
When using an FFT, the lower frequencies are always going to be missing.
I actually found the same problem described here:
Problems with the FFT/IFFT

Frankly it is worse than that. The energy of these frequencies are not missing at all.
They are dissolved into the first several bins, making these bins semi-useless for interpolation.

For now, I simply want a general approximation of the Low Frequencies, including amplitude and phase. In FFT terms, I want bin #0.05, 0.10, 0.15, 0.20, 0.25 ...up to say around bin 3.50. Realistically, I understand that anything to small, say 0.05, would almost amount to Linear Regression. But in my mind, 0.5 or 0.75 should be doable.

I even toyed with changing k to a double (which was 'cough' "interesting"):
best window for close frequency components

When Moses came down from the mountain, he did not carry tablets of stone on which it was commanded that in the equation: F = k*(df) = k*sample_rate/N, that k has to be an integer.

Anyway, I've decided it is time to try something else.
So, what rabbit should I chase next?
(even if it is close approximation)

PS: recommending a bigger sample is not the answer - I'm already sampling my available limit.

Edited to add pics (hoping for a possible new answer):

Test Case (I want a Blue approximation, even if lousy):

Rectangle (of course, lousy Green and so-so Red):

Gaussian 3.0 (only Red can be Interpolated, but decent):

Smaller Gaussian gives a lousy Green Interpolation and decent Red.

Edited to answer general questions (I'm sorry I did not do this to begin with):

What's the mathematical description of the data in the plot?
I'm guessing Sum of Sinusoids (with noise).

What's the sample rate?
All of my samples are at different rates, as in, each entire file size is used.
Rather than Hertz/periods/cycles, the measurements are in deserialized data units.
Most often I work with 8-byte doubles, but sometimes 4-byte integers.
Therefore, with doubles, you can say that my Fs = fileBytes/8

How many samples can you capture?
One each per file.

What's the application?
I have no clue - it's for a client.


texts: Suggestions on how to use FIR model in sentence retrieval task

texts:
Estimating an impulse response from input-output measurements is called system identification. When the impulse response of the
linear system $h(n)$, is of finite duration (M samples) or can be
effectively modeled with a finite impulse response system.  System identification, that is, the modeling and identification of a system from knowledge of its input $x(n)$ and output signals $y(n)$ is known as non-blind whereas if the knowledge of the input and the  system both are unknown by the receiver end then it is termed as blind system identification. In wireless communications and in signal processing research papers I have seen that the channel impulse response is modeled as a moving average. In communications, there is an additive noise known as the measurement noise $e(n)$. Mathematically expressing,
$$y(n) = x(n)*h(n) + e(n)$$

In signal processing and estimation, the objective is to estimate the channel impulse response and recover the input from the noisy observations.

How can I use the above model where the input signal is a sentence. So, a sentence would be represented by assigning each unique word by a symbol. Let's say, I have the sentence "the quick brown fox jumped over the lazy dog" and I have the vocalbulary and mapping as

$the \mapsto 1$

$quick \mapsto 2$

$brown \mapsto 3$

$fox \mapsto 4$

$jumped \mapsto 5$

$over \mapsto 6$

$lazy \mapsto 7$

$dog \mapsto 8$

So, the sentence would be mapped to $[1,2,3,4,5,6,1,7,8]$.

This is the input signal or the input data.

I cannot understand what the role of the channel impulse response would be if

I want to estimate after decoding the input speech signal from noisy observations.
What would be the noise term and
would there be any "channel impulse response" ? What would be the best way to use the FIR model for this kind of data?


texts: How an algorithm for measuring the analytic signal (Hilbert transform) gives us complex value at the end?

texts:
I have a question about the following codes for measuring analytic signal (Hilbert transform). Here,the time domain signal (x) is a real value signal. After making fft it becomes complex (X). Then it is multiplied by h (a real vector with the same size as X, and having real number in upper half and 0 in the bottom half). X*.h is complex obviously. Then we made ifft on X*.h , but surprisingly the output is again a complex signal (while we expected it to be real). How did that happen? Can anybody please explain it to me? Is h doing something special?
In other words, we multiply the real signal with exp-j(2*pi/k) during fft, and multiply it one more time with exp j(2*pi/k) during ifft. These two should kill each other and give us a real output, isn't it?
def main():
    t = np.arange(start=0,stop=0.5,step=0.001)
    x = np.sin(2*np.pi*10*t)

    z = analytic_signal(x)

def analytic_signal(x):
    from scipy.fftpack import fft,ifft
    N = len(x)
    X = fft(x,N)
    h = np.zeros(N)
    h[0] = 1
    h[1:N//2] = 2*np.ones(N//2-1)
    h[N//2] = 1
    Z = X*h
    z = ifft(Z,N)
    return z

if __name__ == '__main__':
    main()


texts:
I getting confused over some basics of image geometry terms due to different definitions, implementations and different outputs in the internet, here is an example. The terms are:

Image derivative vs Image gradient.

Image directional derivative/gradient.

Image Laplacian  vs   image second derivative   vs image divergence.

Image curvature (how it is related to the other terms?).

Image normal vs image gradient magnitude.

it would be nice if someone explains these terms (or provide a reliable source so I can refer for more questions) in a simple way providing:

Simple math symbols.
Meaning of these terms (what can tell us about the input image?).
Simple implementation e.g. simple matlab (without buildin functions) or c++ code.
An input and output images.

All the best!

Ibraheem


texts: Shannon interpolation formula for downsampled data with an "almost ideal" low pass filter

texts:
Let $x[n]$ be a discrete time signal with DFT given by $X(f)=\sum_n x[n]e^{-2\pi inf}$ supported on $[-1/2M,1/2M]$ with $f\in[-1/2,1/2]$.

I can then down-sample to get $y[n]:=x[nM]$. Then, let

$$\widetilde{x}[n]=\begin{cases}My[n/M],& M|n,\\0,&\text{otherwise}.\end{cases}$$

Then its DFT is given by

$$ \begin{aligned}\widetilde{X}(f)&=\sum_{n\in\mathbb{Z}}\widetilde{x}[n]e^{-2\pi inf}\\&=\begin{cases}M\sum_{n\in\mathbb{Z}}y[n/M]e^{-2\pi inf},& M|n,\\0,&\text{otherwise}\end{cases}\\&=\begin{cases}M\sum_{n}x[n]e^{-2\pi inf},&M|n,\\0,&\text{otherwise}.\end{cases}\end{aligned} $$

Now, let $\hat{x}[n]=(\tilde{x}\ast h)[n]$ be the discrete Hilbert transform of $\tilde{x}$, with $h$ an "almost" ideal low-pass filter with cut-off frequency $f_c=1/M$.

My question is, how do I then apply the Shannon interpolation formula to reconstruct $x(t)$?

Intuitively, I would guess that it would be something along the lines of

$$x(t)=\left(\sum_{n\in\mathbb{Z}}x[n]\cdot\delta(t-n\Delta t)\right)\ast H(f),$$

with

$$H(f)=\begin{cases}\frac{DTFT\{\hat{x}[\cdot]\}(f)}{M\cdot X(f)},&\text{if }M|n, \\ 0,&\text{otherwise}.  \end{cases}$$

Am I correct?


texts:
I am trying to reproduce a numerical model of classical spectrum analyzer, described in "Fundamentals of Spectrum Analysis" by Christoph Rauscher.
Classical model consists of a few local oscillators (by number of frequency sweep points). The LO signals should be mixed with analyzed signal one-by-one, and then products should be convoluted with low pass filter impulse response. In the end, power of each filtered signal should be calculated, thus one can plot these values vs. swept frequencies.
In spectrum analysis the most popular IF band pass filter is Gaussian, so i use Gaussian low pass as equivalent.

The resulting spectrum looks bad (see figure). 3 dB bandwidth is not reproduced. Gaussian form distorted near carrier frequency.
Any suggestions?
Matlab MWE:
clear variables;
close all;

%% Signal properties
fc = 1e6;                               % Carrier frequency, Hz
fs = 10e6;                              % Sampling frequency, Hz

%% Spectrum analyzer specification
span = 100e3;                           % Span window, Hz
center = 1e6;                           % Center frequency, Hz
sweep = 1e-3;                           % Sweep time, s
rbw = 10e3;                             % Resolution filter bandwidth, Hz
points = 501;                           % Sweep points

%% Signal synthesis
samples = sweep*fs+1;

% Time scale
time = linspace(0, sweep, samples);

% The signal
signal = cos(2*pi*fc*time);

%% Gaussian filter design
order = ceil(fs/2/rbw)*10;
alpha = 10;
cutoff = rbw/2;
window = gausswin(order+1, alpha);
b = fir1(order, cutoff/(fs/2), 'low', window, 'scale');

%% Signal analysis
start = center - span/2;
stop = center + span/2;
freqs = linspace(start, stop, points);
power = 10*log10(sum(signal.^2)/samples*(samples-1-order))-3;

product = zeros(samples, points);
values = zeros(1,points);
for i = 1:points
    product(:,i) = (signal.*cos(2*pi*freqs(i)*time))';
    product(:,i) = filter(b,1,product(:,i));
    values(i) = 10*log10(sum(product((order+1):end,i).^2))-power;
end;

plot(freqs,values);
xlim([start stop]);
ylim([-120 0]);
grid on;


texts: How to differentiate an empty aerosol from a full one using only sound measurements?

texts:
The challenge I have is to detect an empty spray container using sound measurements only, since I can't place any sensor directly into the container because of the mechanism that tightens it.
My main idea was to calculate the FFT of a 2-second recording just when the mechanism squeezes the trigger of the sprayer and then get the maximum peak frequency.
However, I don't know if it is appropriate to use peak detection because when it is empty, it does not emit sound.

Any ideas for solving this ?


texts: How to produce uniformly distributed low-frequency noise?

texts:
I want to design noise for the sake of modulation and it should have a frequency of under 1 Hz. This seems impossible to do for a frequency that low.
Here is my Matlab script. The lowest frequency that gives me something useful is 2 Hz. But also then the noise does not travel over the whole amplitude range from 0 to 1. It jumps to 0.9 and is stuck there.
Is there maybe a filter that is suited better?
fs = 44100;
L = 10 * fs;
fpass = 2;
fstop = fpass*2;
x = rand(L,1);

fs = 44100;
Wp = fpass * (2 * pi)/fs;
Ws = fstop * (2 * pi)/fs;
Rp = 0.01;
Rs = 40;

[n, ~] = ellipord(Wp, Ws, Rp, Rs);
[b, a] = ellip(n, Rp, Rs, Wp);

y = filter(b, a, x);

plot(x)
hold on;
plot(y)
hold off;


texts:
I am trying to understand the logic behind unsharp filter in matlab. If I type:

image = imread('nameoffile');
filter = fspecial('unsharp', 0.5);
resultImage = imfilter(image, filter);

resultImage is sharper than image. I opened fspecial.m file and saw that unsharp filter is created as:

 h = [0 0 0;0 1 0;0 0 0] - fspecial('laplacian',alpha);

If I filter an image with this matrix:

[0 0 0;
 0 1 0;
 0 0 0;]

result image is the same with original one. I know laplacian filter detects sharp edges. So, if we subtract sharp edges from an image we must get blurred image, I suppose. However, if we filter an image with h matrix(unsharp filter), we get sharper image. I did not understand the logic.


texts:
I want to convert a simulated gain/absorption of a material, which can be understood as a discreet (dispersive?) function $g_i(f_i)$ ($f$ is for frequency) or $g_i(\lambda_i)$, into $\tilde g(t)$ for Finite-Discrete Time-Domain simulations. My title is actually almost the title of this paper where you can find the (mainly theoretical) details.

I know that a wide-band lorentzian algorithm can do the job and that I probably have to do a parameter extraction (based on an analytical solution of a corresponding system of non-linear equation) or somehing like this, but I don't know where to get or how to write the (complete) algorithm.
I have MatLab and I can also code a bit Python and a bit C++.

Is there in MatLab a toolbox for this, can i use/how to use FIR/IIR-Filter or other Convolutional Coding?
I don't really got the theory! Fit multispectral lorenz curves to my $g(f)$-data and do some magic Fourier-Transformation with filters, kernels and/or recursive convolution to get $g(t)$?
Does the Kramers–Kronig relations also play a role to convert the absorption/gain function to real refractive index, to fit over the complex refractive index function ?

I also read a lot of buzzwords but cannot connect them properly:
convolutional coding, (linear) recursive convolution procedure, FIR-Filter, (multispectral-lorentzian fit, kernel function etc...)


texts: What is the reason for "random" spikes in amplitude of a guitar waveform?

texts:
In the image below there is the waveform of a clean, strummed guitar note, where the absolute value of the amplitude values has been taken.

At the point marked there is a momentary spike in amplitude before the continuation of the downward trend (there are a few other points like this in the waveform).

I was wondering if anyone knew how I can describe the reason for this? I assume it's just to do with the random nature of playing an analogue instrument - sometimes the string is going to vibrate in such a way that amplitude isn't going to strictly decrease in amplitude through time.


texts: IIR filter implementation in Direct Form 2

texts:
I have implemented Direct Form 2 IIR filter. The input is the Kronecker delta function. I have written code for the response of the filter for Kronecker delta input. The code is:
clc;
clear all;
close all;
x=[1,zeros(1,150)];%input sequence

y=[];%output sequence

b=[1,-1.5511722144889886,1];%numerator coefficients

a=[1,-1.7473520798913149,0.79762351115754226];%denominator coefficients

bs=0.099825504845559299*b;
%...floating point.....%
w=[];

w(1)=x(1);

w(2)=-a(2)*w(1)+x(2);

y(1)=bs(1)*w(1);

y(2)=bs(1)*w(2)+bs(2)*w(1);
 for n=3:1:150

w(n)=x(n)-a(2)*w(n-1)-a(3)*w(n-2);

y(n)=bs(1)*w(n)+bs(2)*w(n-1)+bs(3)*w(n-2);

end

%freqz(y);

%

%

%.....fixed point conversion....%

%.....considering precision of 16 i.e q16 format....%

for n=1:3

    a_f(n)=int64(a(n)*pow2(16));%.....................converted into fixed......%

end

 for n=1:3

     b_f(n)=int64(bs(n)*pow2(16));

 end

for n=1:3

    a_fix2float(n)=double(a_f(n))*pow2(-16);

end

for n=1:3

    b_fix2float(n)=double(b_f(n))*pow2(-16);

end

w_f(1)=(x(1)*pow2(16));

w_f(2)=((-a_f(2)*w_f(1))*pow2(-16));

for n=3:150

    w_f(n)=((-a_f(2)*w_f(n-1))-(a_f(3)*w_f(n-2)))*pow2(-16)+x(n);

end

y_f(1)=(b_f(1)*w_f(1))*pow2(-16);

y_f(2)=((b_f(1)*w_f(2))+(b_f(2)*w_f(1)))*pow2(-16);

for n=3:150

 y_f(n)=((b_f(1)*w_f(n))+(b_f(2)*w_f(n-1))+(b_f(3)*w_f(n-2)))*pow2(-16);

 end

...converting fixed to float...%

% format long

y_fix2float(1)=double(y_f(1))*pow2(-16);

y_fix2float(2)=double(y_f(2))*pow2(-16);

for n=3:150

    y_fix2float(n)=double(y_f(n))*pow2(-16);%...convert to float..%

end

 for n=1:150

     w_fix2float(n)=double(w_f(n))*pow2(-16);

 end

   %to manually plot frequency response..%

  HH = abs(fft(y));

 yy=abs(fft(y_fix2float));

 plot(HH(1:50),'.r');

 hold on

 plot(yy(1:50),'g');

 xlabel('time');

ylabel('response');

legend('floating','fixed');

title('directform2 q16');

I have written MATLAB code in both floating and fixed point. In fixed point I considered
precision of q16.16. My response is:

My question is:  Is the response I got correct?


texts: Minimize the Cost Function of Values of Vectors Based on Their Amplitude

texts:
I have  two vectors $X = [x_1,x_2,x_3,x_4]$;  and $Y = [y_1,y_2,y_3,y_4]$; I know that $|x_1|$ = $|y_1|$, and $|x_2|$ = $|y_2|$,... so on. it means the difference is only in the sign. it might be either similar to same sign.
Those two vectors have been affected by such noise, and I need to create a cost function to recover them. Is it possible to perform that using such algorithm of optimization ?


texts:
I'm writing a Master degree thesis on Instrument Recognition using pyAudioAnalysis. I was wondering if results could be improved by also analyzing the ADSR shape of the samples.
All I find on the internet about ADSR is related to sound synthesis, not analysis.

Do you think it may be possible to compute ADSR, maybe manually by monitoring the energy over time and detecting when energy is kind of stable? Would it make sense?


texts:
Suppose we have a discrete input waveform (with sampling frequency Fs = 32*56e9). We want to filter this waveform with a filter that has two complex conjugate poles (at 22 GHz) and one zero (at 17GHz) and let's say the gain of the filter is 1.
I'd like someone to provide steps for calculating the filter coefficients.


texts:
Disclaimer: I am in NO way engaged in signal processing.  Just very curious...

Ny question is, very simply: is it possible to apply software processing to an image to remove or reduce headlight glare?

It would be a picture such as this:

If this IS possible, is there a software library available for this?  I don't care which language, I just want the capabilities.  Slash does anyone know if there is current research on this?


texts:
I have a question about the Shannon Theorem. According to this theorem the maximum capacity of a link can be calculated with the formula:
$$C=B\log_2(1+S/N)$$
where $B$ is the bandwidth and $S/N$ is the signal to noise ratio. But I am not very sure which is the meaning of the "capacity" term in this equation, since it should include the probability of bit error in same way.
What I mean is that the capacity might not be defined as "number of bits transmitted per second" but as something like "number of bits transmitted and correctly received per second". But it still makes no sense, since you can transmit with low $S/N$ and symbol length tending to $0$, getting a capacity that tends to infinite and a probability of bit error close to 0.5 (it is theoretically imposible to have more than 50% of error rate), so the "number of bits transmitted and correctly received per second" would tend to infinite and it would be higher than the Shannon limit. I was thinking that the right definition of the $C$ in the formula could be "number of bits transmitted per second $\times$ (0.5- Probability of bit error)", which could have sense but I am not very sure which is the real meaning of this measure.


texts:
I have a signal which consists of oscillations riding on square waves as shown in the image below. I wish to detect the time at which oscillatory events occur (as shown by the red star).

Each square wave is a different height and the oscillatory sequences riding on each sqaure wave  are not identical. Here I have zoomed in on a small chunk of one oscillation.

A second order low-pass butterworth filter with cutoff at 500 Hz can be used to clean the data if this is a useful preprocessing step.

How can non-stereotyped oscillations be detected in a signal like this? Thanks!


texts: What's the sampling frequency when synthetically generating data?

texts: Say I am using matlab's random number generator to get an array of random numbers, which I will then, for testing purposes, find the spectral density etc. For that purpose I need to know the sampling freq., but these have been generated synthetically so I am not sure how the sampling theorem applies here.


texts: Cancelling the acoustic echo that occurs with a variable delay and volume

texts:
I am trying to build a software that records audio to a server and then broadcasts that audio into the same room that the microphone is present. This means that the audio signal is uploaded to the server and travelling back again. This adds a variable delay in its playback.

So far what I've experienced is the recorded audio is then picked up again by the microphone and played back over the speakers. This is, of course, much less than desired.

Given that I will not know very easily the delay in time that it will take for the audio to start playing from the speakers (may be even seconds afterwards), how can I eliminate audio being broadcasted to then be recorded again by the microphone?


texts:
Is there any algorithm that tells you the most dominant frequency component, i.e. does argmax(fft(x)) or similar, that's more computationally efficient than argmax(fft(x))?

I need to continuously find which fft bin contains a tone, of (up to) 4096 bins in the full signal bandwidth. This is part of an RF detection system implemented in FPGA. As the input is taken from the air, the input signal is very noisy. Calculating argmax(fft(x)) with a length 4096 fft does what I need, but I was wondering if there's a way to do it without calculating all the 'unnecessary' fft outputs, to save fpga resources.

For example could there be some fft-type algorithm that bisects the spectrum to find the peak without calculating many of the outputs? Though I suspect this wouldn't really work without high SNR...


texts: What is the best book on Digital Signal processing for math majors?

texts: I am a math major and have knowledge of Calculus, Real and Complex Analysis,PDEs and probability theory. I would like to get started with DSP and need a book suitable for math majors. Please give your suggestions. Thank you! :)


texts: Is it necessary to have a reference plane when doing structured-light scanning for depth calculation?

texts:
I'd like to create a point cloud of an object using the structured-light approach with either fringe-projection or dot markers but the object I plan on "scanning" won't be in front of a flat background as I've seen with most techniques. I'm assuming it's required to have the reference during calibration but I'm wondering if it's always necessary during the application.

I assume it is not always necessary considering dot projection for facial recognition doesn't need a background behind you but perhaps that's due to the nature of the algorithm. I'm fine with having a relative distance of each point with respect to each other if that is the only way to do it without the reference plane.


texts: Creating an array whose DFT is all whole numbers

texts:
I'm working on a simple FFT implementation and currently running some unit tests. Long floating point numbers in C and assembly become very hard to keep track of, and this whole thing is error prone. I was able to some up (purely experimentally) with a few 4-tap and 8-tap arrays whose DFT is all whole numbers. I'm only testing DFT arrays of length $2^N$, and I could, of course, repeat my shorter signals several times until I achieve desired length, but this would give me a whole bunch of zeros, and that's not a good thing to test for. In summary, I need to come up with signals that satisfy the following:

Signals are of length $2^N$
Coefficients of both the signal and its DFT must be whole numbers
Signals are real
Signals must not consist mainly of zeros

Could there be a general way of coming up with such things?

Update
To explain number 4 above, let me demonstrate what I mean with an example. I don't want a situation in that was produced by repeating something that has a known integer DFT several times.DFT of [1 5 -1 0] is [5 2-5i -5 2+5i]. If you simply repeat [1 5 -1 0] four times to get

[1 5 -1 0 1 5 -1 0 1 5 -1 0 1 5 -1 0],

its DFT would be

[20 0 0 0 8-20i 0 0 0 -20 0 0 0 8+20i 0 0 0].

This shows that repeating something many times does not add any new non-zero integer numbers to the DFT. This procedure simply inserts zeros between existing DFT coefficients (and scales them depending on definition of the transform). This isn't of much help. So zeros are welcome, but not the zeros achieved this way.


texts: Generate 3D image from Multiple 2D Images

texts: If we're to capture an image of a body using four (4) WebCam with a 16 megapixel (1 in the front, 1 in the back and 2 sides(left and right)). Is it possible to make a 3D out of it using image processing?


texts: How can I calculate the entropy of a signal that's not independent from itself?

texts:
I really don't know how to word this better, sorry if that title is confusing.

Basically, I'm wanting to use the noise from an AM radio audio signal to generate random numbers. To do this effectively, I need to know how many bits of entropy I can expect from some number of bits of signal data.

If every sample were independent, I could easily calculate the entropy using probabilities. The problem is that the samples are dependent on the samples that came before it and the samples that come after. I don't know how to account for this.

How can I calculate the entropy (in bits) of a section of my signal?


texts: Difference between optical flow field and motion field?

texts:
I have been trying to understand the various confusing definitions of optical flow field and motion flow field but cannot wrap my head around it.
Some authors use the term interchangeably other give specific examples where the two are different.For example in case of a rotating barber's poll as
given here.
How are the two fields so different?

Actually, this is in the context of motion estimation for a project that I am doing.I really don't get how motion estimation is different from optical flow estimation and the difference between optical flow field and 2d motion field.Please help me understand these.


texts: Interpolation methods for radar and acoustic imaging

texts: -----------------deleted by author to merge with valid account


texts: Add multiple aborption coefficients into virtual impulse response

texts:
I've got some code which creates a virtual impulse response of a room with arbitrary dimensions. I want to know, how can I add more than one absorption coefficient into it?

function h = rir(fs, mic, n, r, rm, src)
    %   RIR   Room Impulse Response.
    %   [h] = RIR(FS, MIC, N, R, RM, SRC) performs a room impulse
    %         response calculation by means of the mirror image method.
    %
    %      FS  = sample rate.
    %      MIC = row vector giving the x,y,z coordinates of
    %            the microphone.
    %      N   = The program will account for (2*N+1)^3 virtual sources
    %      R   = reflection coefficient for the walls, in general -1<R<1.
    %      RM  = row vector giving the dimensions of the room.
    %      SRC = row vector giving the x,y,z coordinates of
    %            the sound source.
    %
    %   EXAMPLE:
    %
    %      >>fs=44100;
    %      >>mic=[19 18 1.6];
    %      >>n=12;
    %      >>r=0.3;
    %      >>rm=[20 19 21];
    %      >>src=[5 2 1];
    %      >>h=rir(fs, mic, n, r, rm, src);
    %
    %   NOTES:
    %
    %   1) All distances are in meters.
    %   2) The output is scaled such that the largest value of the
    %      absolute value of the output vector is equal to one.
    %   3) To implement this filter, you will need to do a fast
    %      convolution.  The program FCONV.m will do this. It can be
    %      found on the Mathworks File Exchange at
    %      www.mathworks.com/matlabcentral/fileexchange/.  It can also
    %      be found at http://www.sgm-audio.com/research/rir/fconv.m
    %   4) A paper has been written on this model.  It is available at:
    %      http://www.sgm-audio.com/research/rir/rir.html
    %
    %
    %Version 3.4.2
    %Copyright  2003 Stephen G. McGovern

    %Some of the following comments are references to equations the my paper.

    nn = -n:1:n;                            % Index for the sequence
    rms = nn+0.5-0.5*(-1).^nn;              % Part of equations 2,3,& 4
    srcs = (-1).^(nn);                      % part of equations 2,3,& 4
    xi = srcs*src(1)+rms*rm(1)-mic(1);      % Equation 2
    yj = srcs*src(2)+rms*rm(2)-mic(2);      % Equation 3
    zk = srcs*src(3)+rms*rm(3)-mic(3);      % Equation 4

    [i, j, k] = meshgrid(xi, yj, zk);           % convert vectors to 3D matrices
    d = sqrt(i.^2+j.^2+k.^2);               % Equation 5
    time = round(fs*d/343)+1;               % Similar to Equation 6

    [e, f, g] = meshgrid(nn, nn, nn);         % convert vectors to 3D matrices
    c = r.^(abs(e)+abs(f)+abs(g));          % Equation 9
    e = c./d;                               % Equivalent to Equation 10

    h = full(sparse(time(:), 1, e(:)));       % Equivalent to equation 11
    h = h/max(abs(h));                      % Scale output

end

At the moment, the variable 'r' is the absorption coefficient for the whole room. But for the assignment I'm doing, I'm taking the RT60 of a theoretical, cuboid room that has various absorption coefficients for various surfaces.

FYI, I've looked for the paper Stephen McGovern mentions. I've found a couple of copies on archive.org but none with images! Which is kind of useless because all the images have the relevant equations.


texts: How to Calculate the Period of the Discrete Time Sequence from Taking Its DFT

texts:
This is my discrete time periodic signal, the time resolution of the samples is 0.2ms.

And it's periodic after each 11 samples. So the fundamental period of the signal is 2ms or the fundamental frequency of this sequence is 500Hz. The amplitude of each pulse increases from -5V with unit step to +5V.

But I want to find its frequency (which is 500 Hz) by calculating its FFT and plot of FFT spectrum. Please help me. Thank you.


texts: Frequency measurement from acoustic emission sensor data(VDC RMS)


texts:
According to this website:

  If the output of a system has the same type as its input signal, then the input signal is referred to as the eigen function of the system.

but in this question it is saying only option $(c)$ is eigen function.

My question is why can't it  be option $(b)$ and $(d)$ as it will also obey the defintion of eigen function as given in the website?

PS: Please let me if know my question is not clear i will edit it but please don't downvote.


texts: Are there analogues to orthogonal transformations in non-orientable surfaces?

texts:
I am working on extremely large, symmetric matrices of counts, and attempting to identify patterns/shapes within them.  Wavelets are a popular tool in image processing, and have some nice statistical properties when applies to discrete random variable.

The problem I face is this:  2D wavelet transforms on the diagonal contain redundant values, making the statistical interpretation of their coefficients difficult.

HOWEVER, i noticed that the lower triangular portion of my dataset (i.e. the dataset without any redundant values) has a natural analogue as a Möbius strip!

The steps taken to remove the redundant entries in my matrix are illustrated in the image below:

Remove the upper right half of the matrix.
Slice the image diagonally through the middle.
Twist and flip the lower right portion and "glue" it to the upper left portion so that the dashed black lines are aligned and pointing in the same direction.
Give the square a half twist and "glue" the yellow sides so that the arrows align in the same direction.

If you're incredulous that these steps are justified, see this video about redundant ordered pairs.

This is all well an good, but is there a natural extension of wavelets (or ANY orthogonal transformation) onto a non-orientable surface?  If so, how does one interpret a multi-resolution analysis?

My intuition is that horizontal detail wavelets will carry over, but the non-orientable property will complicate vertical and diagonal detail wavelets.

I am interested in sources that discuss the topic.  Web searches haven't turned up anything. I have emailed the topology faculty at my school, and have yet to hear back.


texts: Viterbi Decoder - Decoding Continuously Encoded Stream Partially

texts:
I am in trouble with Viterbi decoder for a while. I have some questions.

I need to decode messages from a continuous stream which is encoded without resetting the state metrics. Each message starts with a preamble, but since these preambles are also encoded as part of the stream, there is actually no message concept before decoding.

Encoding without resetting the metrics means that the data is encoded as one big message, doesn't it?
The decoder I am using works frame by frame, without storing and re-using the state metrics. So, I am adding a prefix and a postfix from the previous and next messages.

(last $n$ bits of the previous encoded message + message to be decoded + first $m$ bits of the next encoded message)

I hopefully expect that the prefix works as a training data, and the state metrics after the prefix are ready to decode the actual message. In order to decode the last bits of the message correctly, the postfix is used. I suppose using the data from the next message as the postfix is better than adding zeros or random bits, because adding zeros or random numbers may cause a wrong path affecting not only the decoding of the postfix but also of the actual message.

Is this procedure reasonable?
Is it common and does it have a name such as sliding windows?

How many bits should I use as the prefix and postfix? (I cannot set the traceback length and see if it is pre-set somewhere. The code rate is $1/2$ and constraint length is $7$.)

Thanks in advance.


texts: Spectral images - How do they appear during ADC?

texts:
Why is it that spectral images appear? I know they appear for $F_s$, but why those replicas appear, I don't know.

E.g., sampling $x(t) = sin(1000 * 2\pi t)$ with a sample frequency of 230 Hz.
I know it will alias, due to spectral replicas, but why do those appear at all?


texts: Lag in financial trading vs Group Delay in signal processing

texts:
I'm a newbie to Signal Processing - and so I'm providing a "background" and a "question" section separately.

Background:

Suppose I have a linear filter (w.r.t. given as

$\theta_{t+1} = \theta_t + \lambda (x_t - \theta_t)$

In Financial Trading, such a filter is often called an exponential moving average, often applied to both prices (to get smoothened prices) and to square of price returns (to get "EWMA" volatility). By conventional definition:

$\lambda =  \frac{2}{n+1}$, where $n$ is periods (example $20$-day EWMA volatility).

Usually, a lot of folks in Financial Trading define "lag" as the expected value of the filter, when $x_u$ is replace by $t-u$. For instance, the above filter can also be written as

$\theta_{t+1} = \lambda (x_t+(1-\lambda) x_{t-1}+ (1-\lambda)^2 x_{t-2}+ ...)$

To get the "lag" of this filter in Financial Trading, we write

$L(\theta) = \lambda (0+(1-\lambda) 1+ (1-\lambda)^2 2+ ...)$

which gives

$L(\theta) = (1-\lambda)/\lambda = \frac{n-1}{2}$.

Question:

Now suppose I have a filter that is non-linear in $\theta$. Example, suppose it is

$\theta_{t+1} = \theta_t + \lambda \frac{1}{2}(x_{t}^2 e^{2\theta_t}-1)$

I have no idea what would be the equivalent of a lag here. Some folks told me that the definition of lag in Financial Trading is equivalent to the group delay (or may be phase delay) in Signal Processing.

(1) I looked up the definition of group delay and phase delay (e.g. on Wiki), but I couldn't exactly relate them to the definition of lag in Financial Trading. For the linear example:

$\theta_{t+1} = \theta_t + \lambda (x_t - \theta_t)$

what would be the group delay (or may be phase delay if that's more equivalent)?

(2) For the non-linear example:

$\theta_{t+1} = \theta_t + \lambda \frac{1}{2}(x_{t}^2 e^{2\theta_t}-1)$

what would be the group delay / phase delay or the equivalent of lag as applied to the linear filters in Financial Trading?


texts: SIFT: why it is invariant to affine tranlsation?

texts:
I am studying SIFT. I am a little confused in some of Lowe's algorithm.

In order to have a descriptor invariant to translations like scaling, we must get rid of the scaling factor in LoG (Laplacian of Gaussian). I know that the LoG is represented like this:

Then the scale invariant LoG would look like this:

But how the DoG can be like this?:

In other words, how by approximation,using DoG, we get rid of that scale factor in SIFT. I know how DoG is computed, but the thing is I cannot understand how we get rid of that factor to have a invariant-to-scale LoG approximation.
Any precise explanation is really appreciated.

EDIT: some more questions, Please answer precisely. Thanks :-)
1- At the final step of SIFT, we calculate feature vector using Gradient Orientation. to do do, the keypoint's rotation is subtracted from each orientation. I cannot understand why we subtract them?

2- What about Illumination dependence?

Anyone can explain how we remove Illumination and Orientation dependency?


texts: Synchronize a software waveform generator

texts:
I'm having some trouble with a software waveform generator I'm attempting to put together. Especially with synchronizing the waveform.

Goal

Generate a mains synchronized (50 Hz) sinusoidal waveform to output on the DAC of a STM32F103.

Current Method

I developed a NCO (numerical controller oscillator) based on the accumulator method from this wiki.
This works, but my first attempt did not have precise enough calculations for the accumulator increment to get a reasonable close to the original frequency, so I had to move to q7.24 for this.
My samplerate is 10 kHz, with an interrupt every 2 ms.

Problem

I'm measuring the mains frequency with a 4 MHz free-running timer, and calculate the frequency to provide a q15.16 variable. This provides the frequency with reasonable precision. It is satisfactory for all other products that require frequency measurement.
It is however, not accurate enough for this purpose. There will be error due to the deviation of the 12 MHz crystal.

This is causing a problem, since the signal will need to synchronize to this 50 Hz reference. Which it will need some feedback for.

I developed phase measurement using the square wave subtraction method. This can calculate the phase within the limits of the samplerate.
With this result I feed a PI control loop that adds or subtracts from the accumulator increment in the NCO.
This keeps it in phase, but it still drifts around significantly on changes of mains. (and it changes a lot)

Is there a better way to synchronize a software numerical controlled oscillator? Or can I improve my current method?

Code

// Calculate increment for ac waveform generator accumulator
uint64_t f = (FREQ()->freq) << 8;  // Convert frequency q15.16 to q7.24
uint64_t t = (f * 1678);           // Multiply by sampleperiod, f * (1/fs) = f * 0.0001
inc = t / (1<<24);                 // q24*q24=q48, need to shift back to q24
// 50 hz approx 83886 q24

// Generate AC Waveform
// Add to (f * (1/fs)) to accumulator
accumlator24 += inc;
accumlator24 += phase_correction;
// Simulate 24 bit unsigned integer
if(accumlator24 & 0xFF000000u){
  accumlator24 = accumlator24 & 0x00FFFFFFu;
}
// Convert accumulator from q24 to q16 for fixed point sine
uint32_t accumulator16 = accumlator24 / 256;
// Multiply q16 accumulator "0.0 to 1.0" with 2*PI
x = fix16_mul(accumulator, fix16_2pi);
x = fix16_cos(x);
// Fill phase detect buffer (bitbanded)
if( x > 0 ){
  WFG_phase_bb[WFG_phase_dac_i++] = 1;
}else{
  WFG_phase_bb[WFG_phase_dac_i++] = 0;
}
// Multiply process value
x = fix16_smul(x, amplitude);
// Move to DAC range (0.0-1.0)
x = fix16_sadd(x, F16C(1,0));
x = fix16_smul(x, F16C(0,5));
x = fix16_clamp(x, 0, 0xFFFF);
// Copy lsb of fix16 (0.0-1.0) to dac buffer
dac1_data[i] = x;

Solution

In my implementation above the phase measuring of the generated vs reference waveform was lacking.
Because the resolution of this is equal to the samplerate due to the reference being a binary signal. I have improved the phase measurement from the binary comparison to the multiplication method. This allows for the mentioned topologys by Dan Boschen to be used.

I've added input normalization. This is actually remarkable easy to do if the signal is clean. Multiply by (1/peak).

if( input > peak ){
    peak = input;
}else{
    peak *= 0.995; // decay the peak, simulates a rectifier
}
factor = 1 / peak;
normalized = input * factor.

This normalized signal can be multiplied with the generated signal. This gives the phase as offset the multiplied signal. A low pass filter is used to get a stable value.

The phase detection with the multiplication method is proven to be accurate and provides a stable phase control loop.


texts: What is the purpose of dividing an audio signal into segments and analysis each segment?

texts: I read bunch of materials for extracting feature from audio signal and they all tell me to break signal into segments, why don't we analyze all the audio signal? I don't know what are the advantages of doing that and how wide a segment should be? I only see 256 samples per frame or 512 samples per frame... what about 1028 per frame?


texts: 2-D parameter vector: Cramer Rao lower bound

texts:
Given a 2-D parameter vector, $\mathbf{X} = [x_1, x_2]$, let the corresponding $2\times2$ Fisher Information Matrix be $\mathbf{F}$. The Cramer-Rao Lower Bound (CRLB) is the inverse of the FIM. I obtain the following matrix by inverting $\mathbf{F}$ as:
$$\mathbf{C} = \begin{bmatrix} \mathbf{C}_{1,1} & \mathbf{C}_{1,2}\\\mathbf{C}_{2,1} & \mathbf{C}_{2,2}\end{bmatrix}$$

I wanted to use a single error metric for both $x_1$ and $x_2$. I came across the following expression in one of the papers:
$$ f(\mathbf{X}) = \frac{1}{\sqrt{2}}\left(\mathbf{C}_{1,1}^2 + \mathbf{C}_{2,2}^2\right)^{1/2}$$

What does this quantity imply? Is this a joint CRLB for both parameters?


texts: Scaling down the modal value when thresholding

texts:
I have a piece of code that I am translating and I am trying to understand the reasoning behind it.  The application here is thresholding medical (cellular) images.

The function in question takes a histogram and returns the lower threshold value.  The bit of code that I am translating mutates the histogram in a way that I do not fully understand.

It first finds the mode of the histogram.  It then finds the signal which appears most often which is not the mode (i.e., the signal which appears most often behind the mode). I'll just call that the "secondary signal".

If the modal value appears more than twice the number of times as secondary signal, the modal value is scaled down to 1.5 times the modal value.  For example:

mode = find_mode(hist);
second_max = 0;
for(int i = 0; i < hist.length; ++i) {
    if(hist[i] > second_max && i != mode) {
        second_max = hist[i];
    }
}

max = hist[mode];
if(max > secondary_max * 2 && secondary_max > 0) {
    hist[mode] = secondary_max * 1.5;
}

My problem is the "magic" behind that 1.5 number as well as the logic behind scaling only when the modal value is > 2 times the secondary signal.

I realize that this results in a higher threshold value and I assume that it is to compensate for noise (move the floor and next signal closer together), but I just don't know if these constants are well understood or if they were just chosen via experimentation on some unknown data set.

BTW, the developer is unreachable and I'm the only one here who knows anything about image processing... but I'm no expert, hence me coming here.


texts: Conversion from stationarity to non-stationarity

texts: Is there any way to convert a non-stationary signal to a stationary one, perform operations on it meant for a stationary signal and then convert it back to the non-stationary one?


texts: Negative result from filtering a positive signal with a band-pass filter

texts:
I have used scipy.signal.remez to calculate the coefficients for a band-pass filter and when I use it to filter a sinusoidal signal that goes between 0 and some positive number (e.g. $2^{16}$) I get that the filtered signal is negative ( it is attenuated, as I expected ) but it has a negative offset, is this expected? I need my outputs to be between 0 and $2^{16}$ (since I am implementing this filter in an FPGA and send the filtered signal to a DAC which accepts positive numbers between 0 and $2^{16}$ Should I just deal with this by adding a positive offset to re-centre the attenuated signal?

Code used to generate the FIR filter:

fs = 2500000         # Sample rate, Hz
band = [95000, 105000]  # Desired pass band, Hz
trans_width = 5000    # Width of transition from pass band to stop band, Hz
numtaps = 200       # Size of the FIR filter.

edges = [0, band[0] - trans_width,
     band[0], band[1],
     band[1] + trans_width, 0.5*fs]
taps = scipy.signal.remez(numtaps, edges, [0, 1, 0], Hz=fs)

The taps are real and look like this:

Here is an example of the result of using this FIR filter to filter a 200KHz sine wave in python:


texts: Received signal envelope PDF to power PDF [Wireless Communications]

texts:
I am deriving the probability density function (pdf) of the received wireless signal envelope in multi-path fading channels. I wish to transform this envelop PDF to the power PDF of that signal.

I know that there exist a straightforward transform such as the one given in as in eqn $(2.3)$ in:
http://samples.sainsburysebooks.co.uk/9780471715238_sample_385247.pdf

however, it seems that this transform does not always work (unless I have made the same mistake more than 10 times). I am sure that my envelop PDF is a true PDF as it integrates to 1 from $-\infty$ to $+\infty$, but there is some issue with the transform to a power PDF (or so I believe). Any comments that might be helpful?


texts: Why choose anything but highest compression for PNG?

texts:
I just installed LibreOffice for the first time. In the Impress
application for presentation slides, when I choose to save an image on
a slide, the file type is PNG and there is a slider for compression,
positioned approximately midway at 6. Internet searching reveals that
PNG compression is nonlossy.  Why would anyone choose anything but the
highest compression?


texts: is there a use for a changing kernel in image convolution

texts:
I understand the principle of image convolution. Maybe. I think it is this:

You use a small matrix with numbers in it,

then take a sample of an image with as many pixels as you have numbers in your matrix,

then do a dot product, then add up all the terms and

then use the result as the new value for the pixel located in the center of your image sample.

Now, my question is this:

Does it make sense to think about an image kernel for convolution whose values actually depend on the image? For example, consider a 'sharpen' kernel:

0 1 0
1 4 1
0 1 0

I want to change the value in the center to be a number between 1 and 5 depending on the brightness of the pixel which is two places to the left.

The reason I ask this is because I've noticed that when I look at an image, I actually look at 'neighborhoods'. not just individual pixels. While bright spots might catch my attention. I recognize parts of an image before it 'clicks'. So if I am using some parts of an image to inform me about the 'neighborhood' that part lives in, I am wondering if this sort of 'dynamic kernel' could produce a matrix that informs us more meaningfully about the image. Obviously I am naive and know very little about image processing but a lot of papers on image convolution get technical very fast and then I'm lost.


texts: Auto-correlation function, an inverse problem

texts:
$x[n]$ is a complex function $n=0,1,2,\cdots,L-1 $

we assume $x[n]$ is periodic in its index:  $x[n+L]=x[n]$

Its auto-correlation function $C[n]$ is uniquely defined as:
$$
C[n]=\sum_{i=0}^{L-1} x[i+n]x^*[i]
$$
$C[n]$ also has the periodic property: $$C[n+L]=C[n]\tag{1}$$

And ''conjugate-symmetry'' property: $C[-n]=C^*[n] \tag{2}$

Now my question is:

For given $C[n]$, which satisfies property (1) and (2):

Can we find the corresponding $x[n]$ ?

If yes, is it unique? and what is the method to find $x[n]$?

If no, what other constraint properties should we add to $C[n]$, in order to make it yes?


texts: Is there a way to obtain the impulse response of a discrete system by just knowing it's response to the discrete unit step function?

texts:
In continuous time it was possible;

$$
u(t){\longrightarrow} \boxed{\quad\textrm{system}\quad} {\longrightarrow} y(t)\implies
\delta(t)=\frac{du(t)}{dt}{\longrightarrow}\boxed{\quad\textrm{system}\quad}{\longrightarrow} \frac{dy(t)}{dt}=h(t)
$$

Does the same apply for discrete time system i.e.
$$
\delta[t]=\frac{du[t]}{dt} \quad\textrm{where:}\begin{cases} \delta[t] &\textrm{is the discrete time delta}\\
u[t] & \textrm{is the discrete time unit step function}\end{cases}
$$

Is there a way to obtain the impulse response of a discrete system by just knowing the response of the discrete unit step?


texts: what should be the min number of samples and sampling frequency while playing sound

texts:
As i am using open Al library for generating a tune. I was able to generate a tone for single frequency.

When I was trying to generate tone for multiple frequncies, it suffered from the problem of clipping and noise. So please sugest me how to rectify the problem.


texts: How to Remove Double Lines Detected Along the Edges by Edge Detector?

texts:
I'm trying to take real time input for hand gestures with web cam, then processing the images to feed them to a neural network. I wrote this processing function to make the hand features look prominent:
def image_processing(image, count):
    roi = image[42:338, 2:298]
    cv2.imwrite('a/'+str(count)+'.png', roi)

    img = cv2.imread('a/'+str(count)+'.png')

    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    blur = cv2.GaussianBlur(gray,(5,5),2)

    th3 = cv2.adaptiveThreshold(blur,10,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY_INV,11,2)
    ret, res = cv2.threshold(th3, 225, 255, cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
    res = cv2.Canny(res,100,200)
    cv2.imshow("Canny", res)
    cv2.imwrite('a/'+str(count)+'.png', res)

--Edit--
The input and the output images are as follows :

It's obvious that double lines, instead of one, are detected along the edges. I want to make them single. If I apply just Canny edge detection algo, then the edges are not very prominent.


texts: How to find inverse Fourier transform of summ of delta functions?

texts:
I am practicing for my exam that I have this semester and I stumbled upon this one.
How can i find inverse Fourier transform given:
$$
X(j\omega) = \sum_{k=-\infty}^{\infty}\delta(\omega-2k+1)
$$


texts: Implementing Kalman filter or extended or unscented with only position information

texts:
I am new to Kalman filter. Is it possible to use a Kalman filter with just the position information of the target?

I am so confused with states and measurement.


texts: Beam resolution improvement of linear array using MVDR beamformer

texts:
One of the major advantages of using MVDR beam former is to improve bearing resolution as compared to conventional delay & sum beam forming. The bearing resolution is defined by 3 dB beam width of linear array beam pattern. There are also formulas for calculating 3 dB beam width of arrays.

Is there any way to calculate the 3 dB beam width of linear array using ideal MVDR beam former (or beam pattern calculated by ideal MVDR) so that the bearing resolution improvement with respect to conventional beam former can be quantified for same length of array?


texts: Conversion of airflow signal into 1-D as a input for CNN

texts: Trying to detect apnea from airflow signal. I have 100 files of the patient each file contains at least 8 hours of data and sampling rate is 32 Hz. How to prepare my dataset which is used as an input channel. I am new in this domain please help me.


texts:
I'm trying to implement an IIR form to approximate the Gaussian Blur Filter.
I'm working with the article "Recursive Implementation of the Gaussian Filter" by Ian T. Young and Lucas J. van Vliet.

They suggest a form and way to calculate the coefficients as given by:

I'm trying to reproduce their example for $ q = 5.0 $.

There is the MATLAB code I wrote:

qFactor = 5;

b0Coeff = 1.57825 + (2.44413 * qFactor) + (1.4281 * qFactor * qFactor) + (0.422205 * qFactor * qFactor * qFactor);
b1Coeff = (2.44413 * qFactor) + (2.85619 * qFactor * qFactor) + (1.26661 * qFactor * qFactor * qFactor);
b2Coeff = (-1.4281 * qFactor * qFactor) + (-1.26661 * qFactor * qFactor * qFactor);
b3Coeff = 0.422205 * qFactor * qFactor * qFactor;

normalizationCoeff = 1 - ((b1Coeff + b2Coeff + b3Coeff) / b0Coeff);

vDenCoeff = [b0Coeff, b1Coeff, b2Coeff, b3Coeff] / b0Coeff;

vXSignal = zeros(61, 1);
vXSignal(31) = 10;

vYSignal = filter(normalizationCoeff, vDenCoeff, vXSignal);
vYSignal = filter(normalizationCoeff, vDenCoeff, vYSignal(end:-1:1));

figure();
plot(vYSignal);

Now, the result I get is this:

Namely, I get a filter which isn't stable.
Yet it seems I get the same coefficients as they get in their example.

What am I missing?
Has anyone ever implemented this method?

Thank You.


texts: Linear Constant Coefficient Differential Equations: Zero-Input and Zero-State responses

texts:
The solution to a linear constant coefficient differential equation of the form $$\sum_{k = 0}^{N} a_k y^{(k)} (t) = \sum_{k = 0}^{M} b_k x^{(k)} (t)$$ can be written as $y(t) = y_{ZI} (t) + y_{ZS} (t)$ (sum of the zero-input response and the zero-state response) or $y(t) = y_h (t) + y_p (t)$ (the sum of the homogeneous solution and the particular solution). The zero-input response is found by solving the homogeneous equation with initial conditions applied to the solution to the homogeneous equation alone, whereas the zero-state response is found by solving the differential equation with zero initial conditions applied to the solution to the full equation (the sum of the homogeneous solution and the particular solution). However, if we split the solution up to a homogeneous solution and a particular solution (the second decomposition above) we apply initial conditions to the sum of the homogeneous and particular solutions, but not to the homogeneous solution alone first, before adding to it the particular solution. What is the reason for that?

I also wanted to know how this relates to AC steady state analysis in circuit theory. When we do steady state analysis, are we obtaining $y_p (t)$ or $y_{ZS} (t)$? Can you explain why? Is the steady-state response the particular solution or the zero-state response? Is it not one or the other in general?

I would be very grateful if you could explain this in terms of the time-domain description of systems, without resorting to s-plane concepts, poles, etc.


texts: Why Frequency Domain conversion is Important in Digital Image Processing?

texts: Any Image enhancement technique can be easily applied to the normal images. Still, most of the folks say that frequency domain conversion of the images can lead to better enhancement. Why do we need to view images or apply enhancements in frequency domain when they can be easily used in spatial-domain? Can someone please explain this in plain and simple English rather then mathematical equations for the sake of simply understanding the concept.


texts: Regarding MFCC feature of a speech signal

texts:
I am trying to implement speech recognition but I'm struck with a few questions:

There are 12 Coefficients of MFCC. What are their names?
What is the range of values of MFCC coefficients?
If I want to relate MFCC coefficients graphically, what will be unit of weights on their edges?


texts: Is it possible to recover QAM constellation of an undersampled OFDM signal?

texts:
The OFDM signal I'm interested in is rated for a 204.8MHz sampling rate!

I'm limited to sampling at 20MHz to give me just enough resolution into the range of subcarriers I'm interested in, but I just want to see if I can recover the QAM constellation from the sub-carriers I'm interested in.

I understand OFDM very well, but I'm used to having the full sample rate!
Thanks for any insider comments.


texts: understanding time constant meaning in signal processing

texts: from my DSP book,i am reading that  exponential signal $x(t)=e^{-a*t}$ has some time constant value $c$ let say if $e^{-a*t}=e^{-t/c}$ which means that $a=1/c$,but i want to understand   what is general formula to find  time constant for other signals and also what does it express?i meant what is real mining of time constant in signal?clearly it cant be value where signal repeats itself,because  in this case we call this number period,thanks in advance


texts:
I have written a script to plot the frequency spectrum of a sinusoidal signal with c++. Here are the steps
1-Applying Hanning window
2-Apply FFT using fftw3 library
I have three graphs: Signal, Signal when is multiplied to Hanning function, and the frequency spectrum. The frequency spectrum looks wrong. It should have a pick at 50 Hz.Any suggestion would be appreciated. Here is the code:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <fftw3.h>
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;

int main()
{
int i;
double y;
int N=50;
double Fs=1000;//sampling frequency
double  T=1/Fs;//sample time
double f=50;//frequency
double *in;
fftw_complex *out;
double t[N];//time vector
double ff[N];
fftw_plan plan_forward;

in = (double*) fftw_malloc(sizeof(double) * N);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);

 for (int i=0; i< N;i++)
 {
    t[i]=i*T;
    ff[i]=1/t[i];
    in[i] =0.7 *sin(2*M_PI*f*t[i]);// generate sine waveform
    double multiplier = 0.5 * (1 - cos(2*M_PI*i/(N-1)));//Hanning Window
    in[i] = multiplier * in[i];
  }

  plan_forward = fftw_plan_dft_r2c_1d ( N, in, out, FFTW_ESTIMATE );

  fftw_execute ( plan_forward );

  double v[N];

  for (int i = 0; i < N; i++)
    {

    v[i]=20*log(sqrt(out[i][0]*out[i][0]+ out[i][1]*out[i][1])/N/2);//Here I have calculated the y axis of the spectrum in dB

    }

   fstream myfile;

   myfile.open("example2.txt",fstream::out);

   myfile << "plot '-' using 1:2" << std::endl;

   for(i = 0; i < N; ++i)

    {

      myfile << ff[i]<< " " << v[i]<< std::endl;

    }

 myfile.close();

 fftw_destroy_plan ( plan_forward );
 fftw_free ( in );
 fftw_free ( out );
 return 0;
  }

I have to add that I have plotted the graphs using gnuplot after inserting the results into example2.txt. So ff[i] vs v[i] should give me the frequency spectrum.

Here are the plots:   Frequency Spectrum and Sinusoidal time Window respectively:

Edit: After applying the changes to frequency sampling, this is the graph I got:
Edit: The first graph is the plot for frequency spectrum vs time