texts: Implementing a finite impulse respone (FIR) filter for computing the derivative of a discrete signal

texts:
I am trying to reimplement an algorithm on my own. In the description of the implementation, it's written that they compute the derivate of a series of value using a [-1/2, +1/2] finite impulse response filter for obtaining an array of the original length.
Basically, a FIR filter should be a convolution but I don't understand this description applied to this case.
I've tried to develop a simple algorithm using an interpolation:
import numpy as np
from scipy.interpolate import interp1d
x = np.arange(len(signal))
signal  = [2,2,2,3,4,5,5,5,3,4,2,2,2]
# classical differentiation
diff = np.diff(signal)

f = interp1d(x, signal,fill_value='extrapolate')
newx = np.arange(-0.5, len(signal)+0.5)
ynew = f(newx)
intdiff = np.diff(ynew)

And to compare it with the classical differentiation:
import matplotlib.pyplot as plt
plt.plot(x,signal,marker='x',color='g',label='original signal')
plt.plot(x[:-1]+0.5,diff,marker='x',color='r',label='differenciated')
plt.plot(x,intdiff,marker='x',label='interpolation differenciated')
plt.legend()

I am wondering how to implement a derivate of a series of value using a [-1/2, +1/2] FIR filter? And what are the advantages compared to a derivative compute using I[n+1] - I[n].


texts: Magnitude Spectrum of a Linear Chirp Signal

texts:
I am trying to understand intuitively the fft of a signal that changes in frequency in time.
Suppose I have the fft of a linear chirp signal sampled at 1 kHz for 2 seconds. The instantaneous frequency is 100 Hz at t = 0 and crosses 200 Hz at t = 1 second.
Using matlab, I have the following magnitude spectrum plot:
t1 = 0;
t2 = 1;
Fs = 1; %1khZ
f0 = 100;
f1 = 200;
T = 2;

figure;
subplot(2,2,[1,2]);
t = 0:0.001:T;
y = chirp(t,f0,t2,f1); %generate chirp signal
Y=fft(y); %apply DFT on the signal
F=linspace(0,1e3,length(y)); %create x-axis for plotting the spectrum
plot(F,abs(Y)./length(y)*2); %plot the magnitude spectrum

I then truncate the signal by getting only the first 100 samples. Now I have:

I have some questions.

Are the plots correct?
Is it correct to say that by truncating, the ripples produced during transform are minimized hence the peak at 100Hz can be easily distinguished?


texts:
I want to split signal in multiple bands and process each band. Number of bands is not yet determined, but it would be more then 6 and less then 11 (depending on the collected results)

As demonstrative example, let's consider common linear PCM sound data file input.wav and I want to calculate RMS per each band. Using a tool such as SoX I can extract only one band at a time (1000-2000 Hz in this example):

sox input.wav output.wav gain -n sinc 1000-2000

and pipe output to processor and extract wanted feature.

What I would appreciate is solution to process all previously determined bands in one pass.

It doesn't need to be a ready made program like SoX, but preferably Matlab/Octave script or Python/SciPy/NumPy and similar approach.


texts:
How are Radix-8 and Radix-2^3 FFT are related?

Are they same?

I got some more details in IEEE paper by
S.He and M. Torkelson, "Designing pipeline FFT processor for OFDM (de)modulation," in Proc. Int. Symp. Signals, Syst., 1998, pp. 257-262.

FFT Radix 2^3 has complexity of radix 8 but has a structure as that of radix-2.


texts: Where can I get a database of speech signals?

texts: For a classification sort of experiment using Matlab, I am in need of a database of male and female voices. So where can I get links of such open databases.


texts: Time scaled version of discrete time signals

texts:
I have a confusion regarding time scaling of discrete time signals.
Let u[n] be the discrete time unit step signal(or sequence)
Now if i plot u[n/3] i know there will be two zeros added between each previous samples(samples before scaling).
But when i tried plotting the same on MATLAB i got the same plots for u[n] and u[n/3] and even for u[4n].
How could this be?
I am attaching the MATLAB code :
close all;
clear vars;
t=-4:1:20;
stepd=t>=0;
subplot(2,2,1)
stem(t,stepd,'b');
xlabel('n');
ylabel('u[n]');
title('discrete unit step');
stepd1=1/3.*t>=0;
subplot(2,2,2)
stem(t,stepd1,'g');
xlabel('n');
ylabel('u[n/3]');
title('time scaled discrete unit step');
stepd2=4.*t>=0;
subplot(2,2,3)
stem(t,stepd2,'r');
xlabel('n');
ylabel('u[4n]');

I know this is a very silly doubt but please help me come out of this confusion.
I have also attached the plots which i am getting on MATLAB


texts: Very first values of y[n] in an IIR filter

texts:
I use a simple biquad IIR filter  :

if (n >= 2)
   y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2]
                    - (a1/a0)*y[n-1] - (a2/a0)*y[n-2]
else
   y[n] = x[n]     // here it probably needs to be modified

(thanks to http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt)

It works very well.

My problem is that the filtered signal sometimes explodes in the first milliseconds, and then returns to normal after a few milliseconds.

How should I initiallize the first values of y[n] ? I have done this

y[n] = x[n]

for n=0,1, but probably the problem comes from here ?

The problem (it explodes in the first milliseconds) is important when I do 2, 3, or more passes of the same filter in cascade.

Thanks in advance.


texts:
new here and probably pretty unexperienced compared to the rest of you. This should be simple enough but just wanted some clarification. I'm trying to model an analog square wave oscillator with C. With the oscillator I'm trying to mimic, the square wave isn't totally square and has curves with the starting edge of each pulse (on/off). It looks like in the analog device the capacitor is smoothing the square wave, so I believe I need to implement a low pass filter in my code to smooth out the square wave.

tldr - Just wanted to confirm that I should implement a low pass filter on the raw square wave to make it sound similar to the analog oscillator of the picture below. If there's another way I should be approaching this I'm open to listen to suggestions as I might be approaching this wrong.

Top is my square wave
Bottom is device's square wave


texts:
The original idea is to calculate distance from accelerometer input. However, accelerometer reading also contains the gravitational values, thus to remove gravity, I tried using Gyroscope. The idea was to calculate angle of rotation from gyroscope and then calculate gravity at this angle and subtract it from accelerometer. However, gyroscope values drift.

So I tried using Kalman Filter for this. However, Kalman Filter is working very slow. So now finally, I am thinking of converting the gyroscope values in frequency domain with the help of Fourier Transform, and then trying to calculate angle of rotation.

Has anyone tried such crazy idea before? Any leads? I managed to calculate Fourier Transform of Rotation Rate of Gyroscope, however, I am not sure how I should go ahead with these transformed values.

P.S. -  I am working on Windows 8 device, and coding in c#.


texts:
Most likely a very simple question, but I haven't been able to find a good answer.

When working with analytical signals in general, and software defined radio in particular, a common operation is to take the sum real(z) + imag(z). Is there a technical term for this sum?


texts: modelling radar system for image generation

texts:
I am trying to find or derive some model for radar using python and blender which should hopefully create a simulation of what a radar image of the blender environment would look like.

I have been reading a lot of papers but am still struggling. I understand the concept of

  transmitter sends out radio wave -> wave is reflected off of surface -> antenna receives returning signal -> received data processed to make 2d image

but I can't figure out how to implement it myself, or even if it is feasible given my inexperience with signal processing.

I see lots of descriptions for things like radar cross section, range, reflected power, but cant find much on formulae that might model the reflection, receiving, and  algorithms that might help turn the results from the previous step into 2d image information.


texts: What is the name of the filter or technique to reduce depth aliasing around object edges when working with camera depth?

texts:
I'm working with a point cloud, created by sampling a 2D camera texture and a depth map. The color is combined with the depth and is projected onto a 3D scene to create a "point cloud".
The resolution of the image is good, except around the object edges, where I'm running into aliasing / fraying / rounding errors like the image below.
I'm new to signal processing. Please help me understand:
What is the name of the 3D phenomenon I'm describing?
What kind of filter can be applied to enforce sharp depth changes (and reject this fraying) in the projected point cloud?
PS. It appears that if I turn off "smoothing" operation, the aliasing disappears. (But I still have the issue in another project where I can not turn if off)


texts: Does down-mixing a signal before taking the fourier transform aid in signal detection?

texts:
Let us assume that we have a narrowband signal $s[n]$, at frequency $f_1$, and let us further assume that this $f_1$ is just below $\frac{f_s}{2}$, where $f_s$ is the sampling rate.

Furthermore, let us also assume that we have a fixed number of time-domain samples of this signal, $N$, and that our FFT length is also $N$.

The objective is to detect this signal $s[n]$'s presence in the frequency domain. (Further assume that we know to expect this signal in or around that frequency $f_1$).

My question is simple: With all things being equal, which is better from a detection perspective:

Simply do the FFT of this signal and look at the peak at that frequency bin

Or

BPF a band of where we expect the signals' frequency $f_1$ to be, (eg, BPF this band $f_1 - \epsilon \text{ to} f_1 + \epsilon$). Then, mix this band down such that $f_1 + \epsilon$ is guaranteed to be just above DC, and LPF that entire band. Now, take the FFT, and detect energy.

Would the second method be better from a detection point of view because we have more samples per cycle, whereas the first one has just over 2 samples per cycle?

Thanks,

TLDR: Is it better from a detection standpoint to FFT a signal or down-mix it and then FFT it (with appropriate filtering)?


texts: Autocorrelation of a $L$-point moving average system

texts:
The $L$-point moving system is:

$$y[n]=\frac 1L\sum_{k=0}^{L-1}x[n-k]$$

$x[n]$ is a Bernoulli random signal with $\beta=0.5$ (equal probability)

The autocorrelation of $x[n]$: $\psi_{xx}[m]=\delta[m]$

Normally for this type of problems, I would start with $h[n]$, then use the property

$$\Psi_{yy}[m]=|H(e^{j\omega})|^2\Psi_{xx}(e^{j\omega}).$$

However, since I only have the difference equation, I can't seem to find $h[n]$.

I'm trying to compute directly using the equation $\psi_{yy}[m]=E(y[n]y^*[n+m])$, then represent $y[n]$ in terms of $x[n]$, but this seems to be a dead end as well.

Can anyone give me some suggestions?


texts:
Can someone help me to better understand the Impulse Invariant mapping? :

$$h[n] = T \cdot h(nT)$$

I don't understand why the discrete-time impulse response, $h[n]$, is taken from the sampled impulse response in continuous time, $h(nT)$, multiplied by the sampling period $T$.


texts: Design 2nd order sections IIR filter for high orders (more than 500)

texts:
I am currently building a Reverb that needs to fit on a DSP. I am using the model proposed in this link https://ccrma.stanford.edu/~jos/pasp/Freeverb.html.
It involved to create some Feedback Comb-Filters with high orders (more than 1000). For that I use a 2nd-order section IIR filter (IIRSOS) integrated in my DSP. I am using the Matlab function "tf2sos" that takes numerator and denominator of the Transfer Function (TF) of the desire filter and create a matrix of Second Order Section (SOS) coefficient. With this coefficients, I can make what I want.
Problem : for high filter orders (arround order 200) the "tf2sos" function appears to be totally unstable. However the Matlab object called dsp.IIRFilter that use also 2nd-order section IIR seems to handle it :
Impulse response for order = 200 :

Impulse response for order = 1500 :

On the 2nd picture you can see that the filter with the tf2sos coefficients is going totally wrong. Does someone knows how I can get a functional coefficient matrix for orders like 1500 ?
Thank you.


