texts:
I have collected a set of physiological signals through emg sensors.
I will link at the end of the post an example (10 sec.) of a signal collected on zygomatic muscle.

When I analyzed these data, I have seen that they cointain a great ammount of noise (as you can see by the plot of the FFT.

Plot of the emg signal

FFT of the emg signal

As you can see, there are several peaks into the FFT. My idea is to delete them using a notch filter on the frequencies of these peaks. Anyway, I am no able to figure out how select automatically these peaks. Do you have suggestions?

Furthermore, are there any better methods to clean the signal?

NB: Each signals have the noises in different frequencies. The data was collected usign a battery and avoiding the current interference.

Thanks :)

File .mat with the data example: https://ufile.io/zk8rf
File .fig with the plot: https://ufile.io/g8owd
File .fig with the fft: https://ufile.io/02m6g


texts: Why does the periodic signal in time always give a discrete frequency spectrum

texts:
I would like to know, why does the periodic signal in time always give a discrete frequency spectrum in FT?

I know the equations, but I simply dont understand why is it so.

Thanks!


texts: How to extract traffic signs from a photograph?

texts:
What image analysis techniques can I use to extract the traffic signs from an image such as the one below?

Edit:

After Anisotropic diffusion: The background that i don't want gets cleared a little

After Dilation :

Thresholding after Diffusion : Not able to figure out the best thresholding for this purpose

However i am not able to figure out how to remove the background?

Edit : i just want these parts of my image

Taking another input image :

Applying median filtering and edge detection :

After Bottom hat filtering:

How do i isolate the road signs please help?


texts: Amplitude response of Lynn's low pass filter at the 3dB cutoff frequency

texts:
I am referring to the calculations in https://courses.cs.washington.edu/courses/cse474/18wi/labs/l8/QRSdetection.pdf for the second order Lynn's low pass filter.
On the third page, the author mentions the transfer function used as:
$$
H(z)=\frac{(1−z^{-6})^2}{ (1−z^{-1})^2 }
$$
The amplitude frequency response for this is given as:
$$
|H(e^{j\omega T})|=\frac{\sin^2(3\omega T)}{\sin^2(\omega T/2)}
$$
Now, he has calculated the 3dB cutoff frequency to be around 11 Hz for the sampling frequency of 200 Hz (i.e. sampling time = 0.005 seconds). Substituting these values in the above equation for amplitude response, I get:
$$
|H(e^{j\omega_c T})|=\frac{\sin^2(3 \cdot 11 \cdot 0.005)}{\sin^2(11 \cdot 0.005/2)} = \frac{0.026979}{0.000756} = 35.69
$$
At the 3dB cutoff frequency indicated, shouldn't the amplitude response work out to around 0.707 and not 35.69? Where is my understanding incorrect?


texts: BER Analysis of Dual hop Decode and Forward Relay

texts:
I want to perform fair BER analysis between Two-hop Decode and Forward relay communication (S-->R-->D) and Direct Transmission from S-->D. The links have Rayleigh fading.
Now for fair analysis 1) Total Transmit Power is kept same 2) Rayleigh Channels with  distance are considered for each link.

In the literature,BER vs (Average SNR) is plotted.

How do I calculate Average SNR for dual hop transmission?

and Can I plot BER vs Transmit power?


texts: Analytical way to generate an IIR that is the square root response of another IIR

texts:
For simplicity take the transfer function of a second order IIR in $z$-domain:

$$
H(z) = \frac {b_0 + b_1 z^{-1} + b_2 z^{-2}} {a_0 + a_1 z^{-1} + a_2 z^{-2}}
$$

Is it possible to generate a new transfer function that yields the square root of the magnitude response of $H(z)$? Assuming the new transfer function is minimum phase. I know this would be possible using various numerical approaches such as global optimization or least squares, but has this specific problem been tackled or are their any approaches which would make the problem attainable without resorting to a heavy weight numerical approach? An approach that worked in the $s$-domain for an equivalent $H(s)$ would be equally useful.


texts: frequency translation or pitch shifting through linear interpolation in frequency domain

texts:
I want to perform pitch shifting with the method described in NEW PHASE-VOCODER TECHNIQUES FOR PITCH-SHIFTING, HARMONIZING AND OTHER EXOTIC EFFECTS. Basically, it involves:

Locate the spectral peaks and their indices in spectrums.
Determine the region of influence (ROI) for each detected peak.
Perform peak shifting according to the amount of frequency shift. Specifically, peaks and their ROI are shifted by an amount of frequency.
Update the phase to maintain the phase coherence, as in phase vocoder for time-scaling.

I am stuck in step 3. The paper describes that with a fractional number of frequency bin shifting (rather than integer number of frequency bin), one should use interpolation since the frequency bins are discrete:

  If the amount of frequency shift    is a fractional number of frequency bins, then frequency-domain interpolation is required, since the sinusoidal peak is only known at discrete frequencies.

My problem is that how do I perform peak shifting through, say, linear interpolation? And, assume a shifted spectrum is obtained, as interpolation insert values between the original discrete bins, how is it finally istf to the pitch-shifted output? I appreciate for any help.

EDIT:

I've realized my question can be simply be phrased as "fractional shifting of spectrum components". The following code is an example to achieve fractional shifting with a random signal using linear interpolation:

import numpy as np
import matplotlib.pyplot as plt

np.random.seed(5)
y = np.random.random(20)
alpha = 3.2    # shifting factor

# Pad the signal with zero
# to avoid spill-out caused by
# large shifting factor
nPad = np.ceil(alpha*len(y))
yPad = np.concatenate(
           (y, np.zeros(int(nPad))))

x = np.arange(len(yPad))
xInt = x[0:len(y)]*alpha    # the 'xp' in function interp
yInt = y                    # the 'fp' in function interp

# Now define 'x' in function interp
start = np.ceil(xInt[0])
end = np.ceil(xInt[-1])
if float(xInt[-1]).is_integer():
    xQue = np.arange(start, end+1, 1).astype(int)
else:
    xQue = np.arange(start, end, 1).astype(int)

yNew = np.interp(xQue, xInt, yInt)    # linear interpolation
shifted = np.zeros(len(yPad))
shifted[xQue] = yNew

plt.plot(yPad, 'b')
plt.plot(shifted, 'r')
plt.show()

The above example uses a randomly generated signal to illustrate fractional shifting of a spectrum.

However, in the real case, a spectrum shouldn't be padded with zero in the first case as I do in the code. So, how to deal with the "spill" with spectrum component if the shifting factor is too large?


texts: Is there any way I could utilise findpeaks in conjunction with fvtool? I would like to know where on the frequency axis the maximum and minimum of my frequency response happens.


texts: Efficient calculation of correlation function every $N^{\rm th}$ point

texts:
I would like to calculate a long correlation function of length say, 1e6 points.
I have a prior knowledge that the correlation peak will be in point k*1000.
Is there an efficient way to apply this prior knowledge and perform a shorter calculation.

I don't want to calculate correlation by definition and implement a 1000 correlators. This solution is not sufficient.
Batch algorithm (FFT) is always possible but it does not make use of the mentioned structure.


texts:
I'm working on a simple sound analyzer application and a main feature of this program is the spectrogram display. I want this spectrogram to render fast
and to be good looking while preserving all the necessary details. What I have so far is shown below.

  The 3 spectrograms below are of the same sound file (the first 2 are  256
  and 1024 frame spectrograms produced by my application whereas the
  third is generated by the Sonic Visualizer application)

As you can see, it's far from impressive and ideally I'd want my spectrogram to look something like the one in picture #3. The reason that
my spectrogram doesn't look good is that I just draw what is calculated in subsequent FFT frames without trying to average, interpolate or normalize
data in any way (I'm talking about the pixel data here, not magnitudes).

The spectrograms look better when using smaller frame lengths (e.g 256, 128 etc) because the actual frame width is smaller and thus the image looks less grainy. For small files (1-2 seconds or less), there are only a handful of frames and the problem is even worse.

I've considered using either image segmentation (https://en.wikipedia.org/wiki/Image_segmentation) or colour normalization ( https://en.wikipedia.org/wiki/Color_normalization ) but given that each of these technologies has so many algorithms best suited for a particular purpose, I'm kind of lost as to what to use or what would be best in terms of performance while still producing good looking results.

UPDATE:

Marcus' comment prompted me to further explain my problem so let's just briefly go over a simple example. As I already said, the problem is most evident with small files.

If, for instance, my file is 1 sec long, sampled at 8000 Hz (mono) and I choose a frame length to be 1024 samples, the resulting spectrogram will have 8000/1024 = 7 (7 frames). Yes, I actually
create 7*2=14 overlapping frames but they're averaged (3 consecutive frames are averaged into a single frame except for the first frame and the last frame where only two frames are averaged )

So, there are 7 frames from which I create the spectrogram but given this small number of frames, the frame width (the width in pixels that corresponds to a single frame) is large. The frame width is
obtained by just diving the spectrogram image width by the number of frames (e.g frameWidth = 1000px / 7 = 142 px

Now, it should be fairly obvious that this kind of approach leads to spectrograms look grainy, especially for small files and ( relatively ) large frame lengths.

Any help is much appreciated.


texts: How does harmonic distortion occur in ADCs?

texts:
We are currently testing an ADC at my workplace and the Total Harmonic Distortion is an important spec. It got me to thinking as to how it occurs in the first place

1) Can there be harmonic distortion if the input signal is a pure sine wave? In other words if the input is theatrically a clean sine wave , can the adc artifically introduce harmonics?

2) ive read quantisation noise can introduce or amplify harmonics of a signal. How does this happen?

Thanks!


texts: Quadrature subsampling result not as expected

texts:
Let's suppose I have an ADC running at 81.824MHz. I am quadrature subsampling a signal that is at 143.5MHz using a sampling rate of 81.824MHz/4 = 20.456MHz = Fs. I expect the signal to appear at baseband with a small offset of 143.5MHz-7*Fs = 308KHz. But it is showing up at 320KHz when I run the code below. Why is that?

% Sampling frequency
fs = 20.456;

% ADC frequency
fadc = 4*fs;

% ADC period
T = 1/fadc;

% Some ADC samples
n = 0:T:100;

% Received frequency
f_l1 = 143.5;
s_l1 = cos(2*pi*f_l1*n);

% Replica frequency for mixing.
f_local = 7*fs;
s_local = cos(2*pi*f_local*n);

% Mixing
sif = s_l1 .* s_local;

% Find frequency content
siffft = (fft(sif));

% Plot results
nyquist = 1;
freq_steps = (1:length(siffft))/(length(siffft))*nyquist*fadc;
figure(3);
plot(freq_steps, abs(real(siffft))),
grid;


texts:
I am having a VERY hard time capturing when the ball comes into frame in this video

http://www.youtube.com/watch?v=x1V6_OHrXIo

I have no idea what to set the parameters too, and trying random values doesn't seem to help at all, I can't see the pattern to know what effect the numbers are having.  This is what I'm attempting.

Background subtraction, or color detection won't work, as they could easily change.  I need a more generalized solution.

var laneSixBedRect = new Rectangle(new Point(240, 185), new Size(240, 150));
var laneSixBed = imgSource.GetSubRect(laneSixBedRect);

TrackShot(laneSixBed);

private static void TrackShot(Image<Bgr, byte> laneBed)
{
    var laneBedGray = laneBed.Convert<Gray, byte>();

    var circles = laneBedGray.HoughCircles(
        new Gray(150),  //cannyThreshold
        new Gray(75),   //circleAccumulatorThreshold
        2.0,            //Resolution of the accumulator used to detect centers of the circles
        20.0,           //min distance
        5,              //min radius
        50              //max radius
        )[0];           //Get the circles from the first channel

    foreach (CircleF circle in circles)
        laneBed.Draw(circle, new Bgr(Color.Brown), 2);
}

