texts: Estimate frequency and peak value of a signal's fundamental

texts:
How can I find out frequency and peak value of a signal's fundamental?
Please do consider the following:

The peak value of some harmonics might be higher than that one of the fundamental
The frequency of the harmonic is not an integer (e.g. 3.45  Hz)
I have information about where to search for the frequency (3.45 +- 0.5 Hz).
I need to estimate frequency and peak value as accurate as possible

Any response or sample code (MATLAB) is highly appreciated.


texts:
I am trying to apply a filter to reduce noise in angular measurements. Since the data comes with noise, the filter needs to be able to handle measurements that are not smoothly progressing; for example, the filter should be able to work with a series like below:
2, 358, 3, 5, 10, 18 ... 304, 315, 330, 348, 9, 15

As you can see, the second measurement of 358 is an erroneous measurement. How can I reliably put this into a linear scale so that I can apply a regular filter like a moving average filter to the data.
I was initially thinking of setting a maximum change parameter, like 90 degrees, and if such a change is observed to correct that.
I am very new to signal processing. Maybe this is a very common problem that is easily handled. Hope you  can put me in the right direction.


texts: Overlapping power-of-cosine windows with constant weight

texts:
I would like to refer you to a relevant question I posed on the Math StackExchange: A generalisation of the Pythagorean trigonometric identity.

As can be seen from the question and the answer, what this solution means is that the $(2n)$th-power-of-cosine window will exhibit a constant weight of $2n\binom{2n}{n}4^{-n}$ with an overlap of $1 - \frac{1}{2n}$, i.e.

$2$nd-power-of-cosine window exhibits constant weight of $1$ with overlap $50\%$,
$4$th-power-of-cosine window exhibits constant weight of $\frac{3}{2}$ with overlap $75\%$,
$6$th-power-of-cosine window exhibits constant weight of $\frac{15}{8}$ with overlap $83.\overline{3}\%$, etc.

I trust it is clear without explanation why constant-weight overlapped window schemes are great for application in signal analysis-synthesis. As such, it seems to me this would be an important result in signal processing and, since I am sort of a newbie to signal processing, I find it unlikely that I have discovered something important - it is rather more likely that I am just "reinventing the wheel".

However, I couldn't find anything relevant online - for example, the most relevant result in a Google search for "overlap power of cosine window constant weight" seems to be a page which, in passing, mentions that:

  [w]hen four-times-overlapping Blackman windows are plotted (...) a neatly constant sum appears again(...)

So, where can I find material which discusses issues similar to above in detail and, specifically, is there a paper which provides the above result?


texts: Apply "non-causal" filter buffer-wise, a.k.a "soft real-time filtering"

texts:
I am dealing with digital filtering of signals, both offline and in real-time. Typical filtering purposes are highpass filter or bandpass filter.
So far I worked on prerecorded signals (e.g. wav files) so I could use a non-causal filter, such as Python's SciPy filtfilt or MATLAB's filtfilt, which produces zero-phase filtering (see What is zero-phase filtering and forward-backward filtering?). This has the desired effect of canceling any phase distortion. So far it worked very well off-line.
However, since according to theory this kind of filter is non-causal (e.g. the implementation of filtfilt has a stage in which the signal is filtered backwards from its end to its start), it can't be used for "hard" real-time filtering (i.e. reading single sample at a time and immediately filtering it).
I ask if this non-causal filter can be used for "soft" real-time filtering, that is: I read a buffer of n samples, then filter the buffer using filtfilt in the time-domain or by using its frequency response (which is purely real, obtained from the filter by the SciPy function freqz) in the frequency domain (via FFT), and then I read the next buffer and so on.
Another question is what is the recommended way to apply this filter: in the time-domain via filtfilt or in the frequency domain (multiplying the FFT coefficient $F(k)$ with the real positive frequency  response $|H(k)|$)? The purpose is to have a minimally-distorted filtered signal and fast and computationally efficient filtering (to run in "soft" real-time).
Added in edit:
In my application a filtering in the frequency space is desired, and multiplying $F(k)$ by $|H(k)|$ seems to work, even in real-time. But multiplying by the absolute value is like performing zero-phase filtering, which by theory is non-causal. However, since I apply it buffer-wise, this seems to be the loophole. Am I correct?
Thanks.


texts: Calculate the tension of a triad of notes

texts:
I'm trying to implement and calculate the tonal tension of a triad (and its harmonics) following the definition given here: https://pdfs.semanticscholar.org/f05e/56c9548fa18c64efeed248742e3a6afb0c02.pdf

The tension of a single triad is given by: t=v*exp[-((y-x)/alpha)^2], where y=log(f3/f2) and x=log(f2/f1) and f3>f2>f1 where f1,f2,f3are the frequencies of the 3 components of the triad.

So far i've implemented this Matlab code:

function [tension] = tension(f1,f2,f3)
   Fdif1 = log(f2/f1);
   Fdif2 = log(f3/f2);
   alpha = 0.60;
   tension = exp(-(((Fdif2 - Fdif1)/alpha))^2);
end

Which seems right to me, but following the experimental data in the paper mentioned above (for example the tension for a single triad of 3 notes without overtones, so 3 simple sinusoids) I don't get at all the value mentioned in the graph (figure 6 of the paper).

What am i doing wrong? I thought it could be a mismatch of co-domain: the definition of tension works over a pure frequency difference, while (in figure 5 of the paper) the gaussian function of the tension works over semitones difference.

Could it be the problem?

PS: I took inspiration from this answer: https://music.stackexchange.com/questions/4439/is-there-a-way-to-measure-the-consonance-or-dissonance-of-a-chord/6556#6556?newreg=b8a315477e404f34984a65b7d96f2f49 and i wanted to extend the research implementing the other algorithms mentioned in the various papers.


texts: What methods can be used to compute homography

texts:
I am trying to understand panorama stitching. I've come to a conclusion that homography is one of the fundamental parts in the process. Now I am trying to make sense of all the information from literature across the web concerning about solving for homography.

I've read about Direct Linear Transform, Least Squares method and RANSAC. However, from what I've read I'd say DLT and RANSAC are the methods to solve homography while Least Squares is just used as additional step in DLT when there are more than 4 correspondence points. Is this right? I feel like I have things mixed up.


texts: Signals and systems : why do we study causal signals?

texts:
Till now I have read that causal signals are right sided and anti-causal, left sided.

Why did we need to classify a signal with respect to its position?
What is it's physical interpretation?
Similarly, why are LTI systems classified into causal and non-causal systems ?


texts: Get the frequency response curve from FIR filter coefficients + sampling rate

texts:
What's the fastest way (if possible in the browser thanks to an online tool, or if not possible easily, with Python), to get the frequency response curve (x-axis: Hz, y-axis: dB), when giving just:

the sampling rate, example: 44100
the coefficients, example: 1 and -1, i.e. y[n] = 1 * x[n] + (-1) x[n-1] = x[n] - x[n-1]

?

This would be often useful to quickly have an eye on the frequency response curve of a filter.

Example:


texts: How to implement a high pass filter digitally to remove the dc offset from sensor data

texts:
I'm trying to implement a high pass filter on sensor data to remove the dc offset. I'm aware I can subtract the mean of the data but I'm looking for a frequency domain approach. I've used the matlab's filterDesigner tool but I'm facing this problem:
You can see in the time domain output (last plot in blue) that the filter takes some time to settle. I want to minimize that and get similar results as mean subtraction (the plot in orange). Here are the filter specifications.

Can anyone help with me with what parameters to tweek to have no "settling time"? I'm going to implement this on esp32 so I need the order to be low.
I'm pretty new to dsp so please be kind.


texts: How to calculate the spatial frequency of an image in cycles per image

texts:
I have been attempting to calculate the spatial frequency of a colour image.

I first converted it to grayscale and used a Fast Fourier transformation (fft2) that codes the quantity of each spatial frequency in the image in MATLAB. This provides a matrix of coefficients representing the amount of each spatial frequency and orientation and its phase.

I’m having difficulty translating this matrix into a spatial frequency value that I can use to describe the spatial frequency of the image in cycles per image. Also, how can I plot the fft in a way that shows the cycles?

Do you have any suggestions to point me in the right direction?


texts:
I'm having trouble grasping the autocorrelation function for stationary signals, both strict stationary and WSS.

First for strict sense, we have $$\forall(\tau,t_1, \ldots, t_n) \in \mathbb{R} \land \forall n \in \mathbb{N} \ \ \ F_{X}(X_{t_1+\tau} ,\ldots, X_{t_n+\tau}) = F_{X}(X_{t_1},\ldots, X_{t_n}) \ \ $$ For unconditional cumulative distribution function $F_X$

This implies that all time instants are identically distributed $$\forall(t_1,t_2) \ \ F_X(X_{t_1})=F_X(X_{t_2})$$

My question then is, how is it possible for the autocorrelation to be anything other than a constant? The only thing I can think of is each time instant random variable $X_t$ is not independent, so the product distribution function would be different for different time instances and  $$E[X_{t_1}X_{t_2}]\ne E[X_{t_1}X_{t_3}]$$ if they were independent then the product distribution would be the same for all time instants and therefore the expected value as well giving a constant autocorrelation.

Additionally, for WSS, I can't conceptualize how autocorrelation could be independent of time, but still possibly dependent on shift. In this case however, each time instant is not necessarily identically distributed, only they have the same mean, but then it would seem the autocorrelation would depend on time.

Altogether, it seems that if the autocorrelation is time independent, then each time instant random variable is identically distributed (is this not the case?) and if they are identically distributed, the only way shift can affect the value is if

each time instant random variable has a different dependence on the other time instant random variables, but the dependence is consistent for all the random variables with respect to their "relative neighbors"

Is this understanding ok, or am I completely off the mark? Can someone provide an example where the autocorrelation of the stationary process is time independent, but does vary with shift?


texts:
I started learning audio dsp and the book I am working through is loaded with formulas and most of the time expects the reader to know what the relation is between these functions and why they are being used in the first place.

I'd reading a section on spectral shape, which includes sub sections on rolloff, flux, centroid, spread etc.

On what data are the functions actually applied starting from the audio source?

Im trying to get a grip on the actual process behind extracting information from audio.

The book also mentions

  "It is also common to use the power spectrum instead of the magnitude
  spectrum"

How does one change between spectrums and when is it done in the extraction process?

Are they all applied to data in the frequency bins after running a Fourier transform?


texts: Why is the fourier transform of impulse train a impulse train? Is there a intuitive reason behind it?


texts: Claim: Given sampling time T, the hold operator is approximated at low frequency by a time delay of T/2

texts:
Can someone verify this statement?

The hold operator is assumed to be a zero order hold

Then the laplace transform of this hold operator has a well known form $(1-e^{-sT})/s$

Let w approach 0, we see that our resulting function is $(1-e^{\alpha T})/\alpha$ where $s = \alpha + j\omega$

What does it mean for the time hold operator to be approximated by time delay of T/2? How can delaying a signal be equivalent to holding that signal


texts: Outlier Detection after Detrending a Time Series With Missing Values or NaN

texts:
Goal

Substitute outliers in a time series by most recent valid data

Problem

The time series (end-of-day stock prices) has several 'uncomfortable' properties:

It is non-stationary and can have components of low and high frequency (trends and sudden price moves)
There can be missing data for some days, typically single occurrences, but sometimes a whole consecutive segment is missing
Some values are erroneous (implausibly high or low i.e. due to misplaced decimal sign). These are the real outliers and don't belong to the series.

There is an additional caveat: The substitution algorithm must not look into the future of the time series since it will be used in a machine learning scenario.