texts:
I have a question about interpretation of the signal produced by a microphone.

The output of a microphone is a voltage level that corresponds to the pressure on the membrane. The part that confuses me is why are the output signal values located above and below the average (picture attached). Do the values "above and below" correspond to the membrane deflecting, and then going back to its original position? If that's the case, should I just concider the values above the average for my further computation of the Fft?

Thank you!


texts: Structural time series model with multiplicative error term

texts:
I have a noisy time series measurement of a biological signal which I need to smoothen. I believe that the error of the measurement is proportional to the signal strength. I am currently working in R and managed to smoothen the signal using ts, STructTS and tsSmooth:

ts_raw_data <- ts(raw_data, start=0)
struct_raw_data <- StructTS(ts_raw_data, type="trend")
smoothened_data <- tsSmooth(struct_raw_data)[, c("level")]

However, according to the documentation, StructTS uses an additive error term:

  The simplest model is the local level model specified by type =
  "level". This has an underlying level m[t] which evolves by

  m[t+1] = m[t] + xi[t], xi[t] ~ N(0, σ^2_ξ)

  The observations are

  x[t] = m[t] + eps[t], eps[t] ~ N(0, σ^2_\eps)

Instead, I think I need a model where the observations are modelled as:

  x[t] = m[t] * eps[t], eps[t] ~ N(1, σ^2\eps)_

Ideally, I would like to solve this problem in R, but Python, Matlab or Julia would also work. Do you have any suggestions how to achieve that?

Thanks,
Paul


texts:
I need to obtain some real (simulated) data to indicate noise in communication system.

How do I go about it? I need it for my thesis.

I don't know if denoising a set of signals will help so I can have the noise data samples.

I  just need the noise data samples.


texts: Algorithm to identify pitch-shifted recordings?

texts:
new to this whole DSP thing. Two related questions:

Does there exist an algorithm or classifier that, when given two sound files, would be able to tell me if one is a pitch-shifted version of the other? There are algorithms that can tell you whether two images are resized versions of one another, I feel like this would be the audio equivalent.
How would you write an algorithm that takes two recordings that are pitch-shifted versions of one another and spits out the amount of pitch shift. My naive guess would be to count zero-crossings in a fixed window for both recordings and compare the two counts, but I feel like that might lead to aliasing issues.

Thanks!


texts: Deblurring algorithm to precede thresholding - speed over accuracy

texts:
I'm writing an app that recognizes Sudoku puzzles from a camera input.  I'd like to remove camera blur from the images to improve recognition.  Here is an example image:

Since I'm processing a continuous camera feed, I'm concerned about speed, since slow algorithms will degrade my frame rate.  On the other hand, the technique doesn't have to be super-accurate, since I will be thresholding/binarizing the image afterwards.  The deblurring algorithm I use only needs to be accurate enough so that the digits will be clear after thresholding.  Here is what the image currently looks like after a segmented Otsu threshold (the threshold level is selected independently for each 3x3 grid of cells):

I'm looking to write an implementation that's compatible with OpenCV data structures.  This means that an off-the-shelf Matlab solution isn't an option.  However, I found the Matlab documentation on image deblurring to be quite helpful in understanding the general principles, as well as this site.  The Matlab functions are all computationally-intensive in any case, and I wasn't able to pick an estimated point-spread function (PSR) that gave good results.

What are your suggestions for a fast deblurring algorithm that allows features to be distinguished easily by a subsequent threshold?


texts: Any recommendations for buying SINAD measuring equipment?

texts:
I am interested in buying a device that measures the SINAD of the audio signal(FM signal) that I receive from PC. Here is the setup :
Signal generator -> attenuator ->HackRF connected to PC with SDR#