Edit: This is my currentTrackShot method, it's running about 70% as far as accuracy, still some false positives, and some missed positives.

    private static void TrackShot(Rectangle laneRect, Image<Bgr, byte> prevImage, Image<Bgr, byte> currImage, Image<Bgr, byte> background)
    {
        var laneBedBack = background.GetSubRect(laneRect);
        var laneBedPrev = prevImage.GetSubRect(laneRect);
        var laneBedCurr = currImage.GetSubRect(laneRect);

        var laneBedBackGray = laneBedBack.Convert<Gray, byte>();
        //TODO: Should these be Smoothed?
        var laneBedPrevGray = laneBedPrev.Convert<Gray, byte>().SmoothGaussian(5);
        var laneBedCurrGray = laneBedCurr.Convert<Gray, byte>().SmoothGaussian(5);

        //TODO: Uncomment to see difference between frames, nearly black when no motion
        //var diff = laneBedPrevGray.AbsDiff(laneBedCurrGray);
        //diff.Convert<Bgr, byte>().CopyTo(laneBedCurr);

        //TODO: Improve these values
        var prevFeatures = laneBedPrevGray.GoodFeaturesToTrack(100, .01, .1, 3)[0];

        var returnFeatures = new PointF[1];
        byte[] status;
        float[] trackError;
        OpticalFlow.PyrLK(laneBedPrevGray, laneBedCurrGray, prevFeatures, new Size(15, 15), 5, new MCvTermCriteria(5), out returnFeatures, out status, out trackError);

        //TODO: Now how do I refine this???
        for (var i = 0; i < returnFeatures.Length; i++)
        {
            var prevPoint = prevFeatures[i];
            var currPoint = returnFeatures[i];
            var state = status[i];
            var error = trackError[i];

            var line = new LineSegment2D(new Point((int)prevPoint.X, (int)prevPoint.Y), new Point((int)currPoint.X, (int)currPoint.Y));
            if (state == 1 && line.Length > 15 && error < 10)
            {
                laneBedCurr.Draw(line, new Bgr(Color.Green), 3);
                Console.WriteLine("E: {0}", error);
                Console.WriteLine("L: {0}", line.Length);
            }
        }

        viewerModified.Image = currImage;
    }

EDIT2: My ulimate goal is to be able to draw a line along the trajectory the ball took and store that trajectory in some fashion that can be compared to others.


texts: FIR filter design: evaluating the error function

texts:
Question 1

$$
H(e^{j\omega})=\sum_{n=0}^{N-1}h[n]e^{-jn\omega}
=\mathbf{c}^H(\omega)\cdot \mathbf{h} \tag{1}
$$
$$
=\mathbf{h}^H\cdot\mathbf{c}(\omega)  \tag{2}
$$

$$H(\mathbf{h})=\sum_{k=1}^Kh[k]e^{j\omega_k}\tag{3}$$

The design of filter in matlab ,if using:

$-$$(1)$ and $(3)$ the length of filter is $K$.

$-$$(2)$ the length of filter is $N$.

What is the difference between these two design?
Can i use the operation 'transpose' in $D(w)$ and weighting function,length of filter?

Question 2

application in matlab

