texts: confusion related to finding inverse Z-Transform using Complex Integral Method

texts:
I am facing problems related to evaluation of inverse Z-Transform using Complex Integral Method;
Consider $X(z)=\frac{z}{z-2}  $ and $ROC: |z|>2$
then, $$x(n)= \frac{1}{2\pi j}\oint_c X(z) z^{n-1} \, dz$$
$$\implies x(n)= \frac{1}{2\pi j}\oint_c \frac{z^n}{z-2} \, dz \quad \dots (1)$$
$$\implies x(-1)=\frac{1}{2\pi j}\oint_c \frac{1}{z(z-2)} \, dz$$
$$=z\frac{1}{z(z-2)}|_{z=0} + (z-2)\frac{1}{z(z-2)}|_{z=2}$$
$$=-\frac{1}{2} + \frac{1}{2} =0$$
which is obvious as $x(n)=2^n u(n)$ (by inspection), $\implies x(-1)=0$
But for the same $X(z)$ , if $ROC: |z|<2$
then, from $eq(1)$ , we get:
$$x(1)=\frac{1}{2\pi j}\oint_c \frac{z}{z-2} \, dz \quad \dots (2)$$
$$=2 \quad \text{(from Cauchy's Integral Theorem)}$$
but $x(n)=-2^n u(-n-1)$ (by inspection), $\implies x(1)=0$
so,

How $c$ is defined in Complex Integral Method for a given $ROC$ ?
How can we evaluate $eq(2)$ ?


texts:
I got ValueError: operands could not be broadcast together with shapes (194,259,3) (600,800,3) with the below code:
import numpy
import math
import cv2
original = cv2.imread("original.png")
contrast = cv2.imread("compressed.png",1)
def psnr(img1, img2):
    mse = numpy.mean( (img1 - img2) ** 2 )
    if mse == 0:
        return 100
    PIXEL_MAX = 255.0
    return 20 * math.log10(PIXEL_MAX / math.sqrt(mse))

d=psnr(original,contrast)
print(d)

What was the problem with the implementation?


texts:
I've been attempting to work on signal transformation and filtering for the past few months. It's a bit difficult, but I've been making progress.

I was wondering if anyone had any simple examples to show loading in a wave file, editing the volume and frequencies of that file, and re-outputting it to a file? I've already gotten up to volume, but I just can't edit the frequencies.

I thought that by using FFT, I would gain direct access to the frequencies of the sound file. Was that incorrect? I recall looking at frequency bins and such, but I don't see how that ties into wave files.

I know it might sound really complex, and I don't want to ask for a lot,  but could someone post or link to an example? It would really help me out.

I'm using Python, with Windows 64-bit. I'm already using Scipy and NumPy for FFT and wave file input / output.

I want to basically be able to low-pass or high-pass filter a sound by code, as well as be able to read the frequency data in each sample (i.e. see how high- or low-pitched the sample is).


texts:
I'm projecting a series of points onto a surface and then recording their locations in the corresponding image.  However, if one goes pixel by pixel a single point may, at times, take up multiple pixels and would thus be recorded multiple times.  What is the best (least error prone) way to determine the location of a point?  I've thought of simply scanning the image line by line checking to see if a pixel corresponds to that of a point, grouping the pixel clusters together based upon distance, and taking the center of this cluster to be the coordinate of the point.  Perhaps something like an R-tree where I can order things by distance?

Any suggestions? Or tried and true techniques?


texts:
The wavelet transform informs  what all derived wavelets (from mother wavelets) with different scales at different point of time , are present  (along with the associated strength) in my original signal.  I am not able to understand how do I now correlate it with FFT that simply gives what all sine and cosine waves are present.

Now how do I make use of this information that I get from WT? I cannot say unlike as in case of FFT or STFT " we have a 100hz frequency in the window of 4 seconds". I will have to say "we have a db4 wavelet present  in some window". How it will make sense. How do I interpret this in a meaningful way?


texts:
I have a question regarding my homework.

  Let's assume that the transform of $x[n]$ is $X(\omega)$.

  Find $Y(\omega)$ as a function of $X(\omega)$:
  $$ y[n] =\cases{x[n/2],&\text{if } n \text{ is even}\cr 0,&\text{if } n \text{ is odd}}$$
  Find $Z(\omega)$ as a function of $X(\omega)$:
  $$ z[n] =\cases{x[n/2],&\text{if } n \text{ is even}\cr x[(n-1)/2],&\text{if } n \text{ is odd}}$$


texts: Maximum Likelihood Estimation in Presence of Colored Noise

texts:
I am trying to test system identification in presence of measurement noise (1) A white Gaussian noise (2) Colored noise - pink, violet. When we are estimating parameters we do so in presence of iid, zero mean uncorrelated noise.

Q1: I would like to know if the colored noise are correlated or not. I think they have different distribution but I could not find any information if the samples will be correlated or not.

Q2: In estimation we assume that noise is additive white gaussian noise which is uncorrelated iid. What happens when the noise is not gaussian then how do we estimate theta?
For ex: $x = s(\theta) + Colored noise$
where we are trying to estimate $\theta$. Will the performance i.e, MSE vary with different levels of colored and non colored noise?


texts: period detection for a series of photons

texts:
I have a dataset which records the arrival time for a series of photons.
I am using lomb-scargle method of scipy.signal to try to find some kind of period.

Since the arrival time is random,how to express the intensity of the signal?
If I bin the dataset and let the photon counts in every bins be the intensity , the dataset changes to a evenly spaced new dataset and information is lost.

lomb-scargle is good at finding period for unevenly spaced data.
Is it necessary to bin the data? If I bin the data, part of the data info will be lost(?) and I can use fft directly.


texts: Lesser bins histogram looks more equalised than higher bins histogram after histogram equalisation?

texts:
I tried to do a histogram equalisation on an image, and then display its histogram. I realise that when I show the histogram with 10 bins, it looks more "equalised" than when I show the histogram with 256 bins. Here's is an image of the 10-bin and 256-bin histograms of the same image after running a histogram equalisation:

So again, in the image above, clearly, the histogram with 10 bins looks more equalised than the histogram with 256 bins. Since both the histograms reflect the colour pixels for the same image, is there reason as to why the 10-bin histogram looks more equalised than then 256-bin histogram?


texts: Converting a non-stationary random process into a WSS process by adding a random phase

texts:
Here is an example where this method has been implemented.

We were trying to calculate the spectrum of a transmitted signal(Random signal/weighted pulse)

The auto correlation function of the pulse which is not WSS because it is dependent on t:

We associated a random variable(which is the delay) with an uniform PDF with the signal:

PDF of the delay/the variable is:

I was unable to grasp the concept behind it, probably my basics are a bit rusty.

By simply just associating a random variable (with an uniform PDF), how can we just make any random process a wide sense stationary process?
Whats the concept behind it?


texts:
Say, I have original image, noised and denoised. By PSNR value I want to find out how good does my denoising algorithm works.

For which pair of the images should I calculate it? I've tried it for original+noised, noised+denoised and original+denoised and got PSNR = 28, 29 and 31 respectively.

What value shall be appropriate?

I'm calculating PNSR as here.


texts: Low Pass Filter to Maintain Edge Information

texts:
I am looking for a kernel acting as a low pass filter that satisfies these conditions:

$$K(-\mathbf{u})=K(\mathbf{u}) \tag{1}$$
$$K(\mathbf{u}) \ge K(\mathbf{v}), \;\; \text{if} \;\; |\mathbf{u}|<|\mathbf{v}|, \;\; \text{and} \;\; \lim_{|\mathbf{u}|\rightarrow\infty} K(\mathbf{u})=0  \tag{2}$$
$$\int K(\mathbf{x})d\mathbf{x} = 1 \tag{3}$$

In the reference paper, the author suggested a Gaussian kernel that is:

$$K_\sigma(\mathbf{u})=\frac{1}{\left(\sqrt{2\pi}\sigma\right)^n}e^{-|\mathbf{u}|^2/2\sigma^2} $$

with a scale parameter $\sigma > 0$.

The Gaussian kernel is very good at approximating the required properties. But the kernel reduces edge information when the kernel size is large.

Could you suggest to me any kernel that can satisfy the three conditions above, and is more robust than Gaussian in noise reduction, while maintaining edge information? I found a modified kernel, but it was very difficult to implement. Thank you so much.


texts: Equivalent of Fourier transform for Gaussians?

texts:
I have a long signal (million of samples) containing a lot of Gaussian peaks, whose standard deviation is random and about $5$ to $50$ samples wide. Sometimes, these peaks overlap, but not often. The signal also contains high frequency noise.

I would like to compute the distribution of standard deviations, in a similar way one can extract the "distribution of frequencies" using FFT. Currently, we do a first pass for detecting the peaks, then do a classical function fit in the peak region. This is not very robust and the distribution fluctuates a lot depending on the fitting algorithm fine tuning.

Is there a more robust approach which would do a kind of a Gaussian transform?


texts: Coding a Variable Delay with LFO (MATLAB/C)

texts:
I am trying to code a Variable Delay (chorus/flanger) effect in MATLAB using a paradigm that would be friendly for porting to a lower level language like C.  What I currently have is a working echo/delay that uses read/write indices to write into a buffer.  I'm now trying to use an LFO (low freq sine wave) to modulate the delay time but can't seem to figure it out.  Sometimes my errors sound "cool" but they aren't correct or what I was trying to do.

% Create LFO
lfo = abs(sin(2*pi*lfo_rate*[0:length(output)]/fs));

    % Perform the Echo Loop
    for i=1:length(x_t)

    % Write Sample Into Delay Buffer
    buffer(writer) = x_t(i);

    % Get All Delay Into Output
    if i <= length(x_t)
        output(i) = x_t(i) + (b_n * buffer(reader));
    elseif i > length(x_t)
        output(i) = b_n * buffer(reader);
    end

    % Circular Buffer
    writer = writer + 1;
        if writer > length(buffer)
            writer = 1;
        end
    reader = reader + 1;
        if reader > length(buffer)
            reader = 1;
        end
    end

I've been trying to use the LFO Vector to modulate the readers position, but I'm pretty much stuck and the stuff I can find online about this sort of thing isn't too helpful either.


texts: Why is the sound field intensity due to $K$ point sources given by $ I(p,\omega) = \sum_{k=1}^K \sigma_k^2(\omega) \delta(p - p_k)$?

texts:
I am trying to understand the following piece of text. I am not used to dealing with sound intensity and power so I'm not familiar with the derivation of the formula $(*)$ below.

Statement: 1.

We assume there exist $K$ point sources in the far-field indexed by the letter $k$. Each propagates in the direction of the unit vector $p_k$. Then the signal coming from direction $p ∈ S$ is given by $x(p, ω, t) = \tilde x(p, ω)e^{jωt}$,where $\tilde x(p, ω)$ is the emitted sound signal by a source located at $p$ and frequency $ω$. The intensity of the sound field is then
$$
I(p,\omega) = \mathbb{E}[|x(p, ω, t)|^2] = \sum_{k=1}^K \sigma_k^2(\omega) \delta(p - p_k), \tag{$*$}
$$
where $\sigma_k^2(\omega)$ is the power of the $k$-the source and $\delta(p)$ is the Dirac delta function on the unit circle.

Question

How is $(*)$ derived? The formula for intensity on Wikipedia is
$$
I(r) = P/A(r),
$$
where $P$ is the power and $A(r)$ is the surface area of a sphere of radius $r$. The formula in $(*)$ doesn't seem to make any use of a sphere of radius $r$..and it also features Dirac deltas which aren't in the Wikipedia formula.

So what is the relationship between the Wikipedia formula and the formula $(*)$?


texts: Why is the gain of my IIR filter positive?

texts:
Sorry, two questions in one day!

I'm struggling to understand what I'm doing wrong in this very simple filter design. I want to design a simple, single pole low pass filter and implement it as an IIR in an embedded system.

I was looking at the DSP book online at recursive filters, and using their single-pole example to get started: http://www.dspguide.com/ch19/1.htm

According to the next page the coefficients I should need for the IIR single pole low pass filter are:
$a_0=1-x$ and $b_1=x$

In order to get $x$ they give the equation (19-5) of $x=\epsilon^{-2\pi f_c}$

Given an fc of 0.125, I calculate x = 0.455938. Is this correct?

An fc of 0.125 at a sampling rate of 8kHz is 1kHz.

I don't see why when I try to get the frequency response of this filter I end up with entirely positive gain, as shown below:

http://www.valvers.com/wp-content/uploads/2013/01/butterworth-lowpass-positive-gain.jpg

Here is the code I've been using:

%Start from nothing!
clear;

% Set the sampling frequency used by our digital filtering system:
fs=8000;

% Set the coefficients up (As already worked out!) for a single-pole low pass
% filter. This should give us -3dB @ 1kHz with -6dB/Octave roll off
a = [ 0.544062 ];
b = [ 1, 0.45594 ];

% Determine the frequency response of the filter design above. Get the output
% in frequency rather than rad/s. Use 64 plot points.
[H,f] = freqz(b, a, 64, fs);

% Show our cutoff frequency
cutoff = -3 * ones(64);

% Plot the result so that we can see if it is correct:
figure(1);
plot(f, 20*log10(abs(H)), f, cutoff);
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)');

I'm again, just stumped as to what's going on, and don't know how to solve the issue.


texts: Prewarping both resonant frequency $f_0$ and bandwidth (or $Q$) when using bilinear transform

texts:
RBJ's Audio EQ cookbook takes into account only frequency prewarping when  case Q is used for bandwidth. Why not $Q$ prewarping as well with some of those filter types defined there?
At KVR I got info that BLT turns to kind of II (Impulse Invariant) when both prewarpings are in use and BLT looses some nice properties in that case.

Well, I tried the $Q$ prewarping and made few plots:

Right column plots uses EE's $Q$ definition just for the (original) cookbook. Did not check the situation of phases.

If my plots are correct then it looks like prewarping $Q$ might bring some improvement at least for peak filter magnitude. For LP filter, situation is different.

BTW, some doctoral thesis showed plots where both prewarpings were used and set to have same factor. How's that factoring done?

Any thoughts?

EDIT: Plots showing the end results for this query.

Clarifications can be found from RBJ's answer and comments related to that answer.


texts:
I am having trouble understanding the FSK modulation process. There are many ways of demodulating the FSK signal.

What is the advantage of performing the FSK using IQ modulation?
How to demodulate the FSK signal?
Does the FSK signal look triangular wave or sinewave?


texts: Intermittent Harmonics, Is there a physical explanation?

texts:
I am doing some frequency analysis of a vibration signal from a spinning rotor,

I am expecting to see peaks corresponding to the rotational frequency of the rotor. So the fundamental frequency should be ~0.7Hz, then I am assuming I should then see multiples of this corresponding to the harmonics?

I can clearly see peaks at ~ 1.4Hz, 2.8Hz, 3.5Hz, and 4.2Hz but nothing at 2.1Hz which I cant understand

I am not sure whether the explanation for this can be explained physically or if its related to my sensor setup / analysis methods? I dont think it is related to the frequency resolution since this is around 0.03 Hz which seems suitably low.

It seems likely to me that there is some kind of weighting to specific harmonics and the 2.1Hz harmonics is somehow damped but I can't think why this would be the case.


texts: Different results applying DFT (formula only) and FFT on Matlab?

texts:
I have this function in time-domain and in frequency domain after fourier transform:
$$s_1(t) = (t-2)e^{-t}u(t-2) $$
$$S_1(f)=\frac{e^{-2(1+j2\pi f)}}{(1+j2\pi f)^2} $$
First I create a time vector and a frequency vector ranging from [0s,8s) and [-50hz,50hz) respectively and evaluate them on my functions, using these lines:
s1=(t1-2).*exp(-t1).*heaviside(t1-2);  %s1(t)
S1f=(exp(-2*(1+(2*pi*f1*1i)))./((1+(2*pi*f1*1i)).^2));  %S1(f)

What I get when plotting magnitude/phase is this:

After that, I wanted to compare those results using FFT command in Matlab, so I did this:
S1k=fft(s1);
figure % creates a figure
subplot(2,1,1)     %creates a grid of 2 plots in one figure, selecting the   stem as the first plot
stem(k1,abs(fftshift(S1k,2)),'red') %plots magnitude of S1f
title('Magnitude vs Frequency')
subplot(2,1,2)      %selects the phase plot as the second one in the grid
plot(k1,angle(fftshift(S1k,1)),'blue') %plots magnitude of S1f

title('Phase vs Frequency')
And the result, to my surprise, is this:

As you can tell, there are plenty of differences in both plots, though "shape" its similar at least in the magnitude plot, but with different values in the y-axis.
What can be the problem? I'm sure the fourier transform I did by hand is good, but yet results are different.
Why? Isn't FFT and DFT similar except for the speed of calculation?
Any hints will be appreciated.


texts: Why there is error between My DFT and built in Matlab FFT?

texts:
I'm trying to implement DFT/IDFT and FFT/IFFT in Matlab and C.

I got wrong values while I implement IDFT/IFFT. So I'm trying to find a mistake.

Just for DFT, I used this algorithm to implement it in Matlab (from matlab's fft doc)
But I really don't know why there is very small errors when I run this code.
and even my Radix-2 FFT have same problems.
Is there anything I'm missing or can I ignore this values? (mean of 256 values : -1.6881e-25)

Thank you for reading this.

for i=1:256
    x(i) = sin(2*pi*i*80) + sin(2*pi*i*46);
end

X = zeros(256,1);
for k=1:256
   for n=1:256
       X(k)=X(k) + x(n)*exp((-j*2*pi*(n-1)*(k-1))/256);
   end
end

built_in = fft(x);
error = abs(X) - abs(built_in)';

plot(abs(X)); hold on
plot(abs(built_in));
plot(error);
legend('My code', 'Matlab','error');

with result:


texts: What is the difference between Time-Frequency Represenation and TF Decomposition

texts:
I'm asking as I'm looking at Wavelet transforms, and I see that it is possible to have a TF decomposition or a representation of the signal.

Looking for example at the code here we can see that the TF representation
(tfr_morlet function)of a signal returns the averaged power and optionally the intertrial coherence.

The TF decomposition function (cwt_morlet, line 167) on the other hand returns Time Frequency Decompositions (n_signals x n_frequencies x n_times) arrays.

What does each process do in this sense?


texts: Condition for modelling noise as white noise

texts:
I am reading a book on Communication System by Simon Haykin. In the topic of white noise there is a paragraph

"We may state that as long as the bandwidth of noise process at input of a system is appreciably larger than the bandwidth of the system itself we may model the noise as white noise".

1) What is the reason for this statement?

Further I also read about Noise Equivalent Bandwidth, in which we replace an arbitrary low pass filter with transfer function H(f) with an ideal low pass filter of constant frequency response H(0) and bandwidth B.

2) Is the reason for doing so is to make sure that bandwidth of noise process at input of a system is appreciably larger than the bandwidth of the system itself we may model the noise as white noise ?

3) Is there any other conditions to satisfy before modelling the noise as white noise?

Thank you in advance for your help.


texts: Removing gravity from a non-orthogonal body

texts:
I am not sure where to post this question, if it is not appropriate here can you suggest where shallI post it to?

Question:

I have a Cube with dimension of x,y,z. I am trying to do some integration to the accelerometer value. The problem I have now is that I can't assume that I should remove the gravity of 9.81m/s^2  from say in my case, Y direction only, because when moving in a non orthogonal line, the gravity is activity not only on Y, but also in  X and Z.

(TOP) How the perfect movement should have therefore gravity in only Y direction
(BOTTOM) Real movement

I have an Euler angle to estimate the amount of rotation from each axis, but I am not sure on how to deduct the gravity accurately in this case.


texts:
Does anyone know how to find information on the derivation (rather than the definition and application) of Teager's Energy Operator, both for the continuous and sampled case.
I have Kaiser's early papers "On a simple Algorithm to calculate the 'Energy' of a signal" and "Some useful properties of Teager's Energy operator" but these seem to stop short of giving the derivation.


texts: Normalizing loudness level of a set of songs

texts:
I like to listen to instrumental music while trying to sleep. So, I've selected 20 songs from my music archive to listen to when I go to bed. The problem is that the loudness levels of the songs differ. Therefore, I have difficulty listening to some songs while the others disturb me for a specific volume level. I want to normalize the loudness of them and set it to a common value programmatically (e.g. using MATLAB).

I thought the following:

n <- number of songs
a <- an array of values initially 0 (length n)
for i = 1 to n
    partition song i into overlapping windows (e.g. window length of 1024, shift of 512)
    let s_j's involve the values in j'th window where j = 1 to #windows
    a(i) <- max_j sum(abs(s_j))
end for
m <- mean(a)
for i = 1 to n
    rescale all the amplitude values of song i by m/a(i)
end for

What should I take into consideration to normalize the songs' loudness levels? What strategy do you recommend? I can write the MATLAB code easily from a pseudocode.


texts:
I've just stepped into the FFT's world since the last weeks, therefore I still don't have an clear overall idea of how to setup the frequency array.

In case of even number N, I usually do (with respect to the Nyquist cut-off frequency)

$f=\left(-N/2\,:\, N/2-1\right)*f_{s}$

but how does it work in case of odd number N. Is it just

$f=\left(-(N+1)/2\,:\,(N+1)/2-1\right)*f_{s}$

I thank you all in advance.


texts: Regarding the choice of cost function in adaptive control - squared error vs absolute error

texts:
I did search the question database regarding this question, and although one or two questions came close, they didn't really address my specific question.

In adaptive control based on minimizing tracking error (e.g. between plant and model), the designer is free to chose a cost function. More often than not the cost is selected as a function of the squared error.

But I've found in some practical applications that I can achieve a more robust controller by using absolute error. I understand that absolute error provides a more uniform weighting on the size of the error, and I suspect the squared error tends to 'wind-up' the adaptive controller with initially large errors. But I'm not sure how to show this in a generalized way. So I have two questions regarding this:

Is there perhaps a simple analysis that can demonstrate the stability characteristics between absolute and squared error choices in the cost function?
Any references on the matter?


texts: Extracting image metadata programatically

texts:
I hope this is the right location to post this, as my question isn't really stack-overflow material but involves images.
I have hundreds of SEM-Images like this:

and need to track changes in certain features over the position at which the image was captured. This is why I would like to automatically retrieve metadata using something like bash or python for all images and save ti in a csv file or something.

The manufacturer of the SEM implements metadata on the images in the file itself, but I haven't had much success retrieving it. It doesn't show in the EXIF header if I inspect it with gimp or with image-magick's identify image.tiff. I only saw it if I save the image as an .xml file and view it in a texteditor.

The manufacturer ships an .exe program to inspect images, but as I am using Linux and have hundreds of images from which to retrieve the sample position, this isn't a very useful method for me.

Before I start writing a python / bash program that will convert the files to xml and use complex regex stuff to retrieve what I am looking for, I wanted to ask if anyone could imagine a simpler approach. My knowledge on image metadata is very limited.

Thanks in advance :)


texts: Need help to understanding concept of particle filter

texts:
I get confuse with the basic theory of particle filter for tracking single object..
What I want to ask is:

In some paper, they explained about velocity in state vector.. Are we
randomly put number to velocity or get it from some formula?
In pdf by eiji ota, he desrcibe system model as Xn=f(Xn-1)+Wn where Wn is noise.. Why need noise in particle filter?
And can you give me simple explanation in prediction step how the particles predict at t=1? I'm still blank in there..


texts: Time Period of one Cycle is way too large

texts:
I am calculating Time period of Sine/Cos Wave with different frequencies while keeping the Sampling Frequency at 1MHz and plotting it, but in some cases the value of time period is too big,

have a look at some of the examples.

n=[0:0.1:10] %because Time period is 10

F1=100*10^3; %100KHz  and t=1*10^-5
Fs=1*10^6;  %1MHz => Sampling Frequency
T=1/Fs;    %1*10^-6

%Time period = t/T => 10

xn=cos(2*pi*(F1)*n*T)   %T=1/Fs
stem(n,xn);

ylim([-1.5 1.5]);
xlim ([0 10]); %because Time period is 10
grid on;

Here Time period = 10 which means one oscillation would take 10seconds to complete.
and here is the output as i expected,

Similarly in second case when i changed the frequency to 10Hz while the Sampling frequency remains 1MHz the value of Time period is way too big,

n=[0:1000:100*10^3] %because Time period is 100*10^3

F1=10; %10Hz  and t=0.1
Fs=1*10^6  %1MHz
T=1/Fs;    %1*10^-6

%Time period = t/T => 100*10^3

xn=sin(2*pi*(F1)*n*T)

stem(n,xn)

ylim([-1.5 1.5])
xlim ([0 100*10^3])  %because Time period is 100*10^3
ylim ([-1 1])
grid on

and the output wave is,

is it the correct value or am i doing some sort mistakes calculating the time period ?


texts: Bandwidth computation for NRZ baseband transmission scheme

texts:
In Andrew Tanenbaum's book on Computer Networks, while explaining about bandwidth of a NRZ (Non Return to Zero) baseband transmission scheme, he says the following:

  With NRZ, the signal may cycle between the positive and negative levels up
  to every 2 bits (in the case of alternating 1s and 0s). This means that we need a bandwidth of at least B/2 Hz when the bit rate is B bits/sec. This relation comes from the Nyquist rate [Eq. (2-2)].

I have 2 questions here.

What does the first statement mean exactly? Does the author imply that for a signal that switches between 1s and 0s alternately, if a particular bit is a 1, then the next time we get a 1 again is after 2 bits?
How does the first statement suggest the second statement?

The following excerpt from the book explains Nyquist's theorem and is followed by Eqn. (2-2).

  Nyquist proved that if an arbitrary signal has been run through a low-pass filter of bandwidth B, the filtered signal can be completely reconstructed by making
  only 2B (exact) samples per second. Sampling the line faster than 2B times per
  second is pointless because the higher-frequency components that such sampling
  could recover have already been filtered out. If the signal consists of V discrete
  levels, Nyquist’s theorem states:

$$maximum\; data\; rate = 2B \log_2 V \;bits/sec$$


texts:
I am working on speech recognition for Hindi language. My approach is to map speech to text based on phones. For this, first split the speech into the words and then map each word to text by detecting phones. Till now I am able to split the speech audio file into separated words audio files (I used energy levels for this).

Number of different phones is 1023. For each phone, I have extracted MFCC coefficients for every 10ms frame. (So different phones have different number of frames and for each frame I store 38 coefficients. This serves as templates for each phone.) Also for each word in speech, I extract MFCC coefficients for every 10ms frame.

But I am unable to find efficient algorithm to map word into sequence of phones. I have been thinking of two approaches for this:

Naive bruteforce approach in which I simply try to match every possible group of frames in word to every available template (using DTW) and then select the closest match. But this is very inefficient method.
Split word into phones. Then for each phone select most appropriate template from 1023 available templates (using DTW). But in this approach, I am not getting how to split word into separate phones.

Is there any another approach to solving this problem? Or can it be done efficiently using second approach?


texts: Determine impulse resonse of First Order Hold (FOH)

texts:
Question, how can I determine the impulse response function of a first order hold? On Wikipedia it is simply stated as:

$$ h_{\mathrm{FOH}}(t)\,=  \frac{1}{h} \mathrm{tri} \left(\frac{t}{h} \right)  = \begin{cases} \frac{1}{h} \left( 1 - \frac{|t|}{h} \right) & \mbox{if } |t| < h  \\
0 & \mbox{otherwise}
\end{cases} \ $$

But given it's implementation
$$f(t) = f(kh) + \frac{t - kh}{h}(f((k+1)h) - f(kh)) \text{ with }kh \leq t < (k+1)h$$

how do I obtain $h_{FOH}(t)$?

--edit--

So if $f(kh)=δ(0)$ for $k=0$.

For $k=−1$, e.g., $−h≤t<0$ we get $f(t)=f(−h)+\frac{t+h}{h}(f(0)−f(−h))$ combined with $f(−h)=0$ this results in $f(t)=\frac{t+h}{h}\delta(0)$.

For $k=0$, e.g., $0≤t<h$ we get $f(t)=f(0)+\frac{t}{h}(f(h)−f(0))=δ(0)−\frac{t}{h}\delta(0)$.

So we get
$h_{\mathrm{FOH}}(t)\,=  \begin{cases} \frac{t + h}{h} \delta(0) & \mbox{if } -h \leq t < 0  \\ \delta(0) - \frac{t}{h} \delta(0) & \mbox{if } 0 \leq t < h  \\ 0 & \mbox{otherwise} \end{cases}$

what then follows, is that you have to "see" that this equals the formula with $\text{tri}$ function, as at the start of this message.

clear all;
close all;
clc;

h = 0.01;
t = -1:h:1;

for i = 1:length(t)
    if -h <= t(i) && t(i) < 0
        y(i) = (t(i) + h) / h;
    elseif 0 <= t(i) && t(i) < h
        y(i) = 1 - t(i)/h;
    else
        y(i) = 0;
    end
end

fohImpl = @(t,h) triangularPulse(t/h);

figure(1);
plot(t,y);
hold all;
plot(t,fohImpl(t,h));


texts: Is it possible to estimate what the white noise floor should be, and after cross-correlation?

texts:
I am simply sending a signal from a function generator, split it into two signals, and then send it into two inputs of an oscilloscope which can interface with my PC. I take the FFT of these two signal inputs and see a noise floor around 1e-7 V, but how can I know if this is the right noise floor value?

If I was to send this same signal, duplicate it again, and input it into this oscilloscope. Cross-correlate these two signals in the frequency domain (multiply with a conjugate), then I should observe a lower noise floor as the noise of the systems (function generator, oscilloscope, wires) should cancel out. But I observe a noise floor of around 1e-14 V which is really low... so I am not sure how to validate this, if it works or not.

edit: reworded my question better with right terminologies


texts: Partial Fraction Expansion for Inverse Fourier Transform

texts:
In many textbooks, I've seen the application of Partial Fraction Expansion (PFE) to find an inverse Fourier Transform. Let's stick to the discrete time case, and let me give you an example.

Let's say that $$X(e^{j\omega}) = \frac{-\frac{5}{6}e^{-j\omega} + 5}{1 + \frac{1}{6}e^{-j\omega} - \frac{1}{6}e^{-j2\omega}}$$
and we want to find the signal $x[n]$ that has the above DTFT. We can apply PFE and get $$X(e^{j\omega}) = \frac{A}{1 + \frac{1}{2}e^{-j\omega}} + \frac{B}{1 - \frac{1}{3}e^{-j\omega}} \tag{1}$$
where $B$ (and similarly, $A$) is given by
$$B = X(e^{j\omega})\Big(1 - \frac{1}{3}e^{-j\omega}\Big)\Big|_{e^{-j\omega}=3}$$

I know now that we can set $u = e^{-j\omega}$ and turn this into

$$B = X(u)\Big(1 - \frac{1}{3}u\Big)\Big|_{u=3}$$

However, setting $u = e^{-j\omega} = 3$ does not look good to me, because this equation has no real solution for $\omega$.

What do I miss in this application of PFE?


texts: The Stability of the RLS Algorithm for Equalization

texts:
I am reading in the litterature that LMS is more stable than RLS.
But RLS is far more faster in convergence.
So my concern is how to be sure that my RLS algorithm will be stable when I am doing channel equalization ?
What are the causes of the instability ?
How to make the RLS immune to instability ?
I am aware  there exist RLS version like SRLS that are assured to be alway stable.


texts: Good color distance metric for classifying color pairs

texts:
I have some two tone origami paper. This particular paper comes in six types, each with a different pair of colors. Here's an image that shows all six:

Given a picture of one of these sheets, I want to figure out which type it is, and do so in a way that's resilient to common changes in lighting.

Extracting the actual color pair isn't too hard. I find the saddle point at the center of the sheet, do four flood fills (with some sanity checks for square-ness) to estimate the layout and correct the perspective, then average the RGB values of the top-right and bottom-left separately from the top-left and bottom-right (with some margin to avoid the borders).

My current method to classify the sampled color pair is to just pre-measure each known sheet, hard-code the rgb pairs they measure as, then assume new samples are whatever color pair they're closest to. The distance metric I'm using is just simple euclidean distance in the 6d r1,g1,b1,r2,g2,b2 space, except I also compute the distance after swapping the first and second color and take the minimum (to account for the fact that they may be out of order).

The problem with this approach is that it's very sensitive to lighting. For example, I can consistently distinguish between RedBlue and RedBlack but if I make the room brighter or dimmer then one will tend to dominate the other.

One thing I've considered doing is to divide the rgb values by the average of the whole pair. This would tend to cancel luminosity out, I think. But lighting also varies in color, and I'd prefer this to work whether or not the lights are incandescent or LED. One way I might be able to deal with that is to take the ratio of each color channel within a pair, and then treat that as a point in 3d euclidean space to compare. Or maybe the difference? It's hard to say without a variety of rooms to test in.

Ideas? Insight? Experience?


texts: What are some applications where full AM is used nowadays? Is it used at all considering the fact that it is less power-efficient than, say, AM with suppressed carrier?


texts: Difference between Gaussian and moving average filters for peak detection and doppler shift detection?

texts:
Consider having a signal in the time domain, and you want to smooth the signal. Moving average and Gaussian filters that are used. How do you choose which is used for what?

What are the conditions under which Gaussian is better and conditions under which moving average is better?

What I am trying to do with this signal is, peak detection initially, then apply small windows on every part and figure out the frequency changes (Doppler shifts) for every part to figure out the direction of motion from the frequency change. I want to smoothen out the signal in time-domain without loss of information in the frequency domain. I thought for the part of figuring out the Doppler shifts, using STFT would be a good idea.If reference could be given to some paper, that would also be really helpful.


texts: Compute group delay of an audio file from STFT

texts:
I'd like to reproduce results from this paper in which the authors used Group Delay-grams as an input to the Machine Learning model. The Machine Learning side is not the one that I have problems with. I have a problem with computing a Group Delay function of an audio file.

To begin with, I know that a group delay per se is a property of the filter. Authors of the paper, however, wrote something like this

  Group delay [10] is defined as the negative derivative of the
  phase spectrum of STFT:
  $$\tau(\omega,t)=-\frac{d(\theta(\omega,t))}{d\omega}\quad(2)$$
  As the implementation of Equation (2) requires the unwrap- ping  of
  the  phase  spectrum,  the  group  delay  function  can  be
  alternatively calculated using only the amplitude values:
  $$\tau(\omega,t)=\frac{X_{R}(\omega,t)Y_{R}(\omega,t)+Y_{I}(\omega,t)X_{I}(\omega,t)}{|X(\omega,t)|^2}\quad(3)$$
  where $R$ and $I$ denote the real and imaginary parts. $X(\omega,t)$ and $Y(\omega,t)$ denote the STFT of $x(n)$ and $nx(n)$, respectively.

This, I believe, is supposed to generate an image like in Fig. 3 in the paper, which looks like this (after either truncating or padding to the length of 256 along the time axis)

The problem is that when I try to compute this GD-gram from the equation above, the matrices multiplication cannot be done since both $X$ and $Y$ are non-symmetric. This is the original paper, that is referenced in both this paper and [10], where the authors are deriving the equation (3).

As I understood, the matrices multiplication is a standard one, not element-wise (element-wise multiplication doesn't produce the result that is in the paper). In my implementation below I'm using a window of length 800 samples since the authors of the paper use 50 ms window, which corresponds to 800 samples for 16 kHz sampling rate audio file. I tried to implement that in python as follows:

from scipy.io import wavfile
from scipy.signal import stft, get_window
import numpy as np
import matplotlib.pyplot as plt

rate, data = wavfile.read("test.wav")

n_data = np.multiply(data, np.arange(len(data)))
f, t, X = stft(data, rate, window="hamming", nperseg=800, return_onesided=False)
f_n, t_n, Y = stft(n_data, rate, window="hamming", nperseg=800, return_onesided=False)
group_delay = (np.dot(X.real, Y.real) + np.dot(Y.imag, X.imag)) / np.power(np.abs(X), 2)

but the code fails with

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-8-0058b9785caf> in <module>
----> 1 group_delay = (np.dot(X.real, Y.real) + np.dot(Y.imag, X.imag)) / np.power(np.abs(X), 2)

ValueError: shapes (800,109) and (800,109) not aligned: 109 (dim 1) != 800 (dim 0)

which is rather obvious. I tried to implement that in Matlab as well, hoping that maybe it's a python fault but it fails as well.

[x,fs] = audioread('test.wav');
n_x = x .* [1:size(x,1)];
X = spectrogram(x, 800, 400, 2048, fs);
Y = spectrogram(n_x, 800, 400, 2048, fs);
T = (real(X) * real(Y) + imag(Y) * imag(X)) / abs(X)^2;

How can I compute the Group Delay function using mentioned equation


texts:
I am trying to convert an FIR impulse into linear-phase FIR impulse, I need to remove the phase response, so when it is applied to a sound it only changes the amplitude response.

Here is my code below:

clear all;
close all;
[x,fs]=audioread('impulse.wav')

s=fft(x)
ph=angle(s)

amp=abs(s)
s2=real(ifft(pol2cart(0,amp))) ; setting phase to zero

s2= circshift(s2,(round(length(s2)/2)))
plot(s2)

s2=s2/max(max(abs(s2)))

audiowrite('LinearPhaseImpulse.wav',s2,fs,'BitsPerSample',24)

Is this the correct way of converting an FIR to a linear-phase FIR impulse response?
How would one negate the phase so the FIR becomes linear-phase?


texts: Is there a tool for automatically converting filter implementation forms?

texts:
I am looking for alternate tools that will automatically convert filter implementation forms (or signal flow network diagrams in general) to simplest or alternate forms; for example for going between direct form I, direct form II, transpose, ladder, etc...

I am familiar with "convert" in Matlab; but for that function you need to specify the forms. I would prefer one that would quickly generate all options, or provide more intelligence in simplifying the network, so seeing what other options might be out there.

Is this something that is readily available in Octave, or Python- or some other open source solution?


texts: Understanding the Threshold Process in Harris Corner and Edge Detector

texts:
I have read the paper Chris Harris , Mike Stephens - A Combined Corner and Edge Detector about the Harris Corner and Edge Detector, but I didn't understand the point that after low and high threshold they have got 5 regions, specially the point where he has got 2 corner classes, can you please explain that to me with image so I can get that point?

here is the part of the paper which I didn't understand:

  By applying low and high thresholds, edge hysteresis can be carried out, and this can enhance the continuity of edges.

  These classifications thus result in a 5-level image comprising:

    Background.
    Two corner classes.
    Two edge classes.

**Thanks in advance**


texts: Creating a texture image from existing image

texts:
I have some unusual question. I have searched online and couldn't find something similar to what I want to achieve.

I have an image, and I want to create a new image from it (in the same size), so the value of each pixel in the new image will be an indication for the texture of the pixel's close environment. By that I mean that, for example, parts with diffrenet textures from nearby parts will get diffrent values.

I know that segmentation exists but I don't want to partition the image into segments; I just want a way to tell how much each pixel is in an area that its texture is "diffrent" and by how much.

I tried using Matlab's stdfilt and rangefilt (I have rewritten them in OpenCV, C++), but they are no good: I tried using them with a lot of diffrenet parameters, but diffrenet textures get too close values, so my seperation is not good.

I know this question is a bit ambiguous but I just want to know which methods can I use (in openCV) to give me the result I want.

Thanks.


texts: Is the typical implementation of low pass filter in C code actually not a typical low pass filter?

texts:
Quite often in C code you see something along the lines of:

$$ y = (1-a) y_{prev} + input * a $$

..where $a$ is some small number. This equation then runs in discrete intervals at the loop rate.

Let's assume $a = 0.1$.

If I convert this difference equation into z domain I arrive at the following:

$$ Y(z) = 0.1 / (1 - 0.9 * z^{-1}) = 0.1z/(z - 0.9)$$

This function has a horrific phase response:

If I instead start with a continuous time low pass filter and convert it to difference equation I get a slightly different filter.

$$ H(s) = 1 / (s + 1)$$

I convert it into z domain using bi-linear transform:

$$ H(z) = (0.04762 + 0.04762 z^{-1})/(1 - 0.9048z^{-1}) $$

I then convert this into difference equation:

$$ y_n = 0.04762x_n + 0.04762x_{n-1} + 0.9048 * y_{n-1} $$

The result compared to the "simplistic" filter:

The result of the "proper" C implementation looks much more like a low pass filter than the "simplistic" implementation. The simplistic implementation is more like a lag regulator (I realized this while writing this post so it's almost that I have answered my own question). While the "proper" lpf is more like an analog LPF. Obviously this can negatively impact the performance of the system if the different behaviors are not taken into account. Are there situations when either one is better suited than the other?


texts:
I am working on a project that involves Spatial Modulation for MIMO channels. This uses a ML (Maximum Likelihood) detector which is computationally intensive. Sphere Decoders are developed to reduce this computations by limiting the search spaces. I understand that it uses a radius (can be soft or hard) to determine this and that it uses QR decomposition where R is triangular and uses this to create a tree structure. This is where I'm lost as to how this tree is created. If any can explain this or provide a link which explains this I would be very grateful.

I am trying to learn the basics of sphere decoding so as to be able to implement the algorithm in this paper: http://arxiv.org/abs/1305.1478


texts:
Context:

I have used FFT many times, but for real, non-periodic signals I consider it a poor estimator.

For most of my applications I am only interested on the power spectrum, so I use the Welch's method. I really like its approach to take overlapping segments, apply a window to each of them, calculate the FFT and finally average the result to get the power spectrum estimation. The method is easy to understand and its results are smooth and stable.

However I have one application that I am also interested in the phase of the signal. In fact am not interested in the phase estimation of particular signal segment, I want to see how the phases of very similar spread spectrum signals vary over time.

My signals spectrum are spread, but they always have a peak in the PSD, however this peak frequency varies over time. I will probably only need to trend the phase related to the frequency of this peak.

Questions:

1) Does it make sense to use Welch's method for magnitude and phase, instead of power? I mean average magnitude and phase, instead of power.

2) Is there any magnitude and phase spectrum estimator that is smooth/stable like Welch's method?


texts: Triangular dither - What does it mean to say that an input signal is uncorrelated with the dither

texts:
In the oft-cited ADC dithering appnote: Oversampling Techniques using the TMS320C24x Family http://www.ti.com/lit/pdf/spra461, it notes under triangular dither:

However, this approach requires that the signal does not correlate with the triangular signal. If this cannot be ensured the signal should not change more than $\pm 0.5$ LSB from the expected resolution during an oversample period $k \cdot f_s$.

What does it exactly mean to say that the input signal does not correlate with the triangular signal?
(1) Is it that the frequencies in the input spectrum has no overlap with the frequencies in the spectrum of the triangle dither being added?
In the simple case, the triangle wave has a fundamental whose period is $k \cdot f_s$, and all odd-harmonics above that. Nothing below the fundamental. So, does this mean the input signal has to be band-limited to one-half of $\frac1{k \cdot f_s}$? (or comb-filtered to notch out all these odd-harmonics, but that's not an option for most baseband signals)
But then, this sounds like exactly same as the "or else" clause in the above; so I guess its not.
(2) Does it make a difference if I make many triangles within the $k \cdot f_s$ period (instead of one big triangle $\frac{k}{2}$ up followed by $\frac{k}{2}$ down)?
One could shift the fundamental of the triangle wave upwards dramatically. (In fact, this paper seems to be heading in that direction: Improving Digital-to-Analog Converter Linearity  by Large High-Frequency Dithering, http://www.precisionmechatronicslab.com/wp-content/uploads/2017/01/J17c-Preprint2.pdf.)
(3) What happens if my "triangular dither" is not a smooth triangular wave, but a permutation, a random number which has a triangular p.d.f.? The oversampling ADC result should be the same. Then what happens to "correlation"? Now can we say that it surely does not correlate with any signal in the input?
Finally, I suppose I could use an arbitrarily large triangular dither signal. (of course, as long as I am not saturating the signal chain). The dither can have any amplitude more than $\pm \frac12$ LSB. Is that right?


texts: Poisson noise and curve fitting - denoise first?

texts:
If I have an image that is severely corrupted by Poisson noise, and I want to fit a function to the image, is it "better" to attempt to denoise the signal first before fitting, or should I move straight to the fitting stage?

In the example below, a 2D Gaussian function has been corrupted by Poisson noise. Should I fit a 2D Gaussian to the noisy data, or to a denoised version?

Denoising images is often good for qualitative reasons, but I'm curious to know about the quantitative case, for example where the volume of the Gaussian is important?

By "denoising", I'm thinking along the lines of the techniques such as Non-local PCA rather than median filtering etc.


texts: what is proper setting for Fb,Fc in Complex morlet wavelet (cmor)?

texts:
I am using Cmor-Fb-FC wavelet transform in matlab environment. Fb is bandwidth and Fc is center frequency parameters. with trail and error procedure I select Fb-Fc as 5-1, and I've got rational output. But I want to know whats the rule of selecting proper value for Fb-Fc parameters? Imagine I am using 300 samples over 30 sec. so my sampling frequency is 10 Hz.Here is my signal.

x=sin(2*pi*t*.1).*(t<10)+sin(2*pi*t*0.3).*...
    (t<30)+sin(2*pi*t*0.6).*(t<10).*exp(-t*.1);


texts: Generating inaudible sound waves using MATLAB

texts:
I want to generate inaudible sound waves (above 18kHz) with 48kHz sampling rate using MATLAB.

Generating a sound wave with 18kHz frequency makes it inaudible.

I've inserted the data in the 18kHz band in the frequency domain, converted it into time domain signal.
Then I've duplicated the signal, concatenated it, and played it.
As expected, the played sound was inaudible.

The problem is,
I want to play the inaudible sound with an interval.
(playing sound wave for 1.75ms and having a silence period for 4.17ms
 repetitively)

Because of the inserted silence period, the concatenated signal is no longer inaudible because new frequency components are added.

How I can transmit inaudible sound with time interval?


texts: Find the Differential Equation of an Analog Band Pass Filter

texts:
I don't even know how to start. We're supposed to find the differential equations that links $V_{in}$, $V_{out}$, and $V_{io}$, as well as the values of $C_1$, $C_2$ and $R$ so the filter works in the audible spectrum. We're allowed to use Fourier transform, if that simplifies anything.

I thought of splitting the band pass filter as a high pass at first, and a low pass after.

That way I can relate $V_{io}$ with $V_{in}$, and $V_{out}$, with $V_{io}$, in two different equations.

Doing that... the results were:

$RC \frac{\mathrm{d} Vin(t)}{\mathrm{d} t} = Vio(t) + RC \frac{\mathrm{d} Vio(t)}{\mathrm{d} t}$

for the high pass filter

$Vio(t) = Vout(t) + RC \frac{\mathrm{d} Vout(t)}{\mathrm{d} t}$

for the low pass filter

Then, using..
$fc = \frac{1}{2 \pi R C}$

For the audible frequency, it'd be between $20$ hz- $20$ KHZ. So using that, I should be able to express both $C_1$ and $C_2$ as a function of $R$.

However, how do I actually determinate the value of $R$ required? or do I assume a set value?

If there's anything wrong, please let me know why. Thank you, have a nice day.


texts: Is spectral centroid enough to measure brightness?

texts:
i'm new in this group and i'm studying a sound signal.
I have used FFT for extrapolate frequencies and see the harmonics of this sound.
I have to compare this sound with another similar sound and find the diffrences.

From various research I found that an important element that characterizes a sound, and therefore it's timbre is the brightness.
My question is:
is it sufficient to calculate the brightness using only the specrtal centroid, using the frequencies and the 'magnitude' of my fft?


texts: Correct signal analysis flow (Wind Turbine vibration)?

texts:
I have vibration data from WT (gearbox) sampled at 25.6 kHz. From a previous post I received a lot of good recommendation.

What I am trying to do:

Find early stage bearing faults by using an envelope analysis aka. an high frequency resonance technique.
This technique can:

  Magnify the low amplitude, high frequency signal by filtering out low frequency components. .. fault indication frequencies can be determined in the envelope spectrum through a spectrum analyzer

-Fault Detection Of Rolling Element Bearings by C. Liu

Current method:

Apply bandpass filter (low: 5000, High: 6000Hz)
Rectify resulting signal (absolute value AND squaring to remove aliasing)
Apply lowpass at 6000 Hz

-> Fault detection: Do this for many other 10 second samples over time to look for changes in kurtosis, FFT plot etc.

Zoomed in images of the signals processed:

Questions:

Should I upsample before or after rectifying?
Does this process look correct?
Should I do another LP filter to "clean" up the signal?
Should I do another LP filter at a lower cutoff frequency to "clean" up the signal?

Thanks in advance.

My approach resembles this one, from -Fault Detection Of Rolling Element Bearings by C. Liu


texts:
I'm wondering if I have calculated a nulling filter coefficients correctly:

$\ 1, -2\cos(0.44\pi), 1$

I have to make a nulling filter that filters out the frequencies $\theta = 0.44\pi$. I've been told that the formula for nulling filters is $y[n] = x[n] - 2\cos(\theta)*x[n-1]+x[n-2]$.

If I'm correct the two 1s come from the fact that $\ x[n]$ and $\ x[n-2]$ both have a coefficient of 1 and no other variable and the $\ -2\cos(0.44\pi)$ comes from the $\ - 2\cos(\theta)*x[n-1]$ and the fact that $\theta$ = 0.44$\pi$.

If the coefficients are correct, is all I have to do to find the output signal just multiply the input signal by each coefficient and add them together (convolution sum)?


texts: Software to extract frequency spectrum data from an audio file

texts: I've been trying to learn how computers recognize musical notes, and I found apps like spectrogram which shows the frequency spectrum of a sound, but what I need is the data which is plotted or the raw data used. I'm a beginner in this field, so it'd be really great if you could help me with the software or the process used. Thanks!


texts: Synchronizing data sent over sound beeps with Goertzel Detection, C#

texts:
I'm trying to send some text over sound. For example, I try to send the words "Hello John". I do it this way: Every char is converted into its binary ascii code. Then I construct a wav file with no gaps by NAudio library in this manner:

    StartDelimiter = 12KHz,
    1's = 13kHz,
    0's = 14kHz(for the message),
    End Delimiter = 10kHz.
    The durations of whole beeps are similar: 100ms.

I'm only at the beginning of my work and I Record the series of beeps and after recording I analyze the record(in the future I want it to be near Real Time) by:

Find the start delimiter's index with Goertzel filter(max power along the recorded buffer).
Skipping a known duration(100ms) in a buffer to decode the 1 OR 0 by using another 2 Goertzel filters. If the End delimiter is found I break the search and show the decoded message to a box.

My problem that I've encountered so are:

After sending more than 5 chars I get for example: "Hello Pohny". The first chars are fine but then it start to rubbish.
Some noise defects the series.

Are there some strategies which I can use to improve the skills of my the above algorithm?
Thanks
I work with C# on WPF


texts: Phase Noise for OFDM systems (discrete-time Wiener process)

texts:
I am trying to make a Matlab code for a phase noise model for OFDM systems, the literature suggests that the phase noise is modelled as a discrete-time Wiener process.
Could you please help me to build matlab code for phase noise model.

I found this code, it works fine but I don't understand it, please help me to understand it.

function phsnsig=add_phase_noise(xmtifft,freqspace,perctB)

perctB;
[str stn]=size(xmtifft);
T =str*stn;
B=freqspace*perctB;
randn('state',100) ;
dW = zeros(1,stn*str);
W = zeros(1,stn*str);
dW(1) = normrnd(0,sqrt(2*B));
W(1) = dW(1);

for j = 2:(stn*str)
   dW(j) = normrnd(0,sqrt(2*B*j));
   W(j) = (W(j-1) + dW(j));
end

xmtifft=xmtifft.';
xmtifft=xmtifft(:).';
xmtifftpn=xmtifft.*exp(i*(2*pi*4*10^(-6)).*W);
xmtifftpn=reshape(xmtifftpn,stn,str).';
phsnsig=xmtifftpn;

% phase noise plot
figure(14)
plot([0:T],[0,W],'r-')
xlabel('t')
ylabel('PN(t)')
title('Phase Noise for all Time Domain Samples')

end


texts: PPM Variant - Analytic symbol error probability

texts:
I'm trying to calculate symbol error probability of variant of pulse position modulation considering only AWGN channel. The decoder is maximum likelihood so the implementation of the detector is by using vector correlators.
$$
\arg \max_{x} <y,x>.
$$
Attached is the waveforms vector representation of the transceiver & receiver. I didn't find any general term for the inner product that will lead me to solve the probability problem and from there to find the analytic solution. Any help will be appreciated.


texts: I want to detect 6 peaks in a signal. I am open to any suggestions. There is one problem where my signal sometimes jumps high and stays higher than the rest of the signal. I don't know why this happens but would like a solution to lower the signal back to the points where the rest of the signal was lower, which might help detect all 6 peaks. I attached a picture.


texts:
I am looking for advice on a project I am thinking about completing (for experience etc..)

My project is triggering a set of traffic lights (simulation) using Speech recognition. In theory, I want to use a HMM (Hidden Markov model) to determine whether someone wants to cross the road or not, this can be determined by someone saying "Yes" and then if there is white-noise, or, the Phones "Yes" is not present it can infer that no-one wants to cross and therefore there is no need to trigger the lights.

I'm looking for advice in whether this can be done using an HMM? I have some experience in both of these I just need to know whether it would be a good idea to use an HMM / Viberti algorithm

I hope someone can help me,

Thanks :)


texts: ROC of this LTI system given $x[n]$ and $y[n]$

texts:
So I have a system with the following inputs and outputs:

\begin{align}
x[n]&=\left( \frac12 \right)^{n}u[n] + 2^{n}u[-n-1]\\
y[n]&=6\left( \frac12 \right)^{n}u[n] - 6\left( \frac34 \right)^{n}u[n]
\end{align}

The transfer function $H(z)$ can be found to be:

$$\frac{Y(z)}{X(z)}=\frac{1-2z^{-1}}{1-\frac{3}{4}z^{-1}}$$

with a zero at $2$, and a pole at $\frac34$. Now how can we find the ROC of this system given that one of the sequences ($x[n]$) has an anti-causal term?


texts: Samples per second in a row vector in Matlab?

texts:
I wrote two functions in MATLAB, function called half that removes every other element from an arbitrary length vector, creating a shorter vector made of only the odd-numbered elements of the original vector; and a MATLAB function double that creates a longer vector by adding an additional element between neighboring elements in the original vector (Each new
element should equal the average of its neighboring elements).
If you sample a $100\textrm{ Hz}$ tone at $8000$ samples per second, and store the samples as a row vector, what will be the effect of half and double on the pitch and duration of the tone if the playback rate is identical to the sampling rate? In other words, what is the new pitch in Hertz, and duration in seconds of the new sample in each case?


texts: Separate key-related frequencies from audio signal

texts:
I have various samples of various instruments sound, and I'm trying to classify them using pyAudioAnalysis and various Machine Learning algorithms. The samples record the instrument playing different notes, which obviously alters their frequency spectrum. I am looking for a way to separate the information about the note, ideally by reducing the harmonics of the relevant frequency, so that the feature extraction step does not give relevance to this information. Does it make sense? Is there a "simple" way to achieve this?

Thank you in advance.


texts:
I'm studying some variances ($\sigma^2$), that in my case, they must depend by velocity squared $v^2$.

So, in my experimental proofs, I have plotted a graph of $\sigma^2/v^2$, and I was hoping to find a horizontal line.

But, my data seem to be constants in $\sigma^2/v$, and now I find myself in times of trouble: I have to choose which one is the best fit.

In each cases ($\sigma^2/v^2$ or $\sigma^2/v$), I obtain a nearly straight line.

So, I look the equation of best fit lines as $y = mx +q$, where $m$ is his angular coefficient.

The angular coefficient $m$ is less, in the case of $\sigma^2/v^2$ (by about an order of magnitude), but in the case of $\sigma^2/v$, the range of the best fit line (from its maximum and minimum in the graph) is relatively more lower.

At this point, to choose the best fit, the best solution is:

Choose the case where $m$ is lower.
Or I have to choose the dynamic case (maximum value minus minimum value), where the best fit line is more flat in the graph (not by absolute value)?

Here are an example: in the first graph $m$ is greater (see the equation in the plot), but the line varies of 0.01.

In the second case $m$ is lower, but the line varies of 0.15.

What is the best fit? The first or the second?

EDIT

For Matt L. - Your approximation error $e$ is very similar to the $R^2$ parameter, that I define so (now I use your notation):

$$R^2 = 1 - \frac{\sum_i \left[d_i-f(v_i)\right]^2}{\sum_i \left[d_i-\overline{d_i}\right]^2}$$,

where $\overline{d_i}$ is the average value of $d_i$.

Maybe you would like say that I must simply see where I have the minimum error $e$ or the best fit parameter, e.g. $R^2$.


texts:
My goal is to extract a melodic respresentation for monophonic signal like voice.

I have used YIN algorithm to find the pitch of the signal. Now I want to detect notes from the pitch values (like they will change when a note change and become stable when it does not change). So my goal is to segment pitch values into notes so basically I have to:

split the different sung notes within voiced segments.
assign a constant pitch value to each estimated
note.

So what should be my approach after the pitch estimation ?

(As i have very few DSP experience so I would like a detailed answer. Thank you)


texts: What is the minimum sampling rate for QPSK or what is the bandwidth of QPSK signal?

texts:
Consider  we have created a QPSK signal with a carrier frequency 100kHz. Before applying matched filter or demodulation we need to take samples from the received signal. So what is the minimum sampling rate we must have? Consider that somehow we have perfect synchronization and there is no drift of the carrier.

Any help would be appreciated.

I have asked this question (for more attention) at stackexchange .


texts: Generating I/Q samples from a real signal

texts:
My understanding is that if I have a real signal, it can be called as the 'I' component and its Hilbert transform can be called the 'Q' component. Due to the property of Hilbert  transform, 'I' and 'Q' will have 90 degrees phase difference.

Now consider the case of a pure sine wave with constant amplitude. Let us say we sample it at 4 times its frequency, hence taking 4 samples per cycle. Consequently, each sample will have 90 degrees phase difference with respect to the previous sample. In this case, is it correct to say that "the incoming signal delayed by one sample" is the Hilbert transform, and hence the 'Q' component?

Also, now let us say we add random noise to this pure sine wave, thus making it non-periodic. Can we still say that "the incoming signal delayed by one sample" is off by 90 degrees?

I hope my question makes sense! Thanks!


texts: Digital filter performance with noncontinuous signal?

texts:
First of all, I'm new to DSP so excuse my simplified words.
I'm testing the performance of a digital filter on a (partly) noncontinuous signal:

As you can see, the signal is not continuous at some points (like it is stopping and starting over again) When I apply the digital filter to it, I get this:

The filter shows ripples at the noncontinuous areas, then it starts to work again. Why does the filter show this ripple at the noncontinuous areas? How do I calculate it (to know the overshoot, etc.)?


texts:
While studying the topic of filter design,i came across following terms:
1)Factored form
2)SOS(second order sections)form
3)Rational form
4)Transfer function form
What is the difference between all these terms?
According to my understanding,first two terms are mutually synonyms and are implemented in same way in MATLAB
and last two terms are mutually synonyms and are implemented in same way in MATLAB
Is my understanding valid?


texts: why type 2 FIR cannot be used to design high pass filter

texts: Kindly explain why type 2 FIR filter cannot be used to design high pass filter.


texts: use wavelet for improving spectral resolution

texts:
let us consider following code

function [sca_1,sca_2,sca_3,sca_4]=calc_wavelet(y,wname,scales,freq,fs)
%y-input signal
%wname-wavelet basis name
%freq-test frequencies
%fs-sampling rate
TAB_Sca2Frq = scal2frq(scales,wname,1/fs);
[~,idxSca_1] = min(abs(TAB_Sca2Frq-freq(1)));
sca_1 = scales(idxSca_1);
[mini,idxSca_2] = min(abs(TAB_Sca2Frq-freq(2)));
sca_2 = scales(idxSca_2);
[~,idxSca_3] = min(abs(TAB_Sca2Frq-freq(3)));
sca_3 = scales(idxSca_3);
[mini,idxSca_4] = min(abs(TAB_Sca2Frq-freq(4)));
sca_4 = scales(idxSca_4);
coefs = cwt(y,scales,wname);
clf; wscalogram('image',coefs,'scales',scales,'ydata',y);
hold on
plot([1 size(coefs,2)],[sca_1 sca_1],'Color','m','LineWidth',2);
plot([1 size(coefs,2)],[sca_2 sca_2],'Color','m','LineWidth',2);
plot([1 size(coefs,2)],[sca_3 sca_3],'Color','m','LineWidth',2);
plot([1 size(coefs,2)],[sca_4 sca_4],'Color','m','LineWidth',2);

i have  took following data

>> wname = 'morl';
scales = 1:1:128;
>> fs=100;
>> freq=[13.7   10.5    29.9    31
];

when i run following code

[scal_1,scal_2,scal_3,scal_4]=calc_wavelet(B,wname,scales,freq,fs);

got result :

one  frequency is lost,i have tried  also following  basis

>> wname = 'mexh';
>> wname = 'morl';
>> wname = 'haar';
>> wname = 'gaus4';

please  pay attention that  my model is following

https://dsp.stackexchange.com/questions/15559/understanding-1d-wavelet-analysis

so which wavelet basis should i choose for  good spectral  resolution?i want to use wavelet for ability to distinguish signals which are closed  spaced to each other,like in my case

freq=[13.7   10.5    29.9    31];

it could be  even more closed to each other


texts:
I understand the theoretical foundations of convolution, but now that I'm trying to program it I'm having some issues conceptually.

Say I have two blocks of 64 audio samples each. I also have access to fft and inverse fft functions. I want to take these two blocks and convolve them. Is this just taking the Fourier transform of each block and multiplying the resulting elements pairwise?

Say now that I want to deconvolve these two (e.g., its a signal and its convolution). Would I just divide the elements pairwise?

For example, the output of my Fourier transform is this pair of amplitudes.

Real:
11.09  -0.2055  1.214  1.101  1.66  4.594  -3.809  -0.3608
4.198  3.572  0.3175  -0.5848  -5.129  2.26  -5.641  -1.039
0.2445  1.905  -6.607  -1.083  1.726  -6.772  2.04  5.563
-6.907  -4.122  0.276  4.894  -0.8119  1.064  -3.989  -0.1623
-1.712  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0

Imaginary:
0  -3.147  0.7265  -2.434  -1.125  3.208  -3.066  -1.637
-4.558  2.981  2.04  4.246  1.041  -0.1337  -5.165  1.238
-1.223  -1.29  4.51  -4.716  -2.676  2.557  1.385  -1.173
-3.938  -5.14  2.763  -3.018  -1.727  7.329  4.278  2.936
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0

for a block size of 64. If I know that other signal has a Fourier transform given by imp_real[64] and imp_imag[64], how do I practically convolve and deconvolve the signals?


texts: Legacy LongRange Mode information (mode 1 in the my attached link)

texts:
Mode 1- Legacy Long Range Packet Format and Im attaching a photo of ti reference:

link for more information about this mode category : TI SWRA642
I want to understand the packet format, what's my syncword Data in HEXA that this legacy mode use? , what's the payload length in this mode? I didn't understand what's N and DSSS symbols that are found in multiplication sum for length of payload: N8DSS symbols...what should its values? could you guys please explain and illustrate all those parameters of mode 1 by an example of transmitted packet with explaining its transmitted data and how it looks once transmitted? thanks alot!


texts: Optimization of Filter Coefficients to Given Word Length

texts:
It seems to me that this is a difficult mathematical problem where research is still carried on:
Is there an efficient way to find fixed-point coefficients whose zeros are closest to those calculated from the given floating-point coefficients?


texts: SVD is not applicable to time series analysis?

texts:
I am studying a deconvolution problem for which observations include noise. I am considering using one of several common regularization methods, including Tikhonov's solution, truncated Singular Value Decomposition (SVD), or Wiener filter.

A manuscript I am reading, Riel and Berkhout, "Resolution in seismic trace inversion by parameter estimation" in Geophysics, 50(9), pp. 1440-1455, 1985, compares analysis in the Fourier domain with general SVD analysis:

  Examples where SVD-based techniques may be used while Fourier
  techniques are no longer applicable are: time-invariant filtering,
  space-variant wave field extrapolation [...], and linear parameter
  estimation problems. Furthermore, in many nonlinear problems
  linearization is meaningful, again allowing application of the SVD.
  The nonlinear problem treated is such an example. In our opinion many
  problem areas in seismic exploration stand to benefit from an analysis
  involving the SVD. However, there are some limitations compared to
  Fourier analysis. For instance, SVD is not applicable to time-series
  analysis. Furthermore, the eigenvectors and eigenvalues do not, in
  general, have the clear physical meaning the sinusoids and their
  amplitudes in Fourier analysis do. For these reasons SVD-based
  methods should, when possible, not replace Fourier analysis methods,
  but rather be used in conjunction with them.

I was surprised to read that "SVD is not applicable to time-series analysis." It is not clear to me that this is the case, and indeed the authors use SVD to construct an inverse filter for their convoluted time series.

I wonder if there is common knowledge in the DSP community regarding SVD's unsuitability for time series analysis in general or specific aspects, as this is the first time I have come across this statement. (It is also surprising to find no SVD or eigenanalysis tag.) Thanks in advance.


texts: Period, amplitude and phase through FFT in MATLAB

texts: I need to compute period, amplitude and phase of the signal from spectrum analyser. It looks like a sine wave. Since i am new to MATLAB and also have limited idea about Fourier transforms, I am looking for a simplified explanation of how i might use FFT to compute period, phase and amplitude through MATLAB programming. The information i have regarding signal are: sweep time: 0.3183s sweep: 2001 save loop: 100. Thank you so much in anticipation.


texts: Non technically speaking without coefficients and formulas, how do an audio filter cuts off low frequency from a sampled audio w.r.t  cut-off frequency ?


texts: How to perform a block-wise frequency down-shift?

texts:
I'm writing a Python function that shifts the frequency of an audio signal down to a specified range. I perform the downshift by multiplying the time series with a complex exponential, and then low-pass filter the result to remove the cyclic effect of the low frequencies shifting into the higher ones.

The function will be used to process an audio signal block by block in a loop. My question is, what will be the effect of starting the index $n$ of the complex exponetial at zero for each block?

$$ X \big(e^{j2 \pi (f-f_0)}\big) = \mathscr{F} \Big\{ x[n] \cdot e^{j2 \pi f_0 n} \Big\} $$

Where $n \in \{0,..N-1\}$, and $N$ is the block length.

Intuitively, I'm thinking there would be an inconsistent phase-shift between blocks, but I'm not sure.

is there a way to avoid this, without continually incrementing the index throughout the life of the program?

Here's the code:

from numpy import fft, pi, r_, exp, int16, array, fromstring, zeros
from scipy.signal import firwin, lfilter

def shiftFreq(data, cutoff, fs, hist=None):
    """ Downshift audio data

    Parameters
    ------------
    data: str
        Binary data string of 16-bit audio data
    cutoff: float
        The new max frequency component after downshift and filtering
    fs: float
        Sample rate of audio data
    hist: ndarray
        Filter delay line

    """
    data = fromstring(data, dtype=int16)
    N = len(data)
    num_taps = 128
    delay = num_taps - 2
    nyquist = fs/2

    # initialize history
    if hist is None:
        hist = zeros(delay, dtype=data.dtype)

    # Down-shift the data
    shift = nyquist - cutoff
    n = r_[0: N]
    new_data = (data * exp(-1j * 2 * pi * shift * n/fs)).real

    # Apply lowpass filter to remove cyclic effect
    fir = firwin(num_taps, cutoff, nyq=nyquist)
    new_data, hist = lfilter(fir, 1, new_data, zi=hist)

    return int16(new_data).tostring(), hist

As an aside, are there other caveats I should be aware when performing a down-shift, that I haven't accounted for here?


texts: What is the difference between MSE and PSNR of images?

texts:
I have some doubts.

What is the difference between quality parameters MSE and PSNR?
Which is used when?
Is there any advantage of PSNR over MSE or vice versa?

Also I have heard people saying that MSE and PSNR should never be used to check image quality. Instead one should use UQI and SSIM. I read about UQI and SSIM and came to know they are close to human visual system but I read a technical report which says that SSIM is sometimes better than MSE and sometimes MSE is better. Here is the link
http://www.cs.uregina.ca/Research/Techreports/2008-02.pdf

Now I am confused which one to use(among MSE and SSIM) and why?

Also it is said that SSIM is upgraded version of UQI. Then what's the difference between these two?
Why do people still use UQI irrespective of the fact that SSIM is there?


texts:
I have recorded samples of lungs sound (person breath) signals from electronic stethoscope.
How can I measure (In percentage) the similarity between two audio signals (lung sound), the general idea is to take a clean recorded signal(without environmental noises, Laboratory conditions) and compare it with the regular recorded lung sound. If the percent is high enough then it is valid, else it is with too much environmental noises.
I thought to do it by cross-correlation but after a research I found out that it is more suitable for time lag between signals. Any good idea to start with? I want to implement it in MATLAB.
** the recorded files are in AAC format.


texts: The difference between the variance of white noise and narrow-band noise in Matlab

texts:
In Matlab, we can generate noise with zero-mean and unit variance by using "n = randn()". But in fact, the variance is not really equal to 1, but there is a slight error.

Assume that the length of the noise sequence is a constant of N. I generated the noise sequence many times, and calculated the variance of each noise sequence. Finally, I compared each variance with 1, and calculated the MSE (mean square error). For example, I have got the MSE which is around 1 * 10^-6.

Now, I generate narrow-band noise by using a low pass filter. The order of the filter is very high. After scaling, the variance of the filtered noise returns to around 1. But again, there is a slight error. I calculate the MSE as above, and I found that the MSE is around 5 * 10^-6.

Is the MSE getting larger due to the low pass filter? Is there any way to eliminate it? Thank you!


texts: Does lowpass filtering and decimating improve SNR?

texts:
I did not manage to find clear answers to this question: does decimation after an appropriate lowpass filter improve the signal to noise ratio?

To investigate this question, I considered data generated by a sine plus some random noise. The FFT shows a very clear peak (two with the symmetry). If I naively downsample without filtering, the signal gets aliased and the SNR decreases, which makes sense: I removed relevant information about the sine while keeping the noise unchanged.
Then, I applied a lowpass filter to avoid aliasing when subsampling. The SNR did not seem to significantly change.

This question is of practical importance: when measuring a phenomenon, say at 1Hz, is it useful to use a very high sampling frequency such as 1kHz or more in order to improve the SNR by filtering and decimating (given that the memory and computational cost is not a problem, of course)?


texts: Unscented Kalman Filter Equations for Constant Turn Rate and Velocity Process Model

texts:
I am learning about Unscented Kalman Filters in Udacity's Self-Driving Car Nanodegree. The UKF is designed to track an object moving under the assumptions of constant turn rate $\ddot\psi$ and velocity(speed) $v$, the so-called CTRV model. The process noise is assumed to come from a longitudinal acceleration component $\nu_a = {N(0,\sigma_a^2)}$ and a yaw acceleration component $\nu_{\ddot\psi} = N(0,\sigma_{\ddot\psi}^2)$.

The mean state vector $$x = \begin{bmatrix} p_x \\ p_y \\ v \\ \psi \\ \dot\psi \\  \end{bmatrix}$$ tracks the mean values of x and y coordinates, speed, turn angle and the turn rate. The matrix $P$ stores the covariances of these variables.

The screenshots describing the model are below.

My understanding is that since the noise components are zero-mean, they should only affect the covariances not the means. However in the lecture noise is being added to the means too. For example $e=\Delta t \cdot \nu_{\ddot\psi}$ is the effect of of the yaw acceleration noise on the yaw rate. Also the notation seems odd. What does it mean to multiply by $\Delta t$ a stochastic variable $\nu_{\ddot\psi}$ with a mean and variance components?


texts: I'm studying SuperResolution techniques, and I read often "subpixel"/"subpixel registration"/"subpixel accuracy". I don't find what exactly it means; Wikipedia says that is one of the three RGB channel in the pixel, but I think it isn't the right meaning in this context. Anyone can help explain what it is it or give me any tutorial?


texts: Convolution of two large signals in MATLAB

texts: I need help regarding convolution. I am trying to convolve a signal which is $15\textrm{ ms}$ long, and the sampling frequency is $10\textrm{ GHz}$. I need to convolve it with a rectangular pulse, which has $15\textrm{$\ \mu$s}$ pulse width. When I am trying to use conv function in MATLAB, my PC goes busy state, and it does not give me any answer. Can anybody help me with this problem, please?


texts:
I have the measured signal $y(t)$ that can be modeled in the frequency domain as $Y(f)$:

$$Y(f) = X(f)\cdot A(f) - [X(f)\cdot B(f)] \ast C(f)$$

where $\ast$ is the convolution.
I know $A(f)$, $B(f)$, and $C(f)$. I measure $Y(f)$. Is there a way to retrieve $X(f)$?
I know that if $C(f)$ is constant and $1$, then I can easily retrieve $X(f)$ except for frequencies with $A(f)=B(f)$.
But how do I go about this for an arbitrary but known $C(f)$?


texts: Deconvolution with noisy measurement of impulse response function

texts:
I observe a noisy 1D signal that has passed through some linear time-invariant filter:
$$z(t) = (h\star x)(t) + n(t)$$
where $h(t)$ is the filter, and I am hoping to recover $x(t)$. $n(t)$ is some noise with a known
mean power spectral density, $S_n = E[|\hat{N}(f)|^2]$.
Unfortunately, I do not know $h(t)$ exactly, but only have a noisy measurement of it: $h(t) + n'(t)$ where $n'(t)$ here is also noise with the same mean power spectral density, $S_n$, from before.

What is the best deconvolution scheme to use here and can you point me to the relevant papers/algorithms?
Does knowing $S_n$ help at all?

I considered Wiener deconvolution, but it seems this only works when you know $h(t)$ exactly?

Is there a deconvolution scheme that works well in 1D when you can only approximate the impulse response?


texts: Writing a Discrete Fourier Transform program

texts:
I would like to write a DFT program using FFT. This is actually used for very large matrix-vector multiplication (10^8 * 10^8), which is simplified to a vector-to-vector convolution, and further reduced to a Discrete Fourier Transform.

May I ask whether DFT is accurate? Because the matrix has all discrete binary elements, and the multiplication process would not tolerate any non-zero error probability in result. However from the things I currently learnt about DFT it seems to be an approximation algorithm?

Also, may I ask roughly how long would the code be? i.e. would this be something I could start from scratch and compose in C++ in perhaps one or two hundred lines? Cause actually this is for a paper...and all I need is that the complexity analyis is $\mathcal{O}(n \log n)$ and the coefficient in front of it doesn't really matter :) So the simplest implementation would be best. (Although I did see some packages like kissfft and FFTW, but they are very lengthy and probably an overkill for my purpose...)


texts: Using a Multirate FFT system to analyse audio

texts:
I am trying to implement a multirate fft system to try and achieve frequency windowed analysis of audio.

Say I have managed to get an impulse response of a system.  This impulse may be say one second long, but actually the particular time of interest is only 400ms long, and there are other noises in the impulse at this time that did not come from the source of interest.

I would like to split the signal into sub bands, use different window lengths on each sub band, perform an fft of each band, and view the entire spectrum result at once. If I window my entire impulse to just the area of interest, I end up high passing the result as the window length is too small.  However making it any larger ends up letting in unwanted information in the higher frequencies that may result in comb filtering, so I would like to be able to vary this windowing.

Reading up, I believe computationally, using a multirate system is the best way to go.  I can quickly break the impulse into 2 or 3 sub bands, window each sub band with the appropriate window length, decimate the signal and then perform an fft on this.

I have read that I also need to perform a low pass filter on this prior to the fft to guarantee that the highest frequency for each band is the nyquist of the sampling frequency.  Do I also need to perform a high pass?

If I am using decimation, I am decreasing the sample rate, and removing x amount of samples every y samples.  So that I can perform my fft on all bands and add the results together, should I then interpolate the decimated signal to keep my end sample rate t he same? meaning that the frequency bins for each fft will be the same.

Any pointers would be great.


texts:
I frequently see the term "image" thrown around in various DSP discussions.  What exactly does image mean in this context?

Thanks!!


texts: Reliably matching a degraded image with the original out of dozens of candidates

texts:
I have several collections contaning low-resolution captures of unevenly-lit presentation slides:

and thirty to sixty original high-resolution slide images:

How would you design a similarity measure between the low-resolution captures and the high-resolution slides that would nearly always give the highest score to the correct image pair (or, analogously, a distance measure that approaches zero only for the correct image pair)?

Experimental setup

So far I tried a machine-learning solution to get a better feeling for how difficult the problem is. I assigned each image pair a feature vector consisting of:

various grayscale histogram similarity / distance measures (correlation, intersection, $\chi^2$ distance, and Bhattacharyya distance) applied to both the entire images and the image quadrants,
Pearson's correlation coefficient between Haralick texture features,
Hamming distance between various image hashes (aHash, pHash, dHash), and
Levenshtein distance between the image OCRs normalized by the maximum OCR length.

For the training part of a dataset, I take each feature vector $\vec x$, let $\vec a\vec x + q = 1$ for matching images and $\vec a\vec x + q = -1$ for non-matching images. Then I use linear regression to obtain $\vec a$ and $q$. Finally, for the test part of a dataset, I use $\vec a\vec x+q$ as a scoring function to retrieve a sorted list of high-resolution slides for each low-resolution capture and look at the rank of the correct result.

Experimental results

With a small hand-annotated dataset, this is getting me the average rank of 6, which is better than random draws, but not nearly good enough for an application that would overlay the high-resolution slides over live capture; such an application will require an average rank that approaches 1. There is an opportunity for the application to be smart and only look at a small window of slides around the current slide, but it still needs to correctly guess the initial slide.

As you might expect, the feature vectors are also quite slow to compute (several seconds per a feature vector with a naive implementation on a higher-end quad-core laptop), which makes the solution unsiutable for a real-time application.


texts: Which pattern (circle pattern or checkerboard pattern) should be used for automotive camera calibration (fisheye/wide webcam)?

texts:
Calibrating a Fish-eye camera / webcam with large angle mounted on car by using opencv 3

One important issue is to define the calibration pattern and its position !!!!

The affects error that paly an essential role in the camera calibration process; of either localizing the control point or using geometric properties of the pattern directly.
Therefore, the precise localization of control points, or accurate determination of the geometric properties is very important, when a small error lead to imprecise camera calibration .Therefore I decided to use a regular grid of circles as calibration pattern.
But when using the wide angle lens the camera location has a big inclination with respect to the calibration pattern. Therefore, the size of the control points circles varies a lot (circle radius of the most remote circles could be smaller than those close to the lens).

According to that how can determine rows=? X  columns=?  of the calibration sheet, and the distance = ?  between each row an column, and the position=? for the calibration sheet, in order to obtain the accurate calibration for  the camera mounted on the car .


texts: How do I find the difference equation from a transfer function?

texts:
Most of the resources I found online go the other way. If I have the transfer function
 $H(z) = 1 - cos(\theta) \cdot z^{-1} + z^{-2} $
 how do I get the difference equation from it so that I can apply the transfer function to a set of data?


texts: Object Classification using pyramid match kernel

texts: I have been reading up on the pyramid match kernel as an alternative to using the bag-of-words model for object classification using a SVM. The bag-of-words model provides a model for transforming a set of features to a single feature vector, however im confused as to how the pyramid match kernel can be used for this task, for instant if a SVM has been trained using a pyramid match kernel how do I present a test image represented by a set of feature vectors to the SVM as, as far as I can tell the kernel generates some feature space F(x) but provides no mapping to this space. Could someone please give a brief description of how this works?


texts: Using continuous verses discrete wavelet transform in digital applications

texts:
I am familiar with much of the mathematical background behind wavelets. However when implementing algorithms on a computer with wavelets I am less certain about whether I should be using continuous or discrete wavelets. In all reality everything on a computer is discrete of course, so it seems obvious that discrete wavelets are the right choice for digital signal processing. However according to wikipedia it is the continuous wavelet transform that is primarily used in (digital) image compression as well as a large number of other digital data processing activities. What are the pros and cons to consider when deciding whether to use an (approximate) continuous wavelet transform instead of an (exact) discrete wavelet transform for digital image or signal processing?

P.S. (Checking an assumption here) I am assuming continuous wavelet transforms are used in digital processing by simply taking the value of the continuous wavelet at evenly spaced points and using the resulting sequence for wavelet computations. Is this correct?

P.P.S. Usually wikipedia is pretty precise about mathematics, so I am assuming that the applications in the article on Continuous Wavelet Transforms are in fact applications of the Continuous Wavelet Transform. Certainly it mentions some that are specifically CWT so there is clearly some use of CWT in digital applications.


texts: How to construct ideal low pass filter in matlab?

texts:
Firstly, I was asked to construct a signal $x(t)= 2 \cos(2 \pi f_1 t) + 1.5 \sin(2 \pi f_2 t) $ with $f_1= 100, f_2=200, t= 50 \textrm{ms}, Fs= 1\textrm{kHz}$ and number of FFT points $N = 1024$ and my code until this part is below.

f1=100;
f2=200;
fs= 1000;
N= 1024;
t=0:1/fs: 0.05;

x= 2*cos(2*pi*f1*t) + 1.5*sin(2*pi*f2*t)

I don't know that if this is the ideal low pass filter with frequency $f_c$, how to construct it in MATLAB?


texts: How can I spread a modulated signal over walsh code

texts:
I need to confirm if spreading signal by using walsh code in MATLAB is right or no,

Suppose I'm using QAM modulation, so I need to spread the signal over walsh code, is the below step is right:

M = 4;
alphabit = modem.qammod('M',  M ) ;             %QAM modulation
mod = transpose(modulate( alphabit , (0:M-1)));
avg = mod'*mod / M ;                % average power of constellation points
mod = mod / sqrt(avg);              % to make E[x^t x ] = 1
H = hadamard(4);   % The walsh code generation
H_use = H(:,2);  %using the second column for spreading.
S_coded = kron(mod,H_use);  % Spread the modulated data mod over the walsh code

My question is about the last step, is that right how we spread the modulated signal? ..


texts:
I have doubt regarding memory of FIR and IIR, I have read that output of FIR depends upon present and previous inputs, while output of IIR depends upon, present and previous inputs as well as previous outputs. Can anyone explain me how FIR consumes more memory than IIR?

Source: https://dspguru.com/dsp/faqs/iir/basics/

Thanks very much.


texts: Is there a physical reason why phase should be uniformly distributed?

texts:
I was thinking a little about how signal phase might be distributed. Usually in such discussions I see people make the assumption that phase is uniformly distributed between $0$ and $2 \pi$. This only makes sense to me if its a statement about our ignorance of the system in question. That is, if we don't know anything about the phase, then it makes sense to assume all phase values are equally as likely -- uniformly distributed.
Is this the only reason though? Is there a physical reason, or process, as to why this can be the case?


texts: How to design a filter that can filter out noise accurately, after setting the parameters of the filter using standard signal?

texts:
I meet a problem with designing a filter. I have two different instruments that could measure the same AC signal (usually ~200hz, always <1kHz), A and B.  A can carry out signal measurement during the normal operation of the instrument.
B can only be used during instrument calibration, and A can also be used at this time. B can accurately measure the signal. The measurement accuracy of A is lower than that of B.

I want to design a real-time filter for A to filter out the interference noise. The parameters of the filter are adjustable. When the instrument is calibrated, both A and B are used to measure the signal.
The measurement result of B is taken as the standard result to calculate the parameters of the filter adaptively. After setting the parameters of the filter, A is used to measure the signal without B.

I have investigated a variety of filters and found that the adaptive filter is quite suitable for my needs. However, the adaptive filter needs to input two signals, while I can only provide the measurement result of A during the operation of the instrument. So the adaptive filter is not completely suitable for my needs.

I don't know how to solve this problem. Is there any method that suits my needs?
Thank you very much!


texts: Estimate the type of wavelet transform in receiver side

texts:
Suppose that a signal is decomposed by using discrete wavelet transform (DWT) and transmitted. Is it possible for receiver to find which type of wavelet is applied in transmitter side ?

I mean, if the signal is decomposed by Haar or DB and then reconstructed. Is it have any way to know the type of wavelet (like haar) that is already used ?


texts: Spectrogram from scipy.signal with Python

texts:
To test the python spectrogram (from scipy.signal) , I've created a signal with 2 harmonics: 2 Hz and 8 Hz. Then I've added 50Hz noise and a trend (https://i.imgur.com/t1SnQck.png). I wanted to retrieve those frequencies with spectrogram. I only find 10 Hz and about 50 Hz with the noised signal (https://i.imgur.com/I0hMtAC.png). I tried on the original signal without trend and without noise. I only find about 10 Hz (https://i.imgur.com/MVokSSS.png). Do you have any explanation of this ?
The code is only 3 lines ("new_sa" is the noised signal with the trend and "PerEch" period of sampling).

from scipy.signal import spectrogram
f,t1,Sxx = spectrogram(new_sa,1/PerEch)
plt.pcolormesh(t1,f,Sxx)
plt.colorbar()

Thank you


texts: Can you help me to understand Multi-tone FSK, and how I can implement it?

texts:
Any paper, book, Matlab file... that you would recommend.

Thanks.


texts: What are reds and trans in Image processing

texts:
I'm trying to understand this code, however I'm unable to deduce the meaning of reds and trans. I would be glad if you can help with it:

import sys
import Image

# pixel constants in hex
trans="\x00\x00\x00\x00"
# reds most to least, the last is trans and used as a noise factor
reds=("\xf1\x34\x00\xff" , "\xfa\x00\x2f\xff",
   "\xf1\x36\x36\xff", "\xfe\x74\x74\xff", "\xfe\xc3\xc3\xff",
   "\xf9\xcb\xcb\xff", "\xf1\xd3\xd3\xff", "\x00\x00\x00\x00")

The complete code is at: https://matsu-project.googlecode.com/svn-history/r28/trunk/streaming-image-processing/src/reduce.py


texts: How do you convert angular frequency to $\textrm{Hz}$ from MATLAB's $\tt freqz$ function?

texts:
Let's say I have used MATLAB's butter function to generate a 3rd order, low-pass, Buttersworth, digital filter. I have a sample rate of $2000\textrm{ samples/second}$, and I want the cutoff frequency to correspond to an analog frequency of $700\textrm{ Hz}$. Because MATLAB defines its normalized frequencies as percentages of the Nyquist frequency, the $700\textrm{ Hz}$ would turn into $700/1000 = 0.7$. I feed these parameters into the butter function and outcomes my filter coefficients.

I then use the freqz function on these coefficients to obtain the [h, w] vectors. h corresponds to the filter output at a specific frequency, and w is the angular frequency.

I'm having a difficult time understanding the units of the angular frequency. I would typically think of $\omega$ of having units of $\rm rad/s$, but i don't believe this is correct due to us having normalized the frequency earlier.

Would anyone mind explaining to me the units of w outputs by freqz?
And specifically how I would be able to scale that back to an analog frequency in $\textrm{Hz}$?