texts: Expression for discrete fourier transform of linear ramp

texts:
I am trying to compute a single coefficient of the DFT of a linearly ramping sequence, $x[n]=an$ where $a$ is a constant that changes from sequence to seqeunce. I have looked at loads of DFT transform property and pairs tables, but this is a simple case I have not been able to find an analytical expression for. I don't want to have to compute the entire DFT of the sequence just to extract a single coefficient.

My first approach was to notice that multiplication by $n$ in the time domain is like differentiation in the $k$-domain. However, since the DFT of $a$ is an impulse function at $k=0$, I haven't found a way to come up with an analytical expression to take the derivative.

In my application, the number of samples in the sequence, $N$, and the coefficient of interest, $k$, will frequently change. It's just such a simple case that, given $a$, there must be a way for me to predict the value of the DFT of the sequence at a particular value of $k$ without actually doing the transform. Is the only way to do this to numerically create a look-up table of all possible $N$ and $k$ of interest, and then scale by $a$?


texts:
I'm trying to remove random noise from an image. The noise is arbitrarily random so it must not necessarily follow a certain distribution (Not every pixel has the same chance of being affected by noise and not every pixel is affected by the same amount of noise). Such an image might for example look like this example image:

The usual fast'n'cheap filters (like average etc.) just do not cut it for such images. It's pretty obvious that there's still enough information in the image left for it to be reconstructible but I don't think there's yet a tool available that can actually do that. Any hints on how I could try reconstruction? Tools, algorithms?

Update 1

The closest I've come so far is this:

It's far from being good but just to show what I mean by removing the noise.
The resulting image should have more or less uniform areas of about the correct colors.

An ideal outcome would roughly look like this:

Update 2

Example with little noise

Example with more noise

Update 3

PNG images:

For the lena fans out there:


texts: find the maximum of the DFT of sampled signal

texts:
The signal $$x(t)=\cos(10\pi t+\phi)+\cos(20\pi t)$$ is sampled with a sampling frequency $F_s$ as $25 \mathrm{Hz}$ where the phase $\phi$ is unknown.

Sampling the continuous time signal $$y[n]=x(nT)$$ where $T=1/F_s$.

After calculating the DFT of $y[n]$ with the length of DFT $N=100$, which of $k$ will give us the maximum of the magnitude of $Y[k]$?


texts: Computing impulse response for system with feedback terms

texts:
I'm trying to compute the impulse response for the following system:

$$
y(n) = \frac{1}{2} \left( x(n) + x(n-1) \right) + \frac{1}{2} y(n-1)
$$

and am told to assume that $y(-1)=0$.

My solution: Letting $x(n) = \delta(n)$, we have

$$
h(n) = \frac{1}{2}\left(\delta(n) + \delta(n-1)\right) + \frac{1}{2}h(n-1).
$$

Plugging in a few values for $n$ (and assuming that $h(-1)=0$), I've obtained:

$$
h(0) = \frac{1}{2},
$$

$$
h(1) = \frac{1}{2} + \frac{1}{2} \cdot \frac{1}{2} = \frac{3}{4}
$$

and

$$
h(2) = \frac{1}{2} + \frac{1}{2} \cdot \frac{3}{4} = \frac{3}{8}.
$$

From this, I've observed that

$$
h(n) = \begin{cases}
0, & n<0 \\
\frac{1}{2}, & n=0 \\
\frac{1}{2} + \left(\frac{1}{2}\right)^n, & n > 0
\end{cases}
$$

Does this seem correct? I feel like I made a mistake somewhere and that the expression for $h(n)$ should be in a simpler form.

Note: I computed the impulse response by taking the Fourier Transform and then plugging in values for $n$ and got something different than this. However, I believe that this discrepancy is due to the initial condition $y(-1)=0$.


texts: How can I add any kind of noise to image for a given SNR?

texts: What is the best way to add any kind of noise (not only Gaussian noise) to 2D signal (image) for a given SNR?


texts:
I need your help. My lecturer told me to do a study to finish the task that she gave us yesterday but the thing is there is no specific explaination on how to solve the question. Through the task, she gave us only this information. I went through youtubes in case there'll be explaination on those but so far i didnt find anything. The task is due in the next 4 days.
I don't need answer, i just need to know how it works and so on and i'll do the calculation.
[UPDATE:]
Here is my calculation. So the answer for H(k) will be in vector right? If it is, i proceed with the second question but only 1/2 were multiply to the original formula for F(k) right? What can i conclude for the comparisons of both signal? Please correct me if i'm wrong.


texts: How can I manually find the coefficients, poles and zeros of Butterworth low pass filter in MATLAB instead of using the built-in functions?

texts: Actually I need to filter a raw ECG signal using low pass Butterworth filter at 70 hertz. And j need to implement the Butterworth filter first for that. Please any help since I'm very new to this MATLAB. Thanks


texts: How to recognize an object from a small training set of images?

texts:
Given a small training set of images (say, around 6 max) of the same object, how to measure how likely is another query image to contain the given object?

The training images are "clean", i.e. only the original object is present. On the other hand, the query images normally contain only an object of the same class (i.e. if the training images contain a mango, the query images will be definitely fruits, although maybe not mangoes). The query images have varied backgrounds, though.

I tried SURF and FLANN (from OpenCV), with various values of Hessian, but it's not very accurate: it works for certain images but not for others. Maybe it's because of the nature of the objects I'm training to detect? Any pointers would be appreciated. Thanks!


texts:
First-time questioner...

I'm writing an application (hobby/non-commercial, asp.net c#) to process polling data (answers to a single yes/no question) automatically collected from a website. The answers accumulate (yes = +1, no = -1) in a running total that ticks upwards and downwards over time. The application will display this data stream in a chart in real-time as answers are submitted, as well as - hopefully - provide some deeper analysis in, or near, real-time.

The goal is to track the time of each data point and get at any cyclical tendencies or directional movement over time. I'd like to try to do spectral analysis on the raw feed of data, which I understand is a naturally-occurring discrete-time sequence, one that's also non-equispaced in time since the data come in sporadically, like a political debate audience mashing yes and no buttons as they see fit through the course of the discussion.

My cursory initial investigation has led to me understand that linear shift/time-invariate systems generally require samples at integer spaced intervals (and that they can work for non-time-equispaced data, but care would need to be taken in the design and use of such systems). I'd also like to avoid interpolating between the discrete data points, as a workaround, so as not to make up information.

I'm optimistic this isn't an impossible dream, and that there's a way to process this data as it occurs naturally. If so, would NFFT be the right set of tools to use? Is there a tool in particular, or some altogether different processing paradigm, that would apply best? I'm a lay person to the field; any help is appreciated on asking my question most precisely.


texts: Applying Convolution (In 2D) Theorem Swaps Quadrants

texts:
For educational purposes I implemented the DFT and inverse DFT for images using OpenCV. Applying the DFT to an image and taking the inverse DFT of the spectrum yields the original image, so this works. I do not rearrange the spectral image from $ [0,N) $ to $ [-N/2, N/2) $.

Now, using the convolution theorem I want to filter an image. I use a 3x3 averaging kernel and pad it with zeroes to the same size as the input image. I then take the DFT of it, and do a piecewise multiplication of the image spectrum and the kernel spectrum.

The inverse DFT of the resulting spectrum yields an interesting result: The image is filtered (smoothed) correctly, however the quadrants are swapped. Interestingly, if I filter it twice (or any even number), the quadrants are properly arranged. This works for both

$$ \mathcal{F}^{-1}\{ (\mathcal{F}\{I\}\mathcal{F}\{H\})\mathcal{F}\{H\} \} = $$
$$ \mathcal{F}^{-1}\{ \mathcal{F}\{I\}(\mathcal{F}\{H\}\mathcal{F}\{H\}) \} $$

with the image $ I $ and kernel $ H $. This makes sense to me since convolution is associative.

What is the cause of the swapped quadrants?


texts: phase evolution of MRI signal during RF excitation

texts:
I am trying to compute the phase evolution of a proton spin in the presence of a slice selection gradient. I have the following properties for the slice selection gradient and the RF excitation:

[Slice selection gradient]
Peak amplitude: 0.015 T/m
Duration: 0.0042 s.

[RF excitation]: Sinc pulse
Duration: 0.004 s.
flip angle: 30 degrees
center frequency: -2000 Hz

The reason the two durations are slightly different is that the RF pulse begins when the gradient has reached its peak amplitude (after a small ramp time).

Now, I want to track the phase evolution of the signal during the whole process. To do so, I have discretized the signal in time steps of $10^{-6}$ seconds and what makes sense to me is to numerically integrate the frequency over time.

i.e.

$$
\phi(z) = \int \gamma \  G_z z \ dt
$$

and I will do this for the whole time when the gradient and the RF pulse is applied (including the ramp up and ramp down time). Does this sound correct?

The reason I ask is that in the book "Handbook for MRI pulse sequence" there is an alternate formula in terms of the RF bandwidth and the isodelay parameter and the phase is given as:

$$
\Delta \phi = 2 \pi \Delta f \Delta t_1
$$

where $\Delta f$ is the bandwidth and $\Delta t_1$ is the isodelay parameter. I am unable to develop any intuition for this formula. So using the method I described before and this one, are they equivalant in terms of the final phase evolution? If yes, I think the numerical integration might be more accurate as it takes the phase dispersion during the gradient ramp time into account?

[EDIT]: I implemented this and what I find is that the phase dispersion that I compute using numerical integration from the beginning of the RF pulse is twice as long as the second formula (which sort of makes sense as the isodelay is approximately half the length of the RF pulse). Why do we not compute the phase dispersion from the beginning of the RF pulse?

Another thing I wanted to clarify was the purpose of doing this. Is this because the MRI slice that will be excited has a certain thickness and the frequency variation along this thin slice would cause the spins to get out of phase with each other and eventually result in signal loss? However, if we assume a true 2D infinitesimally thin slice, this would not be necessary as all the spins in the slice would experience the same frequency and not go out of sync.


texts: Histogram evaluation for image quality concerning illumination

texts:
I'm currently trying to develop an algorithm to control the camera characteristic of a camera (the camera characteristic can be controlled to adopt it to the different lightning situation which can occur)