I used the same functions in 'cfirls' like desired and actual function.

   %% Desired coefficient

   N = 61;              %desired filter length
   tau = 26;            % desired passband group delay
   % frequency grid
   f = [linspace(-1,-.18,164),linspace(-.1,.3,80),linspace(.38,1,124)];
   % desired frequency response
   d = [zeros(1,164),ones(1,80),zeros(1,124)].*exp(-1i*pi*f*tau);
   w = [10*ones(1,164),ones(1,80),10*ones(1,124)];
   A = w(:,ones(1,N)) .* exp(-1i*pi*f*(0:N-1));
   h = A \ (w.*d);
   %%actual function
   c=[zeros(1,164),ones(1,80),zeros(1,124)]*exp(-1i*pi*f*(0:N-1));
   H=h'.*c;

   %% error function
   E=abs(H-d)^2;
   S=sum(E');

   plot(f,S)

I need in my work to reduce the error as little as possible.How can i changing in this code?


texts: FastICA: what happens when we have more source than channel?

texts:
I am reading the original article proposing FastICA and I have a couple of question on point not covered in the article. Both answering me or providing a source will be very appreciated.

I want to use it in blind audio source separation context, so I am going to use that language.

Let's suppose that I have more source than channels.

$$x_1 = a_{11}s_1+a_{12}s_2 + a_{13}s_3+a_{14}s_4$$
$$x_1 = a_{21}s_1+a_{22}s_2 + a_{23}s_3+a_{24}s_4$$

Where $x_1$, and $x_2$ are our observed channels, $s_i$ the unknown sources and $A = (a_{ij})$ the unknown mixing matrix.

FastICA suppose that we have as many sources as channels, but does not check it in any way. If I am going to run the algorithm on my data, it would extract two sources and a 2x2 mixing matrix.

What should I expect from those sources? Are they going to be weighted mixing of my true sources? If yes: mixed how?

Thanks in advance, and sorry if I did some language mistake.

PS: I don't have a strong formation in Signal Processing, so if you can provide some source or small explanation when using specific language it would be appreciated.


texts:
I am trying to use a basic example of a low pass filter as shown in the example:
https://de.mathworks.com/help/signal/ref/lowpass.html

However, I change the frequency:

fs = 20e6;
t = 0:1/fs:1;
x = [1 2]*sin(2*pi*[70e3 300e3]'.*t) + randn(size(t))/10;
lowpass(x,100e3,fs)

The following is the response that I get:

The location of the peaks are at 68 kHz and 300 kHz. I am not sure why 300 kHz is not filtered. Any guidance will be helpful.


texts: What is the underlying concept behind Bandpass sampling?

texts:
Can you suggest me some books/webpages on Bandpass sampling?

I undestand that if the signal is restricted between $f_L$ and $f_H$, then the minimum bandwidth required is $2(f_H - f_L)$. But say the centre frequency is in GHz and the bandwidth is in MHz, then by this theory I would have the sampling frequency to be in a few MHz. So in case of GHz centre frequency signal(say 1 GHz), I collect the samples every microsecond. But the signal is changing every nanosecond. I did not understand this concept.


texts:
I have a really simple question of definition.

Consider that I have an estimator $\widehat{a}$ and a variable $a$.

I know that we define the bias of $\widehat{a}$ by $B(\widehat{a})=\mathbb{E}(\widehat{a})-a$.

I just want to know in the case where $a$ is a random variable, if the definition is this one:

$B(\widehat{a})=\mathbb{E}(\widehat{a})-\mathbb{E}(a)$.


texts: How to solve this Laplace integral for an averaging function in an iterative numerical (finite difference) model?

texts:
I am trying to implement a mathematical model for vibrational damping described in this article.
They provide an equation for damping force ($F$) as a function of:

a spring constant ($k$)
a damping coefficient ($η$)
displacement of the point being damped ($x$)
velocity of that point ($\dot{x}$)
mean displacement and velocity for the point ($x_m$ and $\dot{x}_m$)

I understand the basic principle of the force equation. However, my math is not very advanced, and I don't understand how they calculate the mean displacement and velocity ($x_m$ and $\dot{x}_m$), given by the equation for $z_m$.
The relevant excerpt is as follows:

The equation for $z_m$ (where $z = x$, $z= \dot{x}$) is what I don't understand. I presume $n$ here is a time constant that allows a relative weighting for older or newer values. Is that correct?
What does the expression $t^{n+1}$ represent? Do they mean time raised to exponent of $(n+1)$? Or something else like time at sample $(n+1)$?
What about the integral? Do they mean a Laplace $s$? What do I do with this in a stepwise function? They explain that this ought to be solved using a stepwise iterative approach which is perfect because I am using stepwise finite difference modeling for the system I want to add this to.
In a finite difference model where $Δt$ is the time step per time sample, $n$ is a given coefficient for mean weighting, and where you have the displacement $x$/$x_m$ and velocity $\dot{x}$/$\dot{x}_m$ at the prior time step, in plain English or simple demonstrative code or line by line math, what would be an iterative solution they are suggesting for $z_m$ (ie. the current $x_m$ or $\dot{x}_m$)?
Thanks for any help. It is very much appreciated.


texts: What are the relative merits of various upsampling schemes?

texts:
I recently encountered a DSP system which did some internal upsampling via zero padding.  Expecting zero-order-hold, I was surprised to find that a DC signal did not produce a DC output; many harmonics of the internal (lower) sampling frequency were also present in the output.

This leads to my question: What upsampling techniques are commonly used, and what are their relative merits?  Why would I choose zero padding, zero order hold, or first order hold, and what other techniques are available?

Some clarifications:

The system is real-time, so the upsampling scheme must be causal.
The upsampler is followed by a an anti-aliasing filter that can also be specified.


texts:
I tried to plot phase demodulated signal and original message signal but there is a significant difference between magnitudes of the message and demodulated signal. I have attached the code and the graph. Please help in pointing out the error.

Code

clear all; close all;
fm = 50;
fc = 1000;
fs = 4000;

t = 0:1/fs:0.1;
kp1 = pi/2;

m_t = 5*cos(2*pi*fm*t);

x_pm = cos(2*pi*fc*t + kp1*m_t);

x = pmdemod(x_pm,fc,fs,kp1);

figure(1);
plot(t,x_pm);
title('phase modulated signal');

figure(2);
plot(t,x,t,m_t);
title('message and demodulated signal');
legend('demodulated signal','message signal');

plot


texts:
Anyone have an idea of how I can implement autocorrelation of power spectrum of one image? I tried using:

 autocorrel = ifft( | fft(power spectrum) | ^ 2 );

but it's not working. Do you have any idea why or some other way?


texts:
Explain why the Hilbert transform of $f(t)=\operatorname{sinc}(at) \cos(2 \pi \nu_c t)$ is

$$\hat{f} (t) = \operatorname{sinc} (at) \sin(2 \pi \nu_c t),$$

where $0<a<\nu_c.$

Attempt:

I have already found the Hilbert transform of $\operatorname{sinc}(at)$ here. Now I want to use linearity property of the Hilbert transformation. So writing $f(t)$ as:

$$f(t) = \frac{1}{2} \left( \operatorname{sinc}(at) e^{j 2 \pi \nu_c t} + \operatorname{sinc}(at) e^{-j 2 \pi \nu_c t} \right) \tag{i}$$

Applying linearity:

$$\hat{f}(t) = \frac{1}{2} \left( \frac{\sin^2(at/2)}{at/2} e^{j 2 \pi \nu_c t} + \frac{\sin^2(at/2)}{at/2} e^{-j 2 \pi \nu_c t} \right) \tag{ii}$$

But this doesn't look right. So why does the linearity not work? How can I arrive at the correct Hilbert transform expression given above?

P. S.

I know that this result follows from Bedrosian's theorem but I am not allowed to use that for this problem. I know the Hilbert transform of $f(t)$ has to be $\operatorname{sinc} (at) \sin(2 \pi \nu_c t)$ since I've already plotted its envelope and it looks correct:


texts: Gardner Timing Recovery for Repeated Symbols

texts:
I am implementing the Gardner Timing Error Detection algorithm for a QPSK signal. I understand the concepts behind it but I am curious as to what effect repeated signals can have on the phase lock.

If a symbol is repeated (maybe twice, maybe one hundred times) would the error not accumulate out of control? As I understand it the Gardner method looks at peaks and zero crossings to determine the timing error. If for, example, a symbol is repeated many times, would the algorithm not spiral out of control? If the symbol never changes, the algorithm would keep determining that there was symbol error and push the loop filter further and further from the true symbol timing; only fixing itself after a new lock in time when symbol transitions start occurring again.

Am I correct in thinking this will happen? If so, is it mitigated by the assumption that real world data will never (or very infrequently) repeat symbols more than a couple times in a row?

Thank you,


texts:
I am assuming there is an Access Point (AP) and IoT Nodes in NOMA uplink scenario. Following is assumed:

the AP does not know the channel gain of IoT Nodes
the transmission power of nodes is also unknown to AP

How can we measure the SINR of the nodes: as we do not have the Power x Gain product without the knowledge of Power and Gain of IoT nodes.
Is it right to assume that the receiver of the AP won't be able to get any legible data (information) unless the SINR is above a certain threshold?


texts: Predict auditory masking with a crude estimation?

texts: If I had a vector containing the spectral centroid, spread, skewness and kurtosis (all normalised) of an audio clip and found the distance between it to the same kind of vector of another audio clip. Would this give me a very crude estimation of how likely each audio clip would mask each other? Bear in mind I'm aware of how loud each audio clip has to be. I'm just trying to see if their spectrums would interfere with each other. Or could I possibly just find the average over time the amount of energy in each FFT bin to build a spectral profile of audio clip, so it would be essentially be like finding the distance between two 1024 value vectors (normalised obviously)


texts:
I am writing a QPSK receiver in MATLAB. In the transmitter part, I have generated random data using randi, QPSK modulated and pulse shaped using a RRC filter.

The pulse shaped data is fed to Rayleigh fading channel with a Doppler frequency and added an AWGN noise (used inbuilt MATLAB functions).

In the receiver, I have introduced a sampling clock offset using MATLAB's function resample (e.g. transmitted samples are 500, means resample it to 530).

After adding sampling clock offset how can I find the doppler and correct it?


texts: How does the world's simplest sigma-delta DAC work?

texts:
I have run into a simple delta-sigma (supposedly, where is the delta part?) DAC implementation utilizing an accumulator and then using the overflow bit as a modulated 1-bit output.
From https://www.fpga4fun.com/PWM_DAC_2.html:
module PWM(clk, PWM_in, PWM_out);
input clk;
input [7:0] PWM_in;
output PWM_out;

reg [8:0] PWM_accumulator;
always @(posedge clk) PWM_accumulator <= PWM_accumulator[7:0] + PWM_in;

assign PWM_out = PWM_accumulator[8];
endmodule

I have implemented this and tested on an FPGA and compared it to a delta-sigma DAC from Xilinx app note: https://www.xilinx.com/support/documentation/application_notes/xapp154.pdf
module ds_modulator (
        output DACout,
        input [7:0] DACin,
        input Clk,
        input Resetn
);

reg DACout;
reg [9:0] DeltaAdder;
reg [9:0] SigmaAdder;
reg [9:0] SigmaLatch;
reg [9:0] DeltaB;

assign DeltaB = {SigmaLatch[9], SigmaLatch[9], 8'b0};
assign DeltaAdder = DACin + DeltaB;
assign SigmaAdder = DeltaAdder + SigmaLatch;

always @(posedge Clk, negedge Resetn) begin
    if (!Resetn) begin
            SigmaLatch <= 10'b1111111111;
            DACout <= 1'b0;
    end else begin
            SigmaLatch <= SigmaAdder;
            DACout <= SigmaLatch[9];
    end
end

endmodule

I am looking for as simple as possible delta-sigma DAC containing minimum logic while still maintaining reasonable performance. The very simple accumulator-overflow solution seems to work great. I understand it conceptually--high values will cause more frequent overflows and low values will cause less frequent overflows. Are there any disadvantages? I am using 120 MHz sampling frequency and generating sine waves between 100 kHz and 500 kHz through direct digital synthesis.
I am interested in this simple approach. Can someone shine light on why it works so well while being so simple? Also, if there is an official name for this approach or if there is some analysis somewhere online, it would be greatly appreciated if you can reference it in your reply.
I also found the simple accumulator-overflow DAC reference here (page 71): https://github.com/hamsternz/IntroToSpartanFPGABook/blob/master/IntroToSpartanFPGABook.pdf
Thank you.


texts:
I am totally new to image processing and wanted to ask you if you could confirm what I understood. It is about deconvolution:

From what I read we find 2 main types of deconvolution:

1. Analytical

   i.Linear : inverse filter, Wiener deconvolution..
   ii. non linear : maximum  entropy  method , CLEAN algorithm..

2. numerical

Is this right ? If I need deconvolution for deblurring, how do I proceed to choose the right algorithm?
Thank you in advance!


texts:
I am looking for good tools for Audio signal processing. e.g Speech & music analysis, automatic language identification, etc.

Does the Scipy library provide functions for audio processing? Does it have a good tool for Audio Signal processing?

Can you please suggest a tool for this?


texts: How do I find the Energy Density Function of $g(t)$ if i am not given an input or impulse response?

texts:
$$g(t)=\frac{12a}{t^2+a^2}$$
I need to find the Energy Density Function of the signal, but everywhere I look has an input and an impulse response. Does anyone know how to solve this. Would I just take the absolute value of it, square it and then integrate it?


texts: Ringing/Oscillation in the reconstructed Periodogram

texts:
I have an original periodogram that I need to model with autoregressive process. However the model isn't right as it is not fitted well to the original periodogram.
I am suspecting I am doing something wrong when taking the IFFT.

Normalize the original periodogram $I(f)$ so that the (sum of the integral
is 1 on the normalized frequency)
Create a $2N-1\times1$ two sided periodogram from $N$ samples of the normalized periodogram
Take the $\sqrt{I(f)}$ of the signal from the last step
Generate random phase values from [0,2pi] and multiply
the signal point with the phasors from the phase
Perform IFFT (Scipy IFFT,  0 frequency content - positive side content - negative side    content )
Autocorrelate the generated IFFT signal
Use Autocorrelation method to solve for the AR parameters
Finally fit the AR model and generate Periodogram

\begin{equation}
 I(f)= \frac{1}{|\hat{A}(f)|^2} = \frac{1}{|a[0] + a[1]e^{-j2\pi f_1} + a[2]e^{-j2\pi f_2} +....+  a[p]e^{-j2\pi f_p}|^2}
\end{equation}
where $p$ is the AR model order

Sorry, I can't show the whole plot for a reason. I am only showing the end of positive side spectrum
what am I doing wrong ?


texts:
I have a small question that I am confused.

N=16;
x=[-pi:2*pi/N:pi-2*pi/N];
y=1.5*cos(x)
z=fft(y)/N

we will get negtive Fourier coefficients, however when we do it in this way:

N=16;
x=[0:2*pi/N:2*pi-2*pi/N];
y=1.5*cos(x);
z=fft(y)/N

we get positive ones.
How to explain this?
Thank you very much!


texts: I am new to DSP, and I'm self studying. Could someone please explain to me what do we mean by trivial and non-trivial zeros?


texts:
I'm doing some self-study for an important exam I'll have in late March and came across the following question:

So, using the convolution properties, if I want to find an identity system so that the final output is just the input, I would need one of the following, right?

h(t) * h'(t) = $\delta(t)$

H(w) * H'(w) = 1, so H'(z) = $\frac{1}{H(z)}$

My question is, if we go through option 2, then we are going to have a bunch of 1/0 since the Fourier Transform of the sinc will be a rect, so the system would not be stable.
Also, the sinc function itself is not invertible as we have many points that maps to 0 and the even symmetry of the function.
So does that means that for this particular case it is impossible to get such an identity system?
Thanks for the help!


texts: How to Calculate Total Variation (TV) of an Image?

texts:
TV is L1 norm of gradient of an image. So we've to find gradient of the image (which is still matrix, right?). Then take the sum of absolute values of the gradient matrix (So now it must be a scalar, right?).

Can I simply use imgradient function in matlab for first step? It gives two values magnitude and direction, so which one should I consider for next step?

After getting gradient matrix say Igrad, will just summing absolute values (sum(abs(Igrad(:))) give me TV? And it must be just a single scalar value right?

Thank you for reading. Keenly waiting for your reply.


texts: How to select the sampling frequency when the input signal frequency is not known

texts:
I am trying to observe the noise produced by UPS present in our lab, under no load (a normal running condition when its power is on). As I don't know its frequency range, I have randomly chosen 4 sampling rates to see which frequency peak remains constant. But surprisingly, peaks obtained in each graph is almost different from one another. So, in this case how to select sampling frequency, so that I can have a rough estimation of noise frequency coming from ups.

I have attached a table which shows my observations. Please have a look.


texts: Representing stereo signal with complex numbers as input to DFT

texts:
Usually, when we have a stereo signal, we process each channel separately in order to extract the frequencies using Fourier transform.

However, Fourier transform can also be applied to complex numbers as well. So what if I represent the original stereo signal with complex numbers, do a Fourier transform, and back?

I know that in this case, for DTF, I would need to keep all N frequency numbers as opposed to N/2 for DFT on the real data. Should I then be able to recover my original signal from the frequencies? (My guess would be "yes".)

Now, what if I want to detect if a specific frequency is present in the signal? I could use the formula for DFT:

So, what if instead of real $x_n$, I pass a complex number containing values of the stereo channels as real and imaginary parts? Would that make any sense? What would that detect?


texts:
I have a sinusoid in continuous time, with a frequency of 18kHz, it is sampled ideally with a continuous to discrete convertor, with a frequency of 27kHz. After that, we change the sampling speed in discrete time, using interpolator system and decimate system,so that result frequency equivalent in discrete time is 13.5KHz.

The interpolation factors and decimation factors are:

a) I=3 and D=2.

b) I = 1 and D=2

c) I= 3 and D=4

d) I = 4 and D = 3

I see this example on the internet and I don't know what is the correct one. Can you please help me to know what is the true answer and how it is calculated?


texts: multiplication of a function with a Fourier-transformed equals to Fourier-transformed with a function

texts:
I already showed b item using the fact that it is $h\left(0\right)=\int \:f\left(t\right)g\left(0-t\right)dt$
I struggle a lot of hours trying to find the trick in item C.
Can anyone help please ?


texts: What is the precise definition of a nonlinear signal?

texts: I tried to find the the precise definition of a nonlinear signal. However it is not easy. How can we define a nonlinear signal?


texts: How can you intutively figure what the impulse response will behave like?

texts:
I was trying to understand convolution from this book and came across this figure:

Here, the input signal is a combination of a sine wave and a ramp.
In fig a, the input signal is convolved with a special type of impulse response that is said to be a 'low pass filter' and the output is just the ramp.

And in fig b, impulse response is actually a high pass filter and the output is just the sine wave.

What I'm trying to do is, just by looking at the wave-forms for the impulse response functions, trying to find an intuitive way of knowing what those impulse responses will do when convoluted with a given input signal. I can't 'see' how the first waveform will result only in the ramp as the output signal when given the mentioned input.

Can you guys figure this intuitively in your head? If so, then how?


texts: Visualising a Z-transformed Transfer Function?

texts:
For designing any analog filter and various other outputs of filter we use  laplace transform,I can visualise a laplace transform like for ex.
s[X(s)] can be implemented as differentiator fetched with signal x(t)while implementing  differentiators we generally use
capacitors or by using OPAMP similarly,
[X(s)]/s can be implemented as integrators using OPAMP.

