texts: Implementing FIR Hilbert Transformer in Python

texts:
I want to implement FIR Hilbert Transformer in Python using window method. I'm new to digital signal processing so please point out to me all mistakes you notice.
Ideal Hilbert transformer is described as:
$H(e^{j\omega}) =
    \begin{cases}
        -j & \text{, $0 < \omega < \pi$} \\
        j & \text{, $-\pi < \omega < 0$}    \\
    \end{cases}
$
from which we conclude that ideal Hilbert Transformer is all pass filter $|H(e^{j\omega})| = 1$.
I know that FIR filter can be implemented using scipy.signal.firwin function.
What I don't know is which parameters to pass to function in order to get Hilbert filter aproximation.


texts: Transposed Direct Form II VS Direct Form II IIR filters?

texts:
I read in "Discrete-Time Signal Processing" Reference, in transposed Direct Form II filters section, that it implements zeros first then poles(unlike Direct form II which implements poles first), Which is important in the presence of quantization of finite precision or noise without adding further explanation.

Why implementing Zeros first is better than implementing poles first?


texts: How to create a test to measure end to end audio delay

texts:
Lets say I have a program like Skype and I call to my friend. I want to create a test to figure out what is the average delay from the audio, from my mic to his speakers.

I want to measure:

delay in one instance of time
delay over longer period (60 s)

Assumptions that i can make:

at least 8000 samples per second.
devices are in the same room and network propagation delay is negligible.
external mic and photo-detector/camera should be used.


texts: DFT sinusoid's fundamental frequency, intuitively

texts:
I am trying to understand, intuitively, the mapping of a sinusoidal signal's fundamental frequency from time domain to frequency domain using $\textrm{DFT}$ formula. Given the time domain samples $\{x[0], x[1], \dots, x[N - 1]\}$; we have from the $\textrm{DFT}$ formula:

$X(f_k) = \displaystyle \sum_{n = 0}^{N - 1}x[n]\exp\left(-j2\pi f_kn\right)\tag{1} \label{dft}$

for $f_k = k/N$ and $k =0, 1, \cdots, N - 1$.

For this purpose I used a sinusoidal signal in Matlab and its windowed version. Here is an excerpt from my Matlab code:

Fs = 1000;
Ts = 1/Fs;
t = 0:Ts:(1000 - 1)*Ts; %1sec

A = 2;
F = 20;
y1 = A*sin(2*pi*F*t);
y2 = y1.*hann(length(y1))';

nfft = 2^nextpow2(length(y1));
Fy = (Fs/2)*linspace(0, 1, nfft/2+1);

Y1 = 2*abs(fft(y1, nfft));
Y1(1) = .5*Y1(1);
Y1 = Y1./max(Y1);

Y2 = 2*abs(fft(y2, nfft));
Y2(1) = .5*Y2(1);
Y2 = Y2./max(Y2);

See the figure below for the time domain and frequency domain plots of the signals

I have two questions:

How can one intuitively see that the linear combination of exponentials from $\eqref{dft}$ will yield a sum with an absolute amplitude $\left| X(f_k)\right|$ that has a maximum at the fundamental frequency $\textrm{F = 20 Hz}$ ? Or is this an optimization problem of the absolute amplitude spectrum $\left|X(f_k)\right|$ wrt to $f_k$ ? Or is this just the magic of the $\textrm{DFT}$ ?
How is the tapering of the signal by non-rectangular window explain from $\eqref{dft}$ the better localization of the maximum at $\textrm{F = 20 Hz}$ (i.e minimized leakage around the fundamental frequency) ? I am well aware of the theory on windows, leakages. I'm more looking for an explanation based on equation $\eqref{dft}$. From the visual inspection of $y_1$ and $y_2$ on the top figure, how could one conclude, from the linear combinations in $\eqref{dft}$, the difference of shapes in  $\left|Y_1(f_k)\right|$ and $\left|Y_2(f_k)\right|$?


texts: Difference between spectrogram and a figure in an audio signal

texts: i wrote a function in MATLAB which will divide a audio waveform (a speech) into smaller windows with overlap .The output will be a matrix X, each column of which contains the windows which i export. Then i calculate the FFT of each column, i remove half of fft bins and i visualize the measure of each FFT frame as an image, using the "imagesc" command.Then i made a spectrogram of my signal and it gives me this figure. Im wondering if this two figures are the same or not. Ok it seems that maybe they are the same but why the colors for example are different? Or is there any other difference between this two figures?


texts: About the variance of the coefficient of narrowband noise when using signal-space representation

texts:
Assume that n(t) is a white Gaussian noise process with zero-mean and power spectrum density $N_0/2$. By using the signal-space representation, it can be expressed as:

$$n(t) =\sum_{j=1}^N n_j \phi_j(t)+n_o(t)$$
where $n_j = \int_{-\infty}^{\infty}n(t)\phi_j(t)\,\mathrm dt$ , $\phi_j(t)$ is the basis function and $n_o(t)$ is a part which cannot be expressed in terms of this basis function.

If the noise process $n(t)$ is a narrowband noise of bandwidth $B$ centered on frequency $f$, can it still be expressed in this way?

My understanding is that only after the matched filter, the part $n_o(t)$ is removed.
So the narrowband noise also can be expressed in this way.

Is my understanding correct?

In addition, the coefficient $n_j$ must be a random variable, how to derive the variance of the $n_j$ in the case of narrowband noise ?


texts: Creating a Phantom Sound through 5.1.2 Speaker Configuration

texts:
I am trying to use a 5.1.2 speaker configuration (left front, center, right front, left rear, right rear, left front height, right front height and Low-Frequency) to create a phantom sound at a certain location. I am looking for an algorithm which takes the 3D coordinate and current velocity of the emitter to calculate sound level at each speaker.

I have been doing research on this and what I found was use Head Related Transfer Function to calculate the sound pressure at right / left pinna, and use cross-talk cancellation to eliminate cross-talk effect from multiple speakers. However, I suppose HRTF is meant for creating virtual sound from headphones which does not help from my perspective. Can someone give some ideas on this? Thanks!


texts: Reduce impact of outliners for frequency analysis by increasing signal length?

texts:
I am working on a project to detect drivers drowsiness with EEG signals. I am using the frequency values retrieved by FFT. I have some outliners (artifacts) in my signals, which I don't want to remove manually. I am doing some things automatically, but I can't catch every single outliner.

Right now I am analyzing a 1 sec (64 values) window and see that outliners have a big impact on the results. I'm wondering if increasing the window length could minimize the impact of the outliners?

If my assumption is right:

Is there any source I can cite?
Is this depending on the implementation?

Thanks in advance!


texts: Confusion with data after cross correlation

texts:
Surely this question has been answered before in parts but I cannot find one solid answer. Ultimately I am trying to calculate the audio delay between two signals I am recording on USB microphones. With no problem I am recording the audio, reading it back into python, computing the cross correlation/convolving, and then finding the delay. When I manually create the signals (one with a delay) and feed them into my algorithm both methods find the right delay. As a test for real data I am trying to find the speed of sound between two mics (velocity = dis / time). Again, with a man-made delay of 76 frames and mic spacing of .6 meters I get a speed of sound of roughly 348.157...close enough for me.

When I try this with real recorded data no two tests have similar outputs; huge outliers, and no consistency.

What should I try next? filtering?
Add more mics for more accuracy?

The source signal is Guassian white noise. Any help you guys can give would be awesome.


texts: Poles and zeros in time domain of analogs filters

texts:
I am currently studying two Butterworth and Chebyshev low-pass filters of order $n =3$ and $n=2$ respectively, whcih are in fact two prototypes to make a bandpass filter. The transfer function that I have is the following one:
$$H(j\omega) = 2\sqrt{\frac{R_G}{R_L}}\frac{1}{R_G(C+\frac{D}{R_L}) + A + \frac{B}{R_L}}$$
where $R_G$ is the impedance in series with the generator and $R_L$ is the load impedance

For the Butterworth filter the data is the following:
$$\begin{align}R_G&=R_L=50\;\Omega\\
A &=1 -0.708\omega^2\\
B &=j59\omega \\
C &=j(0.024\omega -0.008496\omega^3)\\
D &= 1-0.708\omega^2\end{align}$$

and for the Chebyshev filter the data is the following:
$$\begin{align}R_G&=50\Omega\quad R_L=18.8\;\Omega\\
A &=1\\
B &=j34.25\omega \\
C &=j0.036\omega\\
D &=1-1.233\omega^2\end{align}$$
and this is the poles diagram computed with the data above of such circuits:

where:
$$\begin{align}
\omega_{pB_1} &= j1.66\\
\omega_{pB_2} &= -1.45+j0.83\\
\omega_{pB_3} &= 1.45+j0.83\\
\omega_{pC_1} &= -0.9 + j0.55\\
\omega_{pC_2} &= 0.9 + j0.55
\end{align}$$

It is clear that both systems are going to be unstable since they have poles in the right-half plane, but how will these poles look in the time domain? I have read articles like this one or this one and some questions on this website, and I know that if they were complex conjugated poles the response in time domain would be a sinusoid type signal.

I am asking this because the majority of the examples have two conjugated poles, which in this case they are not, and hence the time domain expressions won't be sinusoids, or I am wrong? Could someone answer with the inverse Laplace transform in Matlab of my transfer function?

Note that I am not asking for my job to be done, I have already made it, but some more information about those poles will be appreciated.

Thank you.


texts: Searching for image samples in order to create custom classifier

texts:
I am training a classifier of my own, specifically for detecting body arms. According to the training process I have to provide positive samples and negative samples, wich will be used in the different stages of the cascade classifier. As Mathworks says here, there is a tradeoff between having a higher false positive rate(wich I think is good) and the training set size you have, so, if I want a high false positive rate, then I have to provide a lot of positive and negative samples. I don't expect to provide picture by picture and selecting ROIs(Region of Interest) hundreds of times manually, so my questions are:

Is there any good repository of sample images for CV and specifically
for body parts(I need arms specifically) different from this.?
Am I doing the right thing, or creating samples of my own is a better
way to do this?

PD: Remember: I am interested in having a high false positive rate


texts:
I recently started designing a Polyphase FIR filter in with a lanczos kernel interpolator to resample an image in Python. The goal is to downscale the image using these methods. However, I think I don't understand the intuition behind these processes.

I have a RGB image with dimensions (1000,1910,3) which is sent through the polyphase filter with the lanczos kernel, and I can manage to upsample the image. But downsampling is giving me nightmares. My grand theory is that I just don't understand the basic principle of what interpolation and downscaling actually means when applied with the polyphase filter. It is mostly the tap-parameter in the filter, and its impact, that I just don't seem to get. Is there anyone who could explain the polyphase filters function in regards to image processing simple words?

I am quite new to applied signal processing, so I apologize for my noobines.


texts: Sample keypoint found in multi-scale to one scale (scale space with O octaves)

texts:
For a multi-scale keypoints detector, local extremas are found between the scales at EACH octave.
The scale-space is implemented as follows:
Each octave is downsampled by half from the first image in the previous octave.
In each octave the images are smoothed with a gaussian kernel s times (s in the number of levels in each octave). So, the scale space is constructed by o ocatves with s levels = o*s images at different sizes and different smoothing levels.