When we receive a 1KHZ FM signal generated by the signal generator at the HackRF(which is connected to PC), we get an audio tone from the PC as output. I am interested in measuring the audio quality of FM tone that we receive at hackrf (connected to PC with SDR# support).

I know that for some signal generators, there is a separate port for measuring SINAD. The signal generator that I have does not have the capability to measure the SINAD. So, if there are any other devices that can help me measure this SINAD, please let me know.


texts: Calculating the product of discrete transfer functions

texts:
I'm trying to construct a higher order IIR from a biquad cascade, I know this is generally frowned upon, but it's necessary as the coefficients will be embedded into a larger formula used in a FDTD boundary condition.

According to this answer, I simply need to multiply the biquad transfer functions together, however I'm not sure how to do that.  Is it simply a case of multiplying each numerator polynomial into a higher order one, and then doing the same for the denominator?


texts: how is this method of proving shift invariance correct

texts:
I got this answer from here. But i don't know how this method is correct. Until now to prove shift invariance what i did was :
step 1: delay output and write it in terms of input.
step 2: delay input and write the modified output
step 3: if output from step 1 and 2 are same then system is shift invariant.

what this guy has done is "different". the oppenheim book and proakis manokalis book don't follow this method. which book follows this method?

the method.

  The test for this is
  $$x_{1}[n]=x[n-n_{0}] $$
  $$y_{1}[n]=y[n-n_{0}] $$

  So let's first express in terms of just $y[n]$.
  $$ y[n]=\frac{x[n-3]-y[n-3]-y[n-1]}{x[n]} $$
  Next, we go through the test.
  $$y[n-n_{0}]=\frac{x[n-3-n_{0}]-y[n-3-n_{0}]-y[n-1-n_{0}]}{x[n-n_{0}]} $$
  Substituting $y_{1}[n] $
  $$y_{1}[n]=\frac{x[n-3-n_{0}]-y[n-3-n_{0}]-y[n-1-n_{0}]}{x[n-n_{0}]} $$
  $$y_{1}[n]=\frac{x[n-3-n_{0}]-y_{1}[n-3]-y_{1}[n-1]}{x[n-n_{0}]} $$
  And finally substituting $x_{1}[n] $
  $$y_{1}[n]=\frac{x_{1}[n-3]-y_{1}[n-3]-y_{1}[n-1]}{x_{1}[n]} $$
  Because the shifted sequence has the exact same relationship, it is said to be time-invariant. Most systems that don't alter $n$ or $t$ meet this. Be wary of anything multiplying or otherwise messing with the vector arguments beyond simple delays.


texts: Power spectral density: Why are these two methods equal?

texts:
The power spectral density can be calculated in two ways:

by doing the Fourier_transform of the autocorrelation
by doing (abs(X(f)).^2 where X(f)=fft(x(t))

Can you explain me passage by passage why these are equal?

I'll try to explain better my problem, because I tried to simplify it, but maybe (since I am not an expert) I have worsen the situation.

I had to do the power spectral density of a random signal (the velocity of a CFD simulation).

Firstly I did the FFT of the autocorrelation:

   v is my signal
   r =xcorr(v,v)
   PSD = abs(fftshift(fft(v)))

After that, I realised that in order to be verified the fact that the integral of the PSD is equal to the rms^2 of the signal, my result has to be scaled by the factor 1/(fs*N), as it is shown in PSD, Autocorrelation, and Noise in MATLAB.

Unfortunately I did not understand why this factor was necessary and I did not find any explanation about this online or in my books. So I looked at this video that gives an explanation using the Parseval Theorem, How to scale FFT and PSD in MATLAB.

So I thought if I demonstrate that abs(fftshift(fft(v))) is equal to abs(fft(v)).^2 then I can demonstrate why I need that scaling factor 1/(fs*N) in order to satisfy my check.

I hope you can forgive me if I did not explained everything from the beginning, but I tried to make it simple (I obviously failed). I hope you can help me. I am struggling with this demonstration for one week and none can help me.


texts: the phase spectrum of a zero-phase wavelet is not zero!

texts:
I am going to plot the phase spectrum of a zero-phase ricker wavelet. I calculate the fft of the wavelet and use the phase or angle to calculate the phase spectrum but the result is not zero!

I use the following code:

Fs = 250;
t = 0:1/Fs:0.5*(Fs-1)/Fs;
f1 = 30;
w = (1-2*pi^2*f1^2.*t.^2) .* exp(-(pi*f1.*t).^2);
X = fft(w);
plot(angle(X));


texts:
Let's assume we have a random binary texture image $X(i,j)$ that comes from a Markov-Gibbs model with zero boundary conditions.
The probability distribution Gibbs function is: $$Pr(X)=\frac{1}{Z}\exp(-\frac{1}{T}U(X))$$
If we also have an Ising model with cliques of 1 or 2 pixels, if there are horizontal or vertical neighbours, then its energy is given from the following formula:
$$U(X)=\sum_i\sum_j{[aX(i,j)+b_1 X(i,j)X(i-1,j)+b_2X(i,j)X(i,j-1)]}$$
I want to prove that the above energy function can be written in the following form:

$$U(X)=a\cdot card(X)+b_1 \cdot card(X \ominus B_h)+b_2 \cdot card(X\ominus B_u)$$

where $B_h=\{(0,0),(1,0)\}$ and $B_u=\{(0,0),(0,1)\}$ are structural elements and $card(X)$ is the number of pixels of binary image $X$.
Which is the right way to approach this problem? Any help is appreciated! Thanks in advance!


texts: How do I detect distinct objects when their edges touch each other?

texts:
I need to find all the contours in an image retrieved from the camera. So I first use the canny edge detector to find the edges and then find the contours. Pretty simple.

However, my contours get "merged". For example, in the image below, I clearly have 4 different objects. The edges are slightly touching at some points though, so I get one big contour instead of four separate ones. I tried changing around the thresholds, eroding, morphology operations and similar things but the edges keep slightly touching. Does anyone have any suggestions on how to get separate contours in images similar to the one below? (The image below is obviously just an example, my actual images are much more complex, but have the same basic problem).


texts: Build an inverse model for a train of gaussian pulses

texts:
I have a stationary signal from a train of Gaussian pulses.
My sampling window is too wide (cannot be reduced). In the example 1 ms. So it is not possible to clearly distinguish one pulse from another.

The advantage is that I can resample the signal several times by moving sampling start with a delay. For example, I sample the signal 5 times, moving 0.2 ms in each one.

I need to build an inverse model that given the sampled signals (the 5 signals below), original signal can be reconstructed.

Is there any algorithm that solves this inverse problem?


texts: Why does reversing the order of these two transfer functions give me different outputs?

texts:
Consider these two systems:
\begin{align}
&u\ {\longrightarrow}\boxed{s}{\longrightarrow}{\boxed{\frac 1s}}{\longrightarrow}\ y\\
&u\ {\longrightarrow}\boxed{\frac 1s}{\longrightarrow}{\boxed{s}}{\longrightarrow}\ y
\end{align}

If I input a step ($u=1/s$), I get an output of $y=0$ from the first system, but $y=1$ from the second. (You can see this from considering the signal in between the two blocks - it's zero in the first case and a ramp in the second case).

Why does reversing the order of the blocks change the output?


texts:
I have 6 column vectors $(\mathbf A_x,\mathbf A_y, \mathbf A_z, \mathbf G_x, \mathbf G_y, \mathbf G_z)$ taken by accelerometer to analyze the vibration of a construction. Each column is a $64998\times 1$ valued-vector and overall time is $664$ seconds. I've done something but I don't know how I can fix it.

Fs=97.885;
L=64998;
NFFT=2^nextpow2(64998);

AXdft = fft(Ax);
AXdft=AXdft(1:NFFT/2+1,:);

freq = linspace(0,Fs,NFFT/2+1);

plot(freq,2*abs(AXdft));
xlabel('Hz');ylabel('Magnitude');

figure;
plot(freq,20*log10(abs(AXdft)));
xlabel('Hz');ylabel('dB');
title('Plot in dB');

BTW I will add each column over other via hold on

getting a figure but missing its size. The frequency doesn't appear in figure and I guess I must do PSD, Can anyone help?


texts: How to synchronise two audio files using a marker

texts:
I'm working on a project on which we use WebRTC and the RecordRTC library to record audio files.

I would like to be able to process the audio files server-side to ensure a good synchronisation.

To do so, I'm thinking about marking the start of each record with an inaudible sound marker in order to analyse new records and then manipulate the starting offset with ffmpeg (which I already use to compress the raw files created by RecordRTC).

The thing is I've never done any advanced audio processing before, I'm looking around and cannot find what would be the proper way to do this.

Is there another, better, way to handle synchronisation? And if not, I would be grateful if I could get some tips on the marker technique. Thank you.

Edit: I forgot to mention for those who don't know how RecordRTC works that the record is done client-side in Javascript. The synchronisation issue comes from the fact that javascript is not good at synchronising calls.

The process is done as follow:

1) A user records himself

[User 1] -> Records on his browser an audio file -> Saves raw audio file (call it audio_1.ogg) -> [Server]

2) Another user wants to join user_1's project

[User 2]  <--- Fetch audio_1.ogg (in an audio html tag) --- [Server] -> Press record
 -> [Webapp] Plays audio_1.ogg and starts recording audio_2.ogg -> Saves audio_2.ogg when record is over ->[Server]

The synchronisation issue comes from the fact that there are no way in Javascript to ensure that both the functions handling that starts record and the one responsible for beginning playing the existing audio file happen on the same time.

I end up with ~50/100 ms of gap depending on how many audio files are already on the project (since it's not limited to two).


texts: Contours matching - finding contours displacement

texts:
I found contours on two images with same object and I want to find displacement and rotation of this object. I've tried with rotated bounding boxes of this contours and then its angles and center points but rotations of bounding boxes don't tell about contour rotation correctly because it's the same for angles a+0, a+90, a+180 etc. degrees. Is it any other good way to find rotation and displacement of contours? Maybe some use of convex hull, convexity defects? I've read in Learning OpenCv about matching contours but it hasn't helped. Could someone give some example?

Examples:

I want to detect for example pink square, and in the second case pen. Other examples could be squares with some holes, stars etc. As I said I want to make some uniwersal thing. Any suggestions are appreciated because I want to test as many methods as it's possible.


texts:
I am a PhD. in pure mathematics.

Could you please illustrate the following statement: the eigenvectors of a graph Laplacian behave similarly to a Fourier basis, motivating the development of graph-based Fourier analysis theory.
I am reading the interesting  paper, but could not get how the  Fourier transform is extended to the graph Fourier transform as illustrated on page 23.  Indeed,  why should the matrix V be considered as the extension of (discrete) Fourier transform?


texts: Problem with applying elliptic filter to ecg signal

texts:
I'm currently working on an article for ECG classification which it says that it has used elliptic bandpass filter with 0.5Hz and 50Hz critical frequencies to eliminate base-line and interference etc. First problem is that I think it should be stopband instead of bandpass, am I wrong?
Second problem is when I try to do the filtering in matlab. The original signal shape is something like this:

the sampling rate of the signal is 300Hz.
[b, a] = ellip(10, 1, 100,[0.5 50]/150, 'bandpass')
fvtool(b, a, 'Fs',300)

This is the frequence response of the filter:

using this line, I apply the filter to my signal:
s_filtered = filtfilt(b, a, s)

and what it returns is all NaN! Am I doing something wrong?


texts:
It is not clear to me if the CZT transform actually increases the resolution relative to the FFT or just does interpolation.
The resolution of the CZT transform is assumed to be arbitrary. Up to what limit?


texts: Basic Confusion About the DFT and Convolution

texts:
I am learning DSP (with Digital Images) and I have some elementary confusion about the convolution between two discrete periodic signals. Specifically, I have learnt that when filtering an image, we apply convolution between the image (as discrete 2D signal) and a kernel filter. To visualize what happens in the frequency domain, we calculate the DFT of the image and the kernel and since we are convolving in the space domain, in the frequency domain this corresponds to a point per point multiplication of the two spectrums.

Now, the DFT assumes that the signal to transform is discrete AND periodic, resulting in a spectrum which is discrete and periodic. So here we are assuming that both the signal and the filter are discrete and periodic signals which repeat (usually) after the same M samples. My confusion is, how can convolution work for two discrete periodic signals? Since they repeat infinitely, applying the convolution usual definition as a flipped-shifting multiplication and sum, we would end up with an infinite sum in some single points if the signal to be filtered and the filter overlap. (Because they would overlap in the current repetition, in the next, and the next ad infinitum)

As an example in 1D, let $x[n]$ be our discrete function, which is periodic with a period of $N$ samples in the spatial domain. And let $h[n]$ be the filter impulse response in the spatial domain, also periodic of $N$ samples. We want to filter $x[n]$ with $h[n]$ and get the filtered signal $y[n]$. To do this we convolve these two periodic discrete signals:

$$y[n] = \sum_{k = -\infty}^\infty x[k]h[n - k]$$

However this convolution for a certain $n$, e.g. $n=0$, can lead to an $y[0]$ which is infinite, as both $x[n]$ and $h[n]$ are periodic.

When we convolve between the image and the kernel, we are only considering one repetition of $h[n]$ and one repetition of $x[n]$. Like this:

$$y[n] = \sum_{k = 0}^{N-1} x[k]h[n - k]$$

Why can we do this? Will this still give us a periodic discrete $y[n]$ whose representation in the frequency domain is the point-per-point multiplication of the original signal and filter?


texts: Larger image after wavelet reconstruction

texts:
Depending on the size of the original image and depending on the kind of padding used during 2D discrete wavelet transform and reconstruction, the reconstructed image has a larger size.

Is there a general method given a mxn matrix and given some padding mode to crop the obtained pxq matrix to the mxn matrix (without trying every possibility in order to find the one with the least error)?


texts: Convolution and Cross Correlation on 2D Image

texts:
I have read that convolution and cross-correlation are the same thing, but convolution flips 180 degrees (images), or time reverses (sequences) the kernel, before performing the elementwise multiplication of the input and the kernel.

I understand how this works on 1D signals, however I do not know how to perform these two operations for 2D images, and it's been really hard to find any good example on the web.

I would very much appreciate an example, showing both Convolution and Cross-correlation of an image. Clearly specifying what the indexes stand for and how the output image is calculated.

For example (feel free to use any other example if you think it would be better):


texts: Is it possible to calculate the optical flow magnitude for rigid motion?

texts:
For objects in 2D plane, it is pretty simple to calculate the displacement vectors using optical flow algorithms such as SLIC, LK, Färneback etc.

But how it is possible to know the magnitude of the flow of objects when the motion is orthogonal to the 2D plane i.e the object size increases ( coming towards you ) or the object size decreases ( going away from you ). ?


texts: Does a frequency divider external to the loop BW of a PLL cause any phase ambiguity ? and why? and is the result of dividing by an odd number different than dividing by an even number?


texts: What is the threshold to prefer polyphase channelizer over FIR filtering?

texts:
A wideband signal need to be processed to extract several narrowband channels from it. There are two straightforward approaches to do so:

For each narrowband channel shift frequency and filter it with FIR filter.
Implement polyphase channelizer and select only those chunks that correspond with target narrowband channels.

Considering the following extreme situations:

Need to select 1 narrowband (25 kHz) channel from a wideband channel (56 MHz)
Need to select 2048 narrowband (25 kHz) channels from a wideband channel (56MHz)

It seems to be obvious that in the first case time-domain filtration is more efficient and polyphase channelizer is more efficient in the second case.

The question is what will be more be more efficient (require fewer FPGA resources) if only 12 (25 kHz) arbitrary placed channels need to be extracted from a 56 MHz wideband signal?


texts:
Suppose that we have a dynamical system of which the impulse responses are infinite (IIR). Now I found methods on papers (http://dx.doi.org/10.1109/9.839942) estimating states or outputs of such a system with a FIR estimator. So this FIR estimator gives me approximately the same (state) output as my original system.

I find it hard to conceive how an estimator with only poles in $z_i=0$ is able to duplicate a system with poles $|z_i|<1$ (but not necessarily $z_i=0$). I think it has something to do with interpolation conditions, but I would really appreciate it if someone could make this clear to me. Thanks :)

I understand that for a stable dynamical system IIR will decay to zero and thus can be truncated to FIR. But my question remains how a FIR could 'mimic' the poles of an IIR?


texts: How to recognise different symbols from their slope ? like (,^) etc

texts:
i am trying to build a program in which user input a symbol with mouse and program recognise the symbol by saving mouse coordinates in array ,for this i have followed following steps:

Firstly check if line is straight or not by straight line equation.
I am able to recognise symbols like vertical,horizontal lines, forward and backward slash with the help of the slope of line.
but for >,<,^ i don't know what to do, for starters i have solved it like this, for example if < is to be recognised first symbol should be backward and second to be forward slash but this conflict with ^.

please let me know if there's another method for solving this problem.


texts: How the white and colored noise differ in time domain

texts:
I know the white noise is uncorrelated. So a perfectly white signal has an autocorrelation equal to an impulse at zero. This implies that the corresponding signal in the time domain is any function with no correlation whatsoever between the different samples.

And I know that any colored noise can be thought of as filtered white noise, so this will still look like a somewhat random signal but with less "sharp" transitions between the samples because the high frequency components have been filtered out. This means that in colored noise, the low frequency noise will have higher variance than the higher frequency noise.

But other than that can you give more intuition of the difference between the white and colored noise in time domain?

Lets say I have two exact same signals and I add white noise to one and colored noise with the same total noise power to the other. Does that mean in the signal which I added colored noise the DC part of the signal experiences a noise with higher average variance than the AC part of the signal?

If I use a white noise of the same power instead of colored noise, then what do I lose and how bad this approximation would be in a system simulation?


texts: An input sequence consists of two symbols, each independently and randomly chosen from a set of symbols with known associated probabilities. Each symbol is independently encoded using a prefix code that minimizes the expected codeword length. Is it possible to reduce the expected total length of codewords by using instead of this code a prefix code where the symbols are ordered pairs of the original symbols?


texts:
I am trying to convert few .wav files to .mp3 format
The desired .mp3 format is :

I tried with FFmpeg with this code :
ffmpeg -i input.wav -vn -ac 2 -b:a 160k output1.mp3

This is the output of this command on one .wav format

I am getting the result but two things are different
Overall bit rate mode and Writing library

Writing library: LAME3.99.5 vs LAME3.100 ( I think this shouldn't
make any problem?)
bit rate mode Constant Vs variable

How to change bit rate mode from variable to Constant? and do I need to convert using the same Writing library?
Thanks!


texts: Measuring the average frequency of signals

texts:
I have many signals/audio data of a hammer banging on a nail. As the nail gets deeper it seems obvious to me (just by hearing) that the pitch is higher at the end than at the beginning. I assume that the pitch gets higher with every bang. I want to be able to measure this.

So my question is how to I compute the frequency or average frequency of each bang, to be able to see this increase in pitch?

What I thought about doing was take the fourier transform of each bang and then take a weighted average. Like: (sum over (fourier coefficient index * amplitude of that coefficient)) / number of fourier coefficients.

But I am not seeing a clear rise in this value. Perhaps what I should care about just the fourier coefficeint with the largest amplitude?

What methods (if mine is not correct) to get the average frequency?


texts: MIT exercise 6.003 HW2 - Concept of system initially at rest

texts:
I am following the MIT open course you can find here. My question is about one of the exercises given as homework in the latter and more specifically I think I am missing something on the concept of "system initially at rest".

Homework [exercise 8]: HW2
Solutions: SOL2

In the proposed solution he is solving the problem using differential equations. What I am trying to do is to use functionals (as this is new to me). I think I end up missing an integration constant due to the hypothesis of "system initially at rest". My solution goes as follows:

System differential equation:
$$ \ddot{y}(t) = x(t)-y(t)$$

We seek the response to a step function i.e. $x(t) = u(t)$ where $u(t)$ is zero for $t<0$ and one elsewhere. Now the system functional is:

$$\frac{Y}{X} = \frac{A^2}{1+A^2} = \frac{i}{2}\left( \frac{A}{1+iA}+ \frac{A}{1-iA} \right)$$

where $Af(t) = \int_{-\infty}^{t} f(\tau) d\tau $ is the accumulator operator as defined in the course. Given the impulse function(al) $\delta(t)$, knowing that $u(t) = A\delta(t)$ and using the commutative property of operators:

$$\frac{Y}{X}u(t) = \frac{iA}{2}\left( \frac{A}{1+iA}+ \frac{A}{1-iA} \right)\delta(t)$$

The fundamental mode being $e^{pt}$ where $p$ is a pole:

$$\frac{Y}{X}u(t) = \frac{iA}{2} \left( e^{-it} - e^{it} \right)u(t) = \frac{i}{2}\left( \frac{e^{-it}}{-i} -  \frac{e^{it}}{i}\right) = -cos(t)u(t)$$

While the correct solution is (physically obvious): $\left(1-cos(t)\right) u(t)$. I don't understand where I am doing wrong except for the initial hypothesis "system at rest". Can you tell me where the mistake is and, if the hypothesis is wrong, tell me exactly in what conditions it holds?


texts: How is the Laplacian used for Unsharp Mask?

texts:
Some unsharp algorithms (e.g. Matlab's fspecial) use a Laplacian kernel to achieve sharpening of the image.

From what I know, the image needs to be blurred first, and then the blurred image is subtracted from the original to get a sharper image. The Laplacian part comes exactly where alleged smoothing should take place. Correct me if I'm wrong, but Laplacian doesn't do any smoothing.

So how does the Laplacian help in sharpening the image?


texts:
I'm trying to understand how to program cascading FM synthesis operations.  I can find a good deal of information out there on how to do it on various pieces of hardware, but unfortunately, there isn't enough information to be able to replicate these things in software.

I know that some details may be hardware specific, and that "replicating results" may be complex as there could be specific numbers of bits being used for calculations, or perhaps hardware that alters the results (tubes), but I'm just trying to figure out what is generally considered to be the correct way to do cascading FM synthesis operations.

Let's say that I have the concept of a free spinning oscillator object in my program which stores phase, and has a function to advance phase based on the frequency passed in:

struct SFreeSpinningOscillator {
    SFreeSpinningOscillator () : m_phase(0.0f) { }

    // advances the oscillator and returns the current value of the sine wave
    float AdvanceOscillator (float frequency, float sampleRate)
    {
        float ret = std::sinf(m_phase * c_pi * 2.0f);
        m_phase += frequency / sampleRate;
        return ret;
    }

    // note that phase isn't a true angle, but is just a percent 0..1
    float m_phase;
};

With the above I know that i can get vibrato easily enough with something like this:

SFreeSpinningOscillator a, b;

....

float modulator = a.AdvanceOscillator(10.0f, sampleRate) * 5.0f;
float carrier = b.AdvanceOscillator(noteFrequency + modulator, sampleRate);
return carrier;

The above will make it so the carrier value is a sine wave at frequency "noteFrequency" which varies it's frequency +/- 5hz on a sine wave, 10 times a second.

When talking about FM synthesis, it's more likely to be something like the below where the modulator's frequency and amplitude is based on the note's frequency:

float modulator = a.AdvanceOscillator(noteFrequency * 0.5, sampleRate) * noteFrequency;
float carrier = b.AdvanceOscillator(noteFrequency + modulator, sampleRate);
return carrier;

This is where I start to get confused though.  What if I have two or more modulators?  Are their frequencies and amplitudes ALSO based on the basic note frequency?  Or are they based on the frequency of the last modulator?

If it's based on the basic note frequency, how do the amplitudes of the modulator waves fit in?  If it's based on the modulator frequency, why even calculate the wave forms?

In other words, is the below correct? or is there some other way that it is usually or commonly done?

SFreeSpinningOscillator a, b, c, d;

....

float modulator3 = a.AdvanceOscillator(noteFrequency * 0.5, sampleRate) * noteFrequency;
float modulator2 = b.AdvanceOscillator(noteFrequency * modulator3 * 0.2, sampleRate) * noteFrequency;
float modulator = c.AdvanceOscillator(noteFrequency * modulator2 * 2.8, sampleRate) * noteFrequency;
float carrier = d.AdvanceOscillator(noteFrequency + modulator, sampleRate);
return carrier;

Here are some of the sources I've been reading and have found most helpful:

http://the-all.org/tx81z/fm_overview.html

http://www.soundonsound.com/sos/apr00/articles/synthsecrets.htm

https://www.soundonsound.com/sos/may00/articles/synth.htm


texts: K-means for 2D point clustering in python

texts:
I have a set of points(2D) whose pixels are set and want to perform k-means on these pixels. Is clustering the 2D coordinates the right way ?

If so, can that be done using any libraries in python ?


texts: Vibration Acceleration Analysis with FFT and inverse FFT

texts:
I've been reading time series data off of an accelerometer, and converting it to one RMS acceleration in g. The sensor works in a range of 0-6.4 kHz approximately. Ideally i would like to restrict the range to 10 - 5000 Hz, i however there is no direct way or setting to modify this on the sensor.

Hence i'm thinking of getting all the time series data, and performing an FFT. Then removing any unwanted frequency by setting their values to zero, perform an inverse FFT and calculate my new RMS acceleration based on the new signal.

Does this make sense from a DSP point of view?

Also, should i remove all the negative frequency components too, before performing the inverse FFT?

I'm doing this on python using numpy library.


texts:
I'm trying to perform a state estimation on quaternions to predict the future orientation of a human head. The only sensor data I can obtain (from the AR headset) is the current orientation of the head, sampled at 200 Hz i.e. I don't have access to any gyroscope or acceloremeter data. After getting the state estimations, I would like to reuse the process/motion model (constant angular velocity) to make predictions further into the future, e.g. 20 ms to 100 ms.

Since the process model is nonlinear (due to quaternions), one option is to use an Unscented Kalman Filter (UKF). However, as discussed in this paper, quaternions cannot be directly used in the UKF and some conversions need to be made to obtain "quaternion sigma points" (Sec. 3.2 of the paper).

My question is, does it make sense at all to use this kind of method if I only have attitude measurements (quaternions) and no gyro or acceloremeter data? In this case, my state vector would be 7D: four quaternion and three angular velocity components. However, the paper (and most other works I encountered) always have some kind of gyro/acceloremeter measurements which makes me wonder if it's feasible to just have the attitude information and have the filter estimate the angular velocity.


texts: histogram bin size vs. data sampling rate

texts:
I have a set of numerical signals that give me a set of zeros calculated based on some numerical procedure. I make a histogram of those zeros.

Here, a following problem arises:

If the histogram resolution is declared greater than sampling rate for signals’ data some oscillation in the histogram starts to appear. A frequency of it equals to the sampling rate for the signal.

Is this a common effect?
Is a histogram bin size related in some way to a sampling rate?


texts: How to find the output signal of a filter using state space matrices?

texts:
I have a filter.
It has two poles and two zeros.

I found the state space equations and the matrices A, B, C, and D

Now. I have 9 samples that I need to process with my filter.
How do I use A,B,C,D matrices to process the samples?


texts:
I'm have a sequence of 2-dimensional MxN frames.
I have concatenated these frames to form a 3-dimensional MxNxT matrix.
Now i want to filter this 3D volume by 2 types of filters (a 2D log-Gabor in xy-direction, and a 1D gaussian in z-direction).

Here is my MATLAB implementation:

[yGrid,xGrid] = ndgrid(1:size(D,1),1:size(D,2));
sigmaXY = 0.5;
sigmaT = 1;
numFilts = length(Scales);
w = sqrt(yGrid.^2 + xGrid.^2);
bpFilt = zeros(size(D,1),size(D,2),size(D,3),numFilts);

for sc = 1:numFilts
    for t = 1:size(D,3)
        w0 = 1.0/Scales(sc);
        bpFilt(:,:,t,sc) = exp((-(log(w/w0)).^2) / (2 * log(sigmaXY)^2)) * ...
                           exp(-t.^2) / (2 * sigmaT^2);
    end
end

DF = fftn(D);
DFfilt = bsxfun(@times, DF, bpFilt);

where D is my 3D data.
The output DFfilt is fft inverted and plotted then. But all frames look the same in the output!

Where am I mistaken?

Is there any better suggestion to implement the filtering?


texts:
$$ f(t)=\exp(jat^2) \,\,\, and \,\,\, g(t)\,\,is\,\, a\,\, Gaussian\,\, Window:$$
$$ g(t)= \left (πσ^2\right)^{\frac{-1}{4}}\exp\left (\frac{-t^2}{2σ^2}  \right ) , \,\,\,\,\,\,\left \|g(t)  \right \|=1 $$
$$ $$
I want to find the STFT (Short-Time-Fourier-Transform) of f(t) and prove that:
$$ $$
$$Psf(u,\xi)=|Sf(u,\xi)|^2=\left (\frac{4πσ^2}{1+4α^2σ^4}\right )^{\frac{1}{2}}\exp\left (\frac{-σ^2(\xi-2au)^2}{1+4a^2σ^4}  \right )$$
$$ $$
I started by calculating the Fourier Tranformation of f(t) and found that $$f(t)=\exp(jat^2)\leftrightharpoons K \cdot \exp\left ( \frac{-ω^2}{4α}\right)=F(ω) $$
where K is a constant
$$ $$
I am confused with the next steps i have to follow in order to make use of F(ω) in order to calculate STFT. Do i have to use the definition of STFT?:
$$Sf(u,\xi)= \langle\,f,g_{u\xi},\rangle= \int_{-\infty}^{\infty} f(t) \cdot g(t-u) \cdot e^\left (-j \,ξ \,t  \right )dt $$
I tried to do so but i didn't manage to calculate the integral above.
Is there an easier way to calculate STFT by using any properties?Any help is much appreciated!Thanks in advance!


texts:
In order to familiarize myself with Kalman filter I decided to see how it work step by step. I would gladly use your help.
Let's say I have a falling object with air resistance proportional to its velocity. Since my measurements are not perfect let's say that position measurement is gaussian with standard deviation of $15m$, so is velocity with deviation $5 \frac{m}{s}$. Equation for this system is $\ddot{x} = g - \frac{b}{m}\dot{x}$, where $b,m$ are constant. Now how do I find matrices $A$ and $B$. Do I simply convert to space-state form? Also, how do I determine the processing noise $\mathbf{v}$? And finally, how do I find covariance matrices of of processing($\mathbf{Q}$) and measurement ($\mathbf{R}$)? If you are kind enough to help me I would gladly ask you some more questions tomorrow.


texts: Solving an Array Signal Processing Estimation Problem based on the Rayleigh Quotient

texts:
The Rayleigh quotient for a covariance matrix $\mathbf{C}$ and a non-zero steering vector $\mathbf{a}$ is given by
$$
R(\mathbf{C},\mathbf{a}) := \frac{\mathbf{a}^H\mathbf{C}\mathbf{a}}{\mathbf{a}^H\mathbf{a}}.
$$

In this context, it can be shown that under the constraint $\mathbf{a}^H\mathbf{a}=1$
$$
\lambda_m \leq \mathbf{a}^H\mathbf{C}\mathbf{a} \leq \lambda_1,
$$
where $\lambda_i, i = 1,...,m$ are the eigenvalues of $\mathbf{C}$ sorted in nonincreasing order. These equalities can be achieved when $\mathbf{a}$ is equal to the eigenvector of $\mathbf{C}$ associated with the smallest (i.e. $\lambda_m$) and the largest (i.e. $\lambda_1$) eigenvalue, respectively.

I was therefore thinking, that under the assumption that
$$
\mathbf{a} = \exp(j \cdot \mathbf{k}x)
$$
with
$$
\mathbf{k} = [k_1,...,k_m]^T
$$
I were able to solve for $\mathbf{x}$ by
$$
x = (\tilde{\mathbf{a}}^H\tilde{\mathbf{a}})^{-1}\tilde{\mathbf{a}}^H\tilde{\mathbf{e}}_1,
$$
where
$$
\tilde{\mathbf{a}} =  j \cdot \mathbf{k}
$$
is the "model" contained in $\mathbf{a}$ and
$$
\tilde{\mathbf{e}}_1 = \ln(\mathbf{e_1})
$$
is the logarithm of the eigenvector corresponding to the largest eigenvalue.

Unfortunately, I seem to have messed up something in my considerations: Actually, I expect $x$ to be a real-valued scalar result. However, as $\tilde{\mathbf{a}}$ is complex-valued (but containing an imaginary part only), $\tilde{\mathbf{a}}^H\tilde{\mathbf{a}}$ is a real-valued scalar. $\tilde{\mathbf{e}}_1$ is a complex-valued vector, i.e. $\tilde{\mathbf{a}}^H\tilde{\mathbf{e}}_1$ is a complex-valued scalar. Therefore, I will always receive a complex-valued scalar $x$ as a result.

Can anyone help me identifying my fallacy?


texts: Essential Matrix from line correspondences

texts:
I'm looking for some library with a function to compute an essential matrix from line correspondences in multiple images. All the computer vision libraries I know use point correspondences to compute the essential matrix.

I've seen some papers about how to calculate E from line correspondences but implementing it myself would be a project on itself, so I prefer to try some existing implementation first. Does anybody know of a library with such an implementation available somewhere?


texts: Is the Kalman Filter a Best Linear Unbiased Estimator (BLUE) for Heteroscedastic Noise?

texts: According to the Gauss-Markov Theorem, a ordinary least squares estimator is BLUE if the noise entering a system is uncorrelated with zero mean and is homoscedastic (has a constant finite variance). I am aware that a Kalman Filter applied to a system with additive noise of known mean and variance but non-gaussian distribution is  BLUE. Does this imply that the noise has to be homoscedastic ? Or does the KF have a trick up its sleeve ?


texts: Scaling issue after doing manipulations in FFT

texts:
I have two filters which must apply (in series) to same input data $x[n]$ e.g of length 256 (real time asio input buffers). One filter is e.g. an impulse response $h_1[n]$ of a speaker and other one an IR $h_2[n]$ of a lowpass (created by sinc, blackman). For simplicity lets say both are shorter than 256.

So I zero pad the input and both IRs to 512, FFT and then do: $X[k]\cdot H_1[k]\cdot H_2[k]$, after this I do iFFT and use overlap-add to deal with the output vector of length 512. I do use a wrapped version of FFTW for performance reasons. FFTW tutorial says that doing FFT and afterwards iFFT of a vector of length $N$ produces an output vector which must be scaled by $\frac{1}{N}$.

My understanding problem here is, how do I have to scale? In the upper example I don't just do FFT$\to$iFFT, but I am doing FEW forward FFT of different filters, multiply them and do only one backward iFFT.


texts: If you would write the frequency-response in terms of projections through inproducts. How would you do it?

texts:
While studying for signals and systems I realised that the most intuitive way of understanding Fourier Series for me, was to see it as a projection (through inproducts) of a signal onto the orthogonal complex exponentials.
Is it possible to view the impulse-response and frequency-response of a signal in this same manner? Looking at the definition it seems clear that there should be such an 'intuitive' understanding, but I am having difficulties seeing it..


texts: Sampled signal reconstruction using matlab

texts:
I have a wav file recorded from my smartphone's mic, and I want to reconstruct the sampled signal and plot the reconstructed signal. After some research and search, I was able to get the following code:

[y, fs, nb] = wavread('new.wav');
x=[1:1:length(y)];
z = y(:,[1]);
samp=transpose(z);
b = 48000/fs;

% Quantizing the Sampled Signal
    no = N/b;           % no. of samples
    z = ceil(5*(no));       % no. of bits required
    quan = zeros(1,z);      % constructing a zero array
    c = (abs(p_max) + abs(p_min))/32     % size of quantized level
    u = p_min;
    w = 1;
    quant = zeros(1,N);
    for (q = 1 : b : N)
        for (r = 1 : 32)
            y = r;
            if (samp(q)>=u & samp(q)<=(u+c))
                for (v = (w+4) : -1 : w) % this loop is for converting decimal into binary
                    quan(v) = mod(y,2);
                    y = (y/2)- (mod(y,2)/2);
                end
                 quant(q) = r;
            end
            u = u + c;
        end
        u = p_min;
        w = w + 5;
    end
    quan

    % Writing the Quantized Signal
    fid = fopen ('quant.bin','w');
    count = fwrite (fid,quant,'int8');

    % Reading the Quantized Signal
    fid = fopen ('quant.bin','r');
    [quant_r,count] = fread (fid,inf,'int8');

    % Reconstructing the Sample of the Quantized Signal
    for (n = 1 : N)
        u = p_min;
        for (ab = 1 : 32)
            if (quant_r(n)==ab)
                quant_r(n) = u;
            end
            u = u + c;
        end
    end
    figure
    stem (quant_r);
    title ('The Reconstructed Sample of Quantized Signal')
    grid on;

    % Reconstructing the Original Signal
    for (c1 = 1 : b : (N-b))
        if (b~=1)
            xyz = (quant_r(c1+b)-quant_r(c1))/b;
            for (c2 = (c1+1) : (c1+b-1))
                quant_r(c2) = quant_r(c2-1) + xyz;
            end
        end
    end
    figure
    quant_r = smooth (quant_r);
    plot (quant_r);
    title ('The Reconstructed Signal')
    grid on;

But it looks like I can't get my desired output, I'm completely new to signal processing, can someone tell me what is wrong with my code? Thank you!

Update#1: I just realized that I used a fairly high sample rate(44100hz), so I tried downsampling using the following code:

[piano,fs]=wavread('new.wav'); % loads piano
play=piano(:,1); % Renames the file as "play"

%t = linspace(0,time,length(play));          % Time vector
x = play;
y = decimate(x,25);

stem(x(1:30)), axis([0 30 -2 2])   % Original signal
title('Original Signal')
figure
stem(y(1:30))                        % Decimated signal
title('Decimated Signal')

%changes the sampling rate

fs1 = fs/2;
fs2 = fs/3;
fs3 = fs/4;
fs4 = fs*2;
fs5 = fs*3;
fs6 = fs*4;

wavwrite(y,fs3,'new1');

Is this what I should do? Thank you!

Update#2: I think my problem is this line:  b = 48000/fs; it should be sampled interval, I have no idea how to deal with this.

Update#3: I just found the following code that seems do the same thing, is this right? If so I don't need to implement it myself.

sub1=wavread('jamming.wav');
 magnSub1=abs(fft(sub1));
 phaseSub1=angle(fft(sub1));
 sub1_L=magnSub1.*exp(i*phaseSub1);
 sub1_L=ifft(sub1_L);
 q=(abs(sub1_L).*cos(angle(sub1_L)));
 plot(q);
 axis([44000,45000,-1,+1]);


texts:
I am working on satellite receiver burst mode
I am trying to build receiver. My data rate is typically 10kpbs.
As the data rate is low and carrier frequency offset may also be around 10kbps

so i have implemented reciever please let me know the blocks mentioned below are ok

coarse frequency recovery
carrier recovery
timing recovery
matched filter

i have seen many designs where timing is done before carrier recovery.

what is the advantage of doing carrier before timing? is it because offset is more then do carrier recovery first otherwise vice versa.
Will the nested loops help
but quantitatively how much symbol rate to freq offset can be recovered like this.
Once recovered the burst length can be as long as possible.


texts: Iterative Auto and Cross Correleation Estimates

texts:
I'm looking for literature or other information that covers iteratively estimating the auto- and cross-correlation vectors and the auto-correlation matrix.

Initially, I can assume the signal is wide-sense stationary, but I also have to deal with changing signals and statistics.

For what it's worth, I looked at two simple algorithms in the matlab code below, showing the variance calculation (red) and a leaky integrator (blue). I also have a boxcar filter (green). The code is shown below, along with a plot of the results.

But, except for the variance calculation in red, the results vary a lot from one run to another. I'm reluctant to get too creative without examining any papers on the subject to get a more rigorous and analytical understanding of how to go about this.

In the long run, this gets implemented into an FPGA, so hardware resources are limited and I need to take that into account.

Where can I find information specifically on this topic?

(Also, help with the tags on this would be appreciated.)

n = 10;
historyLength = 200;
mu = 1/historyLength;
p1 = conj(referenceSignal(n))*referenceSignal(1:n);
p2 = p1;

pBox = zeros(historyLength,n);
pBox(1,:) = p1;
pBox(1,:) = p1;
pBoxIndex = 2;
pBoxFillLevel = 1;

figure(100);
hold on;
for index = n+1:sampleCount
    X = referenceSignal(index+1-n:index);
    d = conj(referenceSignal(index));
    deltaP = d*X;
    p1 = (p1*(index-n-1) + deltaP)/(index-n);
    p2 = (1-mu)*p2 + mu*deltaP;
    pBox(pBoxIndex,:) = deltaP;
    p3 = sum(pBox,1)/pBoxFillLevel;
    plot(index, p1(n),'r');
    plot(index, p2(n), 'b');
    plot(index, p3(n), 'g');

    if pBoxFillLevel < historyLength
        pBoxFillLevel = pBoxFillLevel+1;
    end;

    pBoxIndex = pBoxIndex+1;
    if pBoxIndex > historyLength
        pBoxIndex = 1;
    end;

end;


texts: Is there a systematic method for converting an even length FIR filter to odd length?

texts:
I'm currently implementing a discrete wavelet transform (DWT) as a cascaded QMF filter bank (pictured below). I've put together a convolution function that attempts to filter an input signal in a non-causal fashion. Essentially, the convolution mask is center around the output which means the output is a function of previous, current, and future outputs. I'm doing this to achieve zero-phase filtering.
However, I've noticed that filters associated with wavelets tend to be even length which make it impossible to center the convolution mask around the output. The only solution to this would be to convert the even length filter to an odd length filter (probably increase length by 1).
Is there a systematic method for changing the filter order from even to odd using MATLAB?


texts: Finding natural frequency from vibration analyzer data

texts:
I was asked to find the natural frequency from a waveshape obtained from vibration analyzer, and I performed an FFT and told that the peak represents the natural frequency. Now I am called as an imposter for proving a false procedure. If this is a false procedure, then what should be the correct approach?

This is a clearer version:


texts: Design a LTI system which returns DC value of the input signal

texts:
Suppose that $h(t)$ is the impulse response of LTI system. The input signal $x(t)$ is periodic with period $T$. Determine $h(t)$ so that the output signal $y(t)$ only be the DC component of $x(t)$. Is $h(t)$ necessarily unique?

My attempt:
It's known that LTI system response to the periodic input is periodic. So I think the only possible $h(t)$ is constant function. If we let $h(t) = 1$ then: $$y(t) = \int_{-\infty}^{\infty}x(\lambda)d\lambda \tag{1}$$
According to Matt L.'s answer, definition of DC value is:
$$\bar{x}=\lim_{T_0\rightarrow\infty}\frac{1}{T_0}\int_{-T_0/2}^{T_0/2}x(t)dt\tag{2}$$
Clearly $(1)$ and $(2)$ are different. So what's the appropriate $h(t)$? Maybe question uses different definition for DC value?


texts: Difference between the two forms of input-output relationships of an LTI system

texts:
$$y(t)=f(t)*h(t)\tag{1}$$

$$y(t)=H(s)e^{st}\tag{2}$$

$$H(s)=\int_{-\infty}^{\infty}h(t)e^{-st}dt\tag{3}$$

Let $f(t)$ in Eqn $(1)$ be $e^{st}$. In many worked out examples, I have found that the two equations/formulae give different responses. To be specific, the actual convolution (Eqn $(1)$) is giving the zero-state response, while the Eqn $(2)$ involving $H(s)$ is giving the forced response. Recognising that Forced response and Zero-State response are not equal (Z-S responses may involve characteristic modes of the system, while the Forced Response is the non-characteristic mode part of the Total response), I am confused what is the intuitive difference between the two equations? Which equation should be primarily used for finding the response to an input to a system? Note that in the examples, the inputs $e^{st}$ were multiplied by $u(t)$.


texts: What is the difference between using corrcoef to compare two signals by column, and as whole matrices?

texts:
I have two matrices, which represent acceleration readings of the same event from two seperate sensors, and I would like to calculate the correlation coefficients so that I may get a measure of how similar their responses are, and whether this improves or gets worse as various filtering/alignment processes are done.

I have done a lot of these calulcations and collected results, I have done this in two different ways. Firstly, using a for loop and comparing them column by column (axis by axis), producing three coefficients per pair of signals. And secondly, by simply comparing the entire matrix, producing one correlation coefficient per pair of signals.
The issue I am finding is that the two methods produce such wildly varying numbers that it makes me question my sanity, with the individual axes being in the range of 0.6-0.1 and the overall matrix coefficients being in the range of 0.95+.

I found documentation on the mathworks website that states

"The MATLAB® function corrcoef, unlike the corr function, converts the input matrices X and Y into column vectors, X(:) and Y(:), before computing the correlation between them. Therefore, the introduction of correlation between column two of matrix X and column four of matrix Y no longer exists, because those two columns are in different sections of the converted column vectors.
The value of the off-diagonal elements of r, which represents the correlation coefficient between X and Y, is low. This value indicates little to no correlation between X and Y. Likewise, the value of the off-diagonal elements of p, which represents the p-value, is much higher than the significance level of 0.05. This value indicates that not enough evidence exists to reject the hypothesis of no correlation between X and Y."

I was just wondering if these numbers make sense? and which, in your opinion, would be the best for comparing the signals?

Thank you in advance


texts: Illumination Normalization Paper: Help understand equation

texts:
I hope this is the right place to post this question.
Im reading a paper titled "Illumination Normalization Based on Weber’s Law With Application to Face Recognition"
Im only interested in Illumination normalization part of paper, the algorithm for the illumination normalization part is shown below;

WLD is Weber local descriptor.Alpha is "tune-able" parameter as described in paper. Algorithm is pretty self explainatory but here is the pdf link to paper.
Q) In the WLD part, I dont understand (highlighted part) i(del-of-x) and similarly, i(del-of-y). Isn't the del gradient ? Why would one take gradient of a pixel position ?
It is my first time reading a paper like this, it would be highly appreciated if someone would take their time out and help me understand this. I already have coded this but im not sure if I implemented it correctly,I can post code here, if needed.


texts: FFT-like algorithm for fast DTFT computation?

texts:
Good morning!

I'm coding up a project on a microcontroller to read in some analog audio (specifically, the sound of someone whistling: a near perfect sine wave) and determine which piano note tones are present in the signal.

Although the FFT is the obvious first choice, the frequencies I wish to detect in the signal don't line up with the FFT frequencies. Furthermore, I only want to detect around 10-15 frequencies, not the whole spectrum.

So my thoughts quickly turn to the DTFT, which can be implemented with a matrix multiplication (here is my prototype MATLAB code. Details provided on request). However, surprisingly, it still takes more computation than an entire FFT!

This brings me to my question. I've made all the obvious google searches ("fast DTFT", "FFT for specific frequencies") without much luck. Does anyone here know of an efficient DTFT method?


texts: comparison of speech signal processing and financial data

texts: I have read that in speech signal processing analysis when voice is segmented in brief temporary segments the series segments transitions from being non stationary to stationary. My question is if this is also the case for financial data when this data can be segmented in smaller and smaller time spand windows (stock market).


texts: What is the difference between "preprocessing" and "normalization"?

texts:
I am currently writing my bachelors thesis about on-line handwriting recognition.

In this context, there are different methods to make the input data more useful to classifiers / to make learning more effective:

Scaling the drawn symbol
Shifting the drawn symbol
Rotating
Re-sampling
Wild point detection

I think all of those techniques are preprocessing, because I apply them before the image is "processed" by the training / recognition algorithm.

But aren't all of those techniques also normalization techniques?
Where is the difference between "preprocessing" and "normalization"?


texts: Impulse Response to Frequency Response in Octave

texts: Having an impulse response of an audio system recorded as a wav file, how to calculate the frequency response of the system with octave?


texts: In block codes (channel coding), in practice how is the message length ($k$) fixed?

texts:
In block codes (channel coding), in practice, how is the message length ($k$) fixed?  If $k$ is large, the practical implementation of it requires huge memory if look up table approach is adopted.

What is the disadvantage with short $k$'s?  Code rate will degrade?


texts: Decomposing a DFT into multiple FFT calls

texts:
I'm using a good fast FFT implementation (vDSP) that will only work on power of 2 blocks of audio data.  Now I have a problem where I would like to be able to apply the calculations to non powers of 2 audio.

Some degree of reading around suggests that I can do this by breaking the DFT into smaller power of 2 blocks.

Can anyone explain how to do this, if indeed it is possible at all? I have been unable to find any explanations of how to do it ...


texts: SNR estimation in segmented speech signals

texts:
I was called to estimate the signal-to-noise ratio in a collection of recordings that were manually annotated, meaning that the speech and noise segments are known.

The noise is uncorrelated with the signal and is additive noise: $x(i)=d(i)+n(i)$ ('d' stands for desired). I have no information regarding the sound intensity (no sound meter was employed) neither the voltage-sound-intensity relationship in devices.

I found a formula here that seems to be a possible solution (authors explain the annotated way before diving into the no boundaries problem):

$$\text{SNR}=10 \log_{10}{\left(\frac{P(x)-P(n)}{P(n)}\right)}$$

Where $P(x)$ and $P(n)$ are the power of the contamined signal 'x' and the noise signal 'n' ('n' is basically a copy of 'x' but with zero energy in the speech segments). The mean was subtracted from both signals as requested in the paper.

When I apply the formula in two separate recordings (one clean and the other containing much noise, different signals and different noise) I am getting negative measurements: -6.250953 vs. -7.793706, and a difference of just 1.5 dB between them (I was expecting to see a 20dB diference).

Does it make sense to have negative numbers? How can I interpret the 1.5 dB difference in a meaningful way? Thanks in advance for any light on this!

Below are two copies of the same magnitude spectrum of the example of the clean recording I mentioned earlier (I did not include the noisy one). The formula estimated a SNR of -6.250953 dB. I did not include the oscillogram but it oscillates in the [-1, 1] range:

This is what I am taking as the $x(i)=d(i)+n(i)$ signal:

And this is what I am taking as the noise $n(i)$ signal (all energy except the black regions which represent the desired signal):

Therefore the formula can be applied very straightforward


texts: GNU Radio | Async FEC encoder/decoder loopback | Issue during decoding?

texts:
I have implemented a loopback flowgraph intending to perform the following:

FEC encode (repetition code) an input stream in16_2.dat
Store the encoded stream as out16_2_fec_async_enc.dat
FEC decode the encoded stream and store it as out16_2_fec_async_dec.dat

Follows the implemented flowgraph:

My expectation: I was hoping that out16_2_fec_async_dec.dat would be equal to in16_2.dat.

What really happened: out16_2_fec_async_dec.dat was empty.
I can confirm that the encoded data, out16_2_fec_async_enc.dat, is apparently correct, by running:

$ xxd -b in16_2.dat
00000000: 00000000 00000000 11111111 11111111 01010101 01010101  ....UU
00000006: 10101010 10101010

$ xxd -b out16_2_fec_async_enc.dat
00000000: 00000000 00000000 00000000 00000000 00000000 00000000  ......
00000006: 00000000 00000000 11111111 11111111 11111111 11111111  ......
0000000c: 11111111 11111111 11111111 11111111 00001111 00001111  ......
00000012: 00001111 00001111 00001111 00001111 00001111 00001111  ......
00000018: 11110000 11110000 11110000 11110000 11110000 11110000  ......
0000001e: 11110000 11110000                                      ..

Also, the confirmation that out16_2_fec_async_dec.dat is empty:

$ xxd -b out16_2_fec_async_dec.dat

I wonder what may be missing in this setup?
Please let me know if additional information is needed.
Thank you in advance!


texts: Interpolation in Contrast Limited Adaptive Histogram Equalization

texts:
I have been trying to implement the CLAHE algorithm and came across this page which states step by step procedure for the algorithm.

I understand the initial steps to perform HE of tiles in the image. But can't figure out how to perform the interpolation in the last step to remove the artificial boundaries between the tiles? Can someone explain this to me? It would be really helpful if someone explains it with a figure.


texts: Understanding FFT size in OFDM modulation

texts:
I know that the FFT size is the the number of subcarriers OFDM system have. But I also know that the FFT has to be $ 2^N $ big (in order to process N samples from time domain to frequency domain).

But here in Matlab I can set my N to 333 for example, and The program will run without any problem (of course, the constellation diagrams will be different if I use for example N = 256, but that's just it). Why is that? Did I misunderstand something?

1) Also, If I have 1024-OFDM modulation, and the constellation on subchannels is 64 QAM, my FFT size is in the name of the modulation, right? Is it 1024?. Because 64 is the number of constellation points (size of the QAM symbols), so it can't be it.


texts: What are the advantages of LTI ( Linear Time Invariant ) systems over other systems?

texts:
In our engineering academics, there is one subject named "signals and systems". In this subject only LTI system is discussed.

I want to know what are the advantages of LTI systems over other combinations like system which is stable and causal or system which is Linear and stable  ? Also,don't they  have any disadvantages?


texts: Measure 3-D length using smart-phone's accelerometer

texts:
I'm wondering if we can measure 3-D length only by our smart-phone's accelerometer. And we all know these low cost IMUs are not accurate.

You can model accelerometer's error this way:
$$ a = f*a' + g + b + \eta $$

where $a$ is the actual acceleration, $f$ is a 3x3 matrix modeling scaling, misalignments, cross-axis and ... errors. $g$ is gravity, $b$ is bias and $\eta$ is noise.

I'v found a good method to calibrate(compute $f$ and $b$) smart-phone's accelerometer:
Estimate smartphone accelerometer bias

Now I have to:

1) remove $g$

2) remove $\eta$