But I cannot visualize the z transform in designing of digital filters,
while the implementing the digital filters we often map the s plane to z plane i cannot understand the significance

There are various method of implementing but in end we compare the s plane with z-plane ,
and deduce a equation where the value of z in found in place of s,

Why do we need to map the S plane to z plane?


texts:
I have a block of audio and I have performed an FFT on it.  Now what I want to do is convert this FFT into a set of MFCCs, however while I know I need to do something with weighting the FFT samples based upon a set f triangular filters I haven't really got a clue what this involves.

Can anyone go into some good detail on it?  If you are going to give me a matlab example please explain each step well as matlab allows you to cut quite a few corners and I'm trying to implement MFCC extraction on iPhone.


texts: Bandpass filters with python for low frequencies

texts:
I have a signal, sampled at 1 kHz, that I would like to analyze in third octave bands. For that purpose I defined Butterworth filters with proportional bandwidth. This works well for higher frequencies, but produces very weird results for low frequencies. What am I missing?
Plotted are the frequency responses of the Butterworth filters.
I find similar behaviour in Hanning filters, and think that I am missing something fundamental.

Code used to define filters:

import scipy
import numpy as np
from scipy import signal
from matplotlib import pyplot as plt
def butter_bandpass(lowcut, highcut, fs, order=5, label=None):
    nyq = 0.5 * fs
    low = lowcut / nyq
    high = highcut / nyq
    b, a = signal.butter(order, [low, high], btype='band')
    w, h = signal.freqz(b,a,worN=2000)
    plt.plot((fs * 0.5 / np.pi) * w, abs(h), label=label)
    return b, a

center_freqs = np.array([0.5* 2 ** (n * 1 / 3.) for n in range(0, 29)])
center_freqs.sort()
lower_freqs = 2. ** (-1 / 6.) * center_freqs
for lf in lower_freqs:
    butter_bandpass(lf, lf*2**(1/3.), fs=1000, order=5)

plt.show()


texts: GnuRadio FM Receiver: Heterodyne vs Xlating vs Direct

texts:
I'm trying to build an FM receiver (and eventually transmitter) in GnuRadio that will be able to interact with my local repeater. Starting with WBFM (because I can consistently pull in broadcast stations for testing) I created 3 receivers:

Directly tuning my SDR hardware to the station I want to listen to
Tuning the hardware to some base frequency, then multiplying by a cosine; heterodyne
Tuning the hardware to some base frequency, then using the Frequency Xlating FIR Filter

My question is, which is the better method given I eventually want narrow-band FM with split transmit & receive against a repeater?

I'm guessing having to change the hardware's frequency from receive to transmit, then back again will be "too slow". I'd think that going back-and-forth between cosine sources wouldn't be too bad, but I'm wondering if there is an advantage to the Frequency Xlating FIR Filter. Thoughts or advice? Thanks!


texts: Noise cancellation by averaging multiple images together

texts: As the title suggests , I want to know how noise cancellation is achieved by adding multiple images together . I know the theory behind it , but simple adding the pixel values of 100 noisy images of the same sample would simply produce a white image . Can anybody elaborate , how it is normally done.


texts:
I have a digital sensor that can output at two frequencies (250Hz, 1000Hz), but with different RMS AWGN noise (.35 units RMS, .5 units RMS respectively).  The signal of interest has a single frequency <125Hz (i.e. Nyquist is satisfied at either sampling mode) of which I am trying to determine the amplitude, and the window function has fixed time duration (i.e. 4x more samples for the 1000Hz mode).  Which sample rate/RMS noise mode yields better SNR?

There are 2 relevant phenomena I am aware of:

Oversampling can reduce quantization noise if much of the resulting spectrum increase is bandpassed (See What are advantages of having higher sampling rate of a signal?)
For a fixed RMS AWGN noise, a higher frequency would mean a lower PSD at all frequencies, and thus lower noise power at the frequency of interest as well.

Are there other considerations I'm missing?

I would guess that the 4x increase in sampling rate for only a 43% increase in RMS noise would give better SNR, but I am not sure how to quantify this.

Edit: To add further clarification, assume that the samples just 'show up' in my DSP, and I have no means to provide feedback to the ADC/quantizer of the sensor.  (This is because the sensor measures a wireless signal, which I'm not sure how to properly simulate locally.)  Also, even though quantization noise may be 'non-white' since the signal of interest is periodic and low in amplitude with respect to the quantization intervals, let's assume it is white for simplicity.  I am then simply asking for the equation that relates sampling rate and RMS noise to SNR.

I believe AWGN noise difference can be accounted for as: $SNR_{1000Hz} = (\frac{.35}{.5})^2(\frac{1000}{250})SNR_{250Hz}$, which implies that the SNR of the 1000Hz mode is 1.96x or $10 log_{10}(1.96) \approx 2.92$dB better.  This is because the variance of a rectangular-windowed AWGN signal is $\frac{noise^2_{RMS}}{n}$ (not proven here).

It still remains to account for quantization noise difference (if any).


texts: Bandpass fundamental and harmonics in Matlab

texts:
I have a signal in time domain whose sample frequency is Fs=25600. I would like to remove from the fundamental F=285Hz and all its harmonics (2*F,3*F,etc). I tried to use the comb filter in Matlab using this code :

Fs=25600;
N=43;
BW=285;
Apass=200;
[b, a] = iircomb(N, BW/(Fs/2), Apass);
Hd= dfilt.df2(b, a);
x1 = filter(b, a, signal);

Here is the spectrum of the original signal over the frequency interval up to around 400Hz

Here is the result after applying the filter cited above:

I don't get the awaited result. Is there a way to accomplish this in Matlab?


texts: Impulse response of a continuous system sampled with zero-order hold

texts:
I've a continuous system $$F(s) = \frac{K}{Ts+1}.$$

I sample it with zero-order hold with sampling period $T_s$. The discrete system transfer function is $$
\begin{aligned}
G(z) &=
%
\frac{z-1}{z} \mathscr{Z} \left\{
  \mathscr{L}^{-1} \left\{ \frac{F(s)}{s} \right\}
\right\}
\\
&= \frac{z-1}{z} \mathscr{Z} \left\{
  \mathscr{L}^{-1} \left\{ \frac{K}{s \left( Ts+1 \right) } \right\}
\right\}
\\
&= \frac{z-1}{z} \mathscr{Z} \left\{
K \left( 1 - e^{-\frac{1}{T} T_s n} \right)
\right\}
\\
&= \frac{z-1}{z}
K \left( \frac{z}{z-1} - \frac{z}{z - e^{-\frac{T_s}{T}}} \right)
\\
&= \frac{z-1}{z} K \frac
  {z \left( 1 - e^{-\frac{T_s}{T}} \right)}
  {(z-1) \left( z - e^{-\frac{T_s}{T}} \right)}
\\
&= K \frac
  {\left( 1 - e^{-\frac{T_s}{T}} \right)}
  {\left( z - e^{-\frac{T_s}{T}} \right)}.
\end{aligned}
$$

From this I can get difference equation of the sampled system: $$
y[n] = e^{-\frac{T_s}{T}} y[n-1] + K \left( 1 - e^{-\frac{T_s}{T}} \right) x[n-1].
$$

I'd like to get  impulse response function of the system in time domain $h[n]$: $$
y[n] = h[n] * x[n].
$$

To get $h[n]$, I'd have to find inverse z-transform of $G(z)$, but I can't figure out what it is. I can't find it in any tables. What is it?

Thank you.


texts: How can the Poles of the Root Locus be negative?

texts:
My understanding of drawing a root locus diagram is that stability requires all roots of the characteristic polynomial of the open loop transfer function to lie in the negative real part of the plane. In other words, it must have roots $(s+a)(s+b)...(s+n)$ where $s$ is a negative number.

My question is that the Laplace Transform requires that the real part of $s$ be positive, so wouldn't the possibility of negative real parts of $s$ be a contradiction?

Thanks.


texts: 12kHz sine or square. I can hear the difference - why?

texts:
I can hear 12kHz sinewave but not 22kHz.

A 12kHz squarewave has the fundamental and harmonics I think.  But the first harmonic is outside my hearing range, so how come I can hear the difference between 12kHz sine and 12kHz square?  It's a long time since I did any audio electronics so I've probably forgotten some basic rules - cut me some slack!


texts:
I have the following inverse system

$$G(s)= s^2 + 2s + 3$$

How do I implement it in Simulink? Note that the transfer function is only accepted if and only if the order of the numerator is less than the order of denominator.


texts: How to circularly shift a signal by a fraction of a sample?

texts:
The shift theorem says:

  Multiplying $x_n$ by a linear phase $e^{\frac{2\pi i}{N}n m}$ for some integer m corresponds to a circular shift of the output $X_k$: $X_k$ is replaced by $X_{k-m}$, where the subscript is interpreted modulo N (i.e., periodically).

Ok, that works fine:

plot a

N = 9
k = [0, 1, 2, 3, 4, 5, 6, 7, 8]
plot ifft(fft(a)*exp(-1j*2*pi*3*k/N))

It shifted by 3 samples, as I expected.

I thought you could also do this to shift by fractions of a sample, but when I try it, my signal becomes imaginary and not at all like the original:

plot real(ifft(fft(a)*exp(-1j*2*pi*3.5*k/N)))
plot imag(ifft(fft(a)*exp(-1j*2*pi*3.5*k/N))), 'b--'

I didn't expect this at all.  Isn't this equivalent to convolving with a real impulse that's been shifted by 3.5 samples?  So the impulse should still be real, and the result should still be real?  And it should have more or less the same shape as the original, but sinc interpolated?


texts:
I am trying to figure out why a 3D cube doesn't project in the right place in the image.

I start with the camera at origin and the cube centered at (0,0,1) world coordinates:

Then I create a 3D rotation R of 45 degrees around the Y axis:

(0.707106781, 0, 0.707106781,
0, 1, 0,
-0.707106781, 0, 0.707106781)

And I set the camera to use rotation R^-1, with a translation of R * (0,0,1) (these are camera to world transformations). The camera should have rotated 45 degrees CCW around the cube (I can confirm I have 0.707106781 translation on x and z).

At this point, I would expect to see the cube with the same scale, still centered, and with one of the edges right in the middle of the image. But this is what I get:

The procedure I use to project a 3d point X is (pseudo code):

bring into camera coordinates: Xc = R^-1 * X - R^1 * translation
transform into image coordinates: x = Xc * focal length / Xc.z + principal point

I have read the theory from various sources and it seems I am following the rules.

This is just artificial data, so not sure if focal length and principal point can have any effect on it? What am I doing wrong? Why is the cube not centered?

EDIT:

I construct the cube like this (duplicate vertices are there because I need them to draw lines):

  cv::Matx31d center(0,0,1);
  double delta = 0.2;

  std::vector<cv::Matx31d> volumeCorners = {
    // back
    (center + cv::Matx31d(-delta, delta, delta)),
    (center + cv::Matx31d(delta, delta, delta)),

    (center + cv::Matx31d(delta, delta, delta)),
    (center + cv::Matx31d(delta, -delta, delta)),

    (center + cv::Matx31d(delta, -delta, delta)),
    (center + cv::Matx31d(-delta, -delta, delta)),

    (center + cv::Matx31d(-delta, -delta, delta)),
    (center + cv::Matx31d(-delta, delta, delta)),

    // right
    (center + cv::Matx31d(delta, delta, delta)),
    (center + cv::Matx31d(delta, delta, -delta)),

    (center + cv::Matx31d(delta, delta, -delta)),
    (center + cv::Matx31d(delta, -delta, -delta)),

    (center + cv::Matx31d(delta, -delta, -delta)),
    (center + cv::Matx31d(delta, -delta, delta)),

    // front
    (center + cv::Matx31d(delta, delta, -delta)),
    (center + cv::Matx31d(-delta, delta, -delta)),

    (center + cv::Matx31d(-delta, -delta, -delta)),
    (center + cv::Matx31d(delta, -delta, -delta)),

    (center + cv::Matx31d(-delta, -delta, -delta)),
    (center + cv::Matx31d(-delta, delta, -delta)),

    // left
    (center + cv::Matx31d(-delta, delta, -delta)),
    (center + cv::Matx31d(-delta, delta, delta)),

    (center + cv::Matx31d(-delta, -delta, delta)),
    (center + cv::Matx31d(-delta, -delta, -delta)),
  };

I use a right-handed coordinate system, with the y axis pointing down, for world and camera coordinates, while image has origin at top left.


texts: I have estimated AR coefficients of a time series using "aryule" function in MATLAB. Now I want to obtain the error of the estimated model. I think at first I must reconstruct it. so How can I reconstruct a Time series using it AR coefficients in MATLAB?


texts:
I'm able to make a standard band limited saw wave, but at some point in the past, I remember reading that if you phase offset the sinusoids, you get a different looking wave form that sounds the same.

Trying to implement this by offsetting the phase 270 degrees, I'm seeing a different looking wave form but it doesn't quite sound the same.  It has less volume and sounds a little less bright.

Am I remembering correctly / implementing correctly?  Here's the saw and "other" wave below:

Thanks!


texts: Zero-phase vs Linear-phase vs Nonlinear-phase System

texts:
I don't understand what is the difference between these. I'm trying to figure out how to classify this system's phase response:

Would someone please tell me what it is and how you can tell?


texts:
As the questions states, lets consider we have 3 gas sensors giving me data for:

A
B
C

Note that only sensors for A and B give absolute values, yet we need the absolute values for all four species:

A
B
C
D

Where the sum of the four gases are 1: A + B + C + D = 100%.

Where should I start solving this problem from? How can the general case be described mathematically?

EDIT: As a real-world example, lets consider that:

GSensorA: O2 Sensor
GSensorB: CO2 Sensor
GSensorC: Pollution Sensor
GSensorD: Nitrogen via Signal Processing ;)