Strategy

What I thought of so far:

Detrending the series. Maybe rolling linear detrending by the last n values. Will still be a problem with very short term moves.
Replacing the missing values by extrapolating the trend identified in (1)
Calculating the z-score and replacing values with z > 6 by extrapolating the trend identified in (1)

As the tags suggest, I will realise this in python / scipy. However I don't have much experience with time series analysis. I have no idea if this is an appropriate approach or if I'm missing something important. Any help is appreciated. Thanks.


texts: How to Emulate Sample Frequency Offset for OFDM in Matlab?

texts:
I am studying the effect of sampling frequency offset on OFDM, and in order to emulate SFO, I have to slightly change the sampling rate of the signal. In order to have a +5ppm offset, I have to change the sampling rate (in Matlab) from 1 to 1.000005. I tried to use "y=resample(x,200001,200000)" in Matlab but apparently there is a limitation and I could not do it.
How can I simulate an SFO?
How can I use resample in this case?

thanks


texts: Why is fourier analysis used in doppler effect?

texts:
I am a high school student that carried out the experiment on the Doppler effect to therefore analyze the graph but after doing some research, I saw one of the articles saying “ Fourier analysis is a mathematical tool that allows us to extract information about the frequency spectrum of any signal.” I don’t understand, could this be used in my analysis and what does it actually mean?
This experiment was carried out under normal conditions in other words at home and the procedure of this experiment is quite simple where I would be rotating a sound source producing constant frequency in a circular and a smartphone would be recording the data using the app. The results I got shows sharp peaks and frequency ranging from 425 when away from sound source and 441 when in-front of sound source with of course ups and downs due to errors of measurements. The idea is that I am creating a report on how math is used in a real life scenario and so I will be analyzing the graph I got by using different mathematical analysis techniques and therefore this is where I am stuck and looking for what math can be applied to my modeling change in frequency report.
(For my experiment I got sharp peaks of minima and maxima incase you wanted to know what my results were like because unfortunately I have no clue=e how to post my results here)
I was also told by one of the professors from math stack exchange that it would be a good idea to ask this question here
Reference: http://www2.york.psu.edu/~kxt7/Labs/Doncheski/doppler/lab01.pdf


texts: How do I normalize a predesigned IIR filter?

texts:
Obviously  my question here is very similar to  this previously asked question: How to normalize predesigned IIR filter coefficients to have unity gain?

Unfortunately, in the responses available to that question, it isn't super clear how the answers are obtained.
I have a pre-designed IIR filter that is applied in 2 steps:

Step 1:

    Yn =  Xn + a1*Yn-1 - b1*Yn-2

Step 2:

    Zn =  Yn + a2*Zn-1 - b2*Zn-2

with Xn being my initial input and Zn my final output.
Given these 2 pairs of coefficients (a1,b1) and (a2,b2), how do I go about finding the gain of this IIR filter to ensure it has unity gain.

Thanks for the help


texts: How and why does downsampling reduces resolution in time

texts: in my Course we talked about filter banks and the prof said that we get reduced resolution in time because of the downsampling after the band-pass filters. Is this because we now have fewer sample points per second to look at the narrowband signals?


texts: Closed form solution for the minimum phase of a continuous magnitude response

texts:
Let's say I have a continuous real function $F(\omega)$ defined in the region $\omega = [-\pi, \pi]$. Let's also say that I have a minimum phase $z$-domain transfer function $H(z)$ defined as:

$$\left| H(z) \right| = F(\omega)\quad\text{where}\quad z=e^{-i\omega}$$

i.e. $F(\omega)$ defines the magnitude of $H(z)$.

Is there a closed form expression in terms of $F(\omega)$ for the minimum phase component of $H(z)$? Even if the equation is not solvable in the majority of cases!

I know we can use the real cepstrum to reconstruct the minimum phase of a system from the log magnitude spectrum, however this is limited to equally spaced points on the unit circle.


texts: Voice masking for removing voice and not birdsong

texts:
First the problem I'm tyring to solve:
I'd like to find a way of removing any potential noise from audio files recorded in noisy environments where we are trying to record birdsong. This is for the sake of privacy, we cannot record anything unless we're sure we aren't recording private conversations.

So, what is the potential for voice masking in this problem? I've done research but it is hard to understand the real potential without learning a lot of background science first. So I'm hoping someone in the community can help.

Basically I'd like to know if voice masking techniques are able to be used on a random sound file to mask all potential voice so it is not understandable... at the same time as ensuring that we aren't masking other sounds, especially birdsong.
Is this doable?


texts: Can anyone tell me why a filter that blocks DC signal in an Amplifier would have a cutoff frequency of 4 Hz . Why would someone choose a frequency as low as 4Hz to filter out DC content before processing the audio signal further ?


texts: Newbie want to self-study to make guitar effect/amp plugin

texts:
I am a senior Game developer want to self-study how to create electric guitar amp/effect plugin.
I read around and managed to made a simple distortion plugin using JUCE. But because of lacking in basic knowledge, I don't 100% understand what it does so I don't know how to improve or make new plugin.
My question is: How should I build the foundation and deep dive further into DSP programming? What are the sources?
Thank you very much.
p/s: sorry if my English is weird.


texts: Why not use the same "standard" exponentials for both continuous and discrete time

texts:
In continuous time the standard exponential signal is usually defined as
$$
e^{st}, \quad\text{with}\quad s = \sigma+j \omega
$$
In discrete time the standard exponential signal is usually defined as
$$
z^n, \quad\text{with}\quad z=re^{i \theta}
$$
Why not define the discrete time signal as $ e^{zn} $? It seems that $ e^{zn} $ is also an eigenfunction for discrete LTI systems.


texts: Join 2 NMF models where dictionaries has hierarchical structure

texts:
I have two NMF models $A = W_1A_{dict}$ and $B = W_2B_{dict}$ (where the $W$ represents weight coefficient matrix). What is a good way to join two NMFs if I know each column of $B_{dict}$ is summed up to be $A_{dict}$?

For $A_{dict}:
$ \begin{bmatrix}
200 & 0 & 0\\
0 & 0 & 0\\
0 & 400 & 0\\
0 & 0 & 500
\end{bmatrix}

For $B_{dict}:
$ \begin{bmatrix}
0 & 70 & 70\\
0 & 0 & 80\\
90 & 0 & 0\\
0 & 100 & 100\\
110 & 110 & 0\\
0 & 120 & 120\\
0 & 0 & 130
\end{bmatrix}

The second column of $A_{dict} = 400 = 70+100+110+120$ form $B_{dict}$.

———

Additional info: I think with pre-knowledge of dictionary and observation data structure, the update rule should be better than deriving from the cost function of sum of 2 NMF: $D(A||A_{dict}W_{1}) + D(B||B_{dict}W_{2})$ where my $D$ is Kullback-Liebler divergence.

My real data is MS1 and MS2 spectra where MS2 is the fragment pattern of MS1 atom broken by some force. Each MS1 and MS2 is measured separately then $A_{dict}$ , $A$ and $B_{dict}$ , $B$ are different input.

For example, the column in MS1 dictionary has atom with mass/charge(m/z)=200. Each column of MS2 dictionary will be a fragment of 200 m/z.

The complicated thing here is the fragment set will not sum up to exactly 200. It has a rule to calculate anyway. For the element=200 m/z, the first set of possible fragments is 20.9, 30.2, 40.7, 50.0, 60.9 (along with other possible sets). And the most important point is some fragments won’t be detected in observation data. Probably, 20.9, 30.2, 50.0 are appeared. So, I think I have to separate column of each fragment and group them afterward. But to be simple, I wrote above the toy setting.


texts: Get the transfer function when using the "designfilt" command in MATLAB

texts:
To put things into perspective, I initially had these four graphs in MATLAB, whose data were sampled with a rate of 10 samples/sec :-

I wanted to remove some of the spikes on the blue graphs, so I thought about making a lowpass-filter that would take care of that. I used the command d = designfilt('lowpassfir','Filterorder', 5, 'CutoffFrequency',0.1,'SampleRate',10) . I then put the data from the blue graph through the filter, and plotted again. Now they look like this:-

As can be seen, some of the spikes have been removed and the graph have been smoothed out, which is what I desire. However, now I want to get the transfer function for the filter, but the only output I get in MATLAB is
d =

 digitalFilter with properties:

         Coefficients: [0.0287 0.1430 0.3283 0.3283 0.1430 0.0287]

   Specifications:
    FrequencyResponse: 'lowpass'
      ImpulseResponse: 'fir'
           SampleRate: 10
      CutoffFrequency: 0.1000
          FilterOrder: 5
         DesignMethod: 'window'

So my question is, can I just translate the coefficients directly into a transfer function of 5th order and with no zeroes? Like this:-
$$H(s) = \frac{1}{0.0287s^5 + 0.1430s^4 + 0.3283s^3 + 0.3283s^2 + 0.1430s + 0.0287} $$
If not, how can I get the transfer function from my designed filter?
Also, I didn't rigorously derive the arguments for the designfilt  command (filterorder, cutoff frequency) I just guessed at some appropriate values.


texts: How to denoise a conversation between two people?

texts:
I would like to know how to determine (using any programming language) whether a given audio file contains noise, such as of people talking in background, how to remove the noise, and how to subsequently compare the cleaned file with the original file.

The input to the program will be a sound file containing a conversation between two people and the program should be able to remove the noise from that file and should output only the conversation between the two people.


texts:
What will be stability if we have only one single pole at origin in s domain??
and what will be the case for multiple poles at origin in s domain?


texts:
I'm reading a Goertzel algorithm paper and an embedded article. I have several questions:

I don't understand why the the magnitude is calculated as follows:

$$\text{Magnitude} = y^2[n-2] + y^2[n-1] - a * y[n-2]y[n-1]$$
where $a$ is some coefficient. Can someone elaborate on why this is the expression?

Minimum block size If I have a sampling rate of 4000 Hz and target frequency of 50 Hz, what is the minimum block size?
If block size more that magnitude will more accurate right?


texts: Calculating SNR & Es/No and placing noise onto a signal

texts:
I have a signal power of -12 dBW from a 16 QAM signal after the first RRC.
I want to create a channel SNR of 30 dB
I calculate my noise power from this, i.e. its -42 dBW and make the noise to add to signal
#Power values below have been converted to Watts
noise_distribution = np.random.randn(N)  / np.sqrt(2)
noise = np.sqrt((noise_power/signal_power)) * noise_distribution
signal = signal + noise

This noise is inserted into the signal after the first RRC and before the second.
I know my signal power is spread over a symbol rate of 2 MHz, with a 0.35 Roll off on RRC.
Signal PSD = -12 - 10log10(2MHz(1+(2*0.35))) = -77 dBW/Hz
However my noise power is spread over Fs:
-32 dBW - 10log(40MHz) = -95 dBW/Hz
Is this the correct way to do SNR or have I just done Es/No because it doesn't seem to work in my mind, it doesn't end up being 30 dB in PSD terms.


texts: How to detect moving object from moving camera?

texts:
I want to detect the moving object(human) from moving camera. Which is the best suited method for this? Do we have to perform detection in each frame or tracking the detected object is better?
Will optical flow work for this?
Do we have to perform background stabilization?
Please guide


texts: Phase wrap when computing impulse response from frequency response

texts:
Short:

I have the frequency response of a system as a set of complex numbers.
I want the impulse response for that system.

Problem: The phase of my frequency response wraps around 2pi multiple times. When I do a IDFT of the frequency response to get an impulse response, how can I be sure the group delays match ones of the original system?

Long:

My naive approach would be to use the sampled frequency response and feed that into an IDFT/IFFT to obtain an impulse response. But the phase information in the complex numbers is quantized to 0..2pi. For example, let system A have an arbitrary frequency response. System B has the same response, but with an additional phase shift of 360° for all frequencies above a certain threshold f0. In the space of their frequency responses in the form of complex numbers, both systems would look identical. If I did the IDFT of system Bs frequency response, I would get an impulse response that doesn't reflect that 360° phase shift because it wasn't reflected in the complex data. Is this correct?

Staying with my actual problem:

For the system in question, I can clearly see from my phase response, that the phase wraps around 2 Pi multiple times. I can reconstruct the actual phase response by unwrapping it with Matlabs unwrap() command as the phase response is relatively smooth. But as soon as I feed this into an IDFT/IFFT I have to quantize the phase into the angle of a complex number again and the information gained from unwrap() is lost again.

For my application, the actual group delays are very important. So I'm looking for a way to reconstruct the correct impulse response, taking into account that the phase information for a certain frequency may actually have an additional N full rotations that are not reflected in the complex numbers.

Or am I simply imagining the problem and systems like system B are actually impossible?


texts: Sequential processing of uncorrelated measurements in Kalman Filter

texts:
I'm starting to brush up on the Kalman Filtering I learned a couple decades ago. From what I remember, if you have a measurement vector

$$
z=H x + v
$$
 and the $n$ components of the measurement noise $v$ are uncorrelated with each other, then you can process the measurements sequentially in the KF equations. Is there a good reference somewhere (preferably online) that discusses why this is so? Intuitively it is understandable if each measurement $z$ depends on only one state element in $x$, but it isn't obvious if each measurement of $z$ depends on several elements of $x$.


texts:
Let's say I have an IIR filter that is a notch type with a peak at -20db. How do I modify the coefficients of the filter so that the peak is at -10 db for example?

I know I can scale the denominator coefficients so that the global peak amplitude can be set, but it affects the whole filter, which I don't want.

Here is what I want :


texts: All that I heard so far about phase spectrum - that it is very hard to process. Are there any methods to do that, and is it possible to extract information about the noise from phase spectrum?


texts: Why are there no poles for finite length signals

texts:
My professor recently said something along the lines of, "finite length signals can't have poles because poles correspond to recursive difference equations which correspond to infinite length signals."

I can't really wrap my head around this. Can someone explain in a different or more simple way why finite length signals can't have poles? Would much prefer a simple, hand-wavy explanation that I can remember easily rather than a rigorous explanation/proof.


texts: blob detection using Laplacian of Gaussian filter

texts:
I'm learning feature-detectors from this lecture notes, and I don't quite understand the Normalized Laplacian of Gaussian filtered image.

Here is the original image:

this is the output presented in the lecture notes, filtered by Normalized Laplacian of Gaussian with $\sigma=2.502$:

and here is mine, using scipy.ndimage.filters.gaussian_laplace with $\sigma=2.502$:

Well, my output image is quite different from the one in the lecture notes. The background of the lecture's output is totally black, even if I did some thresholding, my output is still different from the lecture's.

Moreover, I noticed that edges almost disappeared in the lecture's output, and around each detected blob, there seems to be a ring surrounding it, like this:

Why is that? Am I using Laplacian of Gaussian wrong?


texts: I know someohow it combines different harmonics to synthsis note, but I don't exactly know how this happens. Does digital piano use pwm to synthesis a note?


texts: what is the the resultant, or, "final" frequency of the FFT of a chirped signal

texts:
Let's say we have a time-transient with a chirped signal,
$$V(t) = \cos\left( 2 \pi f(t) t \right)$$
where $f(t)$ is the frequency of the signal and is time dependant. My question is how would one describe the final frequency, as produced by an FFT spectrum? My intuition is that it would be the time average such that
$$f^{\rm{FFT}}_{\rm{final}} = \frac{1}{T}\int^{T}_{0} f(t) \ {\rm{d}}t$$
where $T$ is the length of the time-transient signal used in the FFT. Strictly speaking I think would use a Gabor transform for non-stationary signals, but seeing as the spectrum analyser I am working with uses an FFT algorithm.


texts: Spectral density of 1-bit nonlinear detector in terms of analog spectral density

texts:
Suppose we have a time dependent noise signal $\theta(t)$.
We sample $\theta(t)$ with a device which has 1 bit of resolution and is itself stochastic in the sense that the readout value $u$ of the device follows a probability distribution

$$P(u) =
\sin(\theta(t)/2)^2 \delta(u - 1) +
\cos(\theta(t)/2)^2 \delta(u + 1) \, .$$

In other words, we get $u=1$ with probability $\sin(\theta(t)/2)^2$ and $u=-1$ with probability $\cos(\theta(t)/2)^2$.

We sample at discrete times $n\delta t$ where $\delta t$ is the sampling interval.
This yields a discrete sequence of random variables with distributions

$$P_n(u) =
\sin(\theta_n/2)^2 \delta(u - 1) +
\cos(\theta_n/2)^2 \delta(u + 1) \, .$$

where $\theta_n \equiv \theta(n \delta t)$.
We record a series of discrete samples $u_n$ from the measurement device, and from that can compute the discrete Fourier transform of the series $u_n$.

How is the spectral density of $u_n$ related to the spectral density of $\theta(t)$?

This problem is difficult because the response of the measurement device is not linear, which means that the usual transfer function methods don't work.
We can assume, if it helps, that

$$\theta(t) = \frac{\pi}{2} + \delta \theta(t)$$

where $\delta \theta$ is understood to be small.
With this assumption, we have
$$\sin(\theta/2)^2 \approx \frac{1}{2}(1 + \delta \theta) \quad \text{and} \quad \cos(\theta/2)^2 \approx \frac{1}{2}(1 - \delta \theta) \, .$$

My attempt

I tried solving this by writing out the expression for the discrete Fourier transform

$$U_k \equiv \sum_{n=0}^{N-1} u_n e^{-i 2 \pi k n / N} \, .$$

Taking the real part and using some basic relations of probability distributions we can write the probability distribution of the real part of $U_k$ as
$$P_{\text{Re} U_k}(x)
= \sum_{n=0}^{N-1} \frac{1}{\cos(2 \pi k n / N)} P_n \left(\frac{x}{\cos(2\pi k n / N)} \right) \, .$$
We can next use the fact that the probability distribution of a sum of random variables is equal to the convolution of the distributions of the summands, and then additionally use the fact that convolution turns into products in the frequency domain.
Doing this yields

\begin{align}
\mathcal{FT}[P_{\text{Re}U_k}](k)
&= \prod_{n=0}^{N-1} \frac{1}{\cos(2 \pi k n / N)} \\
&\left(
\sin(\theta_n/2)^2 e^{-i k \cos(2\pi k n / N)}
+ \cos(\theta_n/2)^2 e^{i k \cos(2\pi k n / N)}
\right) \, .
\end{align}
The notation is considerably simpler if we define $c_{n,k} \equiv \cos(2\pi k n / N)$, giving
$$
\mathcal{FT}[P_{\text{Re}U_k}](k)
= \prod_{n=0}^{N-1} \frac{1}{c_{n,k}}
\left(
\sin(\theta_n/2)^2 e^{-i k c_{n,k}}
+ \cos(\theta_n/2)^2 e^{i k c_{n,k}}
\right) \, .
$$
If we use the linearization mentioned above this simplifies to
\begin{align}
\mathcal{FT}[P_{\text{Re}U_k}](k)
&= \prod_{n=0}^{N-1} \frac{1}{2 c_{n,k}}
\left(
(1 + \delta \theta_n) e^{-i k c_{n,k}}
+ (1 - \delta \theta_n) e^{i k c_{n,k}}
\right) \\
&= \prod_{n=0}^{N-1} \frac{1}{c_{n,k}}
\left(
\cos(k c_{n,k}) - i \delta \theta_n \sin(k c_{n,k})
\right) \, .
\end{align}
This is where I'm stuck.
I realize there may be a considerably easier way to solve this.
I presented this strictly mathematical approach as a point of reference and to demonstrate a possible way of thinking about the problem.


texts: Help implementing digital filter from tansfer function

texts:
I'm trying to implement a digital filter, which is given by the following transfer function:
$$
1+2V K \frac{K+c_m+2Kz^{-1}+(K-c_m)z^{-2}}{1+2Kc_m+K^2+(2K^2-2)z^{-1}+(1-2Kc_m+K^2)z^{-2}}
$$
$$
+V^2K^2\frac{1+2z^{-1}+z^{-2}}{1+2Kc_m+K^2+(2K^2-2)z^{-1}+(1-2Kc_m+K^2)z^{-2}}
$$
My interpretation of the coefficients is this:
$a0_1 =  1+2V K$
$a1_1 =  2Kc_m+K^2+(2K^2-2)$
$a2_1 = (1-2Kc_m+K^2)$
$b0_1 = K+c_m$
$b1_1 = 2K$
$b2_1 = K-c_m$
$a0_2 =  V^2K^2$
$a1_2 =  2Kc_m+K^2+(2K^2-2)$
$a2_2 = (1-2Kc_m+K^2)$
$b0_2 = V^2K^2$
$b1_2 = 2*(V^2K^2)$
$b2_2 = V^2K^2$
After dividing all the coefficients by a0, I try implementing them using a standard biquad:
$y[n] = b0*x[n] + b1 * x[n-1] + b2 * x[n-2] - a1 * y[n-1] - a2 * y[n-2]$
in parallel, with their outputs summed.
I haven't managed to get it working.
Am I on the right path? Is there anything I'm doing terribly wrong, or not doing? Thanks very much for any help!


texts:
I'm trying to transmit and receiver the GPS payload in both Time and Frequency Domain.

For transmitting and receiving in time domain :

numBits = 10;                        % LFSR length
codeLength = 2^numBits-1;           % Spreading code length

payload1 = 1*(rand(1,100)>0.5);
payload2 = 1*(rand(1,100)>0.5);
payload3 = 1*(rand(1,100)>0.5);

payload1 = 2*payload1 - 1;            %BPSK Modulation
payload2 = 2*payload2 - 1;            %BPSK Modulation
payload3 = 2*payload3 - 1;            %BPSK Modulation

%  payload1 = ones(1,10);
%  payload2 = ones(1,10)*2;
%  payload3 = ones(1,10)*3;
%% PN code generation

% initial sequence is taken from IRNSS document
goldCode1 = generateGoldCode(935,239,codeLength,numBits);
goldCode1 = 2*goldCode1-1;                        % Assign code to 1 to 1 and -1 to 0

goldCode2 = generateGoldCode(38,381,codeLength,numBits);
goldCode2 = 2*goldCode2-1;

goldCode3 = generateGoldCode(564,561,codeLength,numBits);
goldCode3 = 2*goldCode3-1;

%% At transmitter part
payloadData1 = kron(payload1,goldCode1);         % Product of payload data and gold code to spread the sequence
payloadData2 = kron(payload2,goldCode2);
payloadData3 = kron(payload3,goldCode3);

TxData = (payloadData1 + payloadData2 + payloadData3);

%% At receiver part
%% Time Domain
crossCorr = xcorr2(TxData,goldCode2);
outputData = crossCorr(codeLength:codeLength:end)/codeLength;

For Frequency domain I want to receive each bit at a time:

starting =1;
i=0;
crossCorr_temp=[zeros(1,100)] ;
goldCodeFFT = conj(fft(goldCode2));
for val = 1023:1023:length(TxData)
  payloadFFT = fft(TxData(starting:val));
  crossCorr_FFT = ifft(payloadFFT .*goldCodeFFT);
  corr_time = crossCorr_FFT(1:end)/codeLength; **#Doubt here**
  starting = starting +1023;
  i=i+1;