How can I do that accurately? As I mentioned above, this problem requires good accuracy.

If you believe accelerometers are not accurate enough for this problem, and other sensors should be used (Sensor Fusion), please share your idea.


texts:
I'd really appreciate it if someone could please explain to me the condition for a LTI system to be BIBO stable, in z-domain.

I have a background in control, and in linear control for example, if we have the transfer function, we simply look at the poles. But in digital signal processing, sometime we look at the poles - they should be inside the unit circle in order to have BIBO stability - and soemtimes the professor says it depends on the ROC - ROC should include the unit circle -.

I am really confused. Could someone please explain to me the difference?


texts: What is the reason behind complex conjugate pairs in Linear Phase FIR filter analysis from the Pole Zero plot

texts: When we say that a Generalized Linear Phase System must satisfy the pole zero plot with the condition that a complex zero not on the unit circle exist's in a pair of 4. Then I understand that I need the conjugate pairs to have real coefficients. Why do we need the complex conjugate reciprocal pairs and what role do they play for the FIR filter? I am aware that we use complex conjugate reciprocal pairs in case of all pass systems but how does that relate to the Linear Phase System if it even does.


texts: Preamble Detection and Frequency Offset Estimation in radio packets

texts:
I have generated a radio packet of data with a preamble header of 0x55555555 and crc32 for the data only.
The entire packet was separated in even and odd streams for I and Q. The I and Q were oversampled by a factor of 10.
The I and the Q were modulated into BPSK then then the I & Q were combined and mixed with the carrier and then transmitted. The transmission is random so I do not know when a packet starts or ends as the payload length is variable. The channel has multipath and noisy.