Edit:

My objective is to obtain fairly accurate air composition, based on the assumption that the air around us is composed only of oxygen, nitrogen, carbon dioxide and pollutants respectively. Therefore, if we know the volume composition of 3 of the above species, we will have the forth: which is where the title of this question comes from.

By absolute, I am referring to the fact that it is zero-referenced and is independent or other values. I'm sorry if this caused confusion.


texts: How to reconstruct signal of its phase and magnitude functions?

texts: I have two continuous periodic (a period of $2\pi$) functions which belong to the phase and magnitude of Fourier transform of a signal, how can I reconstruct the original signal? What kind of transform should I use? (Basic Fourier transform or DTFT)


texts:
I'm trying to find the frequency response $$H(\omega) = Y(\omega)/X(\omega)$$
for this system- the signal equations are given:
$$y[n] = v[n - M] - g * v[n]$$
$$v[n] = x[n] + g * v[n - M]$$

I've tried using the z transform, and the fourier transform, but I just don't know how to get rid of the recursive terms to get it in terms of $Y(\omega)$ and $X(\omega)$.

The system is illustrated as follows:


texts: Kalman fitler to estimate position from velocity measurement

texts:
I am using the Kalman filter to estimate the position from velocity measurements. I implemented the filter, but the position estimate is not well enough (large RMSE and Covariance value). Some time ago, I estimated the velocity using the position measurements (vice versa of the previous case) and the results were satisfying. What could be the reason that the former case doesn't work well enough?

Edit: Let me re-introduce the problem. Suppose I design a robot and I need to estimate its position and velocity using a tachometer. (And yes I know the initial position.) Then, my state variables become

x = [p v]
p: position
v: velocity

Since the tachometer provides a velocity measurement (i.e. pulse per unit time presumably 1 sec), my measurement vector become

y = [v].

Now I assume that my robot make constant velocity moves and crease a CV model for it motion. Assume F,H,Q and R matrices are standard CV motion matrices. To summarize I have measurement of velocity and trying to estimate the position and velocity of the robot. When I use Kalman filter for that problem I have bad position estimates. However, apart from that problem, when I try to estimate the speed from the position measurement, I have nice results for the velocity. My question is about this difference. In the first case I have velocity measurement and I have bad estimates for the position. In the second case I have position measurements but I have nice speed estimates. Although, both measurements are indirect why do I have such a bad estimate when I try to estimate the position from velocity? Am I doing a nonsense thing by estimating the position from velocity measurement?

One possible answer could be: When I try to estimate the position from velocity measurements I integrate the error. However, when I try to estimate the velocity from position measurements I differentiate the error. Therefore the former provides bad results.


texts: The impact on the frequency of adding zero samples and non zero samples

texts:
Can someone give me a brief explanation of what is going on in here? I struggle to understand the full differences between the impact on the frequency of added zero samples and adding samples which are not zeroes. (In between the samples).
I learnt this course 100% from the lectures so if I have some misconception regarding the basics, I'd be glad if you could kindly help me understand.
The key points I know so far:

Adding zero(ed) samples in between the existing ones in the time domain, squizes the frequency domain and adds height to it.
The squized frequency domain is squized while it's normalised (once we turn it to be periodic with period of 2π).
Adding non zero(ed) samples to our time domain, we get an added zeroes vector to the end of the frequency domain's period. (Padding zeroes in frequency). Which means that when it's being normalized into 2π period's length, then it's also being squized.

From that we conclude, that adding zero samples and non zero samples do the same exact thing.
[Question:] where is my mistake in the above logic sequence? Where is the difference between the impact of adding zero samples in the time domain on the frequency vs adding non zero samples in the time domain on the frequency?


texts:
I understand the process of using a Sobel kernel for edge detection in greyscale images. The input is a greyscale image, and the output is a greyscale image. I'm having trouble, however, figuring out how to apply the Sobel kernel to a color image.

Do I find the color gradient for each color channel (R, G, and B) then average each value to get the final color gradient value? Or do I average the color channels then find the color gradient of that image?

My goal is to render a raytraced image, find the edges, then re-render only the high-contrast regions with anti-aliasing and leave the low-contrast regions alone.


texts: Plotting magnitude and phase for frequency spectrum

texts:
I would like to find the frequency spectrum by drawing magnitude and phase for the following signal:

S=sin(2*pi*100*t)+cos(pi*500*t);

X=sinc(2*pi*t);

Is there something particular to this problem that I should be noticing?

We can easily find the spectra giving a time domain like

t=0:0.01:0.1;

And using the fft command for both signals

X=fft(S);

What did they mean by drawing the magnitude and phase?


texts: Chapter 4, section 4.2.1. in Szelisky computer vision, is there a mistake?

texts:
I've already asked a similar question in mathematics exchange without getting an answer, I read a bit more and I think the question might be more suitable for the signal processing exchange.

Basically I was reviewing my background in edge detection methods and I've found the following statement:

  For many applications, however, we wish to think such a continuous
  gradient image to only return isolated edges, i.e., as single pixels
  at discrete locations along the edge contours. This can be achieved by
  looking for maxima in the edge strength (gradient magnitude) in a
  direction perpendicular to the edge orientation, i.e., along the
  gradient direction. Finding this maximum corresponds to taking a
  directional derivative of the strength field in the direction of the
  gradient and then looking for zero crossing. The desired directional
  derivative is equivalent to the dot product between a second gradient
  operator and the result of the first... The gradient dot product with
  the gradient is called the Laplacian.

I did the calculations but I'm not getting the laplacian, however I've accidentally found this paper, where basically the explanation seems essentially to be "directional derivative and laplacian are different but not that much, so given that taking the laplacian instead of the second directional derivative is less expensive (computationally speaking) we can use the laplacian"

My question is then... is this what Szelisky mean?


texts: Can Binary Content alone affect Noise Performance?

texts:
Assume we got a transmitter and a receiver. We send a binary stream of let's say 8 bits (the stream length cannot change), using AM-modulation. We have no info on the channel/noise characteristics. Our end-system is triggered whenever a certain binary pattern arrives at the receiver (assume the triggering pattern is 01010101).