end

How do I approach this frequency-domain way to receive the GPS payload bits?


texts: Real Time Object Tracking using image processing

texts: How we can track a single selected object from multiple detected moving objects using single fixed camara?


texts: Optimization of execution time of audio capture call in c/c++ (ALSA)

texts:
I am working on a Audio Deep Learning Project. In this C++ project I need to capture real-time audio and then do pre-processing and the pre-processed output is fed to the Deep Learning Network.

I am fetching 50 ms audio data in each call at 16000 sampling rate, i.e. 800 samples are fetched in the audio capture call.

Sometimes this call takes more than 50 ms, my processing code is taking ~30 ms.

If the audio-capture + processing takes more than 50 ms, is that mean I lost some audio data?

Can the audio capture call be optimized?

Implementation Info:-
I have the working code on raspberry pi and my processing code is armv7 optimized.

Execution time is measured using std::chrono in c++ using high_resolution_clock.


texts: The autocorrelation of a WSS process as a linear operator

texts:
If I'm given a autocorrelation matrix of a WSS process what interpretation should I put on the resulting vector.

More concretely the matrix takes the form

$\begin{bmatrix} x_1 & x_2 & \ldots & x_n \\ x_2 & x_1 & \ldots & x_{n-1} \\ \ldots & \\ x_n & x_2 & \ldots & x_1 \end{bmatrix}$

and I multiply it with a vector defined on the same space, what interpretation should I give $y = Mv$?

Note, any matrix which has constant diagonals is ok for my purposes. So circular matrices are ok. I.e the matrix could describe the circular autocorrelation function.

For example, the rvs $\{X_i\}$ could be independent Gaussian on $\mathbb{R}^n$, with $v$ being some vector of length n in $\mathbb{R}^n$ also.


texts:
Consider a system implementing a rational sampling rate change by 5/7: for this, we cascade upsampler by 5, a lowpass filter with cutoff frequency π/7 and a downsampler by 7. The lowpass filter is a 4rd-order Butterworth filter with transfer function

$$H(z) = \frac{b0 + b1z^{-1} + b2z^{-2} + b3z^{-3} + + b4z^{-4}}{1 - a1z^{-1} - a2z^{-2} - a3z^{-3} - a4z^{-4}}$$
Assume that the input works at a rate of 1000 samples per second. What is the number of multiplications per second required by the system? Assume that multiplications by zero do not count.

Since there are 9 filter coefficients and 5000 samples left (after upsampling, filtering, downsampling), 9*5000 = 45000 is my MAC calculation, but that seems to be wrong approach, any other idea to solve this question???


texts: Random selection of sub-block in an image with matlab

texts: I want to select a random sub-block of 8x8 out of an image 256x256. Is there an instruction that do this thing or i need to calculate it with a different approach. I found how to choose a galois field array out of a  matrix but i think this is not in my case what i need.


texts:
Assume you have 77777 pictures that are mostly noise.
They are about magnetic anisotropy.

There is one picture among these pictures which has high contrast difference between two large areas (some sort of magnetic gap because of magnetic anisotropy).
One area is gray and the other area is dark.

The pictures are mostly like this (grey or dark)

and

There are some dirty things in some pictures which are just rubbish on the lens.
So only big differences are essential.
Example what the contrast difference should look like

These pictures are about magnetic anisotrophy with Fe and Boron.

How can you find the distinction among these 77777 pictures?
I have went through all of these pictures but my method is errorprone, since I just browse them through.

How can you assist browsing the find the big and large contrast difference in pictures?

Any tool is ok for me: Matlab, Python, ..., pseudo-code too.


texts: Why does decimation make a system time variant?

texts:
On Wikipedia I read this : "The Discrete Wavelet Transform, often used in modern signal processing, is time variant because it makes use of the decimation operation."

Why does decimation makes system time variant?


texts: I have a few sequences of images, taken at fixed camera position, that address a moving object, which means the object moves towards the camera. But all the sequences of images are the cropped images of the object and all images are in the same size (grayscale images). From naked eyes, we can see the images that are closer to the camera are  better than the ones that taken at far distance. How can I show scientifically or show a proof that the images have varied quality? I also want to compare the quality between  sequences.


texts: What do we call the areas with "1" in a binary image

texts: I am looking for possible professional terms. In a binary (1 or 0) image, normally, the areas with "1"s are where the information is. I wonder if there is any professional name for it in image processing. Thank you!


texts: MatLab - Can not detect all lines in a "simple" image using houghlines

texts:
I try to detect all lines in an image with some common geometric figures. The obvious choice, hough of MATLAB wouldn't print out the desired results.

I used the following MATLAB code:

[H,T,R]=hough(BW);
P=houghpeaks(H,10,'threshold',ceil(0.2*max(H(:))));

LINES=houghlines(BW,T,R,P,'FillGap',2,'MinLength',3);
figure, imshow(BW),hold on;

for k=1:length(LINES)
    xy=[LINES(k).point1; LINES(k).point2];
    plot(xy(:,1),xy(:,2),'LineWidth',1,'Color','Green');

    plot(xy(1,1),xy(1,2),'x','LineWidth',1,'Color','yellow');
    plot(xy(2,1),xy(2,2),'x','LineWidth',1,'Color','red');
end

EDIT 1: Including the original RGB image here:

And the image stored in the BW:

The result of this code is shown in the next image.

I think it is visible that hough method did not detect every line leaving quiet a few still to be detected.
Does someone have a solution as to why it did not detect those lines and how to optimize the code so that it does detect them?


texts: What is the ideal FIR length, given a specific pulse length?

texts:
I am trying to ascertain what the 'ideal' FIR filter length should be, given the pulse length $T_p$ of a windowed sinusoid in noise that I seek to filter.

As parameters into an FIR filter that I design, I have:

$F_c = 15 \text{ kHz}$, The center frequency. (This is the carrier frequency of the signal). I know this.
Since this is a BPF FIR, I specify the pass band as $F_{c} - \frac{1}{T_p}$ to $F_{c} + \frac{1}{T_p}$. This is because the bandwidth of the windowed sinusoid is $\frac{2}{T_p}$
The last parameter that I do not know how exactly to specity, is the length of this FIR... this is where I am lost. What is the ideal length here, (if any?)... Should it just be the length of the pulse (in samples of course), thereby making it something akin to a matched filter? Does this mean I have no further gains in increasing filter length?

As further context, I am seeking this 'ideal' length, should it exist, because I am trying to filter out as much noise as possible, but also try my best to retain the sharp transients. This is what led me to ask, is there an ideal filter length to start from. For example, in the following plot below, I have filtered a noisy version of my signal, with filters of length 11 (red) and 171 (black) respectively. They are shown below:

As you can see, while the black result is 'smoother', you can see that it is also more 'smudged' in as far as its transients go. In contrast, the red still retains some noise, but transients are not as affected.

The plot below shows the spectrums of the above filters:

TLDR: So, is there an 'ideal' length for FIR filters, in so far as that further increasing the filter length does not buy you any more noise immunity, but might actually smear your transients even more than needed?

EDIT:

I have added two new images. The first one has filter of length 11, (red), filter of length 171, (black), and filter of length 901, (blue). The thick-blue is the spectrum of the data.

Here is the corresponding results for the filter of length 11, (red), and the new filter of length 901, (black).


texts: Getting Composition of a Mixture of Colors

texts:
I wanted to validate a thought on blending of colours digitally.

Imagine I have two colours, $C_1$ $(R_1,G_1,B_1)$ and $C_2$ $(R_2,G_2,B_2)$. Now, I create colour $C3$ as follows:
$C_3 = \alpha C_1 + (1-\alpha) C_2$

Where $\alpha$ is a value between $0$ and $1$.
So, yes, basically, I am trying to put one object over another with a transparency associated with it.

What I want to understand is that, if I have $C_3$, $\alpha$ and $C_1$ in the above equation, will I get an accurate value of $C_2$?

Math suggests that I should, but I just want to confirm that I am not missing anything.
Also, can I keep a really high but $< 1$ value for $\alpha$ and still accurately get $C_2$?


texts: Kalman filtering for position using GPS,accelerometer and speed sensors

texts:
I am working on tracking a vehicle under tunnel when GPS is lost.
Whenever the vehicle in on the road, the GPS works fine and gives good accuracy but when the vehicle is under tunnel, the GPS is lost and its difficult to track vehicle. This is where i have decided to use kalman filtering.
I have a 9 axis IMU sensor(accelerometer,gyro,magnetometer) and speed value from Candata and would like to predict the location using kalman
So far, this is wat i have done

1. Px(t+1) = Px + delta_t * vx + 0.5 * ax * delta_t 2
2. Py(t+1) = Py + delta_t * vy + 0.5 * ay * delta_t 2
3. Vx(t+1) = Vx + ax * delta_t
4. Vy(t+1) = Vy + ay * delta_t

where px,py are my positions and vx and vy are my velocities this is my statemodel
my input is the abs acceleration in x and y direction calculated from 9 axis IMU using all 3 sensors.
and in my update step i use the gps value i received.
So my question here is, where do i use my speed value? Is accelerometer enough?


texts: Biquad cookbook formula for broadcast FM de-emphasis?

texts: Can a simple IIR biquad filter be used as an audio de-emphasis filter for broadcast FM radio?  If so, how does one translate the filter requirements (50 uS time constant in the U.S.?) into parameters for one of the common (e.g. RBJ's) biquad cookbook algorithms, given typical audio sample rates?  Is the formula for a low shelving filter appropriate?


texts: Do symmetric discrete signals have zero phase?

texts:
I generated a Hanning window having an even symmetry:

where for even-sampled case we either take "left" and "right" to include or exclude the center sample. I was surprised to find its DFT has non-zero imaginary coefficients, i.e. non-zero phase, in both cases. I've also tried an odd symmetry case and ended up with non-zero real coefficients.
Shouldn't even- & odd-symmetric discrete signals have zero-phase DFT?


texts:
A dynamical system evolves according to $x_{k+1} = M_k x_k + w_k$

$w_k$ denotes the model error.

In a textbook, it is specified that $w_k$ is temporally uncorrelated and

$E[w_kw_j^T]$ = $Q_k$ if j=k and zero otherwise; $Q_k$ is n x n symmetric positive definite

Could someone explain why $w_k$ is temporally uncorrelated and how $Q_k$ is symmetric positive definite?


texts: If you are given an inverse DFT, then how do you convert it back to the DFT without actually computing any DFT?


texts: What will be the distribution of a given signal

texts:
Suppose I have a signal $$
\mathbf{s} \sim C \mathcal{N}\left(\mathbf{0},  \sigma^{2} \mathbf{I}_{N_{}}\right)
$$
The signal going through a channel :
$$
{\mathbf{r}}_{}=\mathbf{s}+{\delta \mathbf{n}}
$$
where :
$$
\mathbf{n} \sim C \mathcal{N}\left(\mathbf{0},  \sigma^{2} \mathbf{I}_{N_{}}\right)
$$
$$
\mathbf{\delta} \sim  \mathcal U\left(-1, 1\right)
$$
What will be the distribution of ${\mathbf{r}}_{}$. I am having difficulty because of the second term where the uniform distribution scalar multiplied with a Gaussian vector.


texts: When we play several audio streams what is responsible for mixing them?

texts:
When we play several audio streams what is responsible for mixing them in single audio playing via speakers?

Clearly it should be either OS combining the sounds or hardware getting multiple data streams.

Any references will be much appreciated.


texts: Minimum SNR Requirements for Maximum Likelihood Frequency Estimation

texts:
In certain applications, you have enough SNR available to, for example, perform an FFT and identify peak location and hence the signal frequency. If my understanding is correct, parameter estimation techniques, such as maximum likelihood, will only be useful when your SNR is so low that you can't run a basic peak search to identify frequency.

However, I have seen literature where people plot performance of various estimation algorithms vs SNRs upto 40~50dB. It seems like a waste of processing power to perform ML on a high SNR (40dB is quite a high value) signal and extract the already obvious information?

Is there a 'rule of thumb' to say, use statistical algorithms below such SNR levels?


texts: Orthogonality of filter impulse response to its even shift

texts:
I meet this problem but still do not know how to solve it.
Could you guy give me some guides?

Upsampling by 2 ($U_2$) followed by filtering by $g$, with operator $G$

And given: $<g_n,g_{n-2k}>_n = \delta_k$
(Filters with impulse responses orthogonal to their even shifts)

Prove that:
$$
I = U_2^*G^*GU_2
$$

Thank in advance.


texts:
I've been wondering,

Since some sound generating physical phenomena have been physically modelled as physical modelling synthesisers,

Does there exist a "physical audio theory" (or scientific subdomains fit for belonging to "physical audio theory"), which is like a subfield of applied mathematics or physics that describes the theory of sound generators, propagation and such. For example, the Karplus-Strong algorithm and its analysis would belong there and it would be presented as a derivation of string physics. Sure there's the physics of sound under physics, but I have not seen a coherent mathematical theory on "physical modelling synthesis", even if "physical modelling synthesis" could perhaps be laid out as mathematical formalisms, e.g. as an "applied linear algebra" body of theory. It seems like much of audio DSP is just scattered information.

For those interested, I also think there are at least some books concerning "physical audio theory", an example would be this book:

https://mitpress.mit.edu/books/designing-sound

It does contain chapters that predominantly analyze natural phenomena or "sound generating settings" and try to translate those into expressions in mathematics, using concepts from physics. The derivations don't differ that much from e.g. typical engineering analysis. Much like the Karplus-Strong algorithm was developed by analyzing string instruments.


texts: Multiple cheap IMUs vs one expensive IMUs

texts: In my project, there is a possibility of either buying one expensive IMU or 5 cheaper IMUs. They have to be cheaper due to budget limitations, and the idea is to use them in order to be able to do "voting" - i.e. vote out outlier measurements of one IMU if 4 other IMUs show a different reading - and also for redundancy. Question: does anybody know if 5 cheaper IMUs (on the order to 300 dollars each) can create a signal at least as smooth, via sensor fusion, as one expensive IMU (on the order of 1500 dollars)?


texts:
First of all, thank you all for your answers. I know the z transform for

$$ x(n)=3^n \space ; \space  n\geqslant  3 $$

or rather

$$ x(n)= 3^n u(n-3) $$$$\begin{align}X(z)&=\sum_{n=-\infty}^{\infty}x[n]z^{-n}\\&=\sum_{n=-\infty}^\infty3^nu(n-3)z^{-n}\\& \text{change of variables: } n'=n-3 \\& =\sum_{n=-\infty}^\infty 3^{(n'+3)} u(n') z^{(-n'-3)}\\& \text{recall:  } n'-> n \\&=3^3z^{-3}\sum_{n=0}^{\infty}(3 z^{-1})^{n}\\& X(z) =3^3 z^{-3}\frac{1}{1-3{z^{-1}}},\quad |z|>3  \tag{1}\end{align} $$\begin{align} \\&  \text{instead, for the sequence: } x(n)=3^{n} \ ; n\leqslant -3  \\&=\sum_{n=-\infty}^\infty3^nu(-n-3)z^{-n}\\& \text{change of variables: } n'=-n-3 \\& =\sum_{n=-\infty}^\infty 3^{(-n'-3)} u(n') z^{-(-n'-3)}\\& \text{recall:  } n'-> n \\&=3^{-3} z^{3}\sum_{n=0}^{\infty}(3^{-1} z)^{n}\\&  X(Z)= 3^{-3}z^{3}\frac{1}{1- \frac{z}{3}} \quad |z|<3\tag{2}\end{align}
Is it correct?
And for @Matt L. I don't understand your mathematical step initial when you write:
$$\begin {align} \sum_{n=-\infty}^3 3^nz^{-n}  =\sum_{n=-\infty}^0 3^{(n+3)} u(n') z^{-(n+3)} \end {align} $$

Can you write me the generic formula?


texts: Identify the correct spot to place a label

texts:
In the image shown below, I have a 2D data set where I have identified four clusters labeled [0,1,2,3]. I'm looking for an algorithm to place the labels in a natural* way for each shape. My first guess was to place them in the "center-of-mass" of the cluster, which is shown below. For contiguous clusters this works fine. For clusters that take a shape as in cluster 0 however, the approach fails. Without using a legend, what would be a better method to place the labels on this image?

* natural here is subjective to some extent, but the point of the labels is to help the viewer associate a certain region in the x-y plane with a number.


texts: Fields of math needed for digital filter design

texts: I want learn digital filter design. My knowledge of math is at high school level. I can learn math through the Internet. Then, what fields of math do I have to learn?


texts:
@Jim Clay: No if the filter varies slowly, then the clicks go away. So I guess the filter needs to vary slowly to avoid audible clicking sounds.

I created a test in matlab where I'm comparing time-domain filtering with frequency-domain filtering. The two operations produce the same output, but I get clicks in the audio when I switch filter parameters periodically. How do I solve that?

Here's my script:

clc
close all
clear all

[x,fs] = wavread('audiosignal');
x = x';
numberOfFilterTaps = 256;
NFFT = numberOfFilterTaps * 2;
z1 = zeros(1,numberOfFilterTaps-1);
blockSize = 64;
numberOfSamples = length(x);
h1 = fir1(numberOfFilterTaps-1, 0.5);
h2 = fir1(numberOfFilterTaps-1, 0.9);
blockCounter = 0;
ola = zeros(1,NFFT);
enableThis = 1;
switchCounter = 0;

while 1
    idx1 = 1 + blockSize * blockCounter;
    idx2 = blockSize + blockSize * blockCounter;

    if (idx2 > numberOfSamples)
        break;
    end

    idx = idx1:idx2;

    sampleBlock = x(idx);

    % Switch filter periodically
    if (switchCounter == 0)
        switchCounter = 0;
        if (enableThis)
            h = h1;
            H = fft(h,NFFT);
            enableThis = 0;
        else
            enableThis = 1;
            h = h2;
            H = fft(h,NFFT);
        end
    end
    switchCounter = switchCounter +1;
    if (switchCounter > 60)
        switchCounter = 0;
    end

    % Method #1
    [y1(idx),z1] = filter(h,1,sampleBlock,z1);

    % Method #2
    tmp = real(ifft(fft(sampleBlock, NFFT) .* H));
    tmp = tmp + ola;
    ola = [tmp(blockSize+1:end) zeros(1,blockSize)];
    y2(idx) = tmp(1:blockSize);

    blockCounter = blockCounter + 1;
end

wavwrite(y1,fs,'output_y1');
wavwrite(y2,fs,'output_y2');


texts:
I am a self-learner of DSP by reading various books. I have accomplished basic understanding of Signals - CT and DT and a few transforms. I recently started to learn FIR / IIR Filters.

The part that I cannot understand is that they are termed as 'Filters' which for me logically means blocking / allowing from a threshold value - ex. lower values would be passed higher would be filtered or removed. So if we have a low pass filter - it would lead us to remove high values from a sequence and vice versa for high pass filters - is my understanding correct?

Like HPF (High Pass Filter):

x(n)={1,2,3,4,5,6,7,8,9}

Set threshold as >=5 so output sequence would be {5,6,7,8,9}

OK but the document states FIR / IIR about :

  Finite Impulse Response (FIR) : this type of filter gives a finite
  number of nonzero outputs (response) to an impulse function input. It
  does not use feed-back.

While

  Infinite Impulse Response (IIR) : this type of filter uses feed-back,
  so it could have an infinite number of nonzero outputs (response) to
  an impulse function input.

Now I cannot understand what FIR / IIR has to do with my concept of filters - allow / block high / low values. Where does the question of Feedback comes here?

Similarly for wavelets -

  We call an octave a level of resolution, where each octave can be
  envisioned as a pair of FIR filters, at least for the one-dimensional
  case. One filter of the analysis (wavelet transform) pair is a lowpass
  filter (LPF), while the other is a highpass filter (HPF). Each filter
  has a down-sampler after it, to make the transform efficient.  For
  example, a simple lowpass filter may have coefficients {1/2,1/2},
  producing outputs (x[n] + x[n - 1])/2, which is clearly the average of
  two samples. A corresponding simple highpass filter would have
  coefficients {1/2,-1/2}, producing outputs (x[n] - x[n - 1])/2, half
  the difference of the samples.

I am not able to get the concept of how and why here equation : (x[n] + x[n - 1])/2 and (x[n] - x[n - 1])/2 is being referred?


texts: Oscillations in a first-order discrete-time linear systems

texts:
According to my understanding, continuous first order systems do not exhibit oscillatory behavior because a first order system has only one energy storage element and thus oscillation is not possible. I was simulating the below difference equation for a first order discrete system:

$$y[n] =  \tfrac{1}{10} u[n] - \tfrac{7}{10} y[n-1]$$

where $u[n]$ is a unit step function. As can be seen, this equation describes a first order difference equation. However, when plotting $y[n]$, I can see that it oscillates at the start and settles next:

However, when I simulate the following difference equation then this oscillation disappears:

$$y[n] =  \tfrac{1}{10} u[n] + \tfrac{7}{10} y[n-1]$$

I am not sure how first order discrete time systems are different from their continuous counterparts, and why would the sign change the stability of the system. Any explanation?


texts: What are some uses of the overall colour average of an image?

texts:
As I understand, the overall colour average can be obtained by summing the individual r, g, b values of all pixels within and image and dividing by the number of pixels to produce a new tri-vector.

What are the applications of such techniques?


texts: How to choose a microphone and make sure not to overcharge (clip) it?

texts:
I'm not sure that's the right forum to ask this question but I'll do it anyway.

In my project, I've to listen to different machines using a MEMS mic by fixing the microphone directly on to the machine. The problem that I get, is  that all of the records that I need, are overcharged (clipped) so useless. My question is how should I choose the microphone for really loud measurements?

Thanks in advance for any hint.


texts: what is the possible solution for the Intra-class variations poblems?

texts:
my poblem is that i have a database for human dorsal hand veins ,but with intra-class variations , so this problem have a large effect on my results when i need to do matching between my samples for recognition purpose(testing phase after finishing trainning phase ) .

therefore , i need to know what are the possible solutions that may be suitable here.
are there any function in matlab can overcome this problem?

examples of my images(5 images for the same person):

class 1:

class 2:

class 3:

and the code that i wrote to obtain the above images was as below:

    in_dir = 'E:\master_matlab\HandVein_DataSet';
    out_dir = 'E:\master_matlab\final resultant images';
    for px = 1 : 50,
        for hx = 1 : 5,
            fname = sprintf('%04dhv%d.bmp', px, hx);
            current_image = imread(fullfile(in_dir, fname));

            % do processing

    level=graythresh(current_image);
    x=im2bw(current_image,level);
    % figure,imshow(x);
    nnew=current_image.*cast(x,class(current_image));
    medimage=medfilt2(nnew,[5 5]);%median Filtering image
    % figure,imshow(medimage);
    z=adapthisteq(medimage);
    % figure,imshow(z);
    H = fspecial('unsharp');
    y=imfilter(z,H);
    % figure,imshow(y);
    mIm=imfilter(y,fspecial('average',15),'symmetric');%%%%%%here mask is 15*15 and method is symmetric(not replicate)
    sIm=y-mIm;
    bw=im2bw(sIm,0);                          % Convert to binary image
    ALT_img=imcomplement(bw);                 % Complement binary image
    % figure,imshow(ALT_img);
%%%%%% morphological on binary images.

open_img =bwmorph(ALT_img,'open'  ,Inf);
% figure,imshow(open_img);title('open_img');
major_img =bwmorph(open_img,'majority' ,Inf);
ske_img = bwmorph(major_img,'skel',100);

%removal outer boundary
without_border=ske_img.*x;
% figure,imshow(without_border);

   %%%%spurs removal can be added  or removed
spur_img=bwmorph(without_border,'spur',1);%8 spurs
% figure,imshow(spur_img);

% centering the resultant spur_image
measurements = regionprops(im2double(spur_img), 'Centroid');
    [rows columns] = size(spur_img);
    rowsToShift = round(rows/2- measurements.Centroid(2));
    columnsToShift = round(columns/2 - measurements.Centroid(1));
    shiftedImage = circshift(spur_img, [rowsToShift columnsToShift]);

    %%%%%cropping to remove the below white lines

rect=[26 ,37 ,255 ,138];
ssdc=imcrop(shiftedImage, rect);
q12=imresize((ssdc),1.25);
% figure,imshow(q12);
%
        % save output
        imwrite(q12, fullfile(out_dir, fname));
    end
end

regards for all


texts: Evaluate a complex exponential at negative infinity

texts:
I am learning about the properties of the Fourier Series (FS), which is defined by:
$$x(t) = \sum_{k=-\infty}^{\infty}c_{x}[k]e^{j2\pi kt/T}\tag{1}$$
where
$$c_{x}[k] = \frac{1}{T}\int_{T}x(t)e^{-j2\pi kt/T}\,dt.\tag{2}$$
One of the properties of FS is the time integration property, which is that:
$$\int_{-\infty}^{t}x(\tau)\,d\tau \overset{\mathscr{FS}}{\underset{T}\longleftrightarrow}\frac{c_{x}[k]}{j2\pi k/T},\quad k\neq 0 \ \text{ if }\ c_{x}[0] = 0 \tag{3}.
 $$
To prove this property, I integrated $(1)$ from $-\infty$ to $t$ in terms of $\tau$. However, when I am evaluating the indefinite integral, I need to find the value of $e^{\frac{j2\pi k(-\infty)}{T}}$.
I almost jumped to the conclusion that an exponential raised to $-\infty$ must be $0$, which is what the proof requires in order for the property to hold true. However, $k$ can be negative, and, more importantly, a complex exponential is periodic, so I don't know how to evaluate it at $-\infty$.
I would like some insight into why we can treat this evaluation as zero.


texts: Showing a system is always controllable?

texts:
I need to show that the following system is always controllable:

\begin{align}A &= \begin{bmatrix}
-\alpha_1I_{k\times k}& -\alpha_2I_{k\times k}& \cdots &-\alpha_{n-1}I_{k\times k}&-\alpha_nI_{k\times k}\\
I_{k\times k}&0_{k\times k}&\cdots&0_{k\times k}&0_{k\times k}\\
0_{k\times k}&I_{k\times k}&\cdots&0_{k\times k}&0_{k\times k}\\
\vdots & \vdots & \ddots&
\vdots&\vdots\\
0_{k\times k}&0_{k\times k}&\cdots&I_{k\times k}&0_{k\times k}\end{bmatrix}_{nk\times nk}\\
B&=\begin{bmatrix}
I_{k\times k}\\
0_{k\times k}\\
\vdots\\
0_{k\times k}\end{bmatrix}_{nk\times n} \quad C=\begin{bmatrix}N_1&N_2&\cdots&N_n\end{bmatrix}_{m\times nk}.
\end{align}

Now, I think this is actually the controllable canonical form, but I'm really confused about how to show this is always controllable. Can anyone help? Sorry if this is a dumb question.


texts: Periodogram frequencies not matching with signals

texts:
I am new to signal processing world.  I am working on a project where we have to find change points using spectral densities.  I am running some simulations where in I created a wave which is a linear combination of a few sinusoidals of frequency ranges (3.5-7.5, 7.5-9, 9-12, 12-14).  I find the periodogram of these sinusoidals using the usual formula which goes from 0 to pi.

My understanding is, I will be able to observe peaks in the periodograms which corresponds to the frequencies of the signal.  But since the x axis in a periodogram ranges only from -pi to pi, how can I compare my input frequencies and the frequencies I got in periodogram?


texts:
I read the DAFX book by Udo Zölzer about the distortion effect at pages 124-125
and it says that suitable simulation of the distortion is given by the function:

$$f(x)=\frac{x}{|x|}\left(1-e^{x^2/|x|}\right)$$

Can someone explain this formula and what kind of signal we get?

From what I understand 'x' is the sampled signal, so this is a sequence of numbers. What does |x| mean? Does it refer to the absolute value of x for each sampled value?

So if I want to implement this simulation of the distortion effect,

I need to know the length of x (It's given by the number of samples)
In a loop, I need to calculate this formula for each sample value
after the loop ends, I get the distorted signal (in a digital form)

After that, I need to convert it to an analog signal so I can hear it.


texts: Measure the length of curves via a smartphone's accelerometer

texts:
Is it possible to measure the length of curves by moving a smartphone along them and processing the accelerometer's data?

For example, measure the circumference of a circle of radius $8 \,\rm{cm}$. I've read that accelerometers have noise but I've also read that their accelerometers are very accurate. What does it mean? Can we filter out that noise? What are the types of noise in this problem?


texts: Complex Cepstral Transform and Audio Watermarking

texts:
I am doing research in audio watermarking and have come across the paper that uses the complex transform to embed the watermark in order to improve the robustness and inaudibility of the embedded watermarks.

This is done by embedding the watermark into the complex cepstral components of the audio coefficients transformed by the complex cepstrum. The Complex Cepstral transform is defined by:c(n) = ifft{ln[fft[z(n)]]} and the inverse is defined by: z(n) = ifft{exp [fft[c(n)]]}.This is the formula I am using in MATLAB, where z(n) is my nx1 audio signal array.

My question is do you normally embed the watermark into only the complex part of the values or into the entire values? I am trying to embed in MATLAB using the formula c'(n) = c(n)(1+αW), where α is embedding strength (I am using α=.02), and W is the watermark data. However after embedding and reversing the Cepstral Transform, I am ending up with really large and strange data so I must be doing something wrong. Any help would be greatly appreciated!

I might not have done the best job at explaining my problem so please ask any questions and I can edit this post to make it clearer. Thank you!


texts: Evaluate phase of $X(\omega)$ without computing $X(\omega)$

texts:
$$x(n) = \{ -1, 0, 1, 2, 1, 0, 1, 2, 1, 0, -1 \}$$
Let $X(\omega)$ be the DTFT of $x(n)$. I need to find the phase of $X (\omega)$ without computing $X(\omega)$. I notice that $x(n)$ can be a type I linear phase filter, but not sure if that is used in solving the problem.


texts: Trying to translate formula for blending mode

texts:
I am using OpenCV C++ for making the blending mode like in photoshop, I want to make overlay mode in it. I search its alternate in OpenCV in which I found this blending way, but its not the overlay as I want to use the overlay method in it.

Overlay method formula from this documentation

(Target > 0.5) * (1 - (1-2*(Target-0.5)) * (1-Blend)) +
(Target <= 0.5) * ((2*Target) * Blend)

Can anyone please explain this formula for implementation in OpenCV C++ , how I can easily understand it for implementation or is there any already build in function for it or any other easy way out.


texts: How to identify impulse response of noisy system?

texts:
My lecture slides mention that two-level ("2-tasoiset" in Finnish) signals are good in identification with linear systems. I am trying to understand this in noisy system. I cannot find any method really to identify the impulse response, perhaps good pre-processing and some other checks?

This is a sub-problem 2F here for the course Mat-2.4129 in Aalto University.


texts: Stability of filters with negative phase delay, group delay, and positive phase

texts:
Lets assume I have an IIR filter with :
bz = [1.0195 0 0];
az = [1 0.0166 0.0020];
fvtool(bz,az)

The filter is stable as i can see.

If you check the phase delay its negative, so is the group delay.
Phase response is positive.
What do you make of this. ?  Is my filter suitable still for RTL implementation.
I have read a lot about negative group delays being fine, still causal system. But what about negative phase delays ? Is it all fine?
What about these: somewhat same results, but still stable and HW implementable ?
bz=[0.9941 0 0];
az=[1 -0.0889 0.0830];
fvtool(bz,az)

Thanks


texts: Matlab FFT keeps plotting mirrored values

texts:
My Matlab FFT plot keeps showing the mirrored values of my frequency of interest. In this example I am looking for 250Hz with a 3200Hz sampling freq.  The FFT plots my value at 266Hz as well as 1330 Hz.  I assume my sampling freq is a little off which is why it isn't exactly at 250Hz.  Matlab code is below, any help is appreciated.

% Tmax = (N-1)*Ts
% largest freq = Fs/2
% smalles = -fs/2

fid = fopen('250Hz.bin');
AA = fread(fid, 'short');
length(AA);
flenbytes = ftell(fid);
flenshorts = floor(flenbytes/2);
FF = floor(flenshorts/16)*16;
fseek(fid,0, 'bof');
BB = fread(fid, [8 (FF/8)], 'short');
CC = BB';
DataSet = CC ./2^3;
Z1Axis = DataSet(:,4);

N = length(DataSet)
Fs = 3200;
ts = 1/Fs;
tmax = (N-1)*ts;
t = 0:ts:tmax;  %start at 0 increment by ts up to tmax
plot(t,Z1Axis)

f = (0:N-1)*(Fs/N)/2; % start with -Fs/2, increment by Fs/(N-1), goes to Fs/2
z = fft(Z1Axis);
%zreal =
%plot(f,z)
plot(f,abs(z));


texts: Very basic questions about linear systems

texts:
Note: This question may seem extremely elementary, but I am not a beginner to signal processing, linear system theory, control theory, etc.
I believe my confusion is over a subtle point, so, before responding, please read the entire question so you understand the source of my confusion first.

Consider this simple autonomous system (autonomous means it has no direct dependence on $t$):

$$\dot{x}(t) = A x(t)$$

Assume the output is the state ($y(t) = x(t)$) and $A \neq 0$. My questions are:

Is this system necessarily linear?
Is this system necessarily time-invariant?
What is the zero-input response of this system?
Would the answers above change if we assumed the system was causal?

Easy, right?

Obviously yes, since it is in the form $\dot{x}(t) = Ax(t)$
Obviously yes, since $A$ does not depend on $t$
The zero-input response is: $x(t) = x(0)\,e^{At}$
No, these are unrelated properties.

But wait!

Linearity means a linear combination of the inputs must give the same linear combination of the outputs. If I scale the input, $u$, then $x$ is not affected at all. So how can it be linear?!
Time-invariance means that if I delay the input, the output is delayed by the same amount of time. But if I delay the input, $u$, then $x$ is not affected at all. So how can it be time-invariant?!
If the initial state is an "input": Doesn't linearity imply $x(0) = 0 \implies x(t) = 0$?
If the initial state isn't  an "input": Isn't the system nonlinear unless $x(0) = 0$? (see #1)
Wouldn't zero-input give zero-output for a causal LTI system (the "ZIZO" property)?

Hopefully it's clear why I'm confused.
Where am I going wrong?


texts: How to remove or filter the drift problem in measured Strain signal?

texts:
I have the strain signal of a lateral beam of a car measured at sampling rate 1,200Hz from data acquiring system. Even after using temperature compensation in strain gage, we are getting drift. So I wanted to remove drift in post processing of the strain signal. I have tried using High pass filter (HPF) of order 10th with cutoff freq = 200Hz, but I am losing peaks of the strain signal. So HPF is not useful.

Which filter is suitable to remove drift for strain signals? considering the fact that I want to retain peaks  and what other methods I can use to remove the drifts?

Also, what are the exact factors to consider in choosing the cutoff frequency for HPF? and how to check it is correct?

I have attached the strain signal and HPF filtered signal of 10th order.


texts:
I'm trying to implement a low pass filter in python for a complex signal but the output doesn't look right. I've created a simple example below where I've mixed a 15Hz complex sine wave and a 30Hz complex sine wave so that I get a signal with components (30+15=45Hz and 30-15=15Hz).
What I'm trying to do is filter this signal with a low pass filter to just give the resultant 15Hz component. When I look at the plot of the filtered signal though the imaginary component seems to be almost identical (same phase) as the real signal. It doesn't look right.
Example of code to reproduce then plot below:
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter
import scipy.signal as sig

#Sample rate.
rate = 5000

# Create a 15 Hz comlex signal.
t = np.arange(0,5000)/rate
f1 = 15
msg =  np.exp(1j* (2*np.pi * f1 * t))

# Create a 30 Hz complex signal.
f2 = 30
bb_lo = np.exp(1j * (2*np.pi * f2 * t))

# Create a low pass filter to remove the upper frequency.
nyq = 0.5 * rate
cut = 30
low = cut / nyq
b, a = sig.butter(5, low, btype='low')

# Mix the low frequency and high frequency signal together.
# Will result in a signal with freq components of f1+f2 and f2 - f1.
# Then apply the filter to real and imaginary parts.
signalFilt = lfilter(b,a , bb_lo.real*msg.real) + 1j*lfilter(b,a , bb_lo.imag*msg.imag)

plt.plot(signalFilt.real)
plt.plot(signalFilt.imag)
plt.grid()
plt.show()

Frequency filter looks right at approx 15Hz but real/imaginary in plot I don't think should be the same. What am I doing wrong here?
Thanks


texts: What is the impulse response for 2D functions

texts:
I study image processing and I am new to it. so my question is for example what is the impulse response for:

$$ y(m,n) = 3\times x(m,n)+9 $$
$$ y(m,n) = m^2n^2 \times x(m,n) $$
where the $y(m,n)$ is output and $x(m,n)$ is input.
thanks.


texts: Is there a general relation between mean power and period

texts: I posted this question at Math Stack Exchange a few weeks ago without any luck.  It occurred to me I might have more luck by posting it here.  The basic question is whether there exists a known relationship between the period of a signal (i.e. the inverse of the frequency) and its corresponding power, such as that depicted in the graph in the linked post.


texts: Thresholding for Movement Classification

texts:
I have an application which creates a Gaussian model of the background based on consecutive frame difference and auto-generates a threshold for separating no-changes to movements. The application works perfectly for artificial lighting. But when daylight is present alongside artificial light, I get something like ths

The red dots corresponds to some scalar quantity under steady lighting conditions, and the green ones correspond to the sudden changes in illumination levels. As a result of the green spikes, selecting a threshold at the red-level would mean a lot of false positives where as selecting a threshold at the green level essentially means that detection probability falls because the small movements are not detected. What I tried was selecting separate thresholds for the green region and the red region but still the detector performance barely improved. Is there any known approach for tackling this problem.

False corresponds to the False Alarms. My model was if $RedMean-maxR\times RedVariance < val < RedMean + maxR\times RedVariance$
then no movement where $maxR =  max(\frac{RedElement_{i} -RedMean}{RedVariance})$ and likewise for the green region and anything lying between the red and green would be classified as small movement.


texts:
Suppose there is a process $x(t)$ with power spectrum $$S_x(\omega)=\lim_{T\to\infty}\frac{1}{T}\left|\int_{-T/2}^{T/2}\mathrm{d}t\,e^{j\omega t}x(t)\right|^2,$$ ignoring the expectation value for simplicity.
$x(t)$ is then modified by $$y(t)=\int_{-\infty}^{\infty}\frac{\mathrm{d\omega}}{2\pi}\,e^{-j\omega t}f(\omega)\int_{-\infty}^{\infty}\mathrm{d}t\,e^{j\omega t}x(t)$$ where $f(\omega)$ is an arbitrary function.
I am wondering how to find the power spectrum $S_{y}(\omega)$ of $y(t)$. Intuitively it should be $S_{y}(\omega)=\left|f(\omega)\right|^2S_x(\omega)$ but I just can't seem to prove it using the definition of power spectrum I have given; I'm not sure how to include the $T$ from the time average.


texts: What are the parameters of a calibrated spherical camera?

texts:
I'm aware if we have a pinhole camera model several parameters describe the specific camera (such as aspect-ratio, focal length, principal point, distortion parameters etc).

There're standard procedures to estimate such parameters that one can follow.

I was wondering however if I replaced the pinhole camera with a spherical camera (such as 360 camera for example) what parameters describe such camera?

I would suppose radius is an example of parameter, are there any other relevant parameters in such case?

Is there any reference you can point out?


texts: Role of the rank of the filter mask matrix in image processing?

texts:
I'm reading a material where it says that a filter mask or kernel can be separable if the matrix of the filter mask has a rank 1. The two slides which describes this are as below:

Reading these slides it seems to me that it's trying to mean that the averaging filter can be separable, while Laplacian of Gaussian(LoG) is not. But it doesn't make sense to me, because LoG is the combination of two filters, laplacian and gaussian while in the contrary the averaging filter is just one filter, how can an averaging filter be separable?

I'm really confused on this matter. It would be helpful if you can make any sense out of this and explain me. Thanks.


texts: Compressive Sensing Incoherence Principle

texts:
As people acquainted with Compressive Sensing would know, incoherence and sparsity are two main principles. I've been reading about compressive sampling and developed an interest into the topic. What I'm about to ask might be quite basic so sorry for that in advance.

As incoherence principle states, sensing basis and sparsifying basis must be incoherent. I can understand why it is so and I also understand why a random i.i.d. matrix would in fact give us a good incoherence. My question is, how would one determine it programmatically?

Let's say my sparse basis is the frequency domain. When one says sensing basis, is it actually the sensing matrix? Assuming that the signal is x, and sensing matrix is A, would I just calculate the coherence between fft of x and my sensing matrix? If yes, how would one do that, say, in MATLAB?

Thanks a lot.


texts: What real object could be modeled by this transfer function?

texts:
What object from real world could be modeled by this transfer function?
What could parameters b, p1 and p2 stand for?


texts: FIR Filter Design - obtaining FIR coefficients from frequency response

texts: I would like to obtain FIR filter (low-pass) coefficients from a given frequency response by using C++ to develop algorithms. I have read at http://iowahills.com/B2PolynomialFIRFilters.html, that, if done properly, almost any filter response can be implemented as an FIR. In principle, one simply does an Inverse Fourier Transform on the filter's frequency response. Is there a C or C++ code that will do this? Any links or detailed guidelines how to solve this would be appreciated! I want to thank member hotpow2 for suggesting gradient descent routine, but I need more details on that as well.


texts: Easy way to get rid of noise in a hand drawing

texts:
I would like to take a user's hand drawn input, and filter out "noise", aka small sketches or blobs, where the user might have screwed up and accidentally touched his hand to the drawing device, or something similar.

I'm using Imagick, a PHP wrapper that wraps an image processing library that does everything short of actual, high-level blob detection.  So I'm free to use convolution, erosion, dilation, and a slew of other image processing tools.  I can't write blob detection in the high level PHP code because it's too slow.  And before I go down a path of writing the C code using ImageMagick's API, and wrapping it in PHP, I was wondering if there's some sort of "trick" that I can do to accomplish my objective.

For instance, my initial thought would be to do an erosion on the image (in normal situations, when I think of removing noise from an image, I think to erode then dilate).  But since ALL the lines in the image are just a few pixels wide, everything would disappear.  Then I was considering some sort of blur so the longer lines would end up with higher intensities, then I could just threshold out the lower ones.  But again, in the context of lines, I'm not sure how well that works.

I'll attach an image of increasing "blobs".  I would consider the first 4 left ones as blobs that I want to remove, but then keep the 5th, the line, and the box.


texts: What is the duration of the spreading sequence

texts:
I have a question regarding the spreading sequence duration using Walsh matrix. I've read a paper related to that, they consider the signal $S = R(S) + I(S)$, where $R(S), I(S)$ are the real and imaginary parts of the signal $S$ resulted from the modulation $QAM$.

what is done, briefly, a Walsh-Hadmard matrix is built with dimension $4$x$4$, then the real are imaginary parts are multiplied by the spreading code taken from the Walsh matrix and then transmitted into receiver. So the resulted signal before transmitting is $S = W_1R(S) + W_2I(S)$ where $W_1, W_2$ are two different spreading code taken from the Walsh matrix.

So, without talking about why that process was done, My question is related into the signal after spreading itself:

Will the duration of transmitted signal "after spreading" is similar to duration of signal $S$ before spreading?I think yes, because the duration of chip of spreading sequence is shorter by $n$ times of duration of signal $S$, it's similar to this question here.. If that right, what's the downside of using spreading sequence? I mean when using it, what's the disadvantages we face compared with any other technique. Finally, does using spreading sequence as above process mean that we are using CDMA? ..

thank you


texts: Is there a way to find a picture inside another picture, using only 2D Fourier Transforms of both images?

texts: Can Fourier Transforms of both images tell anything about "likeliness" of two pictures? If yes, how precise? Can it still work if only several pixels are different or can it tell they are same if one of images is rotated, scaled or distorted(up to some degree)?


texts: Interpreting Nyquist Plot for Phase and Gain Margins

texts:
I have an open-loop system transfer function given by $G(s) = \frac{K(ABs^2+As+1)(Cs+1)}{s^2A(s(C+D)+1)}$ so I'd expect two poles at the origin and one at $s=\frac{-1}{C+D}$. After using Matlab to obtain the Nyquist plot (seen below), I'm having some trouble interpreting it. Matlab states that the phase margin is 16.2 degrees. What does this mean exactly? How does changing this phase cause encircling of the -1 point? Also, I've seen examples of how to interpret gain margin from nyquist plots, but I'm not quite sure how to determine this with a root at the origin.
Any clarification would be greatly appreciated.


texts: What is the difference between a one dimensional and a two dimensional signal?

texts:
If a signal depends on only one variable then we call it one dimensional, and if a signal depends on two variable we call it a two dimensional signal.

But when we represent an one dimensional signal, we use two axes(amplitude vs. time).
In case of a two dimensional signal, we use two axes (for example, the x axis and the y axis in an image).

How can I understand the difference between a one and two dimensional signal?


texts: Help with algorithm for modulating oscillator pitch using LFO

texts:
I am developing a software emulation of an analog synthesizer.  I am trying to modulate the pitch of an oscillator using an LFO.  For each sample fed to the computer's sound system, I am calculating the frequency to be input into the main oscillator like this (pseudocode):

osc_frequency = note_frequency * (1 + tuning) * (1 + lfo_y * lfo_mod_depth)

The variables in this statement are described as follows:

note_frequency = frequency of note to be played in Hz
tuning = oscillator fine-tuning in percent of played pitch (ex: -0.02 = detune by 2%)
lfo_y = current y value of lfo waveform (ranges from -1 to 1)
lfo_mod_depth = depth/intensity of effect to apply to oscillator in percent

However, this computation does not yield the desired result.  I expect to hear the pitch modulate up and down, locked around the center frequency (note being played).  What I am getting is a modulation effect that causes the pitch to "run away";  I can't tell exactly what is happening, but it sounds like one of these:

The modulation intensity increases over time (the high/low frequency mark reached by the modulation grows higher/lower the longer the note is held)
While the modulation intensity remains constant over time, the center frequency increases while the modulation oscillates around it

Am I using the correct approach or not?  If not, what should the correct approach be?  Any help with this is much appreciated.


texts: How to Check Separability of 2D Filter / Signal / Matrix


texts:
I'm looking at decoding an OFDM signal which consists of 6 carriers (or tones) which are BPSK modulated and a pilot tone which aids tuning. This is the first time I have worked with OFDM so I need to know if I'm approaching this in the right way.

The way I'm thinking of decoding it is to use the pilot tone to calibrate (as the receiver may be slightly mistuned) then to have six band pass filters to separate out each carrier which is then demodulated in the usual way. Can anyone see any problems with this ? or can you suggest a better way of doing this.


texts: Difference between $\tt fft$ and $\tt dftmtx$ in MATLAB

texts:
I have the following MATLAB code:
audioFile= audioread('myFile');
%% Reshape according to the given distortion period
distortionPeriod = 512;
audioFile= length(audioFile) / distortionPeriod;
audioFile= reshape(audioFile, [newLength, distortionPeriod]);

I noticed the following difference:
 audioFileFft = fft(audioFile); % incorrect transform
 audioFileDftMat = audioFile * dftmtx(distortionPeriod); % correct transform

>> norm(audioFileFft - audioFileDftMat )

ans =

   1.2985e+03

Why this difference exist? I would expect that those two operation(fft, dftmtx) would give the same result, as mentioned by MATLAB dftmtx's documentation.
How can I use the fft and still get the same results I got using the dftmtx?


texts: Why do we put poles close to the zeros in notch filter?

texts:
In the book I'm studying from "Applied digital signal processing - Manolakis" it says:

  The problem with FIR notch filters is that the bandwidth of the
  notches is large. A simple way to create sharper notches is to place
  the zeros on the unit circle and two complex conjugate poles at the
  same angle with the zeros, close to the zeros but inside the unit
  circle.

But why is that? How it changes the thing? I tested it in matlab and in fact I get a way better filter but I don't understand the reason.


texts:
WHAT IS signal means, how is it propagate in space or any other medium?.

what power means signal amplitude increases and decreases to draw the sine wave form through a bit of time. at stable value (forming logical message) affected by medium resistance and transmitting signal power, human code model frequently repeated (hi) started with character ends with another completed word (world) another word stared with a header and ends with trailer a completed word in between. the brain define (h) as code start and (i) as its end then put a definition for it as a welcome category word means how are you.

out of electricity network that it out of control compared with communication signals networks even both of them propagate as a flood of electrons in cables, need a Summarized Signal Theory Basics paper shows its shape in a medium, MW or Electromagnetic waves or in cables.

voice fades away at the moment you shot a word. you already carried it on a carrier to reach ear of who you talk to but at low power so that its power and frequency decreased and lose its shape at a point seems to be disappeared or absorbed to be converted to another shape of energy.
power - amplitude - frequency - energy (essences needed to be learned)

we carries it on a carrier varies depending on the medium and convert carrier to cover all values voice reach as possible, more values means more quality. filtering the result to get carrier and voice met points.

just comments needed, books and papers.


texts: What is the advantage of this system (DA port in the DAS is usually equipped with its own power ampliﬁer at the analog front-end)

texts:
I saw a paper,https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8283591 ,and it said

  Each DA (distributed antenna) port in the DAS (distributed antenna system) is usually equipped with its own power ampliﬁer at the analog front-end. Thus, individual power constraint at each antenna should be considered for the DAS unlike the conventional systems which normally impose sum power constraint

because the author said that the fig(a) unlike the conventional systems which normally impose sum power constraint,so i think there are some advantages,which are better than conventional systems ,in the fig(a) system,Does anyone know what are the advantage about the fig(a) system?

fig(a)


texts: can measurements go out of the uncertainty bounds?

texts:
In the below picture, the measurements are inside the $\pm 3 \sigma$ bounds. In my experiment, the measurements sometimes go out of the uncertainty bounds.

This is a snapshot of my plot where the red is $\pm 3 \sigma$ bounds (i.e. $true \pm 3\sigma$ ), the black is the measurements, the blue is the true value and the green is the EKF. Is there something wrong with my results?


texts: Will binarization / thresholding of image yield better results when performed in a linear color space?

texts:
All thresholding algorithms I have read about make no mention about color space, except sometimes using pixel values between 0 and 255 as an example.

But since the intensity output by a monitor of a greyscale is $greyscale^{gamma}$, the perceived difference between 1 and 2 is less than the difference between 254 and 255. Provided this fact, should it not improve accuracy to perform binarization on intensities rather than greyscale values?


texts: How to obtain impulse response from a plot of magnitude of frequency response?

texts: I have a plot of a magnitude response of a frequency response, how can I get the impulse response using only this plot and nothing else?


texts: Analytical expression for the eigenvectors of a 3x3 real, symmetric matrix?

texts:
I am writing an algorithm that process 3D images based on the local moment of inertia.

I have a 3x3 real symmetric matrix, from which I need to find the eigenvalues. I have found a variety of generic algorithm for the diagonalization of matrices out there, but I could not get to know if there exists an analytical expression for the 3 eigenvctors of such a matrix.

Would someone proficient in maths know that?

EDIT

For the record here is what I have found on the question myself.
As Matthias Odisio said, you can't get down to a simple analytical expression as soon as you have a 3x3 matrix.

I have found however a dedicated paper for the special case a 3x3 hermitian matrices, where various numerical specialized approaches are compared:

http://arxiv.org/abs/physics/0610206

Here is the C and Fortran code of the paper:

http://www.mpi-hd.mpg.de/personalhomes/globes/3x3/index.html


texts: How to find the Pitch of a utterance using narrowband spectrogram

texts:
Can anyone tell me how to find the pitch of an utterance from it's narrow band spectrogram? I am pretty new to the speech processing domain so any help is appreciated.
P.S. I need methods to estimate the pitch from the narrow band spectrogram only. Any help regarding this is highly appreciated.


texts: Fastest way to subtract known music tracks from live videogame audio stream

texts:
I want to isolate video game "action" sounds from the video game soundtrack. Given all ~20 songs, I'd like to filter them out from any live audio stream during gameplay.

What is a fast and robust way to do this?

More info: I am using this to preprocess the audio input for a neural network which is making decisions in real-time, so it needs to be fast (on the order of 100ms or less). It also needs to be robust, since the soundtrack can be interrupted in-game events or pausing the game.

I am thinking of binning the audio with small bins, taking a FFT, identifying which song is playing by feeding the spectogram to a convolutional neural network, and subtracting the song. I fear this approach would be too slow, though.


texts:
I would like to understand what I am doing wrong here.
I am trying to perform polynomial regression by minimizing the least squares, ||Au-y||^2, where y is the given data and A is the matrix where the i-th line holds [1, x_i, (x_i)^2, ... (x_i)^n-1].

If n is larger than the number of data points, the problem is underdetermined, and I expect the numpy.linalg.lstsq() routine to give any of the infinitely possible solutions. But, as you can see, I don't get a solution at all.

import matplotlib.pyplot as plt
import numpy as np

x = np.array([-6 ,1, 2, 3, 4])     # x data
y = np.array([2, -3, 4, 20, -10])  # y data

A = []
n = 50      # polynomial degree
for i in range(0,n):   # create A matrix of proper form: i-th line is [1, x_i, x_i**2, ...]
    A.append(x**i)
A=np.array(A)
A=A.T

u=np.linalg.lstsq(A,y, rcond=None)[0]  # solve underdetermined problem

x_test=np.linspace(-6, 5, 100)   # create more x values for plotting
B=[]
for i in range(0,n):   # same as before, their power matrix
    B.append(x_test**i)
B=np.array(B)
B=B.T

plt.plot(x_test, B@u)   # plot polynom
plt.scatter(x,y)   # plot data
plt.show()

print(A@u-y)    # this should be zero vector??
```


texts:
if I have an analog modulated signal with a DSBSC modulation (modulation index 100%) as an input in my receiver and I want to convert it to a sampled signal, do I need to demodulate the signal (with coherent detector) and then sample it ? Or the other way around?
I know that from the front end of the receiver you have an LNA, BPF, LO for getting the signal to the baseband, LPF and then is it sampling or demodulation?


texts: What's the reasoning behind changing pilot tones in OFDM?

texts:
Many OFDM wireless protocols (e.g. 802.11, DVB-T2, LTE, etc.) utilize pilot tones to provide channel state information for the receiver. Within the transmission, the pilot tones generally assume a BPSK or QPSK modulation depending on the protocol.

Why do specifications have the pilot tones' phase follow a known psuedorandom sequence across frequency and time as opposed to utilizing the same phase or a straightforward rotation for simplicity?


texts: Apply the Hamming window to a sinusoidal signal

texts:
I am a novice in signal processing. I am writing a code to apply the hamming window to a sinusoidal signal. So first I have digitized my sinusoidal signal by choosing a sampling rate more than twice its frequency.

These are the values for the signal: F=500 Hz, T=2 ms, and sampling rate=2000 Hz.

Now, I guess I have to multiply the function of the window to the signal so:

for (i=0; i<windowSize; i++)
     data(i)=signal(i)*window(i)
     i=i+0.5;  //sampling time

My question is when we multiply the window to the signal, does the window function has to be digitized by the sampling rate of the signal or it can be digitized anyway we want? In the code I have digitized the window function according to the sampling rate. Thank you.


texts: The input is three sine waves with different amplitudes and frequencies. After FFT the spectrum shows the correct characteristic of each wave without leakage error. Why does the other spectrum leakage when the input is multiplied by a Hamming window function? Thanks]1


texts: Simple fft to Gaussian pulse with MATLAB

texts:
trying simply to create femtosecond pulse in MATLAB exactly like in the attached image,

the carrier frequency is around 374THz, and my sampling frequency is 10 times the carrier.
The results of the fft yields nothing understandable... tried to change some of the variables, fs,t-around zero, fftshift...
but could not conclude what's wrong with code.

my code follows matlab fft example :

clear all ; close all ; clc
f=374.7e12;%Thz
fs=f*10; %sampling frequency
T=1/fs;
L=1000;
sigma=5e-15;
t=(0:L-1)*T; %time base

x=(exp(-(t-50e-15).^2/(2*sigma)^2)).*exp(-1i*2*pi*f*t);
subplot(2,1,1)
plot(t,real(x),'b');
title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);
xlabel('Time(s)');
ylabel('Amplitude');
ylim([-1 1])
xlim([10e-15 90e-15])

NFFT = 2^nextpow2(L);
X = fft(x,NFFT)/L;
Pxx=X.*conj(X)/(NFFT*NFFT); %computing power with proper scaling
f = fs/2*linspace(0,1,NFFT/2+1); %Frequency Vector

subplot(2,1,2)
plot(f,2*abs(X(1:NFFT/2+1)))
title('Magnitude of FFT');
xlabel('Frequency (Hz)')
ylabel('Magnitude |X(f)|');

the results are :