At the receiver I receive symbols with noise between the packets. I know there is frequency drift during transmission. I tried to frequency sync the packets, but I can not tell where the preamble starts from the collected symbols
If I demodulate the received symbols and search for the preamble I can not find it, because of the frequency drift.

What is a good approach to unlock this circular problem ?

Thanks.


texts: Fourier transform diagonalizes time-invariant convolution operators

texts:
I got the following paragraph from the book "A wavelet tour of signal processing" chapter one, page 2.

The Fourier transform is everywhere in physics and mathematics because
it diagonalizes time-invariant convolution operators. It rules over linear time-invariant signal processing, the building blocks of
which are frequency filtering operators.

How is it (illustrated) formulated mathematically?


texts:
Is it possible to enhance the image below and make it more readable?

I have tried apply binarization but there is some kind of shadow.

So I have tried to convert image to gray scale and then equalization

It is better, but still there is a problem with shadow and international vehicle registration code is not readable.


texts: my Butterworth lowpass formulas do not agree with Fisher webpage

texts:
I want to implement Butterworth low-pass filter. Thanks to this question, I have found out that the filter coefficients can be generated using Tony Fisher web-site or using his code. But the problem arose when I had tried to verify his formulas myself.

Wikipedia says that the derivation of low-pass formulas is simple: we start with the Butterworth polynomial of order n. I took n=1
$$B_1\left(\frac{s}{\omega_{cutoff}}\right)=1+\frac{s}{\omega_{cutoff}}$$

(note that $\omega_{cutoff}$ is angular frequency, not usual one) then do bilinear transform
$$s = 2f_{sampling}\cdot\frac{z-1}{z+1}$$

($f_{sampling}$ is usual frequency, not angular) and rewrite the resulting fraction in the form with non-positive powers of $z$.

To make the story short, my final formula for transfer function is
$$H(z) = \frac{Y(z)}{X(z)}$$
where
$$Y(z) = \frac{a}{1+a}+\frac{a}{1+a}z^{-1}$$
$$X(z) = 1-\frac{1-a}{1+a}z^{-1}$$
and
$$a = \frac{\omega_{cutoff}}{2f_{sampling}}$$
and the resulting formula is
$$y[n] = \frac{a}{1+a}x[n]+\frac{a}{1+a}x[n-1]+\frac{1-a}{1+a}y[n-1]$$
For testing I use $f_{cutoff}=1$ (which is $\omega_{cutoff}=2\pi$) and $f_{sampling}=30$.

We should not worry about coefficients in front of $x[]$ since Fisher multiplies them by gain factor anyway, but the coefficient in front of $y[n-1]$ equals

$$\frac{1-a}{1+a} = 0.8104139027$$

while Fisher's web-page for $f_{cutoff}=1$ and $f_{sampling}=30$ gives $0.8097840332$.

If you had a patience to finish this reading, may be you can explain, where I (or Fisher?) am wrong.


texts: Find the frequency response if i have the magnitude response?

texts:
if i have the transfer function of magnitude response is there a method that i could calculate the frequency response?

For example the transfer function of the magnitude response is:

$ 3db \pm  3.5db  $ for $|ν|<0.1$

$ <-55db $        for  $|ν|<0.2$


texts:
We know optical flow equation cannot be calculated without additional constraints. But what I cannot figure out is why it does not hold exactly for real images? This equation has gradient and so, it can be used to estimate the motion vectors by focusing on edges. Is it correct? How we add other constraints like smoothness into account?
Thanks


texts: For non-uniformly sampled data, how to decide whether interpolation or Lomb-Scargle periodogram is better?

texts:
When handling non-uniformly sampled data, we can use one of the following methods to estimate the frequency spectrum:

Interpolation in time/space domain, then go for classical periodogram OR
Use Lomb-Scargle periodgram

So my question is how do we decide when to choose method 1 and when to go with method 2?

Thanks


texts: How far can numerical differentiation be accurate for sinusoids?

texts:
Suppose you have samples of uniform interval of a sinusoidal signal that is some sum of sinusoids. Forget about aliasing, as the signal is bandlimited. If we have infinite number of samples at sampling rate right at Nyquist rate, we can technically infer the whole bandlimited function and of course differentiate. We cannot do that for finite number of samples.

Thus, my question is how far can numerical differentiation be accurate for each frequency - that is deviation from ideal frequency response - given $n$ samples of uniform interval. One can assume that the filter being used is FIR filter.

Parks-McClellan is often used to obtain an optimal filter, so my question can be rephrased as how required maximum frequency response error magnitude (relative to ideal frequency response of a differentiator) corresponds to upper bound on number of samples/taps/order required for the derived filter.


texts:
Suppose I take a grayscale image and break it into 8x8 pixel blocks, then take the DCT of those blocks.  What is the DC coefficient of the block in relation to the whole image?

To simplify I'm thinking of this in 1D.  I have a row of 64 pixels and I break it into length 8 vectors.  I pick one of these 8-vectors and take its DCT. The average of the 8-vector is not the DC term of the entire 64-row. Now suppose I took the DCT of the entire 64-row. What coefficient in the 64-pixel-DCT would the DC term of the 8-pixel-DCT be projected onto?

EDIT:
Thank you for the replies so far.  The context of this question is I'm trying to assign a cyles/pixel value to the DC coefficient of the 8-pixel sub-block, but in the context of the whole 64-block.  Its clear to me now that the DC coefficient of the 64-block is the average of the DC coefficients of each of the 8-blocks. But while the 8-block is a sample of the 64-block it doesn't make sense to me to say that the 8-block DC coefficient is actually 0 cycles/pixel. For example, one could represent nonzero frequencies using only these 8-block DC coefficients.


texts: I have a problem where I need to obtain 2D IFFT of a $81\times64$ signal. However, if we denote the reconstructed image $I_{m,n}$, its coordinates will be $M\times N$ but the k-space signal is sampled in a different fashion such as $k_x\in[-200,200]$ and $k_y\in[-200,193.75]$. How do i invert this sampled k-space signal? Thanks in advance.


texts: Variance of the Discrete Gabor Transform for practical implementation

texts: When we design a discrete Gabor filter for a 1D signal, how do we determine the variance of the filter, depending on the time step of the signal? Is there any empirical theorem/result that we should know about the Discrete Gabor Transform?


texts:
The goal is to find the FIR filter coefficients $\mathbf{h} = [5;3]$ with the help of the adaptive FIR filter $\mathbf{w}$ of order $p = 2$.

I have implemented the Stochastic approximation algorithm in MATLAB for this adaptive system identification problem.

$\mathbf{w}[k] = \mathbf{w}[k-1] + (1/k) \cdot \mathbf{x}[k] e[k]$

As input sequence I use white gaussian noise with zero mean and variance of 1.
Measurement noise is also WGN with variance of 1.

$N = 1000 $ ... number of measured datapoints

For the input sequence above my algorithm works fine and converges and I find the right $\mathbf{w}$.

However if I change my input sequence to $x[k] = 0.1 \cdot \cos(\pi k /(N/10))$ my algorithm doesn't find the right coefficients.

So my question is:

Is the Stochastic approximation algorithm restricted to special input sequences, and if so what is the optimal input sequence to use?


texts: Segmenting connected hand-written digits

texts:
By using Python (numpy/sklearn/opencv) I'm trying to process images with hand-written digits, and after all my main problem turns to be connected digits. For example:

If I crop the digits by hand I get expected output, by taking advantage from NIST dataset, and sklearn SVC classifier, but segmenting the digits seems like impossible task to me.
Does anyone know of programmatic approach (like library or similar) for this task, regardless programming language, but preferable in Python?


texts:
I want to shift the signal in frequency domain without going back to the time domain.

Is it enough to shift the samples of the spectrum only? How?


texts: Trying to write a signal "unsmoothing" algorithm

texts:
Up front: I'm just a hobbyist, and I know zero about signal processing; I'm trying to write a simple(?) javascript algorithm and hoping I don't need a PhD in DSP to make progress on it.

I have an input signal that often shows only the tiniest difference between the max value and the min value. I'm trying to figure out a way to convert the values such that the max is proportionally much larger than the min, with a steep curve in between. I've tried everything I can think of with exponents and logarithms, even just subtracting the min from the rest of the curve, but nothing seems to work. Part of the problem, as can be seen in my awesome diagrams below, is that the signal strength varies quite a bit; I don't know how to account for that. Also, sometimes the signal is already pretty spikey, and I don't know how to account for that either.

I've poked around with google, but I don't really know what questions to ask. I'm not sure whether there is a class of algorithms that does this sort of thing. I tried "signal unsmoothing", with no luck, and I don't know what else it could be called.

Some hand-drawn diagrams, placeholders while I try to learn how to draw curves on stackexchange. The two on the left show the kinds of signals I often get: varying strength, but the max is barely bigger than the min. The one on the right is what I'm trying to get: a big spike in the middle with a steep curve down to the min.

Is there a name for a class of algorithms that does this sort of thing? Is there a better way to formulate my questions so I can google more effectively? Is there a ridiculously trivial way to do this?

In case it helps, my ultimate goal: I'm modeling the movement of mosquitos. I'm working on getting them to move toward the smell of their prey while accounting for negative factors such as toxins in the air, or high temperature, as well as their jittery motions to avoid being squashed. It's going pretty well, except I have this chronic problem of the input signals being too flat for meaningful comparisons.


texts: Determining the type of filter on an image

texts:
I have the following mask where the origin is marked in bold text

$$ \left[ \frac{-1}{4}~~~{\bf\frac{1}{2}}~~~\frac{-1}{4} \right ] $$

After computing the DFT, the result is:

$$ \frac{1}{2} - \frac{1}{2} \cos(\omega)$$

How can I know what type of filter is it? All-pass, Low-pass, Band-pass, High-pass, Band-cut or All-cut?
To see the type of filter should I just plot it under the main frequency $ [-\pi, \pi] $?


texts: Fourier transform of a normalized vector

texts:
I was expecting that when I take (for example, in MATLAB), s2 = fft(s1/norm(s1)), the norm of s2 is not equal one, norm(s2) $\neq$ 1.

I cannot figure out why this is! Can anyone shed light on this?


texts: Producing images with subpixel shift in region of interest

texts:
Let's say for a zebra image, and at certain pixel location, I would like to makes it "vibrate/warp" to and fro in horizontal direction at a certain frequencies in a sequence of images of time t, with subpixel shift. The circled area is the most significant area that I intended to simulate the vibration. Those images will be mainly used for synthetic motion estimation.

In MATLAB, the the zebra image can be produced using the following code:

m=75;
n=75;
stripe_px=1;
single_pattern=[ones(m,stripe_px),zeros(n,stripe_px)];
zebra=repmat(single_pattern,[1 ceil(n/stripe_px*2)]);
zebra=zebra(:,1:n);

The magnitude of the subpixel shift indicates by this map below:

Also can be produce by MATLAB code:

X=repmat(1:m,[n 1]);
Y=repmat((1:n)',[1 m]);
Shape=0.04*( ((((X/m)-0.75).^2).*X) - ((((Y/n)-0.75).^2).*Y) );

Based on the information that I currently have, what's my next step? I was looking at imwarp (link), but I'm not sure if it can shift local pixels, where usually it was meant for whole image transform. And its usage is very vague for me. A simple pseudocode to depict what I'm trying to achieve would be:

omega=3;
T=30;
Fs=20;
dt=1/Fs;
for t=0:dt:T
    vibrate_im=(zebra + Shape) + sin(omega*t);
end

Can a wavelet transform be used for this subtle pixel shifting? If so how do I manipulate its coefficients?

Appreciate any input and help! Thanks in advance.


texts: DTFT of beat signal with shift due to multiplication

texts:
I am simulating a FMCW radar (Ramp signal is used for transmission)and I have created the transmit signal from matlab FMCW model

hwav = phased.FMCWWaveform('SweepTime',sweep_time,'SweepBandwidth',radar_bandwidth,'SampleRate',Fs);
hchannel = phased.FreeSpace('PropagationSpeed',co,'OperatingFrequency',radar_startfreq,'SampleRate',Fs,'TwoWayPropagation',true);
htx = phased.Transmitter('PeakPower',1,'Gain',tx_gain);
hrx = phased.ReceiverPreamp('Gain',rx_gain,'NoiseFigure',1,'SampleRate',Fs);
hcar = phased.RadarTarget('MeanRCS',1,'PropagationSpeed',co,'OperatingFrequency',radar_startfreq);

x = step(hwav);    % Generate the FMCW signal
xt = step(htx,x);  % Transmitted FMCW signal

After the reflection from the target the reflected wave is :
Some of the code delibrately missed.

xt = step(hrx,xt);

and it comes after some delay and then its multiplied with the transmitted signal to get the beat signal.

Now the multiplication is done between the received signal and the transmitted signal to get the beat signal. The matlab uses dechirp method to perform this operation.

radar_return = dechirp((xt),x);

So the output look like:

So I want to ask some questions related to it:
I came across the equation of mixed signal (Linear Frequency Modulated tx mixed with LFM Rx ) as
(1/2)*cos(2*pi*(fctd+(4B*R/Tp)*t))
fc= center frequency
td = delay time of pulse (From target reflection)
B = Bandwidth
R = Range
Tp = pulse duration
t = fast time (actual time)
Is this equation of the same signal which I have plotted, I am confused due to leading zeros I am getting in my mixed signal but in equation if I put the values of t then no zeros I am getting.

Also If yes the plot and the equation after mixing (matlab dechirp) are same. Then how can I remove leading zeros and make it signal with continous time and phase shift in the equation. In the equation there is a phase shift

2*pi*(fctd)

and In plotted signal received from mixing two Linear chirp signal I am getting zeros and the mix signal. How can I get the signal starting from t=0 with the same phase as in equation, since they both are same.

http://de.mathworks.com/help/phased/examples/automotive-adaptive-cruise-control-using-fmcw-technology.html


texts:
I'm looking for an algorithm for Vibrato audio effect for a cross-platform C++ program of audio processing. Now I use the realization from Chaotic-DAW sources. The problem is that Chaotic-DAW has a huge class hierarchy, and:
 1. I don't want to use such a huge library
 2. I cannot use it on Mac OS X (cannot compile)
 3. I will not be able to port the program to a microcontroller.

The necessary Vibrato parameters: delay, depth, period (cycle length).

Related topic on Software Recommendations.

Update. I have tried to isolate the Vibrato class, but the hierarchy is so large that it's impossible.


texts:
What is the simplest way to implement an all digital GMSK modulator with no multipliers? The implementation approach should be applicable to GMSK modulation with BT=0.5 or less (where intentional ISI is introduced to obtain higher spectral efficiency).

By "all digital" I am referring to the baseband modulation. The result will be IQ samples that fully represent the GMSK modulation at baseband.

The acceptable answer will be the simplest implementation with no multipliers needed that will generate a GMSK modulated signal that has a correlation coefficient with a "perfect" GMSK signal > 0.999 and a spectrum that will meet the spectral mask for GSM as shown in the plot below (which has a symbol period of 48/13 μs (i.e., 270.8333 kHz), that I got from this website: http://etutorials.org/Mobile+devices/gprs+mobile+internet/Chapter+1+Introduction+to+the+GSM+System/Radio+Interface/:

Please preface your answer with spoiler notation by typing the following two characters first ">!"


texts:
Let $G(z)$ be a real coefficient stable all-pass transfer-function with
degree greater than zero. Then it can be shown that $|G(z)| < 1$ for
$|z| > 1$: Given that the poles occur in complex conjugate pairs, one
way of establishing this property is as a natural generalization of the
case when

$$G_1(z) = \frac{1 − \alpha^*z}{z − \alpha}$$

where the superscript $∗$ denotes the complex conjugate operation.
By considering $1 − |G_1(z)|^2$ or otherwise show that $G_1(z)$ has this
property, i.e., $|G_1(z)| < 1$ for $|z| > 1$ .

I try to demonstrate  $|G(z)|^2 = G(z)G(z^{-1}) > 1$, but i don't know how to deal with the complex conjugate  $\alpha$ and $\alpha^*$. or my solution is totally wrong?


texts: What can be a limit to the maximum possible power of a pilot signal

texts: In practice, what can be a limit to the maximum power of a pilot signal in wireless communication?


texts: the ROC of a Z-transform for shifted signal

texts:
I have got two different answers for the ROC of the signal.
In that PIC, I have solved it in 2 methods, but I'm getting different answer.
Which one is correct?
Also please explain how to find the ROC of shifted signal?


texts: Is there any general knowledge regarding the costs of computation time (computation complexity) of filters? Like what types are "generally" less/more costly than others.


texts: What does it mean for a signal to alias to another?

texts: I know the definition of this is simple and I do understand the concept of aliasing (I think) in the way that multiple signals can be aliases of each other. For example, I get it when some one says: sampling of a 7-kHz sinewave at a sample rate of 6 kHz will provide a discrete sequence of numbers whose spectrum ambiguously represents tones at 1 kHz, 7 kHz, 13 kHz, 19 kHz, etc. However, how do you determine what aliases to what? Obviously I have a terminology problem. I understand that signals can be aliases of each other (right??), but cannot see what signal aliases to what other signal.


texts:
I am designing a Chebyshev filter and I am required to calculate the poles of it. It requires $1\textrm{ dB}$ pass-band ripple, a ripple factor of $0.5088$ and an order of $3$.

The equations for calculating the real and imaginary poles are shown below:

\begin{align}
s_k &= \sigma_k + j\omega_k\\
\sigma_k &= \sin\left(\frac{(2k-1)\pi}{2n}\right)\sinh(v)\\
\omega_k &= \cos\left(\frac{(2k-1)\pi}{2n}\right)\cosh(v)
\end{align}

However, when I calculate the imaginary part I get the following values:

\begin{align}
\sigma_1 &= -0.96\\
\sigma_2 &= 0\\
\sigma_3 &= +0.96
\end{align}

However, according to my solutions I should get $+0.96$ and $-0.96$. This checks out with the values from this link.

Is there some sort of rule to invert the values?


texts: What does it mean compute spectra of Center of Press?

texts:
Recently, I studied a paper called "What Does Your Chair Know About Your Stress Level?

It can be download at the link below.

  http://www.barnrich.ch/wiki/data/media/pub/2010_what_does_your_chair_know_about_your_stress_level.pdf

at page 209,
Section IV-A mentioned that

  In order
  to characterize the movement properties of the CoP, we have
  computed the corresponding spectra over the experiment stages
  3–7. Fig. 5 shows the spectra of the norm of the CoP

I can understand that the meaning of Fig.4.
However, I don't understand what does Fig.5 mean.
How did they compute "the norm of the CoP" to "the spectra of the norm of the CoP"?
And what does the graph's axis mean?

Thank you.


texts: What is the cut-off frequency of a moving average filter?

texts:
I need to design a moving average filter that has a cut-off frequency of 7.8 Hz. I have used moving average filters before, but as far as I'm aware, the only parameter that can be fed in is the number of points to be averaged... How can this relate to a cut-off frequency?

The inverse of 7.8 Hz is ~130 ms, and I'm working with data that are sampled at 1000 Hz. Does this imply that I ought to be using a moving average filter window size of 130 samples, or is there something else that I'm missing here?


texts: $\mathcal Z$-transform if the output is given

texts:
A impulse response for a LTI system is given by:

  $$h[n]=\left(\frac{2}{3}\right)^n u[n]+2 \left(\frac{1}{5}\right)^n u [n]$$

  and if the putput for the system is given by:

  $$y[n]= \left(\frac{1}{3}\right)^n u [n] $$

  What is the input in the $z$-domain ($X(z)$)?
  And what is the output in the time-domain ?

I'm not sure what is the correct procedure for solving this type of problem. Can you just simply transform $y[n]$ into $Y(z)$ and then solve for $X(z)$?

$$\frac{Y(z)}{X(z)}=\frac{3-\frac{23}{12}z^{-1}  }{\left(1-\frac 23z^{-1}\right)\left(1-\frac 15z^{-1}\right) }$$

Then I replace $ Y(z)$ with $\frac{1}{1-1/3z^{-1}}$ and then I isolate $ X(z)$.

$$\frac{\frac{1}{1-\frac 13z^{-1}}}{X(z)}=\frac{3-\frac{23}{12}z^{-1}  }{\left(1-\frac 23z^{-1}\right)\left(1-\frac 15z^{-1}\right)}.$$

Then I get $X(z)=\frac{6z^-2-39z^{-1}+45}{23z^{-1}-11z^{-1}+135}$ and then I transform it into a sequence in the time domain.

Is it right? or is there a better method for solving this.


texts: Sin wave spectrum shows multiple frequency

texts:
I am very new to DSP, so excuse my ignorance.

Using Audacity, I generated a sine wave of:

frequency 440Hz
amplitude: 0.8
duration: 1 minute

Now when i plot the spectrum for this sine wave, I get an image like this:

This is really surprising for me.

I was expecting a single surge at 440 Hz for the pure tone. But this is entirely different.
Sure this is not anything to do with noise. Right ?

My question

How can the spectrum of a pure tone have so many frequency components in the spectrum.

What obvious am I missing ?