Our target is to ensure that our end-system will only be triggered whenever we send the triggering stream of 01010101 and minimize the possibility that this occurs due to noise (let's say when sending 01010100 --> receiver translates it as 01010101 and triggers the system).

Is it possible ONLY by choosing the triggering sequence appropriately to increase noise-performance? For example, to say that I choose pattern 11111111 as my triggering sequence, because it is more resistant than 01010101?


texts:
I am trying to verify for myself that aliasing actually makes it impossible to distinguish the "real" and the aliased frequency. What I have done it set the sampling rate to 20 Hz and created two sine wave with 2 Hz and 18 Hz. As far as I understand the 18 Hz signal should alias to a 2 Hz signal when the sampling rate is 20 Hz.

Matlab code:

t = [0:0.05:1];      //20Hz sampling
a = sin(2*pi*2*t);   //2Hz sine wave
b = sin(2*pi*18*t);  //18Hz sine wave
plot(t, a);
hold on;
plot(t, b, 'red');

The plot looks like this:

I can see that both sine waves are equal, but 180 degrees out of phase. I wonder if there is something to it or if it's just Matlab drawing through the points in opposite ways?


texts: Measuring acoustic phase difference between two receivers

texts:
I am trying to measure the acoustic phase difference between two sensors 30cm apart each other. The sampling frequency is 20kHz, and my interest frequency is about 1700 Hz.
The below is how I proceeded.

Take FFT of T = 1 sec time domain signal.
In spectrum, there are several peaks including the interest frequency.
Bandpass filter around the interest frequency (e.g. 1700+-100 Hz)
Reconstruct(or IFFT) the signal in time domain.
Take Hilbert transform and get phase in time domain
Do the same thing for the other receiver.
Compare Hilbert transform phase between two signals in time domain

When I did this, the phase difference between two signals is not constant, but changes with time, which is out of my expectation. Shouldn't the phase difference be constant if they have the same frequency peak? Is there any issue with the above procedure?


texts: I'm have a PSD graph of dB/hz vs. frequency in hz. I want to convert the dB/hz unit to dB, but I can't find any way of doing it. Help would be much appreciated!


texts: How to calculate time of arrival using room impulse response

texts:
I need to find the timestamp of arrival of a particular signal at a receiver location within a room. The known parameters are the room impulse response h for a fixed source and receiver location, the input signal x which is a linear sine chirp.

Currently the steps that i am doing are as follows:

Convolution of input signal x and the impulse response h to generate output y
Cross-correlation of y with x, on which i am doing peak picking to determine the arrival timestamp.

Is the mentioned procedure right or am i missing something?


texts: How to Do Convolution a 2D Signal (Image) and Result of Convolution of Two 1D Filters?

texts:
Assume a 2-D signal (i.e., some image). Load image and assume it to be signal x. Next assume that instead of having a 2-D filter you have two one D filters

$$f_1[n] =\begin{bmatrix}0.25 && 0.5 && 0.25\end{bmatrix}$$ and
$$f_2[n]=\begin{bmatrix}0.25 \\ 0.5 \\ 0.25\end{bmatrix}$$
Assume that the convolution

$$f_1[n]* f_2[n] = f_3[n]= \begin{bmatrix}0.0625 && 0.125 && 0.0625\\ 0.125 && 0.25 && 0.125\\0.0625 && 0.125 && 0.0625\end{bmatrix}$$

Using this information and output at each stage verify that Associative property holds.

My code:

f3 = [0.0625 0.125 0.0625; 0.125 0.25 0.125; 0.0625 0.125 0.0625]
x=imread('img.jpg')
conv2('x, f3)

But this gives error saying x is not a vector. How do I fix this?


texts: Coefficient weights of Simple Moving Average (SMA) on SMA

texts:
A simple moving average (SMA: arithmetic mean) is a low-pass FIR-filter. When you cascade 2 SMA's with a window of length $n$, so when you apply the second SMA on the output of the first SMA, and you want to know which coefficient weights a filter would have with the same output result, applied to the original signal, the 2 impulse responses (coefficients/weights) need to undergo a convolution (non-circular): this should return a vector of $(2*n)-1$ coefficients / weights. I refer to the image below: you have a sinusoidal signal (black), an SMA (blue), and an SMA of this SMA (green), and I compared this to a filter with the "convolution weights":

If you do this in R: the command should be convolve(rep(1/n,n),rep(1/n,n),conj = FALSE,type="open"), right? Obviously the red curve does not coincide with the green curve. Is there an analytic solution that returns the weight vector for this new moving average? Not just for 1 SMA on 1 SMA, but for $x$ SMA's on $x$ SMA's?
Here's my pretty basic R code (I assume Matlab-users / dsp-engineers understand):
n<-10
vperiod<-40
vwave<-sin(2*pi*1/vperiod*(1:(600)))
#
SMA<-function(x,n)
{
  out<-c()
  for (i in n:length(x))
  {
    out[i]<-(sum((x[(i-(n-1)):i])*rep((1/n),n)))
  }
  out[1:(n-1)]<-out[n]
  return(out)
}
#
SmaOnSma<-function(x,n)
{
  out<-c()
  cnvweights<-convolve(rep(1/n,n),rep(1/n,n),conj = FALSE,type="open")
  for (i in length(cnvweights):length(x))
  {
    out[i]<-sum(x[(i-(length(cnvweights))+1):i]*cnvweights)
  }
  out[1:(n-1)]<-out[n]
  return(out)
}
#
plot(vwave[(2*vperiod):(3*vperiod)],type="l",lwd=2,main="SMA on SMA vs. convolution weights");abline(h=0,lty=3,col="gray")
legend("bottomleft",inset=.03,c("signal","SMA of signal","SMA of SMA of signal","Filter with convolution weights"),fill=c("black","blue","green","red"),horiz=FALSE,border="white",box.col="white")
#
tempwave<-vwave
lines(SMA(tempwave,n)[(2*vperiod):(3*vperiod)],col="blue",lwd=2)
tempwave<-SMA(tempwave,n)
lines(SMA(tempwave,n)[(2*vperiod):(3*vperiod)],col="green",lwd=2)
lines(SmaOnSma(vwave,n)[(2*vperiod):(3*vperiod)],col="red",lwd=2)

Update:

Thanks to the kind answers here is the code in R for a moving average on moving average:
smavector<-function(n)
{
  return(rep((1/n),n))
}

SmaOnSma<-function(x,n,nit)
{
  if (nit==1)
  {
    cnvweights<-smavector(n)
  }
  if (nit==2)
  {
    cnvweights<-convolve(smavector(n),smavector(n),conj = TRUE,type="open")
  }
  if (nit>2)
  {
    cnvweights<-convolve(smavector(n),smavector(n),conj = TRUE,type="open")
    for (j in 1:(nit-2))
    {
      cnvweights<-convolve(smavector(n),cnvweights,conj = TRUE,type="open")
    }
  }
  #
  out<-c()
  for (i in length(cnvweights):length(x))
  {
    out[i]<-sum(x[(i-(length(cnvweights))+1):i]*cnvweights)
  }
  out[1:(n-1)]<-out[n]
  return(out)
}

I initially thought this could be a method for estimating the instantaneous frequency of a smooth curve, by correcting for the SMA's frequency response, as per my previous question on SE: which was calculated as ($(sin(n*(\pi/p)))/(n*sin(\pi/p))$), (with p = the period of the wave = 1/frequency), but it becomes clear that with every iteration, the length of the weight vector grows by a factor of $(2*n)+1$ the previous weight vector length. Even if you do only half the iterations and multiply with $-1$, the minimum length of required input data (with the same frequency), is still $2$ times the period + $1$.


texts: What is an analysis dictionary or operator in compressive sensing?

texts:
I am doing research on compressive sensing. I am new in this field. I  read several papers regarding analysis dictionaries.
Here are some papers that I have read so far:
https://www.hindawi.com/journals/tswj/2014/852978/
https://www.matec-conferences.org/articles/matecconf/pdf/2018/18/matecconf_ijcaet-isampe2018_01061.pdf
https://ieeexplore.ieee.org/abstract/document/7374920
What I do not understand is if I have
$Ω ∈ \mathbb{R}^{P\times M} $ where $x$ is the raw signal, $x ∈ \mathbb{R}^{M \times 1} $

What is an analysis dictionary (AD,) and an example of an analysis dictionary?
How can we obtain $AD ∈ \mathbb{R}^{P \times 1}$


texts: Could you describe the effects for varying different parameters of a canny edge detector?

texts:
Last couple of questions touched upon Canny edge detector

What are the limitations of a Canny edge detector?  and
Best way of segmenting veins in leaves?

The basic outline of the algorithm is as follows:

a. Apply Gaussian Convolution. (Choice of $\sigma$ to be made here)
b. Apply 2D derivative
c. Tracking through the ridges of this edges and thresholding (set pixels to zero which are not on the edge) with Hysteresis Lower and Higher T0 and T1 (Choice of $T0$ and $T1$ to be made here).

Read this for more background.

While, it is claimed that Canny is optimal; when getting practical results matters, tweaking factors  as listed above $\sigma, T0,$ and $T1$ does make a lot of difference.

So how does one select these (tweaking) parameters practically? Even if, there is no definite approach or value, what is the general technique to know this?


texts: Although there is wide band spectrum in 5G from 6GHz to 300 GHz, why is NOMA needed in 5G to enhance spectrum efficiency. We can communicate in different frequencies since we have very large band. Are resources limited in 5G?


texts: Kalman Filter for position : introducing acceleration estimates

texts:
I want to estimate the position on a 3D environment by introducing only acceleration estimates. Is that possible? If I use the extended Kalman Filter and introduce these estimates will I have the appropriate results?
Thank you in advance!


texts: fo we need RMS in SNDR of harmonic distortion

texts:
In my system we have the following.
$$V_{in}=1+\cos(2\pi 900,000)$$
$$V_{sample}=V_{in}-0.01V_{in}^2$$
$$V_{noise}=200 \times 10^{-6}V$$
After the input i get in $V_{sample}$ the following coefficients of harmonics in the output as shown in the calculation bellow:
Cos_theta :0.98
Cos_2theta :-5*10^-3
DC:non relevant
My question is regarding the SNDR do i need to divide both the voltage of the signal and the voltage of the hormonic distortion by $\sqrt{2}$
doing RMS on each harmonic?


texts:
I don't understand how this works. Help would be really appreciated.

Let's say we have a 10 second sound input, we make a feature vector every 10ms - so we have 1000 vectors - $\mathbf{o}=o_1, \cdots,o_{1000}$.

For simplicity, let's say that all we want to know, is what sequence of phones $p=p_1,\cdots,p_n$ is the answer to $\text{argmax } P(o|p)$ for $p$, or at least what's a good estimate/close answer. For all phones, we have a seperate left to right HMM model (I think that's what makes sense in this scenario).

How exactly is this done?
Will similar enough vectors be "put together" and only treated as 1?
The input is probably not one phone or a thousand phones - but we don't know that... so for what $p$ will $P(o|p)$ be computed?


texts: IFFT of Microphone Array Directivity Response

texts:
I am implementing a microphone array simulation in my thesis.
My prof and many documents indicates that microphone array behaves like filters in DSP but instead time-frequency domain there exists sensivity-directivity domains.
My microphone array directivity responce is a sinc like shape which can be seen below(x axis is angle from -90 to 90 ):

When I took the ifft of such directivity responce I am expecting to get a rectangle.
But instead ifft result is :

My microphone array composes of 41 apartures and distance between apartures is 10 cm.

My first question after taking ifft I am having 180 bins. How should I assign 180 values to my 41 apartures. Should I just take 41 bins in the middle?

My second question since microphone array directivity responce is a sinc like shape. I were expecting a rectangle like result after ifft. Why I am not getting rectangle?


texts: Different way to separate a particular frequency from a signal

texts:
Let's say I have a signal which is composed of 2Hz,10Hz,17Hz,19Hz and 25Hz discrete time sinusoidal waves and I need to allow only 17Hz component to pass.

As far as I know, the standard way to approach the problem is implementing a Band Pass Filter.( Analog Prototype Filter -> Analog Filter -> Digital filter using Bilinear Transformation).

We can also implement DFT on the signal and use the information from the spectrum and then reconstruct the 17Hz component,right? If yes, which method is preferred and why?


texts:
I have an acceleration record and i want to smooth it's spectrum by using a hanning window with Bandwidth=0.5 Hz.

How could i do that?

Example in python/matlab will be appreciated!


texts: how to calculate the dc component of an energy signal?

texts: Does the energy signal or finite energy signal have 0 dc component always?How to confirm this from the frequency spectrum?


texts: DFT of 2d real signal and Hermitian symmetry

texts:
Knowing that DFT of n-values real signal in 1d consists of n/2+1 different values where the second half of the spectrum is complex conjugate of the first one (Hermitian symmetry).

However in the spectrum of 2d signal that I've made in Octave I see complex conjugates in both dimensions. However the FFTW manual states that we can take a use of the symmetry in only one dimension.

What is the truth? Is Hermitian symmetry only useful in one of multidimensional transform or could it be used in other dimensions?

[EDIT]

Ok, so since the Hermitian symmetry occurs in each of the directions then why the transformed vector in FFTW is diminished only by half (only one dimension values are stored on N/2+1 complex numbers)? Why isn't each direction diminished?


texts: Getting non smooth spectrum after performing fft on numerically obtained acceleration data

texts:
I am trying to calculate the spectrum of Bremmstrahlung, which involves calculating the Fourier transformed acceleration. I am solving a non-linear ODE to numerically calculate the acceleration in the time domain. After taking the Fourier transformation using Numpy's fft, the resultant spectrum looks highly non-smooth and "non-physical" .
I cannot paste the entire code so I am posting what I think is relevant snippet. Can someone point out what I am doing wrong?

Note: My acceleration is a function of two variables (beta, and b, the impact parameter), and I want to plot it for the different b, and in order to factor out the beta term I am just summing over all the values of acceleration for the different beta, for a given impact parameter b.

Also my spectrum is Fourier transformed acceleration square times a constant factor (Larmor's formula)

'''
Fourier Transformation of the acceleration
'''
N = 2**8
sampling_frequency = 10
a_w_normalized = [[] for a in range(len(impact_parameter))]
a_w =[[] for a in range(len(impact_parameter))]
intensity_normalized = [[] for a in range(len(impact_parameter))]
acc_summed_over_velocity = []
intensity_summed_over_velocity =[]

for index,b in enumerate(impact_parameter):
    acc_sum =[0 for x in range(N)]
    intensity_sum = [0 for x in range(N)]
    for j in range(len(velocity_z_component)):
        #window_kaiser = signal.kaiser(N, 15)
        #window_hann = signal.hann(N,sym=True)
        window =1
        fft_input = acc_normalized[index][j]*window
        ft_acc_normalized = np.abs(np.fft.fft(fft_input,norm=None))

        acc_sum =np.add(ft_acc_normalized,acc_sum )
        intensity_list = [power_spectrum_factor * (a ** 2) for a in ft_acc_normalized]
        intensity_sum = np.add(intensity_list,intensity_sum)
        intensity_normalized[index].append(intensity_list)
        a_w_normalized[index].append(ft_acc_normalized)
    acc_summed_over_velocity.append(acc_sum)
    intensity_summed_over_velocity.append(intensity_sum *acceleration_factor**2)

#intensity_summed_over_velocity=  ma.masked_less_equal(intensity_summed_over_velocity,1e-5)

'''
Plotting acceleration for selected values of impact paramters in time and frequency domain
'''

if plot is True:
    plt.figure(figsize=(12, 8))
    for i in range(len(impact_parameter)):
        plt.plot(t,acc_timedomain_summed_over_velocity[i], label='b={:.3f}'.format(impact_parameter[i]), )
    plt.legend()
    plt.ylabel(r'$ a(\tilde t) $', fontsize=14)
    plt.xlabel(r'$ \tilde t $', fontsize=14)
    ax.spines['left'].set_position('center')
    ax.spines['bottom'].set_position('center')
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.spines['left'].set_smart_bounds(True)
    ax.spines['bottom'].set_smart_bounds(True)
    ax.xaxis.set_ticks_position('bottom')
    ax.yaxis.set_ticks_position('left')
    plt.xticks(fontsize=15)
    plt.yticks(fontsize=15)
    if screening is False:
        plt.title('a(t) vs time without screening',fontsize=15)
        plt.savefig('./Plots/acc_without_screening.png')
    else:
        plt.title('a(t) vs time with screening',fontsize=15)
        plt.savefig('./Plots/acc_with_screening.png')

    '''
    Fourier transformed intensity for different impact paramater
    '''

    plt.figure(figsize=(12, 8))
    freq_normalized = np.fft.fftfreq(N)*(2*np.pi*sampling_frequency)
    for index,b in enumerate(plasma.impact_parameter):
        plt.plot(np.abs(freq_normalized), intensity_summed_over_velocity[index], label=r'$ \tilde b={:.2f}$'.format(b), )
    plt.xlabel(r'$ \tilde \omega $', fontsize=14)
    plt.ylabel(r'$ I_{\omega} $', fontsize=16)
    plt.legend(loc="lower left")
    plt.xscale('log')
    plt.yscale('log')
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)

    if screening is False:
        plt.title('Single particle spectrum without screening')
        plt.savefig('./Plots/spectrum_no_screening.png')
    else:
        plt.title('Single particle spectrum with screening')
        plt.savefig('./Plots/spectrum_debye_screening.png')

    plt.show()


texts: Solution to Cross-correlation problem of 2 audio signals

texts:
There are 2 audio signals, X & Y.
X is of 15 second duration. The duration of Y is not given.
Y is a part of signal X (ie a small part of audio X is extracted & made into audio Y)
I have to find the starting & ending location, in seconds, in the signal X from where signal Y is derived.
I was told to NOT use built-in MATLAB functions like conv, xcorr etc.

So I wrote a MATLAB code which compares sample by sample of X & Y starting from the 1st sample.

clear;
[A1,FS1,NBITS1]=wavread('x.wav');
[A2,FS2,NBITS2]=wavread('y.wav');

for i=1:(length(A1)-length(A2)),
    if(A1(i:i+length(A2)-1) == A2)
        found = 1;
        time1 = i/FS1;
        time2 = (i+length(A2))/FS1;
        break;
    else
        found=0;
    end
end

A1 has 120000 samples, FS1 = 8000, NBITS1 = 16
A2 has 20000 samples, FS2 = 8000, NBITS2 = 16
Therefore,
120000/8000 = 15 sec(length of audio X)
20000/8000 = 2.5 sec(length of audio Y)

time1(starting time) = 6.5001 sec
time2(ending time) = 9.0001 sec

Just to make sure the code was correct, I plotted the impulse response of X & Y using fvtool & found that the impulse response of Y matches that of X between 6.5 to 9 seconds.

Now I want to verify the result using built-in MATLAB functions, namely xcorr
So I used

A3 = xcorr(A1,A2);
plot(A3);

A3 is 239999 samples long. Then using

[max idx] = max(A3)

Using the above index location I found the location of maximum correlation value to be at sample 172000. which gives the midpoint at 172000/8000=21.5sec(clearly wrong). However, the location of the maximum correlation value must come to 7.7501 samples. How do I obtain that from the above value?


texts: Setting Parity Check Matrix for LDPC channel coding

texts:
I am trying to implement the LDPC code for OFDM system, where I input data should be binary of length $1024$ and the output coded data of length $2048$ (means of rate 1/2).
As known in Matlab integrated function, we build the encoder and decoder, respectively, as:
ldpcEncoder = comm.LDPCEncoder;  %Encoder
ldpcDecoder = comm.LDPCDecoder;  %Decoder

After checking that, I see that parity check matrix is set by default into $32400$ x $64800$ which means the input data length must be a column of length $32400$.
I need the input data to be set manually, for example of length $1024$, how can I modify the parity check of the above encoder?
Thank you


texts: Correlated signal components from uncorrelated and incoherent source after reflection

texts:
To this point, it has been assumed that the point sources
composing the source are uncorrelated, generating fully
incoherent signals. Thus, capturing the reflected signals and after sufficient time averaging,
only the correlated signals components remain, and
cross-product terms between different point sources tend to zero.

Where the correlated signal components came from as the sources are uncorrelated and fully
incoherent?


texts: Using I/Q demodulation/LIA for a fixed-frequency application of several signals - do the phases of the input signals affect the result?

texts:
My input is a single signal composed of the sum of four periodic signals, each 4 Hz apart, centered around some resonant f0 typically between 1200 - 1300 Hz; the actual frequencies will change occasionally, but not the distance between them. For example, if f0=1250, my frequencies will be [f1..f4] = 1244, 1248, 1252, and 1256 Hz.

A decent analogy would be four LEDs flashing at these frequencies, observed by a single detector.

This signal is sampled at 16384 Hz, and I perform IQ demodulation in software (described here) using the [f1..f4] as the reference frequencies to ultimately extract the amplitude of those four components from the original signal.

My question is about the phases of the four different components. I can control their phases, and I'm wondering if there are any best practices to make sure I get the cleanest possible separation of the four signals, or if the phase won't matter?


texts: Confused on Pulse Filter Bandwidth and Symbol Rate Relation

texts:
***Still need help in 2021 - not fully clear still on Jan 20th ***
I am confused about the relation between Sinc and Rectangle transform pair and how that relates the Bandwidth of Pulses, Bandwidth of Zero-ISI Filter and the Symbol Rate.
Using :

$T_s$ = Symbol Time Period
$R_s$ = Symbol Rate
$Sinc(t/T_s)$

Logic of Bandwidth of Sinc or Raised Cosine roll off = 0

Time-Domain Sinc : Every lobe is width $T_s$ but main lobe is $2T_s$ because its symmetrical on zero
Frequency-Domain Rectangle : Positive frequency Width of $\frac{1}{T_s}$ (But its Symmetrical on zero and so BW include negative frequency)
So...BW $= 2\frac{1}{T_s} =2 R_s$

Logic of Bandwidth Rectangle

Time-Domain Rectangle : Width $T_s$ (symmetrical on zero)
Frequency-Domain Sinc : Every lobe width is $\frac{1}{T_s}$ but main lobe is $\frac{2}{T_s}$ because its symmetrical on zero
So... BW $= \frac{2}{T_s} = 2R_s$

But I have read that's not right, the Zero ISI Filter BW = $R_s/2$ when the roll off factor  is zero. Why has my logic above got this wrong?
***Still need help in 2021 - not fully clear still on Jan 20th ***


texts: Signal correlation vs Pearson correlation between signals

texts:
I have some data which are the sets of values uniformly distributed along some measure (simple example - along the time intervals).
I tested both the coefficients and found the difference, some times essential.
F.e. if both the data are noise-like, signal r is about 0.7, and Pearson r - about 0.25.

Which coefficient should be considered better and why?

I compute the signal correlation coefficient as
$$
r=\frac{\sum_ix_iy_i}{\sqrt{\sum_ix_i^2}\sqrt{\sum_iy_i^2}}
$$

and Pearson correlation coefficient as
$$
r=\frac{\sum_i(x_i-m_x)(y_i-m_y)}{\sqrt{\sum_i(x_i-m_x)^2}\sqrt{\sum_i(y_i-m_y)^2}}
$$

There are two fragments of pair of signals:

Fragment 1. Two signals with similar Signal- and Pearson- coefficients

Fragment 1 http://net2ftp.ru/node0/nf05@ngs.ru/Signals1.png

Fragment 2. Two noise-like signals: Signal r = 0.7, Pearson r = 0.2

Fragment 2 http://net2ftp.ru/node0/nf05@ngs.ru/Signals2.png

PS I do not need to performe cross-corelation, convolution etc.


texts: Removing uncommon objects from bunch of images

texts:
The problem I am facing is the following:

I want to take a picture of the entrance to a building. I fix the
camera on a tripod stand and place the stand on the footpath in front of the building. The problem is that a some people always keep passing between the camera and the entrance, thereby
obstructing the view of the camera.
I want a "perfect image", that is without any people (only the building will appear). So I decided to take $20$ pictures without
changing the camera location, trying to time them right to avoid people coming into the photograph frame.
However, none of the pictures is “perfect”, i.e., there is always one or two persons somewhere in the frame. The persons can be randomly anywhere in the frame.
Now I want to get a "perfect image" from this set of “imperfect” pictures automatically, without any human intervention.

I thought about an algorithm like this:

Since I have $20$ values for each pixel in the image, I will keep the pixel values which are unchanged over all the $20$ images and for the pixels where there are more than $1$ pixel values for a particular user, I will keep the value which is the mode of those $20$ values. i.e. whichever value appears the most number of times.

Are there any better/robust methods of doing this? Because currently, I am not using any kind of image processing here, I am just using a heuristic algorithm based on common sense.


texts: How to visualize this statement regarding Conjugate Symmetry

texts:
A property of real signals states that if $x(t)$ is real then the Fourier series coefficient (frequency spectrum) is given by :
$$
c_{k}=c_{-k}^{*}
$$
In polar form, this can be expressed as :
$$
|c_{k}|=|c_{-k}|\qquad\text{and}\qquad\arg c_{k}=-\arg c_{-k}
$$
It appears here that the magnitude spectrum obeys even symmetry and the phase spectrum obeys odd symmetry. It is said in my textbook :

Due to symmetry in the frequency spectra of real signals, we typically ignore negative frequencies when dealing with such signals.
In the case of signals that are complex but not real, frequency spectra do not possess the above symmetry,
and negative frequencies become important.

For $(1)$, how can I visualize this to see why the negative frequency components do not matter anymore$?$, does this mean the Fourier series representation of $x(t)$ becomes :
$$
x(t)=\sum_{k=0}^{\infty}c_{k}e^{jk\omega_{0} t}\;???
$$
For $(2)$, is this statement true because the complex exponentials in the frequency domain will scale a given signal to a decaying or growing signal?


texts: Calculating the cutoff frequency of a highpass digital filter

texts:
I am new to DSP and I am trying to find the cutoff frequency of a HP digital filter. I know the equation that describes the system, its frequency response: $H(e^{jω})= 1 - \frac{e^{jω}}{2} - \frac{1}{2e^{jω}}$ and of course amplitude response / phase diagrams.

I have found (p. 8) that for analog filters I can calculate $\frac{1}{\sqrt{2}} |H(e^{jω})|$. However I don't know how to do this for digital filters. Reading this makes it look like it's the same procedure, although this seems (to me) like a contradiction to

  Digital filters are less standardized, and it is common to see 99%, 90%, 70.7%, and 50% amplitude levels defined to be the cutoff frequency.

of the first source. Am I confusing something? Please keep in mind that I am new to DSP. Thank you.


texts: How does amplitude scale when FFT size is smaller then signal duration?

texts:
I have one quite simple question: how does the amplitude of the signal scale when we do FFT where FFT window length is shorter then duration of the signal? Does this means that if FFT size is 12 time shorter that also amplitude of the signal will scale by 1/12? if so what is the mathematical explanation.
Thx in adavance for any reply.


texts: What is the most lucid, intuitive explanation for the various FTs - CFT, DFT, DTFT and the Fourier Series?

texts: Even after having studied these for quite sometime, I tend to forget (if I'm out of touch for a while) how they are related to each other and what each stands for (since they have such similar sounding names). I'm hoping you'd come up with an explanation that is so intuitive and mathematically beautiful that they'll get embedded into my memory forever and this thread will serve as a super quick refresher whenever I (or anyone else) needs it.


texts: Continuity and its relationship with asymptotic spectral decay

texts:
The asymptotic decay of the magnitude of the Fourier transform of a function appears always to be determined by its continuity properties as follows, with examples given in Fig. 1:

Continuous integral, -20 dB / decade;
Continuous function, -40 dB / decade;
Continuous 1st derivative; -60 dB / decade;
...

How can this be expressed mathematically in a rigorous way, and proved?

Figure 1. dB magnitude of the Fourier transform of a function as function of the base-10 logarithm of frequency for (from slowest to fastest decay) a rectangular pulse (turquoise), a single lobe of a cosine (purple), and Hann function (blue).


texts: Is my interpretation of CAR filter correct?

texts:
I am a computer scientist working on a Brain-Computer Interface (BCI) project. So, i am using EEG data from a dataset and classifying them with the use of machine learning algorithms. Initial results shows a poor performance since i'm not applying any preprocessing task, but i am aware of the Common Average Reference filter (CAR), which is commonly found in BCI papers along with other more advanced techniques.
One of the papers i've seen mathematically describes the CAR filter as:
$x^{CAR}_i = x^{ER}_i - \frac{1}{N} \sum_{j=1}^{N}x_j^{ER}$
where $x^{ER}_i$ is the vector associated to the registry electrode for a time window and $N$ is the number of electrodes.
So, following this approach, i decided to create a toy scenario and apply the code i made in python. Consider the following 3D matrix as the input EEG data, where rows are EEG samples, columns are measurements in each time instant and each 2D matrix is an electrode:

Then looking at the first sample (row) & time instant 0 (column), applying the CAR filter would do the following:
$x(1)^{CAR}_{electrode - 0} = 1 - (\frac{1+2+3}{3}) = 1 - 2 = -1 \\
x(1)^{CAR}_{electrode - 1} = 2 - (\frac{1+2+3}{3}) = 2 - 2 = 0 \\
x(1)^{CAR}_{electrode - 2} = 3 - (\frac{1+2+3}{3}) = 3 - 2 = 1$
And this would repeat for every time instant in every sample, and the final filtered input data would be:

I'd like to confirm if my understanding is correct, since scientific papers are very vague explaining this technique and are not very intuitive.
Thanks in advance.


texts: Is there an audio processing library/API that contains all standard features of a digital audio workstation?

texts:
I need an audio processing library/API (in any programming language, preferably Java or Python) that is able to do things to sound waves such as: sum/mix sources together, apply EQ, dynamic EQ where you can change a frequency peak or amplitude setting over time, pitch shift, distortion, and convolution reverb, all programmatically without any need for a user interface.

Someone asked "If there were, why would there be a market for premium commercial DAW software?" Obviously this wouldn't be for the actual music-making composer or sound engineer because it would be unusable (it wouldn't have a GUI). I need it to automatically manipulate sound so I can churn out millions of random not-necessarily-musical sound files, without a GUI.

This is not same as the "OpenCV for audio" question, because I don't need intelligent audio feature extraction; I just need the standard features of DAW such as EQ and convolutional reverb, available as an API call, like soundFile.applyEq(myEq).applyConvReverb(myReverb);


texts:
Im' working on a balancing machine. this machine has two vibration sensors. (pizzo) my question is about that why this machine use two Sensors? this machine has an rotary encoder to detect disk angle.

i trying to read these signal by ADC card and using FFT bandpass filtering to calculate unbalanced mass on disk. for this algorithm i just use one of Vibration sensors. should i use second sensor?


texts: Why does a synchrosqueezed wavelet transform show oscillating behavior?

texts:
This question came up in the context of the ssqueezepy library. As a basic experiment I did compute the synchrosqueezed wavelet transform of three basic signals:

A sine of 440 Hz.
A sine of 880 Hz.
A signal that mixes (1) and (2).

The result looks like this:

Full reproduction code: here
Basically the transform manages to perfectly localize signals (1) and (2), but for the mixed signal there is a surprising oscillation pattern. Zooming in a bit:

In general the issue depends on the choice of mu of the underlying wavelet. In this particular example, increasing mu slightly can help to make the transform of the mixed signal non-oscillating.
Nonetheless I'm wondering why synchrosqueezing leads to this oscillating interpretation of the signal in the first place?


texts: Adaptive Piecewise Constant Approximation (APCA) with wavelets/DWT

texts:
I am trying to approximate a vector or a time series, in order to have as little changes as possible. To do so, I pretend to apply the  Adaptive piecewise constant approximation (APCA) algorithm.  Note: I can apply the PAA, but I prefer a method that allows different lengths for each segment of the approximated series.

The following paper Locally Adaptive Dimensionality Reduction for Indexing Large Time Series Databases   (pages 196-199)  claims to have found a faster alternative to APCA, based on wavelets, but I can’t figure out how to apply it in R.

The data used in the example is the following:

library(wavelets)
x<-c(7, 5, 5, 3, 3, 3, 4, 6)
w <- dwt(x, filter="haar",n.levels = 3)

I run the above code, but i haven't even  found the same wavelet coefficients.
I'll appreciate any help finding the same wavelet coefficients of the example, as well as the a final approximation.

According to the paper, the final solution  seems to be the vector y, described as

y<-c(6,6,3.5,3.5,3.5,3.5,5,5)

Implementations of the original APCA algorithm can also be useful. Although R code is preferred, Python implementations are also welcome.


texts:
I'm looking for a dedicated DSP chip that will allow sampling and delayed replay of a signal, given the following parameters:

buffer should be integrated
configuration of the DSP chip (if needed) should be possible via host CPU (SPI or serial)
starting and stopping the sampling/replay should be possible via a dedicated pin
reading the samples via the host CPU is NOT required!
sampling should be done with a frequency of at least 2MHz (since a temporal resolution of 1 µs is required)
since this is for replaying a digital signal, a low resolution (even 1 bit per sample) is possible
buffering should allow for 250 ms period

I did not find any stand-alone DSP with this characteristics.


texts: Why are analytic FFT and computational FFT not matching?

texts:
I have an exponentially decaying function that I want to Fourier transform. My question is why I am not getting the same result with the analytical form and the computational one with np.fft?
I have a function r(t) defined as follow:

    import numpy as np
    fs =5e6
    f0 = fs/2/102
    dt = 1./fs
    t = np.arange(0,0.0021544,dt)
    tau = 30e-6
    r = lambda t : (1/tau)*np.exp(-t/(tau))

that I want to Fourier-transform. According to the definition of the Fourier transform of this function r I am expecting:

    tp =t[0:102] # so half of a period
    freq = np.fft.fftfreq(np.size(tp), d = dt)
    Rf_def = np.divide(1,1+1j*2*np.pi*freq*tau)  # This is the analytical definition of the fourier transform of my function r(tp)

But when I do :

    Rf = np.fft.fft(r(tp))

I don't get the same result as the analytical FFT that I defined above. Why is that ?

This is a plot of the analytical form of the fourier transform so plt.plot(Rf_def).

This is a plot of the compututional fourier transfrom so plt.plot(Rf).


texts: How to calculate sine wave SNR from oscilloscope

texts:
I'm trying to calculate the SNR of a sine wave produced with a 12 bit DAC. I'm new when it comes to calculating/measuring noise in signals. My idea was to capture the signal using an oscilloscope (which unfortunately does not have an FFT function), so I could run an FFT analysis in MATLAB to separate the signal in its fundamental and harmonics to find the SNR.
This is the signal that I acquired, it's a 600 mVpp sine wave at 1kHz

I have 625000 samples, and according to the metadata from the oscilloscope, it has a sample interval of 1.6e-8s. My first approach was to use MATLAB's snr function directly using the voltage samples
Fs = 625000;
r = snr(measurements, Fs);

Using that code I obtain this:

I was expecting the fundamental to be close to 1kHz, but it's sitting at 0.011 kHz with -9.699 dB.
Is this result expected?
I also tried plotting the FFT using the following code (which again gives me this peak close to 0):
y = fft(measurements);
n = length(measurements);
fshift = (-n/2:n/2-1)*(625000/n);
yshift = fftshift(y);
plot(fshift,abs(yshift))


texts: Break a signal into segments, add them together and then perform an FFT on the result

texts:
If you break a 4 second signal into 0.5 second segments, add them together and then perform an FFT on the resultant 0.5 second data.

Will the FFT / frequency spectrum be the simlar to an FFT on the original 4 second data?

This would mean that you can store long amounts of data in smaller memory if all you cared about was retaining the frequency components... I'm not sure if I am missing something though?


texts: What is difference between the terms bit rate,baud rate and data rate?

texts:
Let us consider any video signal. Bit rate of a video signal is the no of bits  per frame per second. Also, data rate is the no of bits per second. Baud rate is the number of signal changes per second.

But I really confused between these 3 terms. They look similar to each other.  So can anyone tell me whether these terms are same or different with the help any example?


texts:
I saw the following digital network in a technical journal.

I think the network's processing cannot be implemented because there is no delay element in the feedback path. How can we compute the "current" y(n) output sample if the "current" y(n) sample is needed in the computation? Am I correct? If not, what am I missing here?


texts: DFT have independent variable in between 0 to $\frac{1}{2}$ no of samples

texts: I was learning of Fourier Transform from this book 'Scientist and Engineer Guide to DSP'. Suppose we have a digital periodic signal and there are 128 of samples of it in the time domain i.e X[0] to X[127], then on converting it to frequency domain (only real DFT is considered i.e no complex variables) why do we need only 65 points in the frequency domain, is this related to the Nyquist rate since the highest frequency in the sample can have a maximum value of 64. Are the last 64 points not needed for calculation


texts: What Properties Make Certain Wavelets "Better" Than Others In Image Compression?

texts:
I am trying to teach myself more about image compression using the wavelet transform method.  My question is: What is it about certain wavelets that make them preferable when compressing images?  Are they easier to compute? Do they produce smoother images? Etc...

Example: JPEG 2000 uses the Cohen-Daubechies-Feauveau 9/7 Wavelet...why this one?