Say, I have keypoints at the last octave (the smallest image), in scale s. Approximating the maximas (for better accuracy) gives (x',y',s').

My question is:

How are these values (x',y',s') converted to the original size image ? (surely, the location (x','y) of an image that was downsampled is different than the point location in the real image)

Thank you.


texts: How to achieve an arbitrary phase shift?

texts:
To help demonstrate why a time delay appears as a linear phase shift and not a constant phase shift I wanted to plot what a constant phase shift looks like.

I have been looking at the Hilbert transform, which shifts the phase (of positive frequencies) by $-90^\circ$, but I was unable to find a transform or technique that allowed shifting the phase by an arbitrary amount.

How can I shift the phase of a signal arbitrarily?


texts: Physically, what does the usage of two variables mean for convolution

texts:
My intuition of convolution is that it is just a way to depict multiplication of two signals where each signal is made up of various frequencies and phases.
Since it isn't easy to find the value of $\cos({w1}+{\phi1})+\cos({w2}+{\phi2})$ multiplied by $\cos({w3}+{\phi3})$, we need a simpler method to represent our resulting signal, similar to how we would use phasors when adding signals of the same frequency.
And intuitively, convolutions are seen as sliding windows.
But I am confused about how that logic gets translated into our equation with $t$ and ${\tau}$
$$
y(t) = x(t) * h(t) = \int_{-\infty}^{\infty}x(\tau)h(t - \tau)d\tau
$$
${\tau}$ is very clearly some dummy variable but beyond that I feel a little confused.
The value $t$ is used to used as time to check out value at a certain instance. And I think using t as a time-shift allows us shift the impulse function to just see it as a moving periodic function function and we are purely changing the origin point of our impulse response.
Because that matches what you are taught as an undergraduate and you draw different regions of overlap.
Is two variables then just to depict:

How much overlap there is between signals since there will be points of the signal that "crossed" the LTI system or haven't reached our filter yet.

What the status of signals are during that overlap?

Would my intuition so far be correct? Which variable is representing this term and how does it relate to the pen and paper method for looking at regions of overlap?


texts: In machine learning, we often see the expression "end-to-end" learning (or training). However, I do not know that it means. When is a network called end-to-end training? How to recognize a network is end-to-end learning?


texts: I'm want to program my own vocoder synthesizer like "Songify" but I can't find a simple of vocoder algorithm. Maybe you can explain or tell where to look for information on how vocoder works.


texts:
I am computing a spectrogram and I've found a code example online which goes like this:

for jj = 1:size(signal_framewise,2)
    current_frame = signal_framewise(:,jj);
    dtf = fft(current_frame).*gausswin(window_length_s);
    %nfft is half of the fft results (since the fft is symetric)
    out_buffer(:,jj) = dtf(1:nfft);
end

But I intuitively did it like this:

for jj = 1:size(signal_framewise,2)
    current_frame = signal_framewise(:,jj).*gausswin(window_length_s);
    dtf = fft(current_frame);
    out_buffer(:,jj) = dtf(1:nfft);
end

The difference is, that the guy online applies the window to the finished FFT and I apply it to the signal frame. Question is: What's the right way to do and does it make a difference? I've attached the outputs of the spectrogram and the full code.

[![%% my implementation][1]][1]

clc; clear all; close all;
Fs = 44100;
t_max = 3;
T = 1/Fs;

time = 0:T:(t_max-T);
input = chirp(time,1500,1,8000);

window_length_t = 0.01; %10ms window length
window_length_s = round(0.01 * Fs); %window length in samples
if mod(window_length_s,2) == 0
    window_length_s = window_length_s + 1; %make sure we have odd window size
end

%activate the following for a no overlap implementation
%signal_framewise = buffer(input , window_length_s);
signal_framewise = buffer(input , window_length_s , floor(window_length_s/2));
nfft =((window_length_s-1)/2)+1;

out_buffer = zeros(nfft,size(signal_framewise,2));
for jj = 1:size(signal_framewise,2)
    current_frame = signal_framewise(:,jj).*gausswin(window_length_s);
    dtf = fft(current_frame);
    out_buffer(:,jj) = dtf(1:nfft);
end

F = linspace(0,Fs/2,nfft);
T = linspace(0,3,size(signal_framewise,2));
surf(T,F,20*log10(abs(out_buffer)), 'EdgeColor', 'none');
axis xy;
axis tight; colormap(jet); view(0, 90);
xlabel('Time');
colorbar;
ylabel('Frequency(Hz)');
set(gca, 'YTickLabel', num2cell(get(gca, 'YTick')));


texts: In a JPEG file, how much is noise and how much is the image?

texts:
I have an IP webcam that generates very low light images of a plain background.  The camera spits out JPEG only files.  The following is one such frame...

and this is with graphic equalisation applied...

You can see that there is a lot of noise, but also a discernable image of the stepped lens mount.  These JPEG files are approximately 20KB in size.

I want to determine what proportion of the 20KB is due to the fixed image (of the lens mount), and what proportion is entirely due to noise.  It's important to reiterate that I'm only concerned with the proportions of the JPEG file, and not the expanded raster images.

So noise.jpg(part) + mount.jpg(part) = 20KB.

My instinct suggested repetitively sampling the static image and frame stacking to isolate the lens mount.  That fundamentally doesn't work.

How can I determine these proportions?


texts: Why do we really split pulse shaping between the transmitter and the receiver?

texts:
EDIT: There was a small error in my code when plotting the Squared RC. Below is the correct frequency response, and clearly RC² doesn't fulfill Nyquist's criterion.

---------------------------------- Original question (to discard)

So first let me start by asking if using a Raised Cosine filter at both the transmitter and receiver (matched filter) gives a response that is ISI free? (Assuming an ideal channel)

In other words is the SQUARED (not root-squared) frequency response of RC $H_{RC}(f)^2$ still fulfills Nyquist's ISI criterion?

I avoided a direct derivation since the mathematical expressions are quite intimidating so I turned to Matlab and quickly plotted the frequency response of both the RC & RC squared and tried to calculate: $\sum H(f-k/Ts)$ and check if it's constant.

The graphs show that both $H_{RC}(f)$ and $H_{RC}(f)^2$ add up to a constant after performing the previous operation. Moreover I performed an ifft on $H_{RC}(f)^2$ and plotted it and it seems to have zeroes at $kTs$ (for $k\neq 0$) just like the RC time domain function.

So bets are, if my Matlab code is correct, that RC² fulfills Nyquist's criterion. Am I missing something here?

Now if the RC² is also ISI free, why wouldn't we use an RC at both the transmitter and receiver? Why do we turn to a root-raised cosine instead?

Why did we go from an RC to a Root-RC? Most textbooks say it's to split the filtering between TX & RX and to get an overall ISI free response but the same could be done with a RC filter.

Thanks in advance.


texts: Why dft of moving average impulse response has 0 angle

texts:
I wanted to visualise angle and magnitude of moving average DFT. I used python3 for that:

import numpy
irs = [1 / 5] * 5
dft_irs = numpy.fft.fft(irs)
print("dft", dft_irs)
print("magnitude", numpy.absolute(dft_irs))
print("angle", numpy.angle(dft_irs))

I got results that I do not understand

dft [  1.00000000e+00+0.j   0.00000000e+00+0.j   1.38777878e-17+0.j 1.38777878e-17+0.j   0.00000000e+00+0.j]
magnitude [  1.00000000e+00   0.00000000e+00   1.38777878e-17   1.38777878e-17 0.00000000e+00]
angle [ 0.  0.  0.  0.  0.]

Here phase shift is 0 for every frequency while I know it is not for moving average filter. Please help me understand why I got this strange result.


texts: Why does bandpass performance break down at low frequencies?

texts:
I've got a basic bandpass filter design that works great at higher frequencies, but breaks down at around 150 Hz. Here's the MATLAB code:

[b,a] = butter(4, [106 212]./(Fs/2));
output = filter(b,a,signal);

I also notice that decreasing the filter order lowers this "breakdown" frequency. This question asks a similar question and the answer does fix the problem, but I'm not sure I understand why.

Here are the filter coefficients for the given example (where it starts to break down):

B = 2.12e-09, 0.00e+00, -8.49e-09, 0.00e+00, 1.27e-08, 0.00e+00, -8.49e-09, 0.00e+00, 2.12e-09
A = 1.00e+00, -7.96e+00, 2.77e+01, -5.51e+01, 6.86e+01, -5.46e+01, 2.72e+01, -7.73e+00, 9.61e-01

…and here are coefficients for a slightly higher frequency (mid-band of 250 Hz), where it doesn't:

B = 2.45e-08, 0.00e+00, -9.82e-08, 0.00e+00, 1.47e-07, 0.00e+00, -9.82e-08, 0.00e+00, 2.45e-08
A = 1.00e+00, -7.93e+00, 2.75e+01, -5.46e+01, 6.76e+01, -5.37e+01, 2.66e+01, -7.55e+00, 9.36e-01


texts: polyphase sample rate conversion with non-integer factor

texts:
I want to do sample rate conversion by subsequently upsampling with factor I=5, and then downsampling with factor D=9.

I have designed a nyquist sample rate conversion filter h() of length M, with matlab's filterbuilder tool for interpolation factor I=5, and decimation factor D=9. Since D > I, I have chosen the normalized cutoff frequency of the filter to be at 1/9, by setting "Band" under filter specifications to 9.

Then I compute I polyphase filters pk(n), which have length K=M/I by sampling h() according to:

pk(n) = h(k + n*I),   for    k=0,...,I-1    and     n=0,...,K-1.

Then I only compute the output samples for each polyphase filter, which are sampled by the downsampling operation. In other words, I compute the output y[m], by sampling the outputs of the polyphase filters yk[] according to:

y[m] =   yk[ floor( m * D / I  ) ]
k    =   ( m * D ) modulo I

Thus, I do not compute samples of yk[] that are not used in the output.

I apply these polyphase filter's first to do sample rate conversion for the rows of the image. Then I apply the same filters to do sample rate conversion for the columns.

However, I get a distorted output image which still, clearly contains alias:

Does anyone know If I'm conceptually doing anything wrong?


texts:
I have two sine oscillators and I get these two different spectrum analysis (let's disregard the slight frequency difference). Is there any deductions that can be made about the "quality", or sine approximation error or any other type of information about the sine generators derived by these graphs? Why the second is more steep? Is it normal? Which of the two is closer to the ideal sine FFT spectrum? What to read so to understand differences of this type?

The sample rate is 32k and there are 8192 frequency bins.

The code that produces this difference is:

a. (upper graph)

double freq;
static double sine_rate;

sine_rate += freq;
*var = (long) ( sin( sine_rate ) * 2142483647.0 );

b.

double freq;
static double sine_rate;

sine_rate += freq;
*var = (long) ( sin( sine_rate * PI ) * 2142483647.0 );

double "freq" is provided when the function is called and can be any double between 0.0 and 1.0. The difference is the multiplication by 3.14.


texts: Why is $\int^\infty _{0^-}\delta(t-nT)e^{-st}dt = e^{-nsT}$?

texts:
I'm currently in the process of going over the $\mathcal Z$-transform and more specifically its derivation. I understand and I am able to follow it up until the final step whereby involving the Laplace transform.

The step that is confusing me is indicated as the step within the red box, derivation taken from Wikipedia page on the $\mathcal Z$-transform. I do not understand how this integral solves to $e^{-nsT}$. I have searched for possible identities relating to this but have not been able to find any help.

\begin{align}
X_q(s)&=\int_{0^-}^\infty x_q(t)e^{-st} dt\\
&=\int_{0^-}^\infty \sum_{n=0}^\infty x[n]\delta (t-nT)e^{-st} dt\\
&=\sum_{n=0}^\infty x[n]\color{red}{\boxed{\color{black}{\int_{0^-}^\infty \delta (t-nT)e^{-st} dt}}}\\
&= \sum_{n=0}^\infty x[n]\color{red}{\boxed{\color{black}{e^{-nsT}}}}
\end{align}

Thanks for taking the time for looking at my question. Any help would be greatly appreciated!

Regards


texts: Image Processing - Identifing/locating Random Solid Blocks of Colour

texts:
I am not overly familiar with image processing. I know a little about it from University, but I have not really done any for a while and I have found myself with a problem that requires it.

What I have is frames of a video which may or may not have blocks (usually 16x16) of solid colour (either purple or green) randomly distributed throughout. What I would like to be able to do is pick out each block of colour and count up the pixels in each.

I have looked into things, and I realise I could perform some sort of edge detection which would produce an image with just the edges highlighted, but that seems to only produce the further problem of how to then identify the blocks from their edges.

I am hoping somebody can point me in the right direction for how to solve this problem, because so far my research has been rather fruitless. There doesn't seem to be a whole lot of useful material out there for a beginner such as myself.

I am using C++, though I would prefer to avoid using external libraries if possible. I am prepared to develop my own implementations.


texts: Coordinate system in digital image processing

texts:
I am trying to understand image coordinate system where I read that it is reversed.
So if $f(x,y)$ is actually $f(y,x)$ where $f(\cdot, \cdot)$ is the image. I am a bit confused and would appreciate help in clarifying certain points.

In digital image processing, an image is a matrix of rows ($m$) and columns ($n$) denoted by $[m,n]$. When showing as an image output would the rows become the $Y$ axis and and column the $X$ axis? Just wanted to confirm this as sometime it is confusing. For example, consider a $3 \times 5$ matrix:

[ 30   40  20  30  0 60
  10   20  15  10  0 20
  20   5   10  30  0 10 ]

where the elements represent the pixel intensities. If I want to access the element 60, how would I specify? Would row, $m = 1$ and column, $n = 5?$ Is row the $X$ or $Y$ axis?

In Maths, if I were to plot in a graph the coordinate $(5,1)$ then 5 refers to the $x=5$ (plotted on horizontal $X$ axis) and $y=1$ (plotted on vertical $Y$ axis). However, in image representation the coordinate $(5,1)$ means go to row 5 and column 1 ie., vertical axis is the row, $m=5$ and the horizontal is the column, $n=1$? Is there a reversal going on or am I misunderstanding something. What is the convention?

So in general, in image Columns --> X axis and Rows ---> Y Axis? But in graphs it is the opposite?
UPDATE:

Consider a matrix
A = [1,2,3
     4,5,6
     7,8,9]

On the graph the coordinate point is $(3,2)$. Here $x=3$, $y=2$. If I want to access element at $A(3,2)$ then this means row (horizontal) = 3, column (vertical) = 2 and the element at $A(3,2) = 2$.
In images does the vertical axis become the rows and the horizontal the columns or is it the same as that of matrices, except for the top to bottom traversal constraint? Something seems to be changing, that is the confusing part.


texts:
Security camera and recorder vendors tout HVEC/H265 codec support in their systems.  As far as I can tell, this is the industry top-of-the-line.  I’ve been using such a system for a few years now and I am continually frustrated by the (I believe) characteristics of the HVEC for this application of forensic video limited by the available settings in the (also terrible) management software.  It seems to me that camera sensors are capable of VERY crisp image capture, but that the lossy encoding makes most video recordings useless for moving faces and plates at reasonable distances.  In security camera footage, almost all content is redundant and uninteresting.  When the scene is still, it seems I could zoom in and count the blades of grass across the street.  I can clearly read distant street signs or the license plates of parked cars.  But when a vandal of foot smashes a car window, or a drunk driver sideswipes a parked car, all I can recover is a useless lossy blur.  It’s very frustrating to have clear boring footage and blurry action footage.

The camera sensors MIGHT be to blame if the issue is motion blur because of shutter speed, but it doesn’t seem to me to be the main problem.  I’ve tried a variety of CBR/VBR, resolutions, framerates to try to get better results.  The software enforces bandwidth limits per camera feed and among all feeds, but I wonder if they are too conservative or if the real limit is the realtime processing power needed to encode.

HVEC was developed for entertainment applications mostly, wasn’t it?  Where subjects of interest are much closer to the camera, we get familiar with the characters, and lossy-related motion blur is more acceptable.

Is there is a better codec choice out there for forensic video?  Is there a codec in which still regions are de-prioritized and motion or even prerecognized areas of interest, such as faces, figures, letters or areas of just high contrast edges, are prioritized in the encoding process?  Is this all possible in HVEC but just apparently not implemented in the commercial-professional recommended systems that I’ve seen?


texts:
I have designed a surface with a shape like a rounded rectangle and I want to detect its exact boundaries in a photo I take from it. A sample photo is like this:

I have tried thresholding the image but even after a Gaussian smoothing, the threshold won't give me an exact boundary.

Does anyone know of a technique that would give me the precise boundaries, regardless of the issues in lighting, etc?

UPDATE:
I'm sorry I didn't state the problem well, and actually I wasn't aware of the real problem (though I think it hasn't changed too much):

Here is the new photo. The photo is taken looking down inside a plastic bucket with a small amount of water inside, and I need to segment the region inside the water from the walls of the bucket, so I can detect the objects inside the water later. There is some lighting illuminating the bottom of the bucket from underneath (actually a sheet of plexiglass is placed instead of the original bottom).

The problem is that the reflections of light on the wall make it the same color as where the water is, in some areas like the bottom-center in the sample image which makes it hard to find the water level.

Also, I would appreciate any hints on how should I differentiate between the boundary related to the plexiglass, and the boundary related to the water level.

Thanks


texts:
In my previous question I asked about calculating a single number as "Spectral Density" feature from signal data. We concluded that it is really a total power and article (link) authors wrote the wrong feature name.
I have a signal with 1 measurement per minute for a few days. It looks like this (in time domain obviously):
,timestamp,activity
0,2003-05-07 12:00:00,0
1,2003-05-07 12:01:00,143
2,2003-05-07 12:02:00,0
3,2003-05-07 12:03:00,20
4,2003-05-07 12:04:00,166

I can assume the noise is white and also other assumptions simplifying the calculations if needed (authors weren't exactly advanced in signal processing, they only used very simple features).
Questions:

How can I calculate the total power? It is "the variance plus the mean squared", so I should just calculate $(\sum_{i}^N x[i]) / N$ for the signal of length $N$? Or just sum the PSD (like in this link)?

Should I perform this calculation in the time domain (just time series like above), or should I calculate FFT and PSD (Power Spectral Density) first and calculate on PSD (which is also just an array of numbers, if I understand correctly)?

I have seen quite a few formulas for the total power. For finite number of samples and discrete measurements I have seen $(\sum_{i}^N x[i])$ divided by $N$, $N+1$, $2N$ or $2N+1$. Which one should I use? Does it have something to do with bias/unbiased sampling, i.e. in statistics we add +1 to the divisor to get unbiased calculations?

EDIT: above there should be $x^2[n]$ instead of $x[n]$


texts:
I am currently working on an audio watermarking project in MATLAB. I currently have a code I am using to construct a nxn 3 Band Wavelet Transform matrix. However, when I try to construct a matrix that is larger in size, I get the error "Maximum variable size allowed by the program is exceeded" or "Out of Memory."

Therefore, I was wondering if someone would be able to tell me what may be the cause of this problem and if there is an exisiting code or toolbox that could construct a 3 Band Wavelet Transform Matrix better and more efficiently. Thank you!

The following is the code I am trying to use. I am trying to create a matrix that is the size 3^9 X 3^9 and 3^10 X 3^10.

prompt = {'Enter Matrix Power: '};
dlg_title = 'Matrix Power';
answer = inputdlg(prompt,dlg_title);
n = str2num(answer{1});  %#ok<ST2NM>

A=zeros(3^(n-1),3^n);
v=[0.338386097283860 0.530836187013740 0.723286276743610 0.238964171905760 0.0465140821758900 -0.145936007553990 ];
w1=[-0.117377016134830 0.54433105395181 -0.0187057473531300 -0.699119564792890 -0.136082763487960 0.426954037816980 ];
w2=[0.403636868928920 -0.628539361054710 0.460604752521310 -0.403636868928920 -0.0785674201318500 0.246502028665230 ];
for j=1:3^(n-1)-1
    for k=1:3^n;
        if k>6+3*(j-1) || k<=3*(j-1)
            A(j,k)=0;
        else
            A(j,k)=v(k-3*(j-1));
        end
    end
end
j=3^(n-1);
    for k=1:3^n
        if k<=3
            A(j,k)=v(k+3);
        elseif k<=3^n-3
            A(j,k)=0;
        else
            A(j,k)=v(k-3*(j-1));
        end
    end

B=zeros(3^(n-1),3^n);
for j=1:3^(n-1)-1
    for k=1:3^n
        if k>6+3*(j-1) || k<=3*(j-1)
            B(j,k)=0;
        else
            B(j,k)=w1(k-3*(j-1));
        end
    end
end
j=3^(n-1);
    for k=1:3^n
        if k<=3
            B(j,k)=w1(k+3);
        elseif k<=3^n-3
            B(j,k)=0;
        else
            B(j,k)=w1(k-3*(j-1));
        end
    end
C=zeros(3^(n-1),3^n);
for j=1:3^(n-1)-1
    for k=1:3^n
        if k>6+3*(j-1) || k<=3*(j-1)
            C(j,k)=0;
        else
            C(j,k)=w2(k-3*(j-1));
        end
    end
end
j=3^(n-1);
     for k=1:3^n
         if k<=3
             C(j,k)=w2(k+3);
         elseif k<=3^n-3
             C(j,k)=0;
         else
             C(j,k)=w2(k-3*(j-1));
         end
     end
W=[A;B;C];
Q=zeros(3^n,3^n);
T=zeros(3^n,3^n);


texts: Design and implementation of causal band-pass filter for biosignals - what to consider?

texts:
I currently work in a project of clinical software (C#) which deals with clinical biosignals, specifically EMG and other low-frequency signals (load-cells, goniometers, and other biomechanical instruments).
We have to be able to:

Create filters based on cuttoff frequencies (low and high) and filter order, for a given sampling frequency; The band-pass could be a cascading of one low-pass and one high-pass filters;
Apply filters in real-time, that is, adding a new input sample and immediately taking a new output sample, in a loop;

I have read a lot about filter types, but explanations are usually based on math notation, while I would need a more computational explanation.
Also, reading source code (mostly from Octave-Forge) I can only "see" a lot of numbercrunching without actually understanding what is happening.
As I understand (correct me if I am wrong), an implementation of what I need would involve:

Choose some input parameters for filter creation, that is, Low Frequency, High Frequency, Sampling Rate, and Filter Order;
Execute some magic operation on these parameters, that would give me a recurrence relation; This recurrence relation would be contained in an instance of a filter;
This filter instance would have a buffer of size N. As I start to collect data, the following loop would start to run:

Add new input sample to filter;
Apply recurrence relation;
Read new output sample;

So what I have to ask is:

Does my computational rationale about filter design and usage (as explained in the bullet-list just above) makes sense from a DSP perspective? That is, would it be a feasible plan to implement some Filter class according to such rationale?

Which concepts should I know / read about in order to properly implement such filter? For example, I understand that recurrence relation, order, sampling rate, (implicit) impulse response, are a bare minimum to define a filter, but I also read about number of taps, poles and zeros, gain, direct form, cascaded sections, and I am not sure it is necessary to deal with all the concepts to satisfy my requirements.

Is there any conceptual topic or resource (link, book) I should take a look? Preferrably one focusing on implementation (that is, without heavy math notation)?


texts:
I'm reading "Fundamentals of Global Positioning System Receivers" section 7.3 "Maximum data length for acquisition" and it's talking about phase transition:

  Theoretically, if there is a navigation data transition, the
  transition will spread the spectrum and the output will no longer be a
  cw signal. The spectrum spread will degrade the acquisition result.
  Since navigation data is 20 ms or 20 C/ A code long, the maximum data
  record that can be used is 10 ms. The reasoning is as follows. In 20
  ms of data at most there can be only one data transition. If one takes
  the first 10 ms of data and there is a data transition, the next 10 ms
  will not have one.

  In actual acquisition, even if there is a phase transition caused by a
  navigation data in the input data, the spectrum spreading is not very
  wide. For example, if 10 ms of data are used for acquisition and there
  is a phase transition at 5 ms, the width of the peak spectrum is about
  400 Hz (2/ (5 × 10−3)).

My understanding was that the C/A signal is a pseudo-random Gold code that is XORed with the data (each data bit being 20*1023 chips long) and the resulting binary signal is BPSK-modulated.

So I would think phase transitions in the C/A signal (caused by the BPSK modulation) would occur much more often, not just between data bits but between chips, every few chips.

What is wrong in my understanding of the modulation of the text?


texts: Find the essential bandwidth of rect function? i want the ans by using Energy spectral density and then essential bandwidth...

texts:
I am trying to find EBW of rect function but i am unable to solve the integral
after finding the fourier transform and then apply parseval's theorem?


texts: How to recognize for small video sequence with a large sequence?

texts:
I'm working on the idea of recognizing a small video sequence (a sequence of 18 seconds) within a long one (a sequence of 15 minutes), the first idea that come to mind stats that I have to characterize this small video with some kind of identification. so I will use the identification to look this small sequence inside the long sequence, I'm asking this question to the community, to share with me an approach that can help me in characterize this small video, then recognize it within the long sequence.

thanks.


texts: Why do IQ Impairements, Quadrature Skew and DC offset have these geometric effects on the constellation?

texts:
I'm studying telecommunications, and would like to be sure to understand the maths behind these effects.
For IQ Imbalance and DC offset, it seems pretty clear why we observe a rectangle shape or a translation of the constellation, but for the quadrature skew, I don't see why we she this parallelogram shape, that stretch more when the skew is growing.
Could you please, neither with maths or graph explain this behavior ?
Thanks for your help !


texts:
I'd like to find some book or books to get information about how digital filter is built depending on specifications. Like depending on price, or speed and etc. As I know it could be built by some D flip-flops and summation blocks, but there are more kind of them depending on specs, so if it's possible to get book or website about this it would be great.
Thanks in advance.


texts:
I have a simple 1sec signal of 1Hz added with 10Hz. I can detect all peaks (I use Python Scipy find_peaks) and I'm trying to deduce the 10Hz signal from those peaks. I can do it but it's not clean since the peaks spacing are not exactly the wavelength. Is there a formula that would adjust the wavelength according to the peaks height difference ? I'm trying to design a filter that removes the highest frequencies at each pass through the signal until there is none left.

and here's the Python code (without signal import or plotting):

_signal_build = np.zeros(len(_signal))
_sig_max, _ = find_peaks(_signal)
_sig_min, _ = find_peaks(-_signal)
for _current in range(0, len(_sig_max) -1):
      _wav_len = int(_sig_max[_current +1] - _sig_max[_current])
      _sine_start = _sig_max[_current] - round(_wav_len / 4)
      _sine_amp = 0.25*_signal[_sig_max[_current]] + 0.25*_signal[_sig_max[_current+1]] - 0.5*_signal[_sig_min[_current]]
      _sine = np.sin(np.linspace(np.pi, -np.pi + 2*np.pi/_wav_len, _wav_len)) * _sine_amp
      _signal_build[_sine_start:_sine_start + _wav_len] = _sine
      print(f"{_sig_max[_current]}-{_sig_max[_current+1]}, _wav_len: {_wav_len}, _sine_start: {_sine_start}, _sine_amp: {_sine_amp}")
_signal_filt = _signal - _signal_build

Thanks, cheers :)

Guillaume


texts: Frequency estimates from three-dimensional data

texts:
I have a lot of three-dimensional positional data from patients with tremor, unevenly sampled at approx. 50 Hz, with timestamps. I am trying to find the dominant frequencies in the signal/tremor. However, the dominant frequency may not be constant.

My current strategy so far has been

Calculating the magnitude (dR = sqrt(df$X**2+df$Y**2+df$Z**2), and detrending by removing the mean.
Interpolating this to a sample rate of 50 Hz using spline (see sample data in Figure 1)

Using pwelchfrom package oce to obtain the PSD with pwelch(indsp$y, fs = smplfrq)

My hypothesis is that I should observe a peak somewhere around 8-12 Hz. However, zero to few peaks are observed (if I'm reading this right), and those peaks have very little strength.

What can I do to improve my frequency analysis? Is it correct to do the calculation on the magnitude of the "signal"?
I would love to be able to extract the dominant frequencies and amplitude from my data.

EDIT: Added info from comments.


texts: Matlab applying an FIR filter to a signal, generated in Matlab

texts:
I want to create an FIR in Matlab and apply it to a signal (also generated in Matlab). You will find the code below. I will put my questions in order from here.

1) The filter coefficients vector "b" should contain coefficients for a bandpass with a filter order of 100 and a passband of 1000Hz to 2000Hz. My sampling frequency is 50.000Hz. Matlab uses normalized frequency. As far as I have understood, my formula to transform my frequency to a normalized frequency is f_norm = (2*f)/f_sample. So in my example I would get 0.04 for 1000Hz and 0.08 for 2000Hz. Is that correct?

2)I am creating a test signal sinuses with the frequency 200Hz, 2500Hz and 5500Hz and compute the two sided fft of the amplitude. The graph is attached

This looks good, since the overall amplitude should be about 0.33 for every signal part. Now, when I apply my filter to the signal and plot the two sided fft of the result, it shows the next graphFFT Signal after filter

I mean I can see the 5500Hz being filtered out, but the amplitude of the 2500Hz signal drops by a factor of 10 and the 200Hz signal is also not filtered out completely. What are some things that I can improve here? 3) Also, when I only raise the filter order, I am getting worse results with more suppression on the 2500Hz signal and less suppression on the signals that I want to have filtered out.

%fs = 50000
b = fir1(100, [0.04 0.08], 'bandpass');    %passband 1000Hz bis 2000Hz
figure(1);
freqz(b,1,2001);

f1 = 100;                  %Hz
f2 = 5500;
f3 = 2500;
A = 1.00;                  %Amplitude
sampleRate = 50000;
sampleTime = (1/sampleRate);
t = 0:sampleTime:1;

s1 = A/3 * sin(2 * pi * f1 * t);
s2 = A/3 * sin(2 * pi * f2 * t);
s3 = A/3 * sin(2 * pi * f3 * t);

signal = s1 + s2 + s3;

Y = abs(fft(signal));
samplePoints = length(Y);
Y = Y / samplePoints;
F = linspace(0,50000,50001);

figure(2);
plot(F,Y);
grid on;

y = filter(b,1,signal);

Y = abs(fft(y));
samplePoints = length(Y);
Y = Y / samplePoints;
F = linspace(0,50000,50001);

figure(3);
plot(F,Y);
grid on;


texts: Is it possible to reconstruct an image using its magnitude only?

texts: Let us take any image like Lena or cameraman. I know that when Fourier transform is applied on image,spatially global features like amplitude and phase are obtained locally. My question is whether it is possible to reconstruct an image from its magnitude only keeping phase value zero or different than actual value? Can anybody explain?


texts: Taking transfer function out of real heating system

texts:
I have some king of heating system: heater (that I can control current for final power control) and a thermocouple (for measuring the temperature). I also have a device that can record temperatures from thermocouple.
I would like to take a transfer function of my system for my PID-alike algorithms testing in Matlab.
How can I do it? I am wandering if setting the heater for some low power and recording the temperatures is enough. How can I generate tf in matlab out of that king os step response?
I have full version of Matlab with all toolboxes (especially Control System Toolbox).


texts: Frequency response of a filter - fft vs. freqz

texts:
I have designed my filter using firhalfband(N,Fo,A), which gives me the filter coefficients. Then I try to see the frequency response of it. I use these two function: fft, and freqz, but they are giving me different result in my figure, why is that? I wonder how these two MATLAB functions operate when taking the frequency response of a signal. I am expecting them to be the same.

Thank you


texts: Normalizing white noise to match pink noise's amplitude at a given frequency?

texts:
I have a pinking filter which I am running white noise through to get pink noise. I would like to then mix the white noise with this pink noise, where the amplitude of the white noise will match the pink noise at a given frequency.

My pinking filter is +/-0.5 dB above 10 Hz.

So let's say I want the white noise to match the amplitude of the pink noise at 100 Hz. Or at least be standardized to close to this frequency's amplitude.

I believe in terms of power which is amplitude squared for pink noise we have: power = 1/freq.

So would it be: amplitude = sqrt(1/freq)?

And thus amplitude of pink noise at 100 hz would be 0.316? I know that's not correct but I don't know what is.

Basically I'm looking for a multiplier for the white noise so that at that given frequency it will match the amplitude of the pink noise.

Thanks.


texts: Digital filter design basic principles (IIR/FIR)

texts:
Although I have a solid experience in designing audio engines and such, I am fairly new to the realm of Digital Filter Design, particularly IIR and FIR filters. In other words, I'm trying to learn as much as I can on how to design filters and derive their difference equations. I'm starting from the basics, so please bear with me, like I said, I'm trying to learn.

Herein is my question:

Say I want to design a low-pass filter with a particular cutoff - say 300 Hz. What would be the best way of mathematically deriving the transfer function and then deriving the particular difference equation to implement the filter in Direct Form I and Direct Form II (or only DF-1 for now...)?

I have some understanding of transfer functions and how they relate to difference equations from some excellent material on the web, unfortunately some of it assumes a good bit of prior knowledge, so it is more confusing than helpful in my quest. So I guess I need a more step-by-step example which will help me connect the dots.

So I'm basically looking for help with a breakdown of the process starting from choosing the cutoff frequency up to deriving the difference equation.

Any help will be much appreciated. I am familiar with a lot of the concepts - impulse response, DFT's, the math behind it, I guess what I need more help with is the concept of the z-transform and the pole/zero use to design the filter's transfer function and then how does the cutoff freq. play in all this to finally derive the difference equation.

Since I tend to learn best from example, I thought I'd ask here.
Thanks a lot to anyone who finds the time to help me out.


texts:
I have a project that requires detecting and processing letters in a given input image. I am also new to subject of image processing. There are lots of subsubjects in image processing. I believe I don't have to learn all the concepts of image processing to achive my purpose.

Question above; how can I detect letters in a given input image?
Note: I already know matlab. I need to do this by implementing algorithm, not by a built-in function.

I am gonna tell my thoughts. I want to write an application which takes an input image as an argument. If there is are English letters on that image (photo), it will detect them by circling each of the letters. I don't know which subject in digital image processing I must look at.


texts: Amplitudes and phases of transform of an image

texts:
I have recorded an image of a large macromolecule and after several types of image analysis, have obtained a rotationally averaged image, that is not quite perfect, but appears to show 6-fold symmetry. With the origin on the axis of rotation, I compute a transform and unlike most of my colleagues, if I actually look at the amplitudes and phases of the transform. I have only one image of this molecule and no more specimen left. So my questions are:

What feature(s) I should see in the transform’s amplitudes and phases?
If the amplitudes and phases do not conform exactly to my expectations, what would that mean?
What are the factors that degrade my image?
What should I do to make the transform conform to my expectations?

Any ideas are welcome. Thanks in advance!


texts:
I'm in the process of implementing a general purpose baseband system for modulation schemes (Linear + CPM) commonly used satellite and deep-space TT&C as shown in the functional flow block diagram (FFBD) below.

So far, I have implemented most of the blocks (in GNU Radio). At the moment, I'm testing the BPSK implementation. In the tests, the software is able to receive transmitted frames when the blocks are arranged according to the figure or when I changed the position of the equalizer. i.e both [--- Matched filter-> equalization -> demodulation -> timing -> phase -> decision] and [--- Matched filter-> demodulation  -> timing -> equalization -> phase -> decision] works fine. Phase recovery is done by the Costas loop. The timing recovery block uses a TED based on maximum likelihood. I use a blind equalizer (constant modulus algorithm (CMA)). I still have doubts about my approach in the FFBD and thoughts regarding the following questions will be highly appreciated:

A suggestion for the optimum location for the equalizer in relation to time and phase recovery.
Any thoughts on improving the overall approach in the FFBD.

I will happily provide clarification if needed.

Regards,


texts: Why are FIR filters still stable even though they contain poles?

texts:
How come FIR filters are always stable?
Since they contain poles, shouldn't they be more affected by stability issues than others?


texts: How to determine where to sample for demodulation of BPSK signals?

texts:
I have a simple BPSK demodulator. Very simply, the signal comes in and is split into two branches, one for I and one for Q.

The I branch is mixed with a sin wave of the carrier, and the Q branch mixed with the cosine wave of the carrier.
Then, each of the outputs is convolved with a matched filter, (in this case a root-raised-cosine, which initially pulse shaped my transmitted bits).
Now, if I combine both outputs and take the magnitude of both of them (I^2 + Q^2), I get the envelope.
From here, I look for peaks, and choose their indicies.
I then use those same indicies that I got from (4), and sample my I and Q at those same indicies. Now I have complex softbit values, and am able to correct for any phase or frequency offsets, and can make hard decisions from there. (I have the luxury of post processing btw).

This technique worked well with high to medium SNR. The problem is that with lower SNR (and maybe multipath), I do not know how to perform bullet (4). The problem is that instead of one peak in the envelopes corresponding to one bit, I now have multiple peaks, and 'peak picking' wont work because there are so many to choose from... how is this problem mitigated? This seems to be a bottleneck because if I cannot tell where my 'bit' is, I cannot move forward. Any thoughts?

Any help is appreciated, math is good, although I would ask the answers be more pesudo-code /concept oriented in advance. Thanks!

Edit: Thanks to feedback from Dilip, I should also add that I can clearly see 'energy' in the envelope when there is a signal and there isnt a signal. (ie, before my signal arrived), so this leads me to believe that I should be able to sync/demod and that it isnt an SNR issue solely...


texts: Possible to implement simple IIR filter with greater than 6 db/octave slope?

texts:
I am using the following IIR code as a low-pass filter in a software project, and it works great. However, I would like the slope of the filter to be much steeper as the one here seems to be very gradual (6 db/octave, from what I understand):

#define CUTOFF_FREQ 500.0
#define SAMPLE_RATE 48000.0

float RC = 1.0/(CUTOFF_FREQ*2*M_PI);
float dt = 1.0/SAMPLE_RATE;
float alpha = dt/(RC+dt);

float output_sample,prev_sample,cur_sample;

/* Run the filter on the two samples (normally done inside a loop) */
output_sample = prev_sample + (alpha*(cur_sample - prev_sample));

I would like perhaps a 12 db/octave slope or even 18 db/octave, similar to the low-pass filters in popular audio programs. Is it possible to modify this code for this purpose? Or should I be looking into alternate implementations altogether?


texts: Downsampling audio for use in Machine Learning

texts:
I'm trying to use the work (Neural Networks) done in this repo:
https://github.com/jtkim-kaist/VAD

It says this:

  Note: To apply this toolkit to other speech data, the speech data
  should be sampled with 16kHz sampling frequency.

I've got speech data at 48khz. I've read in places that reducing sampling rate is a complicated process, you can't just remove every nth datapoint, you have to filter things...

Is this necessary if I only intend to use the data in the Neural Network toolkit provided by the repo I linked?
If so, is there an industry standard method for changing sample rate?

I realise that it probably depends on what features are being used. However the feature that is used is this:

  MRCG (multi resolution cochleagra) concatenates the cochleagram features at multiple spectrotemporal resolutions

This is a ruddy complicated feature! Lets pretend we're just using a Melspectogram (unless you're willing to answer the question from the perspective of MRCG's).

Neural networks are likely to use features of a Melspectogram that we wouldn't think of. This makes me think it is unwise to train the Neural Net using downsampled speech data unless we intend to predict using 48khz data downsampled to 16khz forever after...

What do you think? Can I use my 48khz data - downsampled with no filtering - with the expectation that the model will work for prediction on real 16khz data?

And then for future readers sake, how about the other way? Say I had an 8khz file, could I increase the sample rate to 16khz without filtering?


texts: What are some good images to use when comparing image compression algorithms?

texts:
There was a question about images that are hard to compress. Are there images that are better suited to testing compression quality than others?

Maybe an image of diagonal lines of specific colors at a specific angle would be more likely to show artifacts of algorithms / libraries than others? High contrast colors? High contrast black and white? Checkerboards? Certain kinds of photos?  Maybe there is a set of standard images to use to compare? Is it mostly subjective or are there objective criteria for comparing?


texts:
Consider the Fourier transform $F(\omega)$ of the function $f(t)$. The magnitude of $F(\omega)$ depends on $\omega$ and thus also depends on the scale of the $t$-axis. For example, when $f_1(t)$ is a box function which is 1 between $[0,1]$ s and $f_2(t)$ is a box function which is 1 between $[0,1]$ ns = $[0,10^{-9}]$ s, then the amplitude of $F_1(\omega)$ is $10^9$ times larger than the amplitude of $F_2(\omega)$. This is because the time scale is reduced by a factor $10^9$ in the second case.
However, no difference would be obtained when you do a numerical Fourier transform. If you have 100 points of the function $f_1(t)$ equally spaced between $[0,10]$ and also 100 points of the function $f_2(t)$ equally spaced between $[0,10\times10^{-9}]$, then numerically the amplitude of the Fourier transform of both functions is the same (which is not correct). Numerically, you only consider the Fourier transform of the "y-values" $f(t_i)$, so the information about the time scale is lost...
You can solve this problem by multiplying the result with $10^{-9}$ in the second case because the Fourier transform of the rectangular function is proportional with $1/\omega$. However, in general, this proportionality is not present...  How to solve this problem for a general function $F(\omega)$? For example, when the Fourier transform is proportional to $e^\omega$ or proportional to $1/\omega^2$ or ...? Is there a numerical approach to take the scale of the time axis into account?


texts:
I'm developing a synthesiser and have finished the LFO's.   I'm wanting to provide a knob on the UI for setting the rate.   The minimum value of the LFO will be .01 Hz and the maximum value will be 3000 hz.   I'll have 100 increments in the knob and I want to apply an exponential curve to the values (Lfo rate).

What is the formula/function for calculating this?


texts:
I found out today about Google +'s image search feature. It allows users to perform a text-based search for objects within their picture library. I was instantly curious to know how this feature works. Does anyone know? Are Google using anonymous usage patterns from Google Images to build a computer vision library of CBIR object descriptors?

Possibly related is Google's 'Search by image' feature - see What algorithm does Google use for its "Search By Image" site?.


texts: Impulse response of a system from the input-output relation

texts:
I need to find out the recurrence relation and the impulse response of the following system.

The relation seems to be $$y[n] = \frac{2}{16} x[n] + \frac{3}{16} x[n-1] + \frac{6}{16} x[n-2] + \frac{3}{16} x[n-3] + \frac{2}{16}x[n-4]$$

Since there is no recursion the impulse response $h[n]$ would contain only 5 values (below) being the coefficients?

[2/16, 3/16, 6/16, 3/16, 2/16]


texts:
I am working on text to speech conversion. I have done speech synthesis by

concatenation of phonemes.The transition between phonemes is not

smooth.I want to shift to diphone synthesis.  Where can I find diphone

database for the English language. Any other alternative might help.


texts: how to take a second order transfer function without any zeros and represent it using two first order transfer functions

texts:
does anybody know how to take a second order transfer function with no zeros (no s terms in the numerator):
$$ g(s) = K\frac{\omega_n^2}{s^2 + 2\zeta \omega_n s + \omega_n^2} $$
and represent it using two first order transfer functions.
the layout for my second order transfer function is
     (number)/((number)s^2 + (number)s + (number))

this second order transfer function was previously in the form
(number)/((number) s + (number))^2 before i expanded the brackets


texts: Why is $A\cos(2\pi f_ct)$ a non-stationary process?

texts:
I am studying analog communication and having Communication system - Simon Hykin as one of the reference.

There is a question

  Consider the sinusoidal process$$X(t) = A\cos(2\pi f_ct)$$where the frequency $f_c$ is constant and amplitude $A$ is uniformly distributed:
  $f(a) = 1 $ for $0\leq a \leq 1$ and $0$ otherwise. Determine weather or not this process is strictly stationary.

Now when I go through the solution it says it is not a stationary process and it is provided in the solution that:

  if $A$ is uniformly distributed then
  $${p}_{X_i}(X_1) = \begin{cases}
\displaystyle\frac{1}{\cos(2\pi f_c t_i)} &\text{for}\quad  0\leq X_1 \leq \cos(2\pi f_c t_i)\\[2ex]0 & \text{otherwise}\end{cases}
$$

Now:

How is this provided?
And why is it concluded that it's non-stationary process?


texts:
I would like to implement an algorithm that synchronizes two audio tracks.

The two tracks are very similar; you can imagine they are two recordings of sound (not necessarily music) from two microphones in the same room. This means they appear as one signal that passed through two different (linear) channels, with different additive noise.

I understand the first idea might be to look for the peak of their cross-correlation, but I am particularly interesting in finding literature on the topic, but all the papers I could find are either synchronizing two musical tracks (using chroma-based audio features), or synchronizing audio with a score. They also assume there might be time-warping, which is an unnecessary assumption in my case.


texts:
Why is Goertzel Algorithm considered a block algorithm? Given that my input is bounded, couldn't I just run it forever (taking every sample that comes out after some length N) given a big enough word size for the intermediate coefficients?

I understand that I would get rectangular window spectral leakage, which may not be desirable, but let's assume it is good enough. If my input signal is stationary, then eventually I should get fairly good spectral resolution, correct?

But what if it isn't stationary? What is the memory of the Goertzel algorithm? How fast does the input signal frequency need to change before I get garbage results?


texts: Denoising effect in GnuRadio OFDM Serializer block

texts:
Why does the OFDM serializer has such a strong denoising effect in the flow graph below ? Is that normal ?

The upper constellation is AFTER the OFDM serializer block and the lower is BEFORE the OFDM serializer block.

Here is the OFDM documentation : http://gnuradio.org/doc/doxygen/page_ofdm.html

It does not help to explain why the serializer block has such a strong denoising effect, any idea why this denoising happens ?

Here is the flowgraph (in .grc format): http://pastebin.com/raw/PTY0Q0Ty

Further inspection indicates that the serializer block only does remove non data carriers. It just probably so happens that anything that is non data is super noisy, and data carriers are not noisy at all, but I still wonder how is this possible.


texts: Why is channel estimation done after synchronization and why does it work?

texts:
I am interested in Software Defined Radio communications where almost all processing is pushed to the digital domain.

I'm wondering why is channel estimation done after frequency and phase synchronization?

Shouldn't channel estimation be done before to take into account multi-path and other effects? Why can't channel estimation and frequency/phase synchronization be done simultaneously?

I took a digital communications course but the book sort of skipped these areas which is a fatal flaw.


texts:
I have a friend working in wireless communications research. He told me that we can transmit more than one symbol in a given slot using one frequency (of course we can decode them at the receiver).

The technique as he said uses a new modulation scheme. Therefore if one transmitting node transmits to one receiving node over a wireless channel and using one antenna at each node, the technique can transmit two symbols at one slot over one frequency.

I am not asking about this technique and I do not know whether it is correct or not but I want to know if one can do this or not? Is this even possible? Can the Shannon limit be broken? Can we prove the impossibility of such technique mathematically?

Other thing I want to know, if this technique is correct what are the consequences? For example what would such technique imply for the famous open problem of the interference channel?

Any suggestions please? Any reference is appreciated.


texts: Finding the input from the impulse response and output

texts:
I have $y,h,x$ which are all vectors.
From $y[n]=x[n]*h[n]$    which is basically how I got $y[n]$. I also know $h[n]$.

I put this through a Fourier transform. Let's assume that the capitalized versions of those are the fourier transforms:

$Y[k]=X[k]H[k]$, then $Y[k] inv(H[k])=X[k]$

But inverse of $H$ doesn't exist because it is a vector.

How else can I solve this?


texts:
I would like to characterize 1/f noise in some time series data. I would like to estimate the 1/f noise corner, and the standard deviation of the 1/f noise component and white noise component. The best thing I could find was this paper: A generalized noise variance analysis model and
its application to the characterization of 1/f noise that deals with photon noise arrival rates. That's great, I follow their math and everything.
They start of with a random variable that is photon count rates. The problem is I want to do this for an ADC or electronic noise source and I'm not sure what my random variable would be. How do I estimate the 1/f noise corner, and the standard deviation of the 1/f noise component and white noise component with an electronic noise source from time series data?

To show what a 1/f noise spectrum looks like:

Here is what the FFT looks like. I'm hoping for something that is more numerical based than semi-empirically modeled.


texts: Adjust the power of a digital signal to a given value

texts:
I have two signals: $x(n)$ is a white-noise signal with a given variance, $y(n)$ is the sum of white noise plus a sum of sinusoids.
$$
x(n) = v_1(n)
$$
$$
y(n) = \sum_{i=1}^{q} [ a_i \cos(\omega_i n) + b_i \sin(\omega_i n)  ] + v_2(n)
$$
$$
v_{1,2}(n) \sim W.N.(0,\sigma^2)
$$

And that is how I generate the two signals on Matlab. Now I'd like to normalise $y(n)$ so that its power is the same as $x(n)$, how can I do that?


texts: How to calculate the frequency response of LTI system based on measured impedance

texts:
I have an analog circuit containing unknown resistance, capacitance, and inductance. I have measured its complex impedance across the frequency range of interest. Is there an equation that will allow me to compute the frequency response (complex voltage gain as a function of frequency) of the circuit given the impedance? Clearly lower impedance magnitude would result in greater voltage gain magnitude, but what is the exact mathematical relationship?

As an aside, I am aware that I could directly measure the frequency response e.g. by taking the Fourier transform of its impulse response. This question is not about how to measure the frequency response, it is about the mathematical relationship between the impedance and frequency response.


texts:
Suppose we have a closed-loop system $H(s)=\frac{A(s)}{1+A(s)f(s)}=\frac{A(s)}{1+T(s)}$. I've seen the stability of the system stated a couple ways:

If $H(s)$ has any poles in the RHP, then it is unstable since the system response contains a term of the form $e^{s_{RHP}t}$, where $S_{RHP}$ has a positive real part and so will grow without bound over time.
If $1+T(s)=0$ for any $s$ (or equivalently $T(s)=-1$ for some $s$) then the system is unstable  since there exists some $s$ such that the transfer function blows up.

What confuses me is how these definitions are supposed to be equivalent. In particular, the second definition seems to say that if $H(s)$ has any poles, then the system is unstable. Why is this the case? Take for example a simple low-pass filter, $H(s)=\frac{1}{1+RCs}$, which has a pole at $s=-1/RC$. This pole is in the LHP and so by (1) is stable, however (2) seems to consider it unstable.
What is the relationship between (1) and (2)? In what situations, if any, are they equivalent/does one imply the other?


texts: Correct way of zero padding in time domain

texts:
I am very new to signal processing and want to learn the correct way of zero padding for 'n' even and odd input signals.

For example,

$N=6\;\&\;M=32$

$x(n)=[a, b, c, d, e, f]\;\;\;n=0,1,\dots,N-1$

$x_{zeros}(m)=[a, b, c, d, e, f, zeros(M-N)]\;\;\;m=0,1,\dots,M-1$

-or-

$x_{zeros}(m)=[left\;zeros\dots a, b, c, d, e, f,\dots right\;zeros]\;\;\;m=0,1,\dots,M-1$

-or-

$x_{zeros}(m)=[a, b, c,\dots zeros\;in\;the\;middle\dots d, e, f]\;\;\;m=0,1,\dots,M-1$

What to consider when the input is $\mathrm{Real}$ or $\mathrm{Complex}$ of even and odd lengths?


texts: Causal and Non-causal filtering. Strange behavior

texts:
I'm trying to understand the behavior of a causal filtering exemplified by figure below.

This behavior is making LDA (Linear Discriminant Analysis) misclassify our data, by clearly reverse the signal pattern at the highlighted box.
We need to alter the filtering method from non-causal (MATLAB filfilt function) to a causal (MATLAB filter function), but we face off this strange behavior.

Can someone give us an idea for what is really happening?

EDIT:

Motivation: Real-time processing.
-Note: Delays are expected, but the output causal filtered signal inside the red box seems to be very uncorrelated with the zero-phase filtered signal.
Band-pass cut-off frequency: $[0.16 - 1]\textrm{ Hz}$.
Signal: Electroencephalography @ $128\textrm{ Hz}$


texts: IIR coefficients and difference equation implementation in C language

texts:
I can't find anything on this topic, so either I'm in the wrong direction or else there is just nothing about it on the internet.

So let's say I have 3 $b_i$ coefficients ($b_0,b_1,$ and $b_2$) and 2 $a$ coefficients ($a_1$ and $a_2$) in a difference equation. How do I code the difference equation in C, so that I get the desired effect from the filter coefficients?


texts: How to pick coefficients for Fractional Delay Filters?

texts:
I have a Virtex 6 FPGA running at 200MHz with ADC/DACs on it.  I have been converting a WiFi signal (2462MHz) down to a more reasonable IF of 25MHz, sampling, running the signal through taps, tweaking them, and mixing back up.  This all works fine.

My issue is that since I am mixing down and sampling at a lower rate, I cannot implement RF level multipath by adjusting the delay in the taps for phase changes, instead I had to adjust it at the IF level instead.  This works OK, but it means that timing is off (things like TDOA or stuff with TOF measurements could care about that).  It seems like the best way around this (and probably the right way) is to implement a fractional delay filter (FDF), but I am not sure the best way to do it.

It seems like I need to come up with the coefficients for the taps, but I cannot seem to glean that out of the whitepapers I've read on FDF.  Any ideas?


texts: Discrete Hilbert transform enhancements?

texts:
Consider the Discrete Hilbert Transform, which takes a sequence $u[n]$ defined on the interval $-M\leq n\leq M$ and returns the discrete convolution

$$\tilde u[n]=\sum_{i=-M}^Mu[i]h[n-i]$$

where the impulse response function is given by

$$h[j]=\frac{2\sin^2(\pi j/2)}{\pi j}$$

(zero for all even $j$ including $j=0$, and non-zero for odd $j$).

The wikipedia article above mentions an improved version of the discrete impulse response function:

$$h_N[j]=\sum_{m=-\infty}^\infty h[n-m N]$$

which exhibits a milder frequency cut-off, such that the finite $M$ impulse response is closer to the ideal infinite impulse response $M\to\infty$.

Now my question is:

  Are there any other useful variations of $h[j]$ that would improve the discrete Hilbert transform spectrum and accuracy?

Or perhaps there are some entirely different ways to improve the finite impulse response of a discrete Hilbert transform? Thanks for any suggestion!


texts: What is the decay rate (time constant) of two One-Pole LPF's cascaded in series?

texts:
If you have a One-Pole LPF, and set the cutoff frequency to $\frac{1}{2πt}$ where $t$ is the time to $\frac{1}{e}$ amplitude, it will provide an exponential decay in response to a step function (eg. going from 1 to 0) following the curve $y=e^{\frac{-x}{t}}$.
I am wondering how to similarly predict the decay rate of two One-Pole LPF's cascaded in series.
Ie. If LPF1 is filtering the signal at $t_1 = 2.4$, and then you run the output of LPF1 into LPF2 which is filtering the signal at $t_2 = 0.15$, in a steady state decay (eg. with a step from 1 to 0), what would be the effective "$t$" of this cascaded system?
I presume the cascade would still follow a nice predictable exponential decay just at a slightly different rate? If so, is there an equation that can predict the final "$t$" based on $t_1$ and $t_2$?
Thanks.


texts:
If x[n]= (some values), h[n]=(some values).  Now suppose length of h[n] is a multiple of two. Being specific say it has length of four.. Then M=4, Then what should be value of L and value of N to satisfy N=M+L-1..

E.g. which i tried solving is.

x[n]={7,6,4,5,2,4,5,2,3}
h[n]={1,2,3,1}

Taking N=8 i got L=5.

x1[n]={0,0,0,7,6,4,5,2}
x2[n]={4,5,2,4,5,2,3,0} (extra zero to make length=N)

Now while solving I found to lose some of values using save method.


texts: DSP Benchmarks for ARM Cortex-M4 processor

texts:
Does anyone know where there are any benchhmark timings for the DSP functionality in the ARM CMSIS V2 running on a Cortex-M4 processor.  I am trying to work out whether this processor is powerful enough to meet my requirements, and to compare it to other microcontroller devices with DSP extensions.

edited to add

I will add a little background. I have an existing product that uses an old and relatively expensive DSP. I have been looking at alternative processors including the Renesas MX and ARM M4 both of which have MACC type instructions. There are benchmark figures for the supplied Renesas libraries that are of the form the x-point FFT at Y MHz takes Z ms, The FIR filter with W coefficients takes Vms etc. I was hoping that there were figures somewhere for the ARM library.

Attempting to evaluate the performance of a number of target platforms myself will be extremely expensive in tools (different compiler for each target), development boards and implementation time.


texts: Any examples of analysis in time domain to extact information

texts:
I am sending a 20Khz signal from my phone and capturing all the signals while doing exercise above it. Here I have a signal of a person doing "hand scissors exercise"

I am doing analysis on how many times has the person done the exercise. I am able to figure that out in the frequency domain. But, the time-domain signal is very noisy, is there any way to extract any information in the time-domain from the existing signal that I have ?

The FFT analysis of the signal is attached below :

The raw signal in the time-domain is given below, is there anything that can be done on this :

(Y -axis is the energy of the signal)
(X-axis is the number of frames in the wave signal)


texts: Why is the range of frequency for discrete time Fourier transform $-\pi<\omega<\pi$?

texts:
In my class we are taught that the range for the frequency is $-\pi<\omega<\pi$ for discrete time Fourier transform, however for continuous time the limit is $-\infty<\omega<\infty$
why is this the case?


texts: problems calculating phase propagation (in C)

texts:
I'm coding a phase vocoder in C for time-stretching audio signals. The only piece that is currently not working is the phase propagation.

I take overlapping frames from an input signal, apply a window function, and perform FFT.
Then i calculate the phase propagation (the one I'm stuck with)
Finally I perform iFFT and overlap-add the output frames with a different hop size.

If I skip step 2, the phase propagation, the output sound is correctly time-stretched but I can hear a phaser effect. My assumption is that the missing piece will correct this. However when I apply my current implementation the sound is terribly distorted.

I appreciate if anyone can give some good pointers on how the phase correction can be implemented.

It might be too much to ask, but this is my current implementation should you see something weird.

// _prevPhaseX[] = FFT phases from previous frame (n-1) (propagation input)
// _prevPhaseY[] = FFT phases from previous frame (n-1) (propagation output)
// _phase[] has the FFT phase information from current frame
static int first = 1;
if (first)
{
    first = 0;
    for (int k=0; k<half; k++)          // half = window length/2 = number of bins
    {
        _prevPhaseX[k] = _phase[k];
        _prevPhaseY[k] = _phase[k];
    }
}
else
{
    // int length = window length - e.g. 1024
    // float Ra = analysis hop size - e.g. 256
    // float Rs = synthesis hop size - e.g. 512
    // float PI = PI
    // float DPI = 2*PI
    for (int k=1; k<half; k++)
    {
        // compute Delta Phi(k)
        float phase = _phase[k];
        float omega = DPI*(float)k/(float)length;  // length vs length/2?
        float phasediff = phase - _prevPhaseX[k] - Ra*omega;
        _prevPhaseX[k] = phase;   // Save value for next frame

        // get principal argument
        while (phasediff>PI) phasediff -=DPI;
        while (phasediff<-PI) phasediff +=DPI;

        float freq = omega + (phasediff)/Ra;
        _phase[k] = _prevPhaseY[k] + Rs*freq;
        _prevPhaseY[k] = _phase[k];   // Save value for next frame
    }
}
// the _phase[] vector (and magnitude[]) goes to IFFT (after conv. to rectangluar)

Thanks!


texts: Are Computer Stereo Vision techniques appropriate for sub-millimetre measurements?

texts:
I have a project where I would like to image an object and be able to derive the heights of features in this image to sub-millimetre precision (exactly how precise is still yet to be determined, but let's say 100ths of a millimetre for now).
I have been previously advised that direct laser ranging techniques will not be appropriate

the travel time will be too small and thus will require too much precision to make precise calculations
minor vibrations (such as a person walking near the apparatus) will perturb the results

I have observed a laser device that sells for approximately $1000 that can achieve the precision but suffers from the vibration problem (which is fine, mechanically isolating the apparatus is another discussion).
I would prefer to achieve a result that is more cost effective, and considered stereo vision as an alternative.  Being a novice to this field I am uncertain if the desired precision can be achieved.
Is the desired precision (at least) theoretically attainable?
Is there a recommended paper or resource that would help explain this topic further?
Additional notes
The objects in question will range from approximately 1/2" square up to about 2 1/2" square with some times very low thickness (1/16"?). A large percentage of the surface should be flat, though one test will be to confirm that assertion. Features will be fairly rough (generally sharp transitions). Aug 17 at 11:00
One of the "harder" interesting objects would be about 20mm square, 1.25mm high. The surface features in question would be on the order of .1 - .3mm I'm estimating. The camera position would likely be on the order of 6" above. Does this give you better insight? Aug 17 at 15:15
I am not looking to perform a single profile/relief measurement, but rather attempting to generate a surface height map of the object.  The surface features of the object, as well as the overall profile, are of significant interest.


texts:
I am doing mtech project now.
Actually I am working on discrete wavelet transform.I have done till wavelet decomposition. I have been stuck in reconstructing the signal back to original .please help me out.

code--

f=10;
fs=200;
amp_x = 14;
% amplitude for sinusodial 2
amp_y = 9;
% Time vector
t=(0:1:5000);
% Create a sine wave
x = amp_x * (sin(2*pi*f/fs*t));
%filter coefficients
LO_D =[ 0.7071    0.7071];
HI_D =[-0.7071    0.7071];

C = conv(LO_D,x);
k = 2;
CA= C(2:k:length(C));

D = conv(HI_D,x);
g=2;
CD= D(2:g:length(D));

CA and CD are my approximation and detailed coefficients.
now i do squaring for CD coefficients so as to remove artefacts.

for i=1:length(CD)
    cd1(i)=CD(i).^2;
end

after squaring I put a threshold and remove the values greater than the threshold. So i get a denoised signal.

Now i need to reconstruct the denoised signal to original.how do i do it without using inbuilt commands. please answer me.


texts: Measuring Phase Difference at DC bin aliased frequency using FFT

texts:
I have a code in which two complex signals (I/Q) are created having same frequency but with phase difference. FFT of both signals is taken and atan2 is used to compute phase after which the difference between both phases is calculated.

While changing the input frequency it was observed that for the case where the signal frequency is integer multiple of Fs such that its FFT peak lies on DC bin, the correct phase difference is still obtained. How can phase calculated from DC bins give the correct value. Can anyone explain the underlying logic?


texts: Understanding the Parameters of the Bilateral Filter

texts:
Allow me to show you a snip from Szeliski's Computer Vision book on bilateral filter. I don't know how to interpret these kernel definitions:

In the actual summation what values do the $k$ and $l$ take? E.g For a kernel of size 5x5 does $k$ take values between negative and positive inf? or between 1 to 5 (e.g. in matlab programming)? Or does it take values from -2 to 2?

Also what do those double bars mean in the definition of range kernel?


texts:
I am reading Direct Synthesis versus Wavetable Synthesis. The quote below explains code I have read but I don't get why it's a division by the integer multiple, when multiples increase in frequency. Doesn't that mean we need more samples (higher sample rate mapping to more samples for same accuracy) to deal with the higher frequencies, resulting in a larger wavetable.?

  If you play a loop of a wavetable that is exactly one period at the fundamental frequency then the harmonic partials will fit within that loop. That is because the period of the harmonic partials are the fundamental period divided by N.


texts: Why does this manual bilinear transformation yield different results from Matlab's?

texts:
I've got a first-order Butterworth filter with the cutoff frequency $\omega_c$. Its transfer function is then

$$H(s) = \frac{\omega_c}{s+\omega_c}$$

Using the bilinear transform to find an $H(z)$ (what is that function called?), I get

$$H(z)=\frac{\omega_c}{\frac{2}{T}\frac{z-1}{z+1} + \omega_c}
= \frac{\omega_c z + \omega_c}{\left(\frac{2}{T}+\omega_c\right)z + \omega_c-\frac{2}{T}}$$

However, I can't reconcile this result with what Matlab is doing. It seems wrong, no matter what value of $T$. I assume that B and A below are the coefficients of $H(z)$.

>> [B,A] = butter(1,0.5)
B = 0.5000    0.5000
A = 1.0000   -0.0000
>> [B,A] = butter(1,0.6)
B = 0.5792    0.5792
A = 1.0000    0.1584
>> [B,A] = butter(1,0.7)
B = 0.6625    0.6625
A = 1.0000    0.3249
>> [B,A] = butter(1,0.8)
B = 0.7548    0.7548
A = 1.0000    0.5095

What am I misunderstanding?


texts: What is the difference between the sampling frequency of signal and sampling frequency of filter

texts:
I believe that there is no connection between the sampling frequency used for converting an analogue filter to digital filter and the one used to sample a signal that the filter will be used on. But I would like to confirm this from someone who knows.

I like to confirm that sampling frequency(e.g when using bilinear or impulse invariance method) used to convert analogue to digital filter can be chosen independent of the sampling frequency used to record analogue to digital signal. E.g. can an analogue filter converted to its digital equivalence using the bilinear transform at 100 Hz be used to filter a digital signal sampled at 1000 Hz?


texts: Energy of $\text{sinc}^2(kt)$ function multiplied by variable

texts:
I know how to determine the energy of $\text{sinc}^2(kt)$, but how does this change when I need to find the energy of $(kt)\cdot \text{sinc}^2(kt)$.

If the $(kt)$ in front is squared (in energy integral) does that make the energy of this infinity ?  the energy integral in time domain would be $$E_{\infty}=\int_{-\infty}^{\infty}(k^2t^2) \cdot \text{sinc}^4(kt)dt$$

But then Wolfram Alpha returned that the integral does not converge?

If multiplication in the time domain is convolution in freq domain

So, how do I handle the $(k^2 t^2)$ portion out front?


texts:
I'm making a soft demodulation/decoding to communicate a microphone and a speaker in short range. I have to calculate the LLR using my constellation and the airborne sound channel probability density function (pdf). I have searched a lot about airborne sound or acoustic channel model, and I just found out some considerations about the attenuation depending on the frequency. My questions are:

Wich book can I read, so i can learn more about soft demodulation examples: BPSK, QPSK, QAM, FSK?
If I use a pdf estimator of the channel, how can I use the estimation to find the LLR of my received symbols?
Can I use another model to aproximate the airborne acoustic channel (it could be related to AWGN), or which book can I read to learn about how to model a communication channel?


texts: How can I tell if an image is part of another image?

texts:
I have one image that may or may not be part of another image (possibly resized).

How can I tell if that's the case, and pointing out the region of the first image that contains the second?
For example, I'd like to tell that the second image is an enlarged portion of the first.


texts: Retrieve DFT coefficients from DCT coefficients

texts:
A vector a is transformed via a discrete cosine transform (DCT) to give vector b. For example in Matlab
b=dct(a);.
Vector a is also transformed via a discrete Fourier transform (DFT) to give vector c. E.g.
c=fft(a);
What is the fastest way to determine c from b without using a or retrieving it? For example,
c=fft(idft(b));
is not allowed.


texts: Convert frequency response to impulse response

texts:
I am running an acoustic simulation.  I put in a frequency and get out a complex number; the frequency response for that frequency.

I wish to generate a 1024-sample impulse response (supposing my output sample-rate is 44.1kHz)

How do I go about it?

I think I have the first step: take the Nyquist frequency 22.05kHz, and cut it into 512 equal slices.  So each slice will have a bandwidth of 22050/512 Hz

Now I feed these frequencies into the simulator and get back 512 complex numbers; the first will be 0+0i corresponding to 0Hz

Now I'm following an instruction that says: 'consider 0Hz now to be the symmetry point, and add 511 negative frequencies.

So I have
    {
        Re(511) + i.Im(511),
        ...,
        Re(1) + i.Im(1),
        0 + 0i,
        Re(1) + i.Im(1),
        ...,
        Re(511) + i.Im(511),
    }

1023 frequencies.

Now I'm confused. I don't know what I'm doing any more.

Apparently I need to IFFT this, and that is going to give me an 1023 sample impulse response?

Could somebody help me get my feet back on the ground?

What would the MatLab code for this look like?

(Also, is there any way to do it from the Bash shell using Python or something similar?)


texts: Image transformation where a curve becomes a straight line

texts:
Suppose that I have the green curve (image attached for visualization), values stored in a vector and I want to transform the image such that the curve becomes a straight horizontal line. So if the curve becomes a straight line all normals of the curve has to be parallel to the vertical axis.

How can I achieve such a transformation?


texts: How to select states for a Kalman Filter

texts:
I'm a bit rusted on Kalman filters. I read about them about 10 years ago.

So here it goes

I have this equation which I'm aware is non-linear. This a simplified equation a DC-link capacitor with input power increasing the voltage of the capacitor and output power (V*Iout) decreasing the DC-link voltage.

$$ VC\frac{dv}{dt} = P_{in} - V*I_{out} $$

I measure directly V and $P_{in}$. I think $P_{in}$ should be input "u". I think V should be a state of the Kalman Filter and I would like to estimate $I_{out}$ too. That's where I'm stuck at the moment. I got the feeling that $I_{out}$ should be a state, but I'm kind of lost. Where should I go from here. $I_{out}$ will likely jump from 0 to 100 Amps and the back to 20 Amps in real-life situations.

Regards

Edit : I'm aware that I could estimate Iout without using a Kalman filter, I'm just curious.


texts: How to figure out frequency weightings on acceleration data using ISO 2631?

texts:
I'm trying to convert the raw acceleration data into frequency weighted acceleration data.
According to ISO 2631:

The acceleration signal may be analyzed and reported as either constant bandwidth or proportional bandwidth (e.g.as one-third octave band) spectra of unweighted acceleration. In the case of one-third octave bands the centre frequencies shall be as stated in tables 3 and 4. Any form of frequency analysis, analogue or digital, direct one-third octave band or summation of narrow band data may be used. The data analysis method shall be consistent with the one-third octave band filter specification given in IEC 1260.

The frequency-weighted r.m.s. acceleration shall be determined by weighting and appropriate addition of narrow band or one-third octave band data.

For the conversion of one-third octave band data, the weighting factors given in tables 3 and 4 shall be used. The overall weighted acceleration shall be determined in accordance with the following equation or its digital equivalent in the time or frequency domain:
$$a_w = \left[ \sum_{i}\left(W_{i}a_{i} \right)^{2} \right]^{\frac{1}{2}}$$
where
$a_w$ is the frequency-weighted acceleration, $W_i$ is the weighting factor for the $i$th one-third octave band given in tables 3 and 4 and $a_i$ is the r.m.s. acceleration for the i th one-third octave band.

Since the raw acceleration data I have collected is in time-domain, I'm having trouble understanding how to select weights for each acceleration point using tables 3 and 4?
PS My knowledge in signal processing is limited but helpful suggestions could probably get me going.


texts: Square wave FFT results show frequency that seems too low?

texts:
I have created an open source plotting package for a low cost oscilloscope - see link here: GitHub Plotting Software

But during my testing I have one result that may be wrong: a noisy 7 kHz square wave shows an FFT peak at 6.25 kHz. Can this be correct, or am I missing something?

Here is a python code extract for my FFT

# stack FFT plot in this figure vertically
plt.subplot(grid_stack[grid_row, :])

y_heading = self.y_heading

# Reduce signal_data array size by a factor of n (used to reduce the frequency range)
n = self.n
updated_df_data = self.reduce_sample_array(self.df_data, n)

# update sample rate and array size
sample_rate = float(self.info_dict['rate'][1])/n
array_size = updated_df_data[y_heading].size

# Calculate y-axis magnitude scaled to same units as y-axis in heading2Use data (ie volts)
yf = 2/array_size * fft(updated_df_data[y_heading].values)

# Calculate x axis as frequency in Hz
x = fftfreq(array_size, 1 / float(sample_rate))
x_half = x[:x.size//2]

freq_units, freq_multiplier = rescale_frequency(x_half)
x_half = rescale_data(x_half, 10 ** freq_multiplier)

y_half = abs(yf)[:array_size//2]
engr_power_v = calculate_scale(y_half)
y_half = rescale_data(y_half, 10**engr_power_v)

plt.plot(x_half, y_half, color=self.iplot_colors[-1])

Sample plot with clean square wave that seems to be ok

Sample plot with noisy square wave that seems to have wrong peak value (6.25 instead of 7 kHz)

Any comments or suggestions are welcome as this is my first python signal analysis software project.


texts: Difference between compressive sensing and DCT-based compression?

texts:
I am working on transmitting EEG signals over wireless body area network. I have applied two different compression techniques: DCT-based and compressive sensing (CS-based) approach. I noticed that the reconstructed signal is better using the DCT-based approach. Is this reasonable? I know that compression using DCT is lossy. The metrics used for evaluating the quality of the reconstructed signal is the normalized mean square error (NMSE) and the structural similarity index metric (SSIM).

Thanks in advance

In case of not fulfilling the CS theoretical conditions, is it recommended to use DCT based compression for compressing biomedical signals to transmit them wirelessly over a body area network?
I am asking this question because most papers recommend the use of CS compression, due to the energy efficient consumption property


texts: I have a periodic signal(ECG) with period of ~1 seconds. It does not have features that are shorter than 0.04 seconds. For removal of 60Hz, I thought instead of implementing a notch filter, doing a simple moving average of 1/60~0.016 seconds.(Averaging over a larger window might destroy signal information, and also it's not needed) This is much simpler than a notch filter which can be of several orders. Am I missing something?


texts: Is there any modern information about a 12-hour periodicity in sonar noise?

texts:
I have a copy of Principles of underwater sound by Urick, 3rd edition. In the chapter on The noise background of the sea: ambient noise level, on pages 215/216, it says
"The analysis of data in the frequency band 20 to 100 Hz revealed periodicity of 12 and 24 hours, with a maximum of noise at noon and midnight, local time, at all locations, independent of longitude. Although the change in level was small (normally 1.5 to 5 dB), it was undoubtedly real, but the origins of these changes in noise, which are apparently free from biological activity and synchronized to the mean solar day at diverse locations, remains a mystery."
The book was published in 1967, and my copy printed in 1983. I'd be fascinated to find out if there has been any new research into this. I did a little googling but couldn't find any references to this issue.


texts:
my doubt is about a vector of values that I have and which histogram is the following one:

The function I used to create the histogram was:

histogram(q,1000); %q is the aforementioned vector of values

Now, I have to calculate the variance of each of the 2 gaussian distributions that appear in the image. I know that the function  var(x) gives you the variance of a vector, so I tried with:

h = hist(q,1000);
h1 = h(1:500);
h2 = h(500:1000);

v1 = var(h1); v2 = var(h2);

But it's obvious that the variance of each one will depend of the vector I use to calculate it. Another possibility is that knowing the mean of each distribution (-1 and 1 respectively), I could evaluate the pdf of a gaussian distribution in $f_x(\mu)$ and I would obtain that:

$$f_x(\mu) = \dfrac{1}{\sigma \sqrt{2\pi}}$$

However, the distributions aren't normalised and the normalisation of each distribution would depend again of the vector I chose.

I have no more ideas, so I hope someone can help me.

Thanks in advance for responding.


texts: Ideal sampling - question about the 1/T scaling factor

texts:
Sources discussing spectrum of sampled signals (under 'hypothetical' IDEAL SAMPLING condition) show that the original message spectrum gets replicated at integer multiples of the sampling frequency.

It's noticed that the sources show that the replica spectra (seen in the sampled spectrum) are scaled by a factor 1/Ts .... or 1/T (where T aka Ts is the sampling period, and 1/Ts is the sampling frequency).

My question I'd like to ask is --- it appears that when the sampling period gets relatively small (or relatively tiny), which means sampling frequency gets relatively large, then the scaling factor 1/T becomes relatively large.

So if the sampling period 'approaches' zero, then the 1/T scaling 'approaches' an infinite value, right? In that case, will each of those peaks of the replica spectra (in the spectrum of the sampled signal) become infinite?

I'm not yet able to understand the implications of the factor 1/T for the case where the sampling period becomes really tiny. It just seems to me that the spectral peaks work towards becoming infinite as T gets mathematically reduced toward zero. Have I understood this correctly? Are the spectral peaks meant to become larger and larger with reduced sampling period (aka larger sampling frequency)? I don't understand why the amplitudes can become really large if T is really small. Will this lead to an infinite power or infinite energy condition?

The main thing I'm currently confused about is - if the peak value of the original signal spectrum is 'A', then the peak value of the sampled signal spectrum is A/T (ie. A/Ts), but since 1/Ts is typically a finite number much greater than 1, then the peak value of A/Ts could be some pretty big number. It's as if there's some kind of huge amplification factor introduced due to 'ideal sampling'. Are we meant to just accept this 'big' 1/T amplification factor?

Thanks all!