In this case I need a good measurement of the exposure/lightning on the current image taken (i.e., if it's under/overexposed, well-exposed, maybe low/high contrast etc). And I'm therefore looking for a measurement on how to decide that. So far I couldn't find much about it. I found only ONE paper:

It's called "An optimal measure for camera focus and exposure" (DOI) from 2004 which describes some measurements like mean-values, entropy, standard deviation etc. based on the histogram to somehow measure the image quality (concerning focus and exposure). I also found many other papers which try to measure the image quality concerning things like blur, distortion etc etc but I don't need that obviously as I only want to control the camera characteristic to get a good contrast and exposure of my image -> thus, a well-balanced histogram.

Do you know any other measures which could help me with that or do you maybe have another idea on how solve that issue and how to build a good controller of my camera characteristic?


texts: Method to rescale signals to mean length

texts:
I have a set of signals of varying lengths. I have provided an example of the same below -

Their lengths vary between 186 to 202, with a mean length of 197. I am looking to rescale them to the mean length. I am looking for ideas to do the same. Perhaps a good start will be reinterpolation, but I am open to other approaches too.


texts:
In one of other discussions : How to find frequency response, stability, and causality of a linear system?

I found a comment which was quite strong and definitely caught my attention.

  An ideal low-pass filter is an example of a system that is not BIBO
  stable even though its frequency response is bounded for all $f$

I am following the definition of stability as per here in wiki http://en.wikipedia.org/wiki/BIBO_stability

Can anyone give me a proof that ideal LPF can indeed be BIBO unstable?

Of course, ideal LPF with infinite gain can produce unbounded output. The question is restricted to LPF when gain is finite.


texts: Phase correction using second order all pass filters/LMS with Wiener-Hopf equations

texts:
I am working on phase correction algorithms. Can anyone help me understand how can the following diagram be used for phase correction:

Additionally, for a channel function suggested How determine the delay in my signal practically, I have tried the following:
Fs = 306.700*1e+3; % sampling rate
Fc = 100*1e+3; % central frequency
B = 4*1e+3;  % bandwidth
N = 3072;
T = (N-1)/Fs;
t = 0:1/Fs:T; %time

baseband_signal = chirp(t,-B/2,t(end),B/2)-i*chirp(t,-B/2,t(end),B/2,'linear',90);

% Modulation
modulated_signal = baseband_signal.*exp(i*2*pi*Fc.*t);
modulated_signal = real(modulated_signal);

% Transmitted signal
tx = modulated_signal.*1.25/max(modulated_signal);

% Received signal
rx = [zeros(1,200) tx];
t_received = 0:1/Fs:(length(rx)-1)/Fs;

% Computing equalization filter: rx and tx swapped!
 coeff = channel(rx,tx,20);

% Equalization filtering
 rx_corrected = filter(coeff, 1,  rx);

 figure
freqz(coeff)
title('Equalization filter')

figure
plot(t_received,rx,t_received,rx_corrected)
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
legend('initial','corrected')

Shouldn't the equalization suggested here remove the phase delay and have the equalized and transmitted signal aligned?


texts: FIR filter not eliminating out of band noise?

texts:
I have a simple FIR filter that should eliminate all lower frequencies:

H = zeros(60,1);
H(30:end) = 1+1i;
H = [H;conj(flipud(H(2:end)))]; % double sided
h= ifft(H);

Then I assign a sample time to generate a time vector:

dT = 0.002;
Tspan = dT*length(h);
dF = 1/Tspan;

Here my nyquist is 250Hz.  So the filter should eliminate everything below 125Hz.

I generate a signal at 15Hz, and convolve it with the filter coefficients.

t = 0:dT:5;
x = cos(2*pi*15*t);

But, I get an output signal that clearly does not have the 15Hz eliminated:

Input signal above, response signal below

Below is the FIR filter (plotted single sided):

Does it look like my convolution algorithm is incorrect? Or am I misunderstanding something?

Any help is appreciated!

Thanks


texts:
I have an USRP (B205mini) with an RX frequency of 900 MHz and a bandwidth of 100 MHz. I want to distinguish between two raw, unmodulated signals at respectively 875 and 925 MHz.

My approach would be to bandpass filter the output of the USRP, but I am not quite sure how to design and implement filters based on baseband IQ samples. Can anyone provide references or explanations ?


texts: position of spike in the spectrum of a sin wave

texts: I have a sin wave of 16Hz, sampled at 2048 samples persecond. I performed the FFT of the sequence and did a spectrum plot. My plot gave me two spikes at both ends of the graph. But i was told the spike is meant to be at 16. how exactly am i supposed to do the plotting in order to get this exact spike?


texts:
Matlab says

  x = hilbert(xr) returns a complex helical sequence, sometimes called the analytic signal, from a real data sequence.

How did the name complex helical come about? How is it related to analytic signal?


texts: Signal view from two different receivers (of the same model)

texts:
I have two SDRs hooked up to two different computers, both radios tuned to the same frequency.  They sample at 2Msps.  What I would like to do is start up both (at 'about the same time'), and, after adjusting for the inevitability that one started before the other (cropping part of a signal), compare and see that I have the same signal.

I theorize that I won't, actually, have the same signal.  Because while both radios are sampling at the same sample rate, the samples aren't captured at exactly the same time.  Am I correct?

The target signal is flexible, but DVB, and FM radio stations are examples.


texts: Is there any good book regarding Image Processing Algorithms for Feature Extraction and Matching which gives examples in MATLAB?

texts:
I have been looking to implement feature extraction and matching in MATLAB. For this, I've read many algorithms, but i'm not able to understand how to implement these in MATLAB. Is there any Book related to this topic which is based on MATLAB? i.e. gives exapmles and sample codes in MATLAB?
I have read Gonzolez and there is no other book that deals with Image Processing Algorithms with help of MATLAB.


texts: Signal sparsity: with noise or without noise?

texts: In compressive-sensing, signal should be sparse. Is this with or without noise? When I differentiate signal, it is supposed to be sparse. But when I add noise on it, it isn't sparse anymore. Should this algorithm  work correctly for me or not?


texts:
I always hear that wavelet transform is not shift invariant, and that there are other types of wavelet, like stationary wavelet and double density dual-tree wavelet transform, that are shift invariant.

Can anyone explain to me, what is the meaning of "shift invariant" .


texts: How to prove that this system is an invertible system or not?

texts: How could i go throw proving that this system $y(t)=\int_{-\infty}^{t}e^{-(t-\tau)}x(\tau)d\tau$ is invertible system or not ?


texts: Derive Bode Diagram from difference equation

texts:
I have designed a 2nd order low pass butterworth filter for the following:

Sampling Frequency: 10kHz. Cut-off Frequency: 1kHz

After doing a bit of maths I worked out the difference equation:

w=tan(1000*pi / 10000) = 0.3249
H(Z) = 0.06747(z + 1)^2 / z^2 - 1.143z +0.413

Poles / Zeroes:

a1=1.143, a2=-0.413, b0=0.06747, b1=0.13494, b2=0.06747

Difference Equation:

$$y[n] = 0.06747x[n] + 0.13494x[n-1] + 0.06747x[n-2] + 1.143y[n-1] - 0.413y[n-2]$$

Difference Equation in C#

Y[n] = a1 * Y[n - 1] + a2 * Y[n - 2] + b0 * Signal[n] + b1 * Signal[n - 1] + b2 * Signal[n - 2];

The problem I'm having is trying to plot the frequency response using a Bode Diagram (i.e the low pass filter curve).

I'm struggling to understand how the difference equation can be used to plot the bode diagram. How can I do it? I understand that it must be dB magnitude.

To get Y[n] I need to input a signal into the Signal[n] array. I should be able to produce a graph that looks something like this:


texts:
I have a block of n bits that I'd like to encode into m bits that have an equal number of zeros and ones.

I looked at protocols like 8b/10b but it wastes 25% of the data to achieve balance.

As an example, it turns out that 128 bits have ${128 \choose 64}$ combinations where there is an equal number of zeros and ones.  This number is greater than $2^{124}$.  This means that I should be able to encode 124 bits of data into 128 bits that have an equal number of zeros and ones.

I have no idea how to do this mapping though.  Obviously I can't make a look-up table of size $2^{124}$.  Anyone have any ideas?


texts: How can frequency dispersion in a vibrating string be modelled using an LTI filter?

texts:
According to JOS on stiff-string synthesis, stiff strings (like on a piano) introduce inharmonicity (i.e. the harmonics of the tone are not all in tune) due to different frequency components of the wave travelling at different speeds. This inharmonicity is called "dispersion".

According to another page on the same site about modelling this effect, he says it can be done by putting an LTI (linear, time-invariant) filter of some sort at one end of the delay line (in waveguide modelling, a delay line is used to model a physical string) before feeding the output back into the delay line.

Somehow, this LTI filter introduces inharmonicity, or frequency distortion. But by definition, an LTI filter does not introduce any new frequencies into the signal (and thus can be accurately represented by a frequency-response graph).

How can inharmonic tones be introduced by an LTI filter? Am I missing something obvious? Do I not understand my DSP basics well enough?


texts: What Are the Best Algorithms for Document Image Thresholding (Example Inside)?

texts:
I'm trying to implement various binarization algorithms to the image shown:

Here's the code:

clc;
clear;
x=imread('n2.jpg');     %load original image

%   Now we resize the images so that computational work
  becomes easier later onwards for us.

size(x);
x=imresize(x,[500 800]);
figure;
imshow(x);
title('original image');

z=rgb2hsv(x);       %extract the value part of hsv plane
v=z(:,:,3);
v=imadjust(v);

%now we find the mean and standard deviation required for niblack and
%sauvola algorithms

m = mean(v(:))
s=std(v(:))
k=-.4;
value=m+ k*s;
temp=v;

%   implementing niblack thresholding algorithm:

for p=1:1:500
    for q=1:1:800
        pixel=temp(p,q);
        if(pixel>value)
            temp(p,q)=1;
        else
            temp(p,q)=0;
        end
    end
end
figure;
imshow(temp);
title('result by niblack');
k=kittlerMet(g);
figure;
imshow(k);
title('result by kittlerMet');

%   implementing sauvola thresholding algorithm:

val2=m*(1+.1*((s/128)-1));
t2=v;
for p=1:1:500
for q=1:1:800
    pixel=t2(p,q);
    if(pixel>value)
        t2(p,q)=1;
    else
        t2(p,q)=0;
    end
end

end

figure;
imshow(t2);
title('result by sauvola');

The results I obtained are as shown:

As you can see the resultant images are degraded at the darker spots.Could someone please suggest how to optimize my result??


texts: Differentiation of discrete sinusoidal signal

texts:
What I understand from differentiation of discrete sinusoidal signal is $y(n) = \alpha(x(n)-y(n-1))$ where $\alpha$ may be a factor depending on sampling frequency and signal frequency. Now y(n) represents signal which is $90^\circ$ phase shifted sinusoid.

My question is why to go to Hilbert transform and other complex methods to shift a signal $90 ^\circ$. My concern is with $50\,\text{Hz}$ signal only till $40$-th harmonic.


texts: Using MATLAB `xcorr()` to Find a Signal Hidden Behind Noise

texts:
I am trying to develop some code to find a transient signal in a data set I have.  Before I get there however I am trying to write code using simulated data.

I first am creating a signal with a specified frequency and then adding white noise to it.

I then iterate through a loop where I create a reference signal at an incremental frequency.  I take the FFT of both signals and the I xcorr the results.

With this methodology I get descent results when I use a SnR ratio of greater than -15 dB, but after that my results are no good.  Is there anyway I can optimize this to find signals that are hidden deeper than -15 dB SnR?

My Code:

t = linspace(0,16*pi,1000);
y = cos(2*t);
z = awgn(y,-10);
fftz = fft(z);

subplot(2,1,1);
plot(t,z)
subplot(2,1,2);
plot(t,y)

freq = linspace(0.1,10,500);

for i=1:500
    reference_signal = cos(freq(i)*t);
    fftr = fft(reference_signal);
    Q(i) = max(abs(xcorr(fftz,fftr)));
end

subplot(3,1,1);
plot(t,y)
subplot(3,1,2);
plot(t,z)
subplot(3,1,3);
plot(freq,Q)

The output


texts: Seeking segmentation methods for this light microscope image

texts:
Although I am not new to math or programming, I am a total newbie to image segmentation.  I have the following light microscope image

and I would like to segment it into cytoplasm (the magenta background) vs. the nuclei (the round-ish objects that look like cells).  I am working in MATLAB.

I was hoping someone with segmentation or image processing experience could tell me what they thought would be an efficient approach.

First, do you see any issues with this image that I ought to pre-process out?  E.g. non-uniform background illumination, noise, etc.  I am not familiar with how to identify these things visually in an image.

Secondly, there are two dominant colors in this image, corresponding to two dyes (hematoxylin and eosin, or "H&E" for short).  The cytoplasm and nuclei have different colors, which in principle we know the RGB values of.  So I first tried a method of color deconvolution by Ruifrok to try to separate out the pink from the purple.

Once I did that, the cytoplasm and nuclei seem to have very different textures.  I tried a range filter and got the result below:

Do you have any suggestions for where I can go from here?  How can I eliminate the regions with cytoplasm and end up with clearly segmented nuclei?

I do not know much about graph cuts.  Do you think they would be useful?

Please let me know if I need to clarify the question.


texts: What is the difference between Filters and Windowing?

texts:
I'm finding some difficulties to understand the difference between Filters, and Windowing.

accoriding to my understanding both filters and window functions will make changes to the input signal parameters, according to wiki,

Filter:

a filter is a device or process that removes from a signal some unwanted component or feature

Windowing:

a window function (also known as an apodization function or tapering function[1]) is a mathematical function that is zero-valued outside of some chosen interval.

What I'm trying to understand is this,

Where do we use these windowing functions & Filters in practical world?
Do I need to use both for better signal quality, if so which one come first(Filters => Window or Window => Filters)?


texts: Why does block LMS have the same performance as LMS?

texts: The block LMS and conventional LMS have the same convergence rate and the same misadjustment. I am having trouble wrapping my head around this. The block LMS uses a more accurate estimate of the gradient vector at each iteration. Conceptually, why does a better gradient estimate have no benefit on the descent?


texts: Impact of different padding schemes in Frequency domain image filtering

texts:
I understand, that image padding is necessary in order to prevent wrap-around effects due to circular convolution. My set of questions are related to different padding schemes.

Zero Padding is easy to visualize in the context of reducing wrap-around effects. In the case of schemes like mirror reflection, I have a doubt that since these are non-zero paddings, so doesn't this kind of padding distort the true spectral content of the image (in the sense that the relative spectral content of two frequencies getting changed ) ?
Could someone present examples of effects due to different padding schemes (in MATLAB, mirror, symmetric and zero padding are available) and point out subtle differences arising due to different schemes and possibly pointing out their importance ?

I would be very grateful for the patience of reading this question and giving your consideration to it.


texts: Code Snippet to Convert ADC Samples to I/Q

texts:
I'd like to pull a narrowband signal out of ADC samples, where the ADC rate is much higher than the bandwidth/central frequency of the narrowband signal.  I'd like to feed the narrowband signal into a software package that want I/Q samples, so I'd like to know if a code snippet is doing the right thing.  There are lots of descriptions online, which seem to be ambiguous about factors of 2, and I've so far failed at finding a code example.
Let's say the ADC operates at sampling frequency $f_{samp}$, and the narrowband signal has central frequency and bandwidth $f_0$ and $bw$.  I think what I'm supposed to do is take my ADC samples, multiply by cos/sin($2\pi f_0 t$), then lowpass/downsample that to get I/Q. What exactly does that lowpass/downsampling look like, though?  I would have naively expected to set the output sample frequency to be the Nyquist rate for the desired bandwidth for both I and Q.  But... that just seems crazy?  I can't imagine people would carry around two Nyquist-sampled timestreams for one signal, so I have to be missing something.  Since nothing is as concrete as code, here's a snippet (ignoring edge effects, windowing, etc.) that does what I think I've read but which I firmly believe must be wrong.  Any suggestions on what it should actually look like would be most appreciated!
import numpy as np

def adc2iq(samples,f_samp,f0,bw):
    #Convert real ADC samples taken at sampling frequency f_samp to I/Q
    #data with full bandwidth bw centered at f0

    n=len(samples)
    #make vectors of sin/cos at frequency f0
    t=np.arange(n)/f_samp
    mycos=np.cos(t*f0*2*np.pi)
    mysin=np.sin(t*f0*2*np.pi)

    #take the Fourier transform of the samples times the sin/cos vectors
    ift=np.fft.rfft(samples*mycos)
    qft=np.fft.rfft(samples*mysin)

    #low-pass/downsample by inverse FFTing a suitable number of samples
    keep_frac=2*bw/f_samp  #is this right?
    kmax=np.int(keep_frac*len(ift))
    i=np.fft.irfft(ift[:kmax])
    q=np.fft.irfft(qft[:kmax])
    return i,q

(In case anyone is curious, my motivation is trying to process GPS signals inside 550 MHz worth of L-band radio astronomy data, and the GPS software seems happiest with I/Q samples)


texts:
In my book solution is given like this.
But i am solving like this , am i doing wrong??


texts: What is the minimum sampling duration to capture a given frequency?

texts:
Due to the Nyquist rate, you need to sample twice as fast as the highest frequency you want to measure. Then when you do a FFT the number of samples determines the number of bins and thus the frequency resolution.

But what about the lowest frequency you want to measure?
I would think your sampling duration needs to be at least as long as one cycle of your lowest frequency.

Is this true, or can you register $20$ $Hz$ from a dozen samples at $44$  $kHz$?

If this is true, how long do you need to sample, and how do you limit the number of bins?


texts: Matlab - Segment cell nucleus from similar background

texts:
I am trying to segment the nucleus of the cell in an image so I can extract its boundary. The nucleus and the background of the image are very similar so I am finding it difficult to do this using the something like erosion.

If anyone could suggest a way to remove the background and keep the nucleus that would be very helpful.

Image:


texts: Matching LPC frequency response to raw sample data frequency response

texts:
Background:
The intention is feature/formant extraction from speech input.
I have used an FFT on raw samples in the past and have done simple peak picking from a weighted average of frequencies over time. That gave results that approximated a voiced non-nasal utterance's location in the vowel quadrilateral, but it was not consistent. I heard that LPC would give a smoother response curve and much greater accuracy in feature extraction. The residual is another desired side-effect which will hopefully allow for analysis of other features as well.
Issue:
I have a large disparity in the peak frequencies between an FFT on the raw samples and an FFT on the derived LP coefficients.
I find that the response curves are wildly different in shape and peak frequency locations. Often FFT_LPC (see definitions below) will show large peaks in the 3000/4000Hz range for simple voiced vowel utterances. Perhaps these are pops - maybe I should perform IFFT and play back the output to check. FFT_Raw peaks precisely where I would expect given the source samples.
Process:
Here is my current method:

Obtain samples at 22050Hz.
From the raw sample frame, window with Hamming and perform FFT. Call this FFT_Raw.
In parallel, extract LP coefficients from the raw samples, do NOT window, and perform FFT directly on the LP coefficients padded with zeroes. In effect, every frame would lead with these coefficients. Call this FFT_LPC.
Take RMS of raw samples and apply an (admittedly arbitrary) multiplier to bring FFT_LPC to comparable magnitude compared with FFT_Raw.
Display both frequency response curves with one overlaid on top of the other.

I have tried anywhere from 8 to 32 coefficients with similar results.
Questions:

Is using the coefficients directly as input to the FFT the right approach? The assumption on my end is that leading with the coefficients would approximate a unit impulse. However is there any intermediate processing that I should be doing (such as somehow shifting the starting point of each set of coefficient data to match the fundamental frequency)?
Should the LPC data be windowed prior to FFT? I would think that my current approach of leading with the coefficients every frame means that windowing would reduce the amplitude of the first set of coefficients and FFT would produce different frequencies. However maybe if I window the raw samples and THEN use that as input to the LPC data then I will obtain more accurate results.

I have not used MATLAB or any other third party applications - the desire is to build this myself using Xcode and its accompanying libraries alone. I can display this code but it is lengthy and spans several classes (including adapter classes between data types and math/FFT operations). Ideally I would seek input on a language-agnostic conceptual level.


texts:
I have this Matlab/Octave code:
% needed for Octave ----------------------
pkg load signal
% ------------------------------------------------

% Square -----------------------------------------
figure
N=50;                               % harmonics
fs = 1000;
r_start=0;
r_end=10;
r_step=1/fs;
r = r_start:r_step:r_end;           % range
w_sqr = square(r)/2;                % Square wave [-0.5:0.5]
%w_sqr = square(r);                  % [-1:1]

plot(r,w_sqr);
axis([r_start r_end -1.2 1.2]);
grid on;
hold on;

% Fourier -----------------------------------------
i=1;
sum=0;
for t=r
  for n=1:N
    sum = sum + (2*sin(n*t)+sin(pi*n-n*t)-sin(n*t+pi*n))/(2*pi*n);
  end
  F(i)=sum;
  i=i+1;
  sum = 0;
end;
F=F';
plot(r,F);
axis([r_start r_end -1.2 1.2]);

which results this:

By changing the value of variable w_sqr to (square(r)+1)/2 and calculation of F to F(i)=(1/2)+sum I get the result in range [0:1].
What changes are needed to do in Stage 2 to get the result in range [-1:1]?


texts: How to obtain the probability of a detection?

texts:
I will use a specific example from image processing to illustrate my question, but I'm actually interested in the higher level / abstract procedure. I must lack the specific vocabulary and my hunch is that my question relates to some topic in math / signal processing / computer science that I'm not yet aware of.

I extracted part of an image and I want to check if it contains an edge.
Using some filtering technique (e.g. Sobel) I obtain pixels which are more likely to be part of an edge.

What I would like to obtain is the likelihood of the image to contain an edge.
For example: The probability that this image contains an edge is p=0.82 .

Q1: Which processing steps am I missing here?

My intuitive approach is the following:
Let's assume I want to purchase a magazine. I know that the average price is 4€. By checking how much money I carry, I can predict the likelihood that I can complete the purchase. By example:

With 1€, the likelihood is low, maybe 0.1
With 4€, the likelihood is average, 0.5
With 50€, I can afford almost any magazine, 0.99

Now, I drew the probabilities and created a PDF (probability density function) out of nowhere. Knowing the actual repartition of magazine prices would help me create a more realistic PDF.

Q2: Is this intuitive approach correct?

Q3: How does it apply to the aforementioned problem in image processing?

Q4: Which topic/keywords is my question actually about? Can you recommend some sources / references to develop my knowledge?


texts: How to make the impulse response sparse? How does one know that the channel is sparse?

texts:
I am new to sparse channel estimation algorithms and reading research articles. One such paper is blind sparse channel estimation using a modification of the BOMP technique titled, "Blind Acoustic Source Separation Via
System Identification for Leak Detection in
Pipelines."

How are the impulse response/coefficients made sparse?

Dankers, Jalilian, and Westwick have explained the way they have done parameterization under their algorithm on page 4 and (10). How does one do parameterization of impulse response to decide for sparse/non-sparse?

In general, how is parameterization applied to make the impulse response to zero and in general how does one know which coefficients are sparse?


texts: I trigger recording when power of current sample is X dB greater than last Y samples, what is the terminology here?

texts:
Doing time domain processing of incoming audio. I sample the power level every 0.25s and keeping a running average of intensity over 5 samples. When the power level of the current sample is 10dB greater than the moving average, we start recording.

What are the correct names for these numbers? I also use the same method to trigger recording stop. Is this the same terminology?

I have the code and will use your suggestion to name the variables correctly.

Thank you.


texts:
I am searching a paper or article on this subject.
I have heard of a function that estimates the sampling frequency offset between nominal and actual (sample rate of samples) sampling frequency and corrects for the found value.
Particularly it is done by splitting the signal into blocks of block sized symbols and estimating the sampling time offset for each of the blocks.
Then, the sampling time offset is corrected for by cyclic time shift of the individual blocks.
I have searched all over but didn't find any.


texts: Matched Filter BER vs SNR curve does not match the theoretical curve

texts:
I am creating a matched filter using filter command. The coefficients are also generated in another file using sigma delta modulator these are ternary coefficients (+1,-1,0). I have generated 1 and 0 with equal probability, mapped the bits with a rectangular pulse then added noise and used filter command to filter the received signal with ternary coefficients. After retrieving of the bits when I try to calculate the bit error, the plot comes out to be flat, it does not resemble the theoretical curve and the error rate gives strange values. I'll really appreciate it if someone helps me, please.

The Pb values does not seem to be right. There is not much difference that is why the plot is flat


texts: Can a discrete sinusoidal signal represent only limited number of frequencies?

texts:
If $\omega$ is the frequency of a continuous time sinusoidal signal, $-\infty < \omega < \infty $.

But when it comes to discrete time sinusoidal signals, the range becomes limited : $-\pi \le \omega_{discrete} \le \pi $.

Does that mean discrete sinusoidal signals cannot represent all frequencies possible ? What is the true picture here ?


texts: Combining simultaneous measurements of the same signal for better SNR?

texts:
I have multiple data sets of the same signal measured using the same hardware and I want to know what sort of techniques I can use to improve the SNR.

I was thinking if I adjust and ensure they have the same phase, i could coherently add them, but I didn't really see an improvement in SNR. I'm guessing the reason for this is because the noise gets added together as well.

It makes me wonder two things:

What are some valid ways to combine like signals, to improve SNR
Is there any way to exploit the similarity in signals to reduce noise?

Thank you


texts: Minimum phase systems with pole at infinity

texts:
If a system is given by a transfer function in the $z$ domain that has all poles and zeros inside the unit circle except for a factor of $z^{-1}$ in the denominator (pole at infinity), can it still be considered minimum phase?
If not, how would I create an all pass system to neutralize this pole and obtain a minimum phase representation of the system without also adding a zero at infinity (which i assume would also cause the system to not be min-phase?

The transfer function:

$$H(z) = \frac{1 - \frac 12 z^{-1}}{z^{-1}}$$


texts: Differences between phase and group delay

texts:
Yet another group delay vs. phase delay question! Though this is a question that's been asked several times I don't feel like it's been fully discussed so I'll post an example that I can't quite seem to wrap my head around.

Assume some system whose phase response is shown below;

where the phase is piecewise affine.

For frequencies 0 < f < 0.3 the phase is purely linear and, as is expected, the phase and group delay are identical.

For frequencies 0.35 < f < 0.55 the phase is linear (excluding the discontinuous jump) and, again, in this range the phase and group delay are identical.

However, for f > 0.6 things get confusing for me. Here, the phase is affine (i.e. a straight line that doesn't necessarily pass through the origin). Here, the group delay is constant (as is obvious by its definition) but the phase delay varies with f. As the group delay is constant I would expect a band-limited signal, say in the range 0.7 < f < 0.9, to exhibit no dispersion, i.e. the output from the system is a (possibly frequency varying scaled) time-shifted version of the input. However, if we look at the phase delay it seems like the output should in fact show dispersion (as for some sinusoidal input sin(0.7*t) the delay is on the order of 2.1, while for some sinusoidal input sin(0.9*t) the delay is on the order of 2.5).

If anyone has a way of explaining this apparent paradox I'd really appreciate it!


texts: How can I get the uncertainties for peaks on an image?

texts:
When pick the peak points on an image, e.g. the matrix made by peak in matlab as this one,

I can use max to get the index of the peaks. But how can I also get the uncertainties of the index for the peaks?

For example, the max peak of the red spot could be located at (ix,iy)=(25,37). How do I get the uncertainties like (25±3,37±2)?


texts: How to perform convolution using polyphase structure

texts: I am trying to implement convolution using polyphase structure but, how to split input samples among different filter banks is my major doubt. Please explain the same with example?


texts:
I am currently trying to implement the method described in this paper. In short we have a system of the form $a=B\times c$. Where

$$a_i = \int d^3r \space w(r)f_i(r)t(r)\quad\text{and}\quad B_{ij} = \int d^3r \space w(r)f_i(r)f_j(r).$$

The solution is given by $c = B^{-1}a$. In this case $w,t,f_i$ are volumes, specifically a sequence of images obtained from an x-ray simulation. When I solve these integrals using MATLAB's trapz function I get a poorly-conditioned $B$ matrix.

Is there any other way to integrate this type of data (images)?
Or a different way to calculate my $a$ and $B$ terms?


texts: Concrete use of convolution algebraic properties

texts:
There are 3 main properties of convolution in every image processing lecture notes I read :

Commutativity: $f\star h = h\star f$
Associativity: $f\star (h_1\star h_2) = (f\star h_1)\star h_2$
Distributivity: $f\star (h_1+h_2) = f\star h_1 + f\star h_2$

I'm looking for examples of when these are used (in image processing preferably).

From my research:

A system with unit sample response $h$ and input $f$ behave the same way as a system with unit sample response $f$ and input $h$.

$\Rightarrow$ We can interchange filter and image when computing convolution.

If two systems with unit sample responses $h_1$ and $h_2$ are connected in cascade an equivalent system is one that has an unit sample response equal to the convolution of $h_1$ and $h_2$

$\Rightarrow$ We can convolve our different filters instead of applying them consecutively. It can save time if some filters are often used together.

If two systems with unit sample responses $h_1$ and $h_2$ are connected in parallel an equivalent system is one that has an unit sample response equal to the sum of $h_1$ and $h_2$

This is where I'm unsure. In which instances we would frequently have multiple systems connected in parallel ?
Certainly in ML while computing some CNN.
Also learned about some sharpening method using blur:
$$
f' = f + c \cdot (f - f * h_{\text{gaussian kernel}})
$$

I can't think of any more common examples so I would be glad if you could enlighten me with some and/or correct my eventual mistakes.
Thank you very much!


texts:
What is smoothing and how can I do it?

I have an array in Matlab which is the magnitude spectrum of a speech signal (the magnitude of 128 points of FFT). How do I smooth this using a moving average? From what I understand, I should take a window size of a certain number of elements, take average, and this becomes the new 1st element. Then shift the window to the right by one element, take average which becomes the 2nd element, and so on. Is that really how it works? I am not sure myself since if I do that, in my final result I will have less than 128 elements. So how does it work and how does it help to smooth the data points? Or is there any other way I can do smoothing of data?

EDIT: link to followup question


texts: Discrete Wavelet Transform: Specifics of Filter Bank

texts:
So I have been given to understand that the discrete wavelet transform is able to provide both time and frequency resolution in ways that classic Fourier and even short time Fourier cannot. By carrying out discrete convolutions of the wavelet at different scaling factors, one can perform this transform. Now, I have been reading about the implementation and it seems as though this transformation is often carried out by convolving quadrature mirror filters over the signal, downsampling by a factor of two, then performing the same operation on the downsampled version to determine lower frequency components.

I am very confused about the particulars of why this works. It would appear that a particular QMF filter bank, a binomial filter bank, designed by Ali Akansu, is able perform the same transformation as the Daubechies wavelet.
https://en.wikipedia.org/wiki/Binomial_QMF

I am wondering if the same can be said for other wavelets. Are there binomial QMF filter banks designed to perform the discrete wavelet transforms for different families of basis wavelets? What are the mathematics behind this alternate approach to calculating discrete wavelet transforms and what are the advantages of using this filter bank technique (computing resources, etc)?


texts: Time-shifting operation post the time-reversal operation when performing convolution

texts:
I'm confused with the time-shifting operation post the time-reversal operation when performing convolution. Let's say we were to convolve $x(t)$ and $h(t)$, so I would have the term $x(k)$ and $h(t-k)$ to solve for. In $h(t-k)$, we first reverse $h(k)$ to $h(-k)$ and then shift it to $t$ units. Ideally, we should shift t units to the left but I find examples where they have moved $t$ units to the right instead.
I'm confused because, for any $x(t+n)$, we shift $n$ units to the left of $t$, so for $x(-t+n)$, why we are moving n units to the right of $-t$?


texts: Low-Pass Filtering on Small Chunks of Audio

texts:
I've got a script (Python) that chops 44.1 kHz realtime audio into 10 ms chunks, processes each chunk, and stitches the chunks back together with no added artifacts.  I'm trying to create a low-pass filter that operates on each chunk, but every filter I've tried introduces unwanted artifacts.

I've tried creating various types filters, including IIR (Butterworth) and FIR (Hann, Hamming, rectangular windows, etc.), and Remez.  The attempted methods of applying the filters to the input signal include just a straight transfer function, convolution, and a forward-then-backward filter (namely scipy.signal.filtfilt).  I've also tried the moving average approach, but I don't know what to do near the endpoints of the chunk.

Is there such a filter that is designed for this kind of application?

INPUT WAVE (lots of harmonic content)

|<-- 1 CHUNK  -->|
:                :                :                :
:                :                :                :
: -----       ---:-       -----   :   -----       -:
:|     |     |   : |     |     |  :  |     |     | :
:|     |     |   : |     |     |  :  |     |     | :
:|     |     |   : |     |     |  :  |     |     | :
:       -----    :  -----       --:--       -----  :
:                :                :                :
        V                V                 V
        V                V                 V
     FILTER            FILTER            FILTER
        V                V                 V
        V                V                 V
:                :                :                :
:   ---         -:-         ---   :     ---        :
:  /   \       / : \       /   \  :    /   \       :
: /     \     /  :  \     /     \ :   /     \     /:
:/       \   /   :   \   /       \:  /       \   / :
:         ---    :    ---         :--         ---  :
:                :                :                :

OUTPUT WAVE (less harmonic content)

EDIT: Following the answer from @hotpaw2, I wish to try the IIR approach first (I'm a novice at this, but my gut tells me try IIR first).  For discussion purposes, let's define these arrays:

B = transfer function numerator coefficients
A = transfer function denominator coefficients
I0 = previous input array (same size)
I1 = current input array (441 samples)
R0 = previous output, post-filtered (DO WE NEED?)
R1 = current output, desired post-filtered result array

Do I generate the initial conditions from I0 only, or do I need to figure R0 into the equation?  To ask another way, here's the Python code I'm trying:

initCon = scipy.signal.filtic(B, A, I0)

Once I have this set of initial conditions, are they directly applied to the filter, or is there more that I need to do with them?  Again, the Python code:

R1, _ = scipy.signal.lfilter(B, A, I1, z = initCon)

As the code stands now, it executes but there is a lot of off-frequency buzzing.

EDIT 2:  Just thought I'd post the output of the filter with a sine wave input.  It's quite obvious something goes wrong every 441 samples (the beginning of each chunk):


texts: Why does Hilbert filter distorts the shape of the signal?

texts:
If all the harmonics composing a the signal are shifted by the same amount, this would be the same as sampling later or earlier in time. I think.

Take a simple pulse train as an example.
If Fourier is performed when the pulse is high for time t after 0, and flat for time t before the 0 it will have odd symmetry and only sin harmonics. If the same signal was sampled differently with half of the pulse left of y-axis and other half right of it, it would have even symmetry and contain only cos terms.

Each time actual signal is the same, just its Fourier representation is different.

Difference between these is only shifting all harmonics by 90 degrees. Why is Hilbert filter different in those regards?

I know square wave passed through Hilbert filter produces sideways curly braces like shape, so my fundamental understanding of something is wrong. Thanks for help.


texts: I have  designed a system in simulink and works well through simulation. In order to convert to fixed point, I tried fixed point advisor with little success. The reason being that the coefficients on the float model are larger than 1. I have two of them, a1=0.021 and a2= 3600. My input is from an 16 bit ADC (Q15). So how to scale everything within the range -1 to +1?


texts:
From a book, I learned that image interpolation (or upsampling) can be written as a convolution like this:
$$g(i,j) = \sum_{(x,y)}f(x,y)h(i-rx,j-ry)$$
while $r$ is the upsampling rate.

But I have a time understanding this formula, since AFAIK, the basic idea of image interpolation is to bring near-by pixels into consideration, so I thought a convolution like below might suffice:
$$g(i,j) = \sum_{(x,y)}f(x,y)h(i-x,j-y)$$
What is the point of $r$ in the formula?


texts: Quantization SNR of sine wave doesn't match 1.761 + 6.02 * Q

texts:
I am trying to show with numpy that the quantization noise of a sine wave matches the SNR formula of SNR = 1.761 + 6.02 * Q.
The numpy code is simple:

import numpy as np
import matplotlib
from matplotlib import pylab, mlab, pyplot
plt = pyplot

from pylab import *
from numpy import *
from scipy import signal

def quantization_noise(quant):
    N=8192
    freq = 128
    x = np.linspace(0., 1., N)

    y1 = 0.5 * np.sin(2 * np.pi * freq * x)

    y2 = (np.floor(quant * (y1)) / quant)
    diff = y2 - y1

    freqs = fftfreq(N)
    x_mask = freqs >= 0

    Y1 = np.fft.fft(y1)
    Y2 = np.fft.fft(y2)

    Y1db = 20 * np.log10(np.abs(Y1) / N * 4)[x_mask]
    Y2db = 20 * np.log10(np.abs(Y2) / N * 4)[x_mask]

    plt.plot(freqs[x_mask], Y1db, 'bx', label = "input")
    plt.plot(freqs[x_mask], Y2db, 'r-', label = "output")
    #plt.plot(freqs[x_mask], Y1db, 'bx')
    plt.ylim([-140, 5])
    plt.xlim([0, 0.5])

    snr = np.amax(Y2db[3*int(freq):])
    print(snr)

    plt.plot([0.0, 0.5], [snr, snr], 'm-.', linewidth=1.0)
    plt.text(0.3, snr+4, "SNR=%4.1fdB" % snr)

    plt.grid(True)
    plt.legend(loc=1)

if True:
    plt.figure(figsize=(10,6))
    quantization_noise(8)

    tight_layout()
    plt.savefig("quantization_noise_8.png")

    plt.figure(figsize=(10,6))
    quantization_noise(16)

    tight_layout()
    plt.savefig("quantization_noise_16.png")

When I look at the results, I get an SNR of 27.4dB for 3 bit of quantization. The theory predicts 19.8db.

Similarly, for 4 bits of quantization, I get an SNR of 36.1dB: ~9dB more than for 3 bits, where you'd a delta of 6dB.

Ultimately, I want to show how with 16 bits A/D conversion, you'd end up with 98dB, but as the quantization level increases, the output spectrum gets closer and closer to the input spectrum, which is a continuous downward slope, which raises the question at which point something is considered noise instead of part of the signal.
I used applied a hanning window to better isolate the sidelobes of the main signal, which, for 3 bits of quantization makes the SNR go up from the earlier 27.4dB to 33.3dB:

I'm trying to figure out where my understanding is lacking.
How can I numerically show demonstrate the validity of the 1.761 + 6.02Q theory?
Tom


texts: Difference between the average operation and the application of the equivalent LPF

texts:
I would be glad if someone could answer my question. I have a bit stream of data and I want to extract the low frequency component. When post processing the data I can calculate the average value over a certain number of samples with the MATLAB operation mean(data(1:N))
Then I tired to build the equivalent LPF of this operation:
$$V_o(k) = \frac 1N \big[V_i(k-1) + V_i(k-2) + \ldots + V_i(k-N)\big]$$
Plotted the equivalent filter transfer function: freqz(ones(1,N),N,1e3).
And it looks like a sort of first order LPF. Now if I filter the data I don't get the same results of the average operation, filter(ones(1,N),N,data).
So what am I missing? The purpose of this investigation is to look for a better filter that will be implemented on FPGA to do real time processing.


texts:
(system is LTI and Casual)
1)If a periodic signal is applied to the input of this system.
Does output always have to be periodic ?
2)What conditions are required for this system to be linear?
thanks for answers


texts: Can Cholesky outer product version result in negative square roots?

texts: Say A is symmetric positive definite matrix , which means one necessary condition is diagonal entries of A are positive. If I do cholesky factorisation using outer product form, Can there be any positbility that $\sqrt{A[i][i]}$ will result in negative square roots ?


texts: Identify whether to have unique output in this ARMA system

texts:
my friends and I have no idea whether to diagnose to have the specific output from  the formula below:

The question is that Assume we are given a specific input signal x[k]x[k]. Explain and justify whether or not there is a unique output y[k] satisfying this difference equation.
Would somebody please answer this question asap??
Thank you


texts: Why the Nyquist frequency is 0.5 of Fs, why not 0.55 or 0.65?, brief explanation

texts:
This my elaboration of the aliasing issue:
a continuous signal can be represented by factors of :
$e^{(i2{\pi}ft)}$ if we sample this signal then I will get:
$e^{(i2{\pi}fk/N)}$ where $k=0,1,2.., N-1$
this point can be represented by the below factor as well:
$e^{(i2{\pi}f_pt)}$
if we put all together:
$e^{(i2{\pi}ft)} = e^{(i2{\pi}f_pt)}$
$e^{(i2{\pi}(f_p-f)t)} = 1$
this is satisfied only if :
$(f_p-f) 2{\pi} /N = 2{\pi}m,$ this lead to
$f_p-f = N*m$
now here it comes the analysis
$N$ is actually the sampling frequency, let say $N$ = 100
so if a say my signal is a single frequency $f$ = 100 then my aliasing frequency (or the other signal frequency) would be:
$f_p = f + m*N = 100 + m*100 = 100(1+m),$
$f_p(m=-1) = 0,$ issue,
$f_p(m=0) = 100,$ no issue,
$f_p(m=1)= 200,$..issue,
now if my $f = 50$
$f_p = f + m*N = 50 + m*100 = 100(0.5+m),$
$f_p(m=-1) = -50,$ issue
$f_p(m=0) = 50,$ no issue
$f_p(m=1)= 150,$..issue
now if my $f = 25$
$f_p = f + m*N = 25 + m*100 = 100(0.25+m),$
$f_p(m=-1) = -75,$ no issue
$f_p(m=0) = 25,$ no issue
$f_p(m=1)= 125,$.no .issue
now if my $f = 75$
$ff = f + m*N = 75 + m*100 = 100(0.75+m),$
$ff(m=-1) = -25,$ issue
$ff(m=0) = 75,$ no issue
$ff(m=1)= 175,$.no .issue
so then after tabulating all possible frequencies I can say that the best frequencies where $f_p$ doesn't exist is when $f < N / 2$
so What do you think about this reasoning. is there other way to explain the 1/2 term that multiplies $N$ to give us the right signal frequency ( that can be correctly sampled with $N$  samples)?
Appreciate your opinion


texts: What is a good way to locate butterfly in an image

texts:
I have some images of butterflies. I've downloaded them from here. A sample is below:

In each image, the most prominent object is the butterfly (with flowers, leaf etc in background). I usually go for contour/edge detection to locate features in image, but in this case these algorithms are not working as I expected.

I want to locate butterfly and bound it with a box, or better, compute its contour. Is there a way to do this automatically using python-opencv or some other tool?


texts: Denoising of Images capture by digital camera using Butterworth Filter

texts:
Right now, i am doing a research on how the Butterworth filter can reduce the noise in images captured by digital camera. For start, what i need is images which contain noise in it. My question is;

Is there is a way to add artificial noise such as gaussian noise into images?
After i have an images with noise in it, what are the parameters that i should have to create butterworth lowpass filter?

This is my block diagram of my research. any help will do:


texts: Image Histogram - What Is the Interpretation of PDF

texts:
For digital images (assume 2D gray scale image), the normalised intensity histogram is often treated as the probability distribution function of the intensity ie., intensity is treated as a random variable (RV).

Where is the randomness in intensity coming from ?
Should I treat this RV as the intensity value at any pixel in the overall image ie., can I infer this statement from the PDF - “choose any pixel. Probability that the intensity at that pixel has a value of 100 is 0.35” ? If so, it would seem that all pixels have the same PDF.  Shouldn’t the overall structure of the image structure have a bearing  on the PDF? eg., if the image is black at a pixel, shouldn't we would expect the PDF to be concentrated only around 0 at that pixel and zero everywhere else.


texts: How many times does a certain sound appear in an audio clip?

texts:
I have an audio clip which can be found here  or here. If you hear the audio clip you will notice that there are six times a kind of hit sound in the clip.

My questions are:

How can I count these hit sounds (I should get six in this clip)?
What is the best tool/software/app for this problem?
Where can I find a good source that explains the theory behind this?


texts: what is the difference between the convolution and differentiation over image in image processing?

texts:
In image processing the differentiation and convolution are the terms that are used interchangeably.

What is the difference between applying convolution and differentiation over the image?

How we perform the differentiation over the image(Since in order to differentiate we need to represent it as equation that is differentiable How we do it?) ?


texts: correlation matrix for complex white noise does not equal to identity matrix?

texts:
I generate 8 time series of gaussian white noise and want to compute the correlation matrix at a frequency bin between them. The following is the matlab code I use
clear all;
close all;

fs = 4000;
N = 100*fs;
R = 0.5;% overlap percent
Nseg = fs;

M = 8;

for m = 1:M
   x(:,m) = randn(N,1) ;
end

segNum = floor((N-R*Nseg)/((1-R)*Nseg));

for n = 1:segNum
   y = x([1:Nseg]+(n-1)*Nseg*(1-R),:) ;

   Y = fft(y);

   RR(n,:,:) = transpose(Y(300,:))*conj(Y(300,:));

end

R_hat = 0;
for n = 1:100
   R_hat = R_hat + squeeze(RR(n,:,:));
end

R_hat = R_hat/100;

However, the estimated correlation matrix $R_{hat}$ does not equal to identity matrix. Can you help point out what the problem is with my code?


texts: How to detect slices with circular crops in volumetric mri data

texts:
Ive got some MRI volumetric data I am trying to do some image analysis on. Ive got an issue right now where the first and last 2-4 slices of the data are cropped circularly. Here is an example of what the slice should look like. The black background and the MRI image.

Here are examples of how the slice is getting corrupted at the start and end of the block.

How would you detect for this circular cropping effect. Ive tried looking at the average intensity of the voxels in each slice but theres no generally identifiable pattern in the data which allows me to identify the corrupt slices.


texts: Generation of Noise-shape filter from Power Spectrum Density

texts:
This is my very first time in dealing with signal processing, so I am sorry if I will not use a rigorous terminology.

I am dealing with some issues about noise modeling in matlab. I'm trying to figure out a way to construct a model (filter) of a noise from data. My first problem is that I have no $ S_{xx}(f) $ of the disturbances but only experimental data.

I have plots of the particular requirement with other noises characteristics in a differencial (or stray) acceleration $ (m/s^{2})/\sqrt{Hz}$ vs frequency $ Hz $.

I am wondering how can I get a spectrum from those disturbances and then use it to recreate the noise effect of the disturbances in matlab.

Edit:

After some research, I have some question:
I am oriented to design a noise-shape filter to introduce disturbances in the model. But my problem still remains: How can I be sure that the noise produced by the filter will generate a PSD coherent with the one that I have in my data?

I am refering to something like this for basic use in MATLAB. But these are old notes and the writer uses old versions of MATLAB functions (as psd) and I don't know how to apply it to my case.
I found this for a more detailed and complex procedure, but even here I don't know how to use it properly.

I forgot to present this alternative: fftnoise which seems to do exactly what I need

EDIT
Given the interpolation of the ASD (amplitude spectral density) (which is $ \sqrt{PSD} $ how can I get the H(f) of the filter?
I am not sure how the use of prony and frd (system identification toolbox)

% points
x = ([0.1 0.12 0.2 0.24 0.4 1 2 3].*1e-3);
y = ([150 100 40 30 20 13 12 12].*1e-15);
xlog = log10(x);
ylog = log10(y);
% fitting
N = 1000;
pp = polyfit(xlog,ylog,3);
freq_log = linspace(xlog(1),xlog(end),N);
CAPACT_sensing_ASD_log = polyval(pp,freq_log);
CAPACT_sensing_ASD = 10.^CAPACT_sensing_ASD_log;
freq = 10.^freq_log;

% ESTIMATION
impulse_resp = ifft(CAPACT_sensing_ASD);
f = logspace(-4,-1,N);
phases=rand(1,N);
phases = 0; %(phases-median(phases))*2*pi;
% phases=complex(cos(phases),sin(phases));
response = impulse_resp.*exp(1j*phases*pi/180);
h = idfrd(response,f,1);
data = frd(h,frequency,'FrequencyUnit','Hz');   % object asked by frd! Am I doing it right?
H_CAP_est = tfest(data,3,2);
Num_est = H_CAP_est.Numerator;
Den_est = H_CAP_est.Denominator;
% PRONY
denom_order = 3;
num_order = 2;
[Num_pro,Den_pro] = prony(real(ifft(response)),num_order,denom_order);
s = tf('s');
H_CAP_prony = tf(Num_pro,Den_pro);


texts:
I am performing decorrelation of two channels of audio using all pass filtering. The two all pass filters for two channels are of very high order (>1000 but with not all coefficients non zero). I have to perform this filtering in frequency domain. I get input samples in 2048 frame size (48 K sampling) with 50 % overlap Hann windowed.

So to apply this filter (a small intermediate matlab snippet for one of the channels)

freq_resp_filter=freqz(filter_APF,4096,'whole');

fft_input_sig=fft(input_sig_frame,4096);

filtered_sig_fft=freq_resp_filter.*fft_input_sig;

filtered_sig_ifft=ifft(filtered_sig_fft); % done for testing only

final_2048_samples=filtered_sig_ifft(1:2048); % throw away last 2048 samples to
remove aliasing by fft convolution

and then i recombine this final_2048_samples with previous frames with overlapping.

When I listen to the output audio, I hear intermittent noise with signal,
the noise is absent when I apply the same filter in time domain.

my question is:
1. Is this implementation correct (I have to perform this in frequency domain! and I can not do overlap add/save as this block is a part of a system, and I have no control over frame size, so every operation, 2048 samples should be given as output for further processing. )

Regards,
Kd


texts: methods of computing fixed point atan2 on FPGA

texts:
I am in need of computing atan2(x,y) on an FPGA with a continuous input/output stream of data. I managed to implement it using unrolled, pipelined CORDIC kernels, but to get the accuracy I need, I had to perform 32 iterations. This led to a pretty large amount of LUTs being devoted to this one task. I tried changing the flow to use partially unrolled CORDIC kernels, but then I needed a multiplied clock frequency to execute repeated loops while still maintaining a continuous input/output flow. With this, I could not meet timing.

So now I am reaching out for alternative ways of computing atan2(x,y).

I thought about using block-RAM lookup tables with interpolation, but since there are 2 variables I would need 2 dimensions of lookup tables, and this is very resource intensive in terms of block-RAM usage.

I then thought about using the fact that atan2(x,y) is related to atan(x/y) with quadrant adjustment. The problem with this is that x/y needs a true divide since y is not a constant, and divisions on FPGAs are very resource intensive.

Are there any more novel ways to implement atan2(x,y) on an FPGA that would result in lower LUT usage, but still provide good accuracy ?


texts: Texture mapping on a 3D face from 2D face image

texts:
I have 3D points (xyz) of a face image and I have 2D face image of the same person.

The 3D points of the face are such that If I project the points to 2D plane, it matches with the 2D face image.

I want to map the color information on to the 3D image.
So after mapping I will have the texture of each point.
I want to do it using Matlab/OpenCV.

Can anyone suggest any algorithm or refer some source for me to start.


texts: I have an input signal in the ( 0 - 20 kHz ) frequency range . When i sample this signal maximum sampling frequency is around 40 kHz . When i calculate the FFT using  1024 points i got resolution of 39 Hz ( resolution = fs/N) . But i need a resolution of 5 Hz . How can i get better resolution?


texts: How can I compute the magnitude of edges of an image?

texts:
if I have an image with 11x11 pixels and In the center of the image is a square of 5x5 pixels. The gray level of the background is 0 and the gray level of the square is 50. How can I compute the result of the magnitude of edges given by the compass operator for this image taking into account that the image is not noisy? I have the code but I don't know how to apply the math on paper...
from skimage import filters
import numpy as np
grad_x = filters.sobel_h(input_image)
grad_y = filters.sobel_v(input_image)
edge_magnitude = np.sqrt(grad_x**2+grad_y**2)


texts:
I am trying to generate a 2D DFT matrix in matlab, which I need for 2D compressed sensing (CS) problems.

Lets say $N_1=8$, $N_2=16$, then according to the requirement of CS, to generate a 2D DFT matrix, we need to first generate DFT matrices  $A$ $(N_1\times N_1)$ and $B$ $(N_2\times N_2)$. Later calculate Kronecker product of $A$ and $B$ which will be of order $N_1\times N_2\times N_1 \times N_2$.

A= dftmtx(N1);
B= dftmtx(N2);dft2D = kron(A,B);

It can be done by Matlab, but there is a limit to the max size one can calculate (in my case its $N_1=64$, $N_2=256$).
But I need it for higher orders i.e., $N_1=128$, $N_2=512$ or higher orders. Is there any efficient way to do this without memory issues?


texts: Need some references on sound quality evaluation and syncing

texts:
I have to do a project where I'm receiving the same sound signal from different channels (with different offsets), but they may not be consistent all the time. At any given time, I should decide which channel is providing the best transmission, and make the connection as persistent as possible.

I'm an electronic engineering student familiar related concepts. I appreciate it if you know of any reference that would help me.


texts:
In the window method for filter design it is explained that we do an ideal filter and then we pass it to time domain, but it will be time limited and then...

Why don't we filter directly in the frequency domain?


texts: What filter is optimal for noise cancellation when working with very low sample count

texts:
I am working on sound processing android application project in which I have to input sound and remove noise as much as possible at run-time, somewhat like streaming. I am recording video at one place and play at a different place with very low latency.
I tried using Chebyshev filter but found that it didn't work if I had less frame available to process. There was clipping at the boundaries of the sample so when the video was played I could hear hissing like sound.

To demonstrate what actually happened I am attaching a Matlab code that simulates the situation output that I am getting.

Matlab code when run on a long sample give reduced noise output.

clc;clear;close all;
[sample_data, sample_rate] = audioread('save.binary.wav');
Fs = sample_rate;                                       % Sampling Frequency (Hz)
Fn = Fs/2;                                              % Nyquist Frequency (Hz)
Wp = 1000/Fn;                                           % Passband Frequency (Normalised)
Ws = 1010/Fn;                                           % Stopband Frequency (Normalised)
Rp =   1;                                               % Passband Ripple (dB)
Rs = 150;                                               % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs);                         % Filter Order
[z,p,k] = cheby2(n,Rs,Ws,'low');                        % Filter Design
[soslp,glp] = zp2sos(z,p,k);                            % Convert To Second-Order-Section For Stability
figure(3)
freqz(soslp, 2^16, Fs)                                  % Filter Bode Plot

filtered_sound = zeros(size(sample_data));
filtered_sound = filtfilt(soslp, glp, sample_data);
sound(filtered_sound, sample_rate)
audiowrite('save.binary.test.wav',filtered_sound,Fs)

While when running on small samples of the big file gives, hissing sound (hear simulated by using small samples in a loop).

clc;clear;close all;
[sample_data, sample_rate] = audioread('save.binary.wav');
Fs = sample_rate;                                       % Sampling Frequency (Hz)
Fn = Fs/2;                                              % Nyquist Frequency (Hz)
Wp = 1000/Fn;                                           % Passband Frequency (Normalised)
Ws = 1010/Fn;                                           % Stopband Frequency (Normalised)
Rp =   1;                                               % Passband Ripple (dB)
Rs = 150;                                               % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs);                         % Filter Order
[z,p,k] = cheby2(n,Rs,Ws,'low');                        % Filter Design
[soslp,glp] = zp2sos(z,p,k);                            % Convert To Second-Order-Section For Stability
figure(3)
freqz(soslp, 2^16, Fs)                                  % Filter Bode Plot

BufferSize = 960;
bufferCount = 830400/BufferSize;
filtered_sound = zeros(size(sample_data));

for i = 0:(bufferCount-1)
    filtered_sound(BufferSize*i+(1:BufferSize),:) = filtfilt(soslp, glp, sample_data(BufferSize*i+(1:BufferSize),:));
    sound(filtered_sound(BufferSize*i+(1:BufferSize),:), sample_rate)
end
sound(filtered_sound, sample_rate)
audiowrite('save.binary.test.wav',filtered_sound,Fs)

So what I want to know is which sort of filter is suitable for such an application in which frame length is small due to the requirement of low latency? I tried filters like Butterworth , elliptic, etc . but the results weren't any different.


texts: Which is the Matlab equivalent to IDL's function bytscl?

texts:
From IDL code I got

openr,1,"measures.dat"

nx=200
ny=100

data=fltarr(200,100)

readf,1,data

iimage,bytscl(data)
iimage,sobel(data)

but I can't afford IDL, even isn't near easy to buy a student licence in my contry. Anyway

In a Matlab transcript I wrote:

I=importdata('measures.dat');
nx=200; ny=100;
S=reshape(I,nx,ny);

figure(1)
image(S)

B = edge(S,'Sobel',0,'both') ;

figure(2)
image(B)

So how bytscl can be done?

Thanks.


texts: With a BPSK modulation the data rate is $D=\frac{1}{T_s}$ where $T_s$ is the symbol time. But for a BFSK modulation, how do we find the data rate?


texts: How to detect a long signal inside an even longer one?

texts:
I'm trying to detect a long pattern inside a long recorded audio. In order to do so I am implementing a matched filter in time by performing a FIR filtering using the coefficients of my pattern inverted in time as filter coefficients and doing all the processing in frequency domain. I'm ensuring periodic convolution is equivalent to linear convolution by carefully selecting the FFT size named NFFT so that there's no time aliasing at the output.

$ ifft(fft(patternCoeffTimeInverted,NFFT).*fft(Segment,NFFT),NFFT)$

I am familiar with the existence of overlap-add and overlap-save algorithms to optimally compute the FFTs I would use to implement the convolution between pattern and audio. The problem I'm facing is that normally these algorithms operate with a manageable number of filtering coefficients A and the large audio is divided into chunks of size B for easier processing. My question is what can I do if both the filtering coefficients and the audio are large? Would I have to nest overlap-adds by taking the first chunk of audio B and use it as coefficients A' in a second overlap-add while dividing the original coefficients from A into chunks just to have an output to be used in an iteration of the first overlap-add and then do this for every iteration of the first overlap-add?


texts: Detection Bandwidth for Noise Power Calculation

texts:
I am trying to calculate the $P_{noise}$ in an experimental setup, such as given
below. The DUT is excited at a predefined frequency, $f$ , with
power $P_\text{in}$. The total power is measured by the RF digitizer. We
can assume that the generator and the sample are ideal so that only noise in the
system , $N_{a1}$, is originating from the Low Noise Amplifier (LNA).

Now, I know that $P_{Na1} = kT_e \Delta f$ and $T_e$ can be found in LNA
specs. What confuses me is the choice of bandwidth.

If we look at the RF front end of the detector;

We see that RF input is first shifted to IF band, then adjusted (to cover ADC full range I suppose) and filtered before ADC.
ADC has $f_{sample} = 250\,\text{MHz}$. Also, the device allows $f_{sample}$ down to 10 kHz.

In view of these informations, here are my questions:

What determines the $\Delta f$ for $P_{noise}$ calculation ? Is it $f_{c}$ of the BPF at the detector front-end ?
What is the role of the sampling frequency? Would it be correct to say $\Delta f =  f_s$ or $f_s / 2$ ?
What is the role of the measurement time? If I measure during 1 s and average the data, can we say that the detector will be accepting noise from 1 Hz window of noise PSD ?
(additionally,) Given the fact that ADC has $f_s = 250\,\text{MHz}$ yet it's possible to sample at $\text{kHz}$ regime, can we say that data is being averaged in case of downsampling ?


texts:
What is the frequency range in which acoustic feedback can be found?  Most importantly, is there some lowest frequency below which one can expect not to find any feedback?

My conclusion from the reading I've done and from working with a limited number of audio feedback samples is that it can be found anywhere from 900 Hz upward. However, I've also found an example where
the feedback in question shows up in the spectrogram around 550 Hz.  Now, the creator of that sound may well have shifted the sound's pitch down after recording it (I've asked the uploader and I'll wait for an answer).  But in any case, it made me wonder if such a situation actually might arise in practice.


texts:
The easiest way to smooth a signal is by moving window average.

A more advanced way is to use a Savitzky-Golay filter.
From wikipedia:

  The main advantage of this approach is that it tends to preserve
  features of the distribution such as relative maxima, minima and
  width, which are usually 'flattened' by other adjacent averaging
  techniques (like moving averages, for example).

There is also a whole range of window functions.
As I understand this: any finite filter wil cause spectral leakage,
but the moving window average is the worst. E.g. a Gaussian window is better in this respect.

Is flattening and spectral leakage the same?

When should one use Savitzky-Golay and when should one use Gauss, Hann, Hamming etc?

Thanks in advance for any answers!


texts: I'm trying to estimate SNR level in db to use it as a switch for an speech enhancement method that i'm working on. The noise level is not known and can be estimated using a posterior SNR algorithm. Considering having noisy speech signal power spectrum and estimated noise power spectrum (using a posterior SNR estimation method) how can one estimate signal SNR level in db? The reason for estimating the SNR in db is that if the SNR level rises above a known value e.g. 10db the enhancement algorithm should be switched to another one. How can i estimate SNR in db accurately?


texts:
In case of 1-D FFT it is far more easier to find number of harmonics and their Respective frequencies and amplitudes.
Lets say if i have 8 points signal the harmonics of it then would be 7 with one DC point i.e,

the harmonics after 4th points would have negative imaginary part as it below the nyquist rate.

but if I've 2D signal of 8x8 Matrix there would be total of 64 harmonics and the Nyquist rate will then be on the 32nd point. Am i right ?

If my above statement is correct, the fractional frequency for the first harmonic then would be ,

0 -> Dc
1st Harmonic - > 1/64 -> 64 samples in 1 cycle

Number of Cycle 1.
Number of samples = 64
Sampling rate = 0.015625

What would then be the actual frequency of this Harmonic , I am asking this because i couldn't be able to identify it when i am plotting it on Matlab.


texts: Dataset suggestion: video dataset with accurate depth and pose info

texts:
Please suggest some datasets (can be synthetic, like rendered in blender or so) which have video frames (30fps preferred) with accurate ground truth depth maps and pose (rotation and translation for every frame).
PS: I couldn't figure out if this is the correct site to ask this question. Please let me know if it isn't and where I can ask this question.


texts: IIR filter with circular buffer - Arduino

texts:
I am trying to implement a butterworth lowpass filter with a circular buffer. The code below does not filter as intended and I am not really able to understand what is wrong. Any suggestion?

#define PERIOD_MICROSECS 1000

static uint32_t lastRead = 0;

int analog_pin = 0;
int32_t analog_input0 = 0;
double analog_input0_lp_filtered = 0;

// The coefficients are calculated offline. I set the sample frequency to 1000 Hz, the cutoff to 50 Hz.
// The filter has order = 4.
double c[] = {0.000416599204407, 0.001666396817626, 0.002499595226440, 0.001666396817626, 0.000416599204407};
double d[] = {1.000000000000, -3.180638548875, 3.861194348994, -2.112155355111, 0.438265142262};

int m = 10;
double x[10];
double y[10];

int n = 0;

double lp_butterworth(double input_sample, double *x, double *y, int m, int n)
{
    x[n] = input_sample;
    y[n] = d[0] * x[n] + d[1] * x[(n-1+m)%m] + d[2] * x[(n-2+m)%m] + d[3] * x[(n-3+m)%m] + d[4] * x[(n-4+m)%m]
                     - c[1] * y[(n-1+m)%m] - c[2] * y[(n-2+m)%m] - c[3] * y[(n-3+m)%m] - c[4] * y[(n-4+m)%m];

    return y[n];
}

// ************************* //

void setup() {

  Serial.begin(115200);
}

void loop() {

  if (micros() - lastRead >= PERIOD_MICROSECS) {
        lastRead += PERIOD_MICROSECS;

        analog_input0 = analogRead(analog_pin);
        analog_input0_lp_filtered = lp_butterworth(analog_input0, x, y, m, n);
        n = (n + 1) % m;

        //Check the original and filtered signals with the serial plotter
        Serial.print(analog_input0);
        Serial.print(" ");
        Serial.println(analog_input0_lp_filtered);
  }
}

Below you can see the result of the code in the serial plotter using as analog input an accelerometer at steady state. You can notice a huge offset and not really a filtering effect.


texts: Intuitive interpretation of Fourier transform in beamforming

texts:
When applying Fourier transform in time domain the signal will be carried to frequency domain. And when we apply Fourier transform in spatial domain the signal will be carried to directivity domain.

$$ D(\theta) = \sum\limits_{n = \frac{-N}{2}}^\frac{N}{2} v(n) \exp\left(\frac{j2\pi}{\lambda} nd \sin(\theta)\right)\tag{1}$$

And let's simplify  $ d = \lambda / 2 $ so

$$ D(\theta) = \sum\limits_{n = \frac{-N}{2}}^\frac{N}{2} v(n) \exp(j\pi n \sin(\theta))\tag{2}$$

I can see the mathematically this is $\rm sinc$ if I take $v(n)$ as a rectangular window. I have no problem with the result.

First $\sin(\theta) $ confuses me extremely  how does this $\sin$ performs within Euler's formula ?
Secondly I can understand clear in time domain - frequency relationship: $\exp\left(\frac{j2\pi}{T}t\right) $. From Euler's formula $\cos$ and $\sin$ waves are created every $\frac{t}{T} $ step from $0$ to $ 2\pi$.  I can not understand this when  I look at beamforming function above (formulas (1) and (2)).
And finally why result is in $\theta$ domain how that happened ?


texts: How many multiplications and additions does it take to compute an FFT of a signal?

texts: How many multiplications/additions does it take to execute an FFT operation in terms of the length of the signal $N$ and the number of FFT bins $M$? I don't want an answer in terms of big O, but rather in terms of just $N$ and $M$.


texts:
This is a simple question. Fourier analysis gives us the DFT, which is known as a global transform of a signal. In contrast, the Discrete Wavelet Transform (DWT) has a plethora of wavelets, all of which fall under the umbrella of local transforms.

I wonder, might there be other global transforms besides projection onto a family of orthogonal complex exponentials as with the DFT?

(I am aware of the DST and DCT, however I am looking for applicable non-sinusoidal bases).

Thanks!


texts:
I'm looking for a technical explanation or a specification that explains exactly how 5G NR collision avoidance will work. I was watching a talk from the Mobile World Conference in Shanghai two years ago (2018) and it appears that centralized transmission scheduling may be a part of the standard - here is a timestamped link to the panel member that references this:

Steve Greaves addresses 802.11ay collision avoidance

To quote:

  If you look at what Facebook are doing with AY they are trying to get coordination & synchronization across the
  whole network. Once you have that capability what you can do is you
  can manage interference. You can control the scheduling of
  transmissions such that you can deal with the dense urban deployments
  which are interference limited.

I can't find a standard or explanation for this exact thing within 5G so I was hoping someone could point me in the right direction.

Note: I am not intimately familiar with 5G and am not sure what parts of the "standard" for 5G have been defined. For a long time there was no standard at all. Also please let me know if there is a better community for this question.


texts: Speech dereverbaration via maximum kurtosis adaptive filtering

texts:
I'm trying to code the algorithm described in Speech dereverbaration via maximum-kurtosis subband adaptive filtering by Gillespie, Malvar and Florencio, and the signal looks cleaner in when I plot it.
However there are 2 aspects of the results that are worrying me:

The sound level seems lower than the original when played.
And the sound comes out muffled.

I'm quite new to speech signal processing so I was wondering whether the latter issues occur commonly or is it just my bad coding?

Here is the part of the code that corresponds to the adaptive filter. I believe it should be the problematic part.

for n=1:500
 %Sig is the sum of the product of the FFT of the kusrtosis gradient and
 %the complex conjugate of the FFT of the LP residual of the reverberant
 %signal
    sig=0;
    ii=1;

    while ii<length(F)-L
        sig=sig+sum(F(ii:ii+L).*Yconj(ii:ii+L));
        ii=ii+L;
    end
 %H is the frequency domain representation of the filter and the following are the update equations

%Hpr is G' in the paper
    Hpr(n+1)=H(n)+(mu/M)*sig;

    if Hpr(n)==0 || isnan(Hpr(n))==1
       H(n+1)=0;
    else

        H(n+1)=Hpr(n)/abs(Hpr(n));
    end
 %getting the optimized signal
    Zt=Yleftres.*H;

    zt=ifft(Zt);
%updating the value of the kurosis gradient
    q=1:length(zt);
    while q<length(zt);

        secmoment=beta*secmoment+(1-beta)*zt(q:q+881).^2;
        fourthmoment=beta*fourthmoment+(1-beta)*zt(q:q+881).^4;

        f(q:q+881)=4*(secmoment*(zt(q:q+881).^3)-fourthmoment*zt(q:q+881))/(secmoment.^3);
        q=q+881;

        cleaner=isNaN(f(q:q+881));
        cleaner=cleaner-1;
        cleaner=abs(cleaner);
        f(q:q+881)=cleaner.*f(q:q+881);

    end
    F=fft(f);

   %   Hpr(n+1)=H(n)+(mu/M)*sig;
end


texts: How to estimate filters using conjugate gradient?

texts:
An image $I$ is computed by performing convolution and summation:

$$
\sum_{k=0}^{K-1} z_k * f_k = I
$$

Given only the feature maps $z_k$ and the resulting image $I$, how do I compute the filters $f_k$ ?

This is a linear system, therefore it must be possible to solve it with conjugate gradient. How to formulate it as $\mathbf{Ax} = \mathbf{b}$ ?

$z_k$ and $I$ have both the same quadratic size $N \times N$.


texts: Getting a weired behavior when windowing an audio signal

texts:
I am processing audio signals using Essentia, an open-source library and tools for audio and music analysis, description and synthesis.
Here is a waveform corresponding to a frame extracted from an audio signal. The plot is obtained with the following instruction:

plt.plot(essentia.array(audio_pool['frames.actual-frames'][22]))

... and here is the previous waveform, windowed. The plot is obtained with the conjunction of these two instructions:

w = std.Windowing(type='hamming',
                  size=len(audio_pool['frames.actual-frames'][22]),
                  normalized=False)
plt.plot(w(essentia.array(audio_pool['frames.actual-frames'][22])))

We can see that the resulting waveform is somehow inverted, i.e. the beginning of the original signal occurring in the middle.

I tried other window types (rect, hann, etc.) as well as w/ and w/o zero-padding the original signal, I get the same behavior.


texts:
I would like to take an audio sample and reduce it to a very limited set of numbers, with one value for amplitude and another for length.

Example:

I want to find the dimensions of the red boxes, which represent areas of similar sound intensity. Ideally I'd like this as a python list in a format similar to:

[[2,10],[5,3],[2,8], ...]

(where [x,y] = [length,intensity])

During creation I'd like to specify resolution in some way, so I can take one sample and have a list of 100 items or 10 items or whatever.

Being able to specify y resolution would also be useful, so \$intensity can be 1-10 or 1-100 or so on. As I write that I realise that I can probably only specify one of those, if \$intensity is bounded as an integer 1-10 then the number of list items depends on that, I think?

I'm pretty familiar with using python for various things, audio/signal processing is totally out of my area of expertise so I'm a bit lost and any pointers on where to start would be much appreciated.

The context is I'd like to use that list as an input in a FreeCAD or Blender script which will generate various shapes and designs from audio samples, ultimately to be 3D printed.


texts:
When I calculate the cross correlation between two vectors with the following code

a = [1 2 3 4 5];
b = [6 9 8 9 10];

% correlation using convolution
conv(a,conj(flipdim(b,2)))
% correlation using FFT
ifft(fft(a,9).*conj(fft(b,9)))
fftshift(ans)

when I use the FFT i need to fftshift the output in order to get the correct cross correlation:

ans = 10    29    56    92   134   116    94    69    30

ans = 134.0000  116.0000   94.0000   69.0000   30.0000   10.0000   29.0000   56.0000   92.0000

ans = 10.0000   29.0000   56.0000   92.0000  134.0000  116.0000   94.0000   69.0000   30.0000

However, if i just calculate the convolution of the two vectors using the FFT I don't need to apply the ffshift

 conv(a,b)
 ifft(fft(a,9).*fft(b,9))

ans = 6    21    44    76   118   124   106    85    50

ans = 6.0000   21.0000   44.0000   76.0000  118.0000  124.0000  106.0000   85.0000   50.0000

Why do I need to do a fftshift when calculating the cross correlation? I guess it must be very obvious but I just don't see it right now and I've been googling for hours.


texts:
I have a dataset with over 2000 examples of digits (0 to 9) recorded on wav files. I'm trying to process these files with MFCC so that later I could train an Artificial Neural Network (ANN).

My problem is that ANNs requires, each sample of data, to have the same size, and every single tool I tried (HTK, Matlab and others..), generates outputs of different sizes.

This is probably due to the fact that some digits take more time to be pronounced than others. But how could I deal with this? Should I crop then in order to force them to have the same size? Or should I concatenate all of them with '0's, which would also make them with the same size?

I got stuck with the implementation, any suggestion is welcome


texts: What does the $n$ do in $1/(j \omega)^n$

texts:
I'm currently working through a research paper on beam forming. In this paper a magnitude compensation is introduced to compensate for frequency dependency. Due to other calculations low frequencies are lower in magnitude than high frequencies.

To compensate for the frequency dependency they multiply the signal with:
$$
 \frac{1}{(j \omega)^n}
$$

I know when $n = 1$, the formula is just a simple integrator. But I don't understand what happens when $n$ is higher, and how I should implement it in MATLAB.


texts: System characterization given pole-zero mapping

texts:
The figure shows the pole–zero plots for three different causal linear time-invariant systems with real impulse responses.
Indicate which of the following properties apply to each of the systems pictured: stable, IIR, FIR, minimum phase, all pass,linear phase, positive group delay at all $w$:

I am having problems specifically finding out if the system is linear phase and has a positive group delay, and all pass or not.

In the first plot: the system is stable since we have a region of convergence containing the unit circle, and FIR because it is stable, and minimum phase because we have a pair of complex conjugate pairs.

And so on with the other figures...But I still cannot quite figure out how to determine the other properties given the pole-zero mapping.

Ok, so I've gotten to this point:
Plot 1 is not stable because the ROC doesn't contain the unit circle and since all zeros are in the unit circle, we have a minimum phase system. Additionally, we have a IIR system because of the 3 poles so we have feedback. Its also not an allpass filter because poles and zeros are not reciprocals of each other. I hope those are right and I understand the concept so that I can continue with the other plots. But, I'm really having difficulty trying to find out if the system is a linear phase system or not and if it has a positive group delay. I know that linear phase translates in delay in time for all frequencies by the same amount and that group delay $\tau_g = -d\theta(w)/dw$.

Thanks in advance guys.


texts: How can i hide audio inside other using FFT, I need to know how to begin and what to do ? the first image is for the first audio and the second which i want to hide


texts: Recommended approach for extracting specific edges from image?

texts:
I have several sets of images with a typical image being:

and from each image, I would like to extract the top and bottom curves of the object, shown in red here:

What are some possible tools I could use to solve this problem?

Some things I've looked in to:

Edge detection

As seen in the pictures, there are more edges in the image than just the two edges I'm interested in. I've implemented some naive edge detection in Python with scipy, however, this approach returns a lot of edges I don't want and the data is noisy. If I were able to clean up the data, is there a way to automatically select the edges I'm interested in (the red lines in the picture above) from the whole set of edges?

Background Subtraction

The image sets are actually taken from a video of the object moving over time. Using background subtraction, I'm able to create images like this:

But since the object is fixed on the upper-left end, there is little movement and this approach doesn't provide enough data in that region to create a complete line. Additionally, some sets have very little movement anywhere in the image so this approach wouldn't register the object in these cases.

Possibility of using computer vision: An approach that I haven't looked into is implementing some form of computer vision. I see examples of object detection where a bounding box for an object is created. However, I would like to extract specific curves.

Any feedback or help pointing me in the right direction would be greatly appreciated, thanks.


texts: Can Gabor filter be used for detecting dents in cars?

texts:
I am doing some research on Gabor filters for detecting dents in cars. I know Gabor filters have had widespread use for pattern recognition, fingerprint recognition, etc.

I have an image.

Using some code from the MathWorks File Exchange site, I got the following output.

which somehow isn't the output that one would expect. This isn't a good result.

The my script is as follows:

I = imread('dent.jpg');
I = rgb2gray(I);
[G, gabout] = gaborfilter1(I, 2, 4, 16, pi/2);
figure
imshow(uint8(gabout));

EDIT: Applying a different code to the following image :

Output image after different orientations of gabor filter:

how do i isolate this DENT which is got being detected properly?


texts: Pitch detection using Cepstrum in matlab

texts:
What i am trying to do is to detect the pitch of a given sound signal, so for that purpose, i wanted to find cepstrum of a given signal.

This is my code in MATLAB:

[x fs] = audioread('a.wav');
N = length(x);
n = 0:N-1;

figure, stem(n, x);

X = fft(x, N);
length(X)

figure, stem(n, X);

Y = X(1:6400);
N = length(Y);
n = 0:N-1;

figure, stem(n, Y);

Z = log(abs(Y));
figure, stem(n, Z);

z = ifft(Z, N);
figure, stem(n, z);

Now, all i did was that i found fft of audio signal and then i cut off the second half of it because it is basically the same thing i have in the first half, then, i just followed the standard procedure for cepstum, i moved to logarimic representation and then i found inverse fourier of it. Based on what i saw on the internet, i expected evenly spaced peaks since that represents existence of a definite pitch in the signal, however, this is what i get:

So basically i have no idea what can i do with this, since this what i have is speech signal, i am not sure why there's no any evenly spaced peaks. When i zoomed in a bit, this is what i got

:

This also doesn't help at all, i am having trouble with understanding the way that cepstrum enables us to determine pitch frequency so basically, even if i had something what would seem to me as a proper cepstrum, i doubt that i would be able to determine pitch frequency from it, so any help is highly appreciated!


texts:
This is a photo of our homeworld, taken by the Juno spacecraft recently, sling-shotting on its way to Jupiter. What it gained in speed, we lost in ours, however thankfully we will not be falling into the sun.

I think the South American continent is on the left.

However, we can notice that there is a sort of artifact across the image, a faint sort of blue bar that exists across the image. I am curious as to what may have caused that.

What I would really like to know though, is what image processing techniques us puny humans might muster in order to remove this artifact?