texts:
As I am not from control theory, I do not understand - after reading the Wiki page about PID control (https://en.wikipedia.org/wiki/PID_controller) and watching some videos - whether a model of the process which is due to be controlled is necessary for a PID control or not. For example it is written on one occassion:

  Control action – The mathematical model and practical loop above both use a "direct" control action for all the terms, which means an increasing positive error results in an increasing positive control output for the summed terms to apply correction.

And on another occassion it is written:

  But the PID controller is broadly applicable, since it relies only on the response of the measured process variable, not on knowledge or a model of the underlying process.

If I want - for example - to control a heating system using a PID-control such that the temperature in the building in at a certain value, is it necessary to have a model of the heating system or the building that maps the fuel consumption (e.g. gas or oil) to the generated heat and the temperature?

Update: What does this transfer function (mentioned below by Marcus Müller) consists of? He wrote " I'd argue that you want your plants transfer function to be continuous, and that's already a model"

Update 2:
I think my question is not too dificult and people with experience in that field should be able to answer it. Does a PID-controller need a model of the process? Unfortunately this question has not been answered yet :-( –


texts: Discrete Fourier Transform frequency bin size

texts:
I want to ask a simple maybe stupid question, why in DFT the frequency bin size is limited to $n/2+1$

http://support.ircam.fr/docs/AudioSculpt/3.0/co/FFT%20Size.html.

What I see from Wikipedia and also in complex discrete fourier transform, the sum should be from $0 \rightarrow n-1$, here $n$ is the sample size.


texts: Does Reed-Muller codes exist when $r = 0$ and $m = 0$?

texts: Does Reed-Muller codes $\mathrm{RM}(r,m)$ exist for $r = 0$ and $m = 0$? Namely,  does $\mathrm{RM}(0,0)$ exist?  Some books mention that $m$ should be a natural number whereas some books mention that it can be a whole number including $0$,  for example Shu Lin and  Daniel Costello  Error Control Coding  book.


texts: Design of Reed-Solomon Code where $n < q-1$

texts:
I'm trying to figure out how to design a Reed-Solomon generator polynomial where $n$ divides $q-1$ (I believe it's denoted by $n|q-1$) but where $n < q-1$. For example, lets say we have a $q=16$ and we want to design a codeword with length 3 and corrects 1 error. so we have the following:

$n = 3$

$l = \frac{q-1}{n} = \frac{15}{3} = 5$

$t=1$ (for correcting 1 error) therefore $\delta = 2t+1$

from here we can get our roots of unity as $\{\alpha^5, \alpha^{10}, \alpha^{15}=\alpha \}$. We then need to choose $\delta -1$ consecutive powers of $\alpha$, but i thought we chose these powers of $\alpha$ from the roots of unity, but there aren't any consecutive roots.

I can solve this for $n=15$ since I will have consecutive roots, however since $n=3$ in this case, i'm not sure how to proceed.


texts: Improving Canny Edge Detection and Contours Image Segmentation

texts:
I am working on an image segmentation project to identify playing cards on varying backgrounds. For my use case I care most that I accurately extract all the cards in the image; false-positives are inconvenient but not fatal. I also care that I can run the segmentation without user interaction (i.e., an algorithm like GrabCut does not work for me).

So far I have the following simple algorithm based on Canny edge detection and contour selection:

# Pre-processing: Convert frame to standard size, 1024x768
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = cv2.medianBlur(gray, 9)
edges = cv2.Canny(gray, 10, 25)
_, contours, _ = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
for c in contours:
    rect = cv2.minAreaRect(c)
    box = cv2.boxPoints(rect)
    area = cv2.contourArea(box)
    ratio = area / size
    if ratio < 0.015: # Any contour large enough is a candidate
        continue
    # Mark this box as possible card

For some (many) inputs it works well enough, or even very well:

However for other inputs the contour detection does not successfully disambiguate cards. The contours are grouped in ways that link cards or result in undesirable bounding boxes:

For the record, here are some other things I have considered:

Using a bilateral filter instead of median blur. Might have improved results a bit, e.g., in the bad example above the first column third row card is now correctly segmented.
Using histogram equalization to enhance contrast. Generally obscured some necessary edges.
Attempting to automatically determine Canny thresholds for each image based on the median. Generally this approach missed many of the noisy card edges that we need to consider.
def auto_canny(image, sigma=0.5):
    v = np.median(image)
    lower = int(max(0, (1.0 - sigma) * v))
    upper = int(min(255, (1.0 + sigma) * v))
    return cv2.Canny(image, lower, upper)
Attempting to use watershed segmentation. The fundamental problem is automatically determining the initial segmentation markers, which turns out to be roughly equivalent to identifying the cards in the first place. Finding "white" is particularly hard because its color varies with the ambient lighting conditions.
Attempting to use mean shift filtering / segmentation. I expected it might denoise the edge detection process by simplifying the image structure but it seemed to have more of a "blurring" effect, especially around reflections.

For reference (or, better yet, if you want to play along at home) I have a set of example inputs and the outputs of my current algorithm: album.


texts: What is the filter to get a heavy metal film ilustration?

texts:
How I can transform an image to get a same image style like the Heavy Metal film?.

I remember that I could read a paper about this, but I lost it.


texts:
In 2D the discrete wavelet transform (DWT) of an image using lifting based 5/3 filter, if I perform a row-wise operation first then perform column-wise operation then I will get 4 sub-band LL, LH and HL and HH.

During reconstruction, that is IDWT, should I maintain the order in reverse direction that is column first and then row?
Or any order I can maintain?
In JPEG 2000 there is no order information found in the header. Then how I can main the order during reconstruction?


texts: is there upper limit on averaging window size for images?

texts: An amateur question. I take an image and average pixels over a window 3 by 3, thus obtaining a smoother image. Then I increase the averaging window size - obtain an image with even less details, but still with some low frequency details. Is there some theoretical upper limit, when there is no sense to increase the averaging window anymore, because I will loose any details. If yes, does this limit depend on the range of intensities [0,255] or on lowest frequencies, present in the image?


texts:
I am searching for documentation on the behaviour of complex low pass filters, and their application in telecommunications.

Thank you


texts:
Is it possible to calculate the DC value of signals with undefinable area?

More specificaly, in the case of $x(t)=\frac{1}{t}$. $\int\limits_{-\infty}^\infty\frac1t \, \mathrm dt$ does not converge. Does that mean that its DC can not be determined?


texts: Benefit to know Fourier series for image processing?

texts: I know there's a benefit of knowing the Fourier Transform for image processing, but is there a benefit to know Fourier series, or could you just skip them? Would you recommend skipping Fourier series or would that make it too abstract? What's your opinion on this?


texts: Difference between rceps and cceps in MATLAB

texts:
I'm trying to construct a cepstrum using MATLAB built in function but I don't get the difference between MATLAB's functions rceps and cceps.
Can anyone explain to me the difference between rceps and cceps?


texts: I'm reading up on DSP implementations and Q number format for representing decimal and decimal fractional numbers. Why would you use the Q format and not a standard like IEEE 754? When would you use one instead of the other? They both encode numbers into a sequence of bits, right?


texts: I am working with ultrasound signals with frequency 100 kHz. Chirp signals with bandwidth 16 kHz are being modulated with 100 kHz and then transmitted via one ultrasonic sensor. With another ultrasonic sensor signals are being received, demodulated, low pass filtered and then matched filtered with transmitted signal. Can anyone back me up with the following reasoning: the peak of matched filter will be delayed by the time of flight between the sensors, time needed for ADC+DAC conversion and time spent for low-pass filtering and matched filtering? To remove the time offset due to ADC+DAC conversion and filtering I would try connecting output of DAC on input of ADC and find the peak of MF. Then for the measurements with the sensors I would subtract the previously mentioned offset time. Is that correct?


texts: Dependence of $\tt n$ in $\tt fft(data,n)$ in auto correlation of data

texts:
The followings are results of autocorrelation of an 'image'(1*) (subplot 221) using xcorr, n point fft, and 2n-1 point fft. I observe that I get different results. Why does it happen?

PS: result at subplot 223 is the expected image.

(1*) In fact it is identified as 'integrated image' in the paper doi:10.1038/nature11578 by Dr. Jacopo Bertolotti, which can not be considered as a general image that has both magnitude and phase information.


texts: Causal and Non-memoryless LTI sytems described by LCCDE

texts:
I was wondering about the nature of stable systems (in the BIBO sense) that are causal with memory for which we wish to represent them by LCCDE (if they may exist). How frequent do LCCDE exist such that the derivative of the output is related to a time-shifted version of the output and are they resolved numerically?
I wish to further note that in saying that the system has memory, I don't mean it in the sense that only the input is shifted, but also I am looking for an output that is already shifted. To provide an example :
$$
y'(t)+K_{1}y(t-\alpha)+K_{2}x(t-\beta)=0
$$
where $\alpha<\beta$ and $K_{1},K_{2}\in\mathbb{R}$ non-zero constants


texts: Fast Fourier Transformation using parallel processing coding for image processing

texts:
I'm now working in parallel precessing -and i want a full code for fast Fourier transform(FFT)
written  parallel processing Code for any image processing application


texts: Exercise Related to Frequency Resolution and SNR

texts:
I'm studying a book about DSP and trying to make exercises. Here is one I'm interested in:
A scientist acquires 65,536 samples from an experiment at a sampling rate
of 1 MHz.  He knows that the signal contains a sinusoid at 100 kHz.  He
needs to determine is if there is a second sinusoid at 103 kHz.  As a start,
he takes a 65,536 point DFT of the signal.  To his surprise, all he can see
in the spectrum is noise.  He estimates that the signal he is looking for is
4 times lower in amplitude than the random noise (i.e., SNR = 0.25). He also
estimates that the SNR will need to be at least 3.0 for the signal to be
detected, if present.  To improve the SNR, he decides to break the signal
into segments, and average their spectra.  Arrange your answers to the
following questions in a table.
a. If he uses a segment length of 16,384 samples, what will be the frequency
resolution (i.e., the spacing between data points) in the averaged spectrum?
Give your answer in hertz.  How many segments will be averaged?  What is the
SNR of the averaged spectrum?  Does this have the required frequency
resolution?  Does this have the required SNR?
b. Repeat for segment lengths of: 8192, 4096, 2048, 1024, 512, 256, and 128.
Here is my solutions:
1)
16384 samples
4 segments will be averaged
freq. resolution would be (25*10^4)/8193Hz ~ 30Hz
(it is told in the book that random noise reduces in proportion to the square-root of the number of segments)
snr = 0.25 *$\sqrt{4}$ =0.5 (not enough)
freq. resolution is enough to resolve between 100kHz and 103kHz sinusoid
2)
2048 samples
32 segments will be averaged
$10^6$/32 = 31250
freq. resolution would be 31250/1025Hz ~ 30Hz
snr = 0.25 *$\sqrt{32}$ = 1.4 (not enoght)
freq. resolution is ok
3)
128 samples
512 segments will be averaged
freq. resolution would be 1953/65Hz ~ 30Hz
snr = 0.25 *$\sqrt{512}$ = 5.6 (is ok)
freq. resolution is ok
Am I right or wrong? Where I can be wrong?
Thank you so much in advance!


texts: Gaussian Blur - Standard Deviation, Radius and Kernel Size

texts:
I've implemented a gaussian blur fragment shader in GLSL. I understand the main concepts behind all of it: convolution, separation of x and y using linearity, multiple passes to increase radius...
I still have a few questions though:

What's the relationship between sigma and radius?
I've read that sigma is equivalent to radius, I don't see how sigma is expressed in pixels. Or is "radius" just a name for sigma, not related to pixels?

How do I choose sigma?
Considering I use multiple passes to increase sigma, how do I choose a good sigma to obtain the sigma I want at any given pass? If the resulting sigma is equal to the square root of the sum of the squares of the sigmas and sigma is equivalent to radius, what's an easy way to get any desired radius?

What's the good size for a kernel, and how does it relate to sigma?
I've seen most implementations use a 5x5 kernel. This is probably a good choice for a fast implementation with decent quality, but is there another reason to choose another kernel size? How does sigma relate to the kernel size? Should I find the best sigma so that coefficients outside my kernel are negligible and just normalize?


texts: How to detect a signal while ignoring another signal which is a phase shifted version?

texts:
I have a signal coming from a sensor as shown below. This signal has high frequency noise (as can be seen from small fast wiggles) and four regions of interest where distinct spikes can be seen. The first region of interest starts with signal dropping first and settling. Second interesting region shows similar pattern; it drops first. The third region of interest is different from first and second because this time it spikes upwards and then settles. And fourth area of interest is also similar to third one; it spikes upwards first and then settles.

I consider third and fourth area of interests as similar signals as first and second but phase shifted versions.

My goal is not only to detect these interesting areas but also distinguish between the first two and last two. I then designed a matched filter and passed the raw signal through this matched-filter. The template for the matched filter was designed to detect the first two variants (the ones which fall downwards first) as shown in the picture below. Note that template is time-reversed version of the first area of interest in the signal.

The output from matched filter is shown in the figure below which improves the SNR quite a bit and allows for easy detection of areas of interest. As can be seen, I can very clearly see the spikes corresponding to the four areas of interest. However, I cannot distinguish between the first two and second two. How do I do that?


texts: Discreteness and periodicity in Fourier transform

texts:
Why discreteness in time / frequency domain dictates periodicity in the other frequency / time domian?

For example the DTFT is perodic in frequency?
Why it doesn't contain all the frequencies?
Why the DTFS contain only finite number of frequencies?

NOTE:

I've read the derivation but sometimes i see it's like a definition or a claim in the case of DTFS.

How we prove that equation of DTFS ?
$$
x[n] = \sum_{k=0}^{N-1} a_k e^{jl\omega_o n}
$$


texts: How can I extract the 2 polyphase components of a signal after sampling at the half of sampling rate

texts:
Suppose I have a continuous signal $x(t)$, which was sampled using sampling function $s(t)$ whose sampling rate is $T_s$.How can I sample the continuous signal by Ts/2 instead of Ts in order to get two fractional sampled signals.

for example:
$y(t) = s(t) * x(t)$ with $t = nT_s$ ,

So if I sampled with sampling rate Ts/2, I supposed to have
$Y_1 = S_1(t) * x(t)$ and
$Y_2 = S_2(t)* x(t)$,  with $Y_1, Y_2$ and $S_1(t), S_2(t)$ are the polyphase components of $y(t)$ and $s(t)$ respectively.

Is that right :

close all, clear all
Fx = 20; Tx=1/Fx; % Original sampling frequency in Hz
tx = 0:Tx:1; % Time vector tx
x = 0.9*sin(2*pi*tx); % Input sequence
y = resample(x,2,1); % Re-sampling
ty = (0:(length(y)-1))*1*Tx/2; % New time vector ty
y1 = y(1:2:end);    % First representation of signal x
y2 = y(2:2:end);    % Second representation of signal x

If so, .. and if y is the first polyphase component of input signal, so where is the second component, or how can I get it?

thank you.


texts: EEG Sampling, Which Order should cover my result?

texts:
I have EEG data sampling rate is 250 Hz and I want to band pass this data in ( 0.5-3 Hz &  3-8 Hz &  8-13 Hz & 13-30 Hz & 30-40 Hz).

Currently, the data is in the frequency range of 0.5-40 Hz. (my implementation code is in Matlab, filter designer and EEGlab).

Is the Butterworth filter good here?
How do I apply Butterworth filter on this data?
What should be the ideal filter order for get the better result?


texts: Addition of signal variance and noise variance

texts:
Can I add two variances directly? I have my noise variance $\sigma_{noise}=-10 \ \mathrm{dB}$ and signal variance, $\sigma_{signal}=40 \ \mathrm{dB}$. So, can I say the total variance is $\sigma_{total}=30 \ \mathrm{dB}$?

I will use this total variance to generate random variables using a normal distribution with $\mu =0$ and $\sigma = \sigma_{total}$.


texts:
I am trying to get the phase angle between 5th harmonic and the fundamental harmonic of a 50Hz current signal sampled @10kHz. I am doing the following:
1- take a window of 200ms and apply matlab function fft. I get here complex values.
2- Calculate the angle of every harmonic order using matlab function angle().
3- Substract 5th order phase from 1st order.
The issue is I am getting a rotating phase difference as shown below.

Is there any way I can get a non-rotating difference between the two harmonics. I understand that they are of different frequencies, but I am trying to get such angle according to IEC standard as shown below:

Edit
This is a snapshot of the signal I am trying to analyse. The snapshot start from the closest point of zero crossing, the size of fft window is 200ms which is 10 times the signal frequency.

After running fft of the entier period in the snapshot, 150 fft windows could be obtained with the angles of fundamental and 5th order shown below.


texts: What's the maximum allowable amplitude modulation frequency for a given carrier frequency?

texts:
I'm currently studying wavelets and had an interesting thought experiment: If you were to calculate the wavelet transform of a signal using a wavelet of a fixed frequency, you would get time varying wavelet coefficient. Say this fixed frequency wavelet is 1000Hz. You essentially yield a signal that shows how a 1000Hz frequency component varies with time.

If you were to run a Fourier transform on this new signal, what is the maximum frequency content you could find in it?

My intuition says that there is some upper limit to this (i.e. you couldn't find 10kHz frequency content), but I'm curious if there is a way to prove this limit.

After thinking about it some more, it seems like what I'm asking is: what the maximum modulation frequency that can be encoder into a carrier frequency?


texts:
Suppose i have the system equation

$Y(s) = G(s)X(s)+ 3T(s)$

Then what is the transfer function of the system?

I know that the transfer function is $Y(s)/X(s)$, but i can't get that expression.


texts: How do you calculate spectral flatness from an FFT?

texts:
Ok, the spectral flatness (also called Wiener entropy) is defined as the ratio of the geometric mean of a spectrum to its arithmetic mean.

Wikipedia and other references say the power spectrum.  Isn't that the square of the Fourier transform?  The FFT produces an "amplitude spectrum" and then you square that to get a "power spectrum"?

Basically what I want to know is, if spectrum = abs(fft(signal)), which of these is correct?

spectral_flatness = gmean(spectrum)/mean(spectrum)
spectral_flatness = gmean(spectrum^2)/mean(spectrum^2)

Wikipedia's definition seems to use the magnitude directly:

  $$
\mathrm{Flatness} = \frac{\sqrt[N]{\prod_{n=0}^{N-1}x(n)}}{\frac{\sum_{n=0}^{N-1}x(n)}{N}} = \frac{\exp\left(\frac{1}{N}\sum_{n=0}^{N-1} \ln x(n)\right)}{\frac{1}{N} \sum_{n=0}^{N-1}x(n)}
$$
  where $x(n)$ represents the magnitude of bin number $n$.

SciPy docs define power spectrum as:

  When the input a is a time-domain signal and A = fft(a), np.abs(A) is its amplitude spectrum and np.abs(A)**2 is its power spectrum.

This source agrees about the definition of "power spectrum" and calls it $S_{f}(\omega)$:

  We can define $F_{T}(\omega) $ which is the fourier transform of the signal in period T, and define the power spectrum as the following:
  $\displaystyle S_{f}(\omega) = \lim_{T \rightarrow \infty} \frac{1}{T}{\mid F_{T}(\omega)\mid}^2.$

This source defines Wiener entropy in terms of $S(f)$.

But I don't see the squaring in equations like this, which seems to be based on the magnitude spectrum:

  $$
S_{flatness} = \frac{\exp\left(\frac{1}{N} \sum_k \log (a_k)\right)}{\frac{1}{N} \sum_k a_k}
$$

Likewise, another source defines the spectral flatness in terms of the power spectrum, but then uses the magnitude of the FFT bins directly, which would seem to conflict with the above definition of "power spectrum".

Does "power spectrum" mean different things to different people?


texts: DFT: Basis functions and Significance of dividing frequency by Sample length

texts:
A time domain signal can be decomposed into sinusoids which are based on basis functions.

For a N sampled input, a cosine basis function is defined as:

$$C_k[i] = \cos\left[\dfrac{2\pi k i}{N}\right]$$

Range of Frequency $k = 0 \ldots \frac{N}{2}$, Range of $i = 0 \ldots N-1$

Why is the sinusoid angle divided by $N$?


texts: Calculating filter coefficients of a Moving average with error correction

texts:
I have an oversampling ADC where I need to correct Gain/offset errors 'during' each conversion. This also links to my previous question - Moving average and linearization of two piecewise linear systems

For simplicity, it is a First order Incremental Sigma Delta with 1000 sampling clock cycles for one conversion, meaning that I have to average 1000 samples at the end of each conversion for filtering. A straightforward approach is to use an accumulator (1/z-1). However, using this approach I can correct the errors only after conversion.

After plotting the input and output of ADC with a DC sweep, I get the characteristic similar to Blue line shown below:

If I remove the offset (b) and gain(m2) errors, I would be left with violet line which is my objective.

One straightforward way of correcting this would be at the end of each conversion cycle, which is correcting at the 'end' of conversion. The approach what I am looking for is to correct it 'during' the filtering.

My filter is normally an accumulator- (1/z-1), which is an IIR variant. However, if we take its FIR variant, it would be something similar to:

Here, normally the coefficients b0,b1,b2....bn are all '1' to perform an accumulator operation. However, I am thinking if I would be able to somehow change these coefficients (depending on m2 and b), I would be able to correct this gain and offset 'during' filtering.

I am not sure on how to get these coefficients, which is exactly where I am stuck.

For example, in a simple moving average of 20 taps, the impulse response would look something like below: (each dot denoting the coefficients - b0,b1,b2...bn)

However, to correct the gain/offset errors,could the impulse response be 'bent' like below?

The slope and intercept of this red line should be dependent on m2 and b, but not sure how to link it.


texts: differences between DIT & DIF algorithms

texts:
What are the differences between decimation in time and decimation in frequency algorithms of FFT, especially as their names suggest?

How can I see/understand that decimation in time domain is taking place in DIT and decimation in frequency domain is taking place in DIF?


texts: Visualize the preprocessing steps of the wav file, e.g., downsampling, normalization, etc

texts:
I have an audio file, I am doing Signal preprocessing steps for other downstream tasks, I want to visualize the preprocessing steps to show the difference before and after each step.
My preprocessing steps involve:

Downsampled to 16 kHz [ Visualize before and after downsampling ]
Normalization with a target amplitude of -28.0 dBFS on downsampled
audio [ visualize normalized audio ]
split Normalized features into segments based on the silence threshold. [ How to visualize this to
show the segments? ]
Apply a High Pass Filter(HPF) [ Visualize this
step ]
divide segments into sub-segments of non-overlapping
Hamming-windowed frames [ visualize this too ]

My code for preprocessing looks like this:
import numpy as np
from pydub import AudioSegment
import python_speech_features
from pydub.utils import mediainfo
from pydub.silence import split_on_silence
from scipy.signal import lfilter

from pydub.playback import play

def match_target_amplitude(audioSegment_sound, target_dBFS):
    dBFS_diff = target_dBFS - audioSegment_sound.dBFS
    matched_audio = audioSegment_sound.apply_gain(dBFS_diff)
    return matched_audio

def apply_preEmph(x):
    x_filt = lfilter([1., -0.97], 1, x)
    return x_filt

s    = AudioSegment.from_wav('a.wav')
info = mediainfo('a.wav')
fs   = float(info['sample_rate'])
print("origional sample rate: ", fs)

             # downsampled
s          = s.set_frame_rate(16000)
             # normalization
s          = match_target_amplitude(s, -28.0)
             # split based on silence
s_segments = split_on_silence (s, min_silence_len = 600, silence_thresh =s.dBFS-10)

# print(len(s_segments))
# # play each segment
# play(s)
# for i in range(len(s_segments)):
#     play(s_segments[i])

AudioSegment2numpy_arr = lambda x: np.asarray(x.get_array_of_samples())
s_segments_np = list(map(AudioSegment2numpy_arr, s_segments))

# High Pass filter
preEmph_filtering = lambda x: apply_preEmph(x)
s_segments_filt = list(map(preEmph_filtering, s_segments_np))

win_func= np.hamming

# devide segments into sub-segments of non-overlapping Hamming-windowed frames
for idx, seg_i in enumerate(s_segments_filt):

    frame_len_s  = 0.025
    frame_step_s = 0.025
    frame_len    = int(round(frame_len_s*fs)) #frame length in samples
    frame_step   = int(round(frame_step_s*fs)) #frame step in samples
    x_frames     = python_speech_features.sigproc.framesig(seg_i,frame_len,frame_step,win_func)
    nr_frames    = x_frames.shape[0]

How to visualize these steps?


texts: Trouble checking if a given difference equation corresponds to an LTI System

texts:
I'm having trouble on how to check if a given difference equation corresponds to an LTI system. For instance,

  Does the following difference equation correspond to a LTI DT system ? Explain.
  $$y[n+3]+3y[n]+y[n+1]=\left ( \frac 12 \right )^{n+3}u[n+3]$$

I've learned how to show a system is LTI given an explicit statement of the input and the output of a system. However in this case, I am not given any relationships. Are there any assumptions I should be making about LTI systems such as causality?
Any help will be much appreciated.


texts: Generating data with given Auto and Cross Correlations

texts:
I have two discrete vectors $\mathbf{x}_1$ and $\mathbf{x}_2$, and I'm trying to generate more data $\mathbf{f}_1$ and $\mathbf{f}_2$ that has some basics properties of $\mathbf{x}_1$ and $\mathbf{x}_2$. Namely, the same autocorrelations and cross-correlations. It doesn't have to be the exact same, just similar. For example, I can cut the tails off the correlations if that makes it easier.
Is this possible?


texts: How to Describe the Color of an Image Patch?

texts:
I want to describe the color of an image patch (say, of size 5x5) centered around a pixel of an RGB image. The most straightforward way to do that is to calculate the average color over that patch and have a 3D vector, where each component represents the average color of the corresponding channel.

Another way, more informative in my opinion, is to calculate an weighted average where the weights decrease the further we go from the center of the patch. In the literature, is there an efficient and proven way to describe the color of a small patch of an image?

I'm asking this question because I'm trying to implement a particle filter that tracks an object that has a certain color. Now, the object I want to track is very narrow, so my patch should be very small to fit inside it.

Most of the color-based particle filtering algorithms represent the color information with a histogram and calculate the battacharyya distance - for example, between the histogram of the particle and the reference histogram. For a patch of 5x5, a histogram is not efficient because there are only 25 pixels.

On the other hand, patch descriptors like SIFT and SURF are not suited for color in my opinion (but if you have a different opinion it's more than welcome), this is why I'm looking for another way to robustly represent the color on a small patch of pixels.


texts: When channels are in a cascade and are independent is the capacity the sum?

texts:
Just wondering if two channels are independent then is the overall capacity, the sum of the individual capacities?

For example suppose I have two BEC where the probability of erasure is $\varepsilon$ and $\varphi$ respectively.

The individual capacities are then  $1- \varepsilon$  and $1-\varphi$ respectively. Now if these channels were independent and in a cascade would the overall capacity be
$1- \varepsilon$ +  $1 - \varphi$?

Best regards and thanks for indulging me.


texts: phase, magnitude, audio file and information

texts: I've been doing some thinking lately. I know that for image files a larger portion of information is contained in the phase of the signal. How does that go for the audio? Does the same hold or is the amplitude the one with the more information content? Thx all.


texts: How to visualize high-pass filtered images?

texts:
When I try visualizing a high-pass filtered image, all I see is gray, similar to the middle subfigure in the attached figure from a related paper. The authors claim they normalize the image to have unit variance, so I tried plotting $(x - \mu) / \sigma$, which still resulted in a gray image. Here is my process for high-pass filtering:

Shifted DFT
Apply radial mask, zero out low frequencies
Inverse shifted DFT
Normalize image to $[0, 1]$


texts: Why is it possible to frequency sweep with just one sinusoid?

texts:
One way to measure the frequency response of a filter is to input separate cosine/sine wave at the desired frequency, measure the steady state output, stack the inputs/outputs into complex arrays, and divide. A more efficient way is to use the DFT, and somehow we get away with just inputting one sinusoid.

Input $x_n = A \cos(\omega_0 n)$, with $\phi = 0$
Measure the steady-state output:
$$
  \begin{align*}
    y_n =  A | H(e^{j \omega_0}) | \cos\left (\omega_0 n + \angle H(e^{j\omega_0}) \right )
  \end{align*}
$$
Compute the DFTs $Y_k$ and $X_k$
Record $H_{\hat{k}} = \frac{Y_{\hat{k}}}{X_{\hat{k}}}$ at $\hat{k}$ that corresponds to $\omega_0$

What I'm trying to figure out is why this works, clearly there's phase information but I'm missing something in the derivation.

$$
\begin{align*}
  X_{\hat{k}} &= \sum_{n=0}^{N-1} x_n e^{-j \omega_0 n} \quad \text{where } \frac{2\pi}{N} \hat{k} = \omega_0 \\
    &= \sum_{n=0}^{N-1} A \cos(\omega_0 n) e^{-j \omega_0 n} \\
    &= \frac{A}{2} \sum_{n=0}^{N-1} \left (e^{j\omega_0 n} + e^{-j\omega_0 n} \right ) e^{-j\omega_0 n} \\
    &= \frac{A}{2} \sum_{n=0}^{N-1} 1 + e^{-j 2 \omega_0 n}
\end{align*}
$$

$$
\begin{align*}
  Y_{\hat{k}} &= \sum_{n=0}^{N-1} A \left | H(e^{j\omega_0}) \right | \cos\left (\omega_0 n + \angle H(e^{j\omega_0}) \right ) e^{-j \omega_0} \\
    &= \frac{A}{2} \left | H(e^{j\omega_0}) \right | \sum_{n=0}^{N-1} \left (e^{j(\omega_0 n + \angle H(e^{j\omega_0}))} + e^{-j(\omega_0 n + \angle H(e^{j \omega_0}))} \right ) e^{-j\omega_0 n} \\
    &= \frac{A}{2} \left | H(e^{j\omega_0}) \right | \sum_{n=0}^{N-1} e^{j \angle H(e^{j\omega_0})} + e^{-j \angle H(e^{j \omega_0})} e^{-j 2 \omega_0 n} \\
    & \; \Big\Downarrow \; \text{?} \\
    &= \frac{A}{2} \left | H(e^{j\omega_0}) \right | e^{j \angle H(e^{j\omega_0})} \sum_{n=0}^{N-1} 1 + e^{-j 2 \omega_0 n}
\end{align*}
$$

The idea is that the phase information comes out by dividing:

$$
\begin{align*}
  H_{\hat{k}} &= \frac{Y_{\hat{k}}}{X_{\hat{k}}} = \left | H(e^{j\omega_0}) \right | e^{j \angle H(e^{j\omega_0})}
\end{align*}
$$

What am I missing?


texts:
OK, I have been banging my head for quite a while trying to make sense of this simple equation:

The $1/T$ is what is causing me all the grief.  I assume that the square of the Fourier transform of the signal $X$ is a finite function.  So won't the $T$ in the denominator mean that the PSD, $S_x$, will always tend toward zero?  If $X$ does increase to infinity with time, can someone explain this to me?  I am thinking that $X$ is a measure of the frequency content of the random time signal, and that shouldn't change appreciably with the time taken to measure it.


texts: Why does DTFT start and end at the same magnitude?

texts:
I would like to know why the spectrum of FIR filters (and maybe all DTFT spectra) start and end at the same magnitude. I guess there is something related to $H(e^{j\omega})$.
Thanks


texts: Audio phase shift using Hartley Transform

texts:
I want to shift the response phase of an audio signal (float array, length N, value range -1..1). I'm about using Fast Hartley Transform to transform it to the frequency-domain, process phase shift, then convert back to the time-domain and output the result.
I'm now can do the Hartley transform, and I also can calculate the phase of kth bin:

real(k) = (x(k) + x(-k))/2
imag(k) = (x(k) - x(-k))/2
phase(k) = atan2(imag(k), real(k))

I want to shift the phase(k) by an α degree. What should I do?


texts:
I'm currently working on multiple mini pet-projects in my spare time, grounding myself in the basics of audio signal processing, and trying to develop algorithms for polyphonic pitch detection. As I'm having a lot of joy (even in the failure) in doing so, I am considering moving into a career in signal processing (I'm aware this is a vast area!) My background is in mathematics (I have a  bachelors degree in applied mathematics, so the theory and practice excites me) and I have no grounding whatsoever in electrical or electronic engineering.

I'm therefore wondering the following:

Assuming I can develop a project portfolio demonstrating basic competence, what specific careers would be open to someone of my background in something highly geared to signal processing? I would be particularly interested in sound engineering, but would also be interested in compression algorithms and coding theory.
Is a supplementary MSc. necessary to get my foot in the door to job positions? I am open to both industry and academic positions.
Would an MSc. in something involving machine learning and neural networks be a.) relevant, and b.) worth the dough? I am considering getting out of industry for a year to work more on my projects in the context of such a degree programme. I am getting the impression that combined with a knowledge of signal processing, some knowledge of A.I. and self-learning systems would go a long way.

Thanks in advance for your answers.


texts: Designing a feature vector for discriminating between different sonic waveforms

texts:
Consider the 4 following waveform signals:

signal1 = [4.1880   11.5270   55.8612  110.6730  146.2967  145.4113  104.1815   60.1679   14.3949  -53.7558  -72.6384  -88.0250  -98.4607]

signal2 = [ -39.6966   44.8127   95.0896  145.4097  144.5878   95.5007   61.0545   47.2886   28.1277  -40.9720  -53.6246  -63.4821  -72.3029  -74.8313  -77.8124]

signal3 = [-225.5691 -192.8458 -145.6628  151.0867  172.0412  172.5784  164.2109  160.3817  164.5383  171.8134  178.3905  180.8994  172.1375  149.2719  -51.9629 -148.1348 -150.4799 -149.6639]

signal4 = [ -218.5187 -211.5729 -181.9739 -144.8084  127.3846  162.9755  162.6934  150.8078  145.8774  156.9846  175.2362  188.0448  189.4951  175.9540  147.4631  -89.9513 -154.1579 -151.0851]

We notice that signal 1 and 2 look similar and that signal 3 and 4 look similar.

I am looking for an algorithm that take as input n signals and divide them into m groups, where the signals within each group are similar.

First step in such an algorithm would usually be to calculate a feature vector for each signal: $ \mathbf{F}_i $.

As an example we might define the feature vector to be: [width, max, max-min].
In which case we would get the following feature vectors:

$ \mathbf{F}_1 = [13,146,245] $

$ \mathbf{F}_2 = [15,145,223] $

$ \mathbf{F}_3 = [18,181,406] $

$ \mathbf{F}_4 = [18,189,408] $

The important thing when deciding on a feature vector is that similar signals get feature vectors that are close to each other and dissimilar signals gets feature vectors that are far apart.

In the example above we get:

$| \mathbf{F}_2 - \mathbf{F}_1 | = 22.1, |\mathbf{F}_3 - \mathbf{F}_1 | = 164.8 $

We could therefore conclude that signal 2 is much more similar to signal 1 than signal 3 is.

As feature vector I might also use the terms from the discrete cosine transform of the signal. The figure below shows the signals along with approximation of the signals by the first 5 terms from the discrete cosine transform:

The discrete cosine coefficients in this case are:

F1 = [94.2496  192.7706 -211.4520  -82.8782   11.2105]

F2 = [61.7481  230.3206 -114.1549 -129.2138  -65.9035]

F3 = [182.2051   18.6785 -595.3893  -46.9929 -236.3459]

F4 = [148.6924 -171.0035 -593.7428   16.8965 -223.8754]

In this case we get:

$| \mathbf{F}_2 - \mathbf{F}_1 | = 141.5, |\mathbf{F}_3 - \mathbf{F}_1 | = 498.0 $

The ratio is not quite as large as for the simpler feature vector above.
Does this mean that the simpler feature vector is better?

So far I have only shown 2 waveforms. The plot below show some other waveforms that would be the input to such an algorithm. One signal would be extracted from each peak in this plot, starting at the nearest min to the left of the peak and stopping at the nearest min to the right of the peak:

For instance signal3 was extracted from this plot between sample 217 and 234. Signal4 was extracted from another plot.

In case you are curious; each such plot corresponds to sound measurements by microphones at different positions in space. Each microphone receive the same signals but the signals are slightly shifted in time and distorted from microphone to microphone.

The feature vectors could be sent to a clustering algorithm such as k-means that would group together the signals with feature vectors close to each other.

Do any of you have any experience/advice on designing a feature vector that would be good at discriminating waveform signals?

Also which clustering algorithm would you use?

Thank in advance for any answers!


texts:
I have just started my work in compressive sensing. the measurement vectors are obtain by multiplying the sensing matrix with input signal. the thing i cant figure out adaptive compressive sampling.

can anyone please explain it as practical ?

thank you


texts: Baseband vs Passband simulation in terms of noise impact

texts:
From other posts I understood that it is normally no problem to simulate a communication system in the baseband though it is carrier modulated in reality. It just speeds up the simulation.

But what if I want to add noise to the signal and the noise shape is depending on the frequency? Of course I want to superpose my signal with the noise around my carrier frequency and not the baseband noise. I guess that simply adding noise and baseband signal would falsify the simulation...

Is there a solution so that I can still simulate in the in the baseband? Maybe to transfer the noise to baseband somehow?


texts: Transforming RGB images including NIR to LAB

texts:
I'm relatively new to image processing, so I hope I don't ask trivial questions.

I have some images that I want to use in a machine learning context. The images have four color channels: RGB and NIR (near infrared). After some research, it seems like the LAB color space is better suited for machine learning in many cases than the RGB one.

First question would be: is that correct, or did I just fall for single people claiming something?

The second, more important question: Is there a way to properly include NIR in the LAB color space? Or would it be better to keep it as separate information?

And lastly, another question that came up: Can I even transform RGB to LAB properly? What information would I need (wavelengths of red, green and blue; some information on the whitepoint, ...)? Is there a different color space better suited?

If relevant: I am focusing on plant images and tasks appearing there, e.g. plant/background segmentation, fruit detection, leave counting,...


texts: Is FIR decimation the fastest possible method for integer downsampling?

texts:
For a digital music synthesizer I am developing, I have a stream of incoming samples $x_i$ and would like to downsample by $M$ to obtain a stream of samples $y_{Mi}$. I am currently bandpassing the signal with an FIR which is a brick-wall filter windowed by Blackman-Harris, and it sounds great to my ears. But I have to compute $y_{Mi} = \sum_{j=0}^{N-1} x_{Mi-j} h_j$ for every outgoing sample. $N$ is usually 64 to 256, and $M$ is usually 8 or 16, so an FFT convolution doesn't seem worth it for performance.

If there a better method than naive FIR for integer decimation of audio at these scales? Can I make some reasonable tradeoffs in quality to achieve better performance? For example, polyphase decimation is a nice trick, but since RAM/cache is not an issue, I believe they should run in the same speed since they involve an equal number of multiplications.


texts: Frequency Domain Correction of Frequency Offset or Doppler Frequency in LTE

texts: We are working on LTE Uplink CFO Correction for 3 MHz band. The time domain CFO correction is easy, which depends on the processing of 3840 samples step by step multiply by $\exp(-j 2\pi f_\text{offset}t)$. . What will be the equivalent frequency domain correction?


texts: Is it always necessary to use two cameras to find the distance between camera and object?

texts:
I am working on finding the distance between a camera and an object using image processing.

In many places, it's written that we have to use a stereo pair, but my project allows only one camera.  Is it feasible to find distance to an object using just one camera? If so, what are the possible ways to do this?


texts: Why this two FIR filters have the same amplitude but different phase response

texts:
Why a filter of the form

$$
1+a_0 z^{-1} +a_1 z^{-2}+ a_2 z^{-3}
$$
has the same amplitude response when in the reversed form
$$
a_2+a_1 z^{-1} +a_0 z^{-2}+z^{-3}
$$
but the phase response is different. I don't get it, and can't understand what the differences in terms of the relative group delays mean.


texts:
I am working on a library for generating LPC for speech synthesis.  I am currently using a hamming window for the spectral analysis which goes in 200ms blocks over the signal, and does the a-to-k conversion.

I have read some stuff online about a technique of overlapping these windows so it would process the signal in groups like [1-200, 150-350, 300-500, etc].

My question is:  How exactly is this done, and more important-- is there a benefit to overlapping the windows?  Will I get better results with my analysis?


texts: Is the zero part of a RRC filter generated signal sent?

texts: When you use a RRC filter you add extra symbols at the end of your generated data because of the delay of the filter. When the data passes through the filter it gets up-sampled and the delay is introduced. However, the delay also introduces some zero, or near zero, valued parts to the signal, see figure. My doubt was, at the moment of sending the signal, are this parts also sent? Or you only take the non zero value parts?


texts: How to choose basis functions that contribute most efficiently per term to an approximation of an image f(x,y)?

texts:
GOAL:

I would like to approximate some positive, scalar function, $f(x,y) > 0$, on a 2D field of finite size i.e. $x=[a,b],y=[c,d]$

OBSTACLE:

I am familiar with the set of basis functions used in the Fourier series but using the Fourier series requires too many terms. Infinitely many:)

Instead, I desire to find a collection of functions that can be used to approximate $f(x,y)$ with a "finite" number of terms.

QUESTION:

How can I approximate $f(x,y)$ with a collection of functions $G(x)$ and $H(y)$ (see definition of $G$ and $H$ below), such that the number of elements in $G$ or $H$ is finite?

$$G(x) = [g_1(x)\ldots g_n(x)]\\
H(y) = [h_1(y)\ldots h_n(y)]$$

The elements in $G$ and $H$ do not have to be of the same form ($g_1(x)=\sin(nx),g_2(x)=\sin(mx)$)

Thanks in advance:)

EDIT:

I should clarify that $G(x)$ and $H(y)$ need to be combined in an inner product fashion i.e.

$$f(x,y) = < G(x),H(y) > = g_1(x)h_1(y) + g_2(x)h_2(y) + ... g_n(x)h_n(y)$$


texts: Banding in the derivative of a lock-in amplifier signal

texts:
I'm analysing several measurements taken with a SR830 lockin amplifier.

These measurements look similar to this one.
Since I'm interrested in the derivative of the signal I took the numerical difference. What I found was this.
One can clearly see two bands in the signal. I'm no expert, but I'm guessing it might be related to digitalisation in the lock-in amplifier.

So this leads me to two questions:

What could be the origin of these two bands and how to avoid them in the first place?
How should I correct the data already taken?


texts:
Suppose I have the following equation, where $x[n]$ is the input and $y[n]$ is the output: $$x[n]-x[n-1]=-10y[n-1]+2y[n]+2y[n+1].$$

The question asks me to compute the impulse response from this equation.

Attempts: $x[n]=1$ when $n=0$; $0$ otherwise. I need to find $h[n]=y[n]$, but, from the equation, it always depends on the future value $y[n+1]$, which is unknown.


texts: proof of Autocorrelation property of DFT

texts:
I am facing problem in proving the Auto-correlation property of Discrete Fourier Transform (DFT), that is

$$\mathcal{DFT}\left\{\sum_{r=0}^{N-1}x[r]x^*[r+n]\right\} = X[k]X^*[k]= |X[k]|^2$$

where $X[k]$ is the DFT of $x[n]$, and $x[n]$ is periodic with period $N$:
$$ x[n+N] = x[n] \qquad \forall n \in \mathbb{Z} $$
Likewise  $X[k]$ is periodic with period $N$:
$$ X[k+N] = X[k] \qquad \forall k \in \mathbb{Z} $$

Below is my Approach:

$$\begin{align}
\mathcal{DFT}\left\{\sum_{r=0}^{N-1}x[r]x^*[r+n]\right\} &= \sum_{n=0}^{N-1} \sum_{r=0}^{N-1}x[r] x^*[r+n] e^{- j 2 \pi n k/N} \\ \\
 &= \sum_{r=0}^{N-1}x[r] \sum_{n=0}^{N-1}  x^*[r+n] e^{- j 2 \pi n k/N} \\ \\
 &= \sum_{r=0}^{N-1}x[r] \sum_{n=r}^{r+N-1}  x^*[n] e^{- j 2 \pi (n-r) k/N} \\ \\
 &= \sum_{r=0}^{N-1}x[r] \sum_{n=0}^{N-1}  x^*[n] e^{j 2 \pi r k/N} e^{- j 2 \pi n k/N} \\ \\
 &= \sum_{r=0}^{N-1}x[r]  e^{j 2 \pi r k/N}  \sum_{n=0}^{N-1}  x^*[n] e^{- j 2 \pi n k/N} \\ \\
 &= \sum_{r=0}^{N-1}x[r]  e^{j 2 \pi r k/N}  \sum_{n=0}^{N-1}  x^*[n] (e^{- j 2 \pi n (-k)/N})^* \\ \\
 &= \sum_{r=0}^{N-1}x[r]  e^{j 2 \pi r k/N}  \sum_{n=0}^{N-1} ( x[n] e^{- j 2 \pi n (-k)/N})^* \\ \\
 &= \sum_{r=0}^{N-1} x[r] e^{ j 2 \pi r k/N} X^*[-k] \\ \\
 &= \sum_{r=0}^{N-1} x[r] e^{ -j 2 \pi r (-k)/N} X^*[-k] \\ \\
 &= X[-k] X^*[-k] = \Big| X[-k] \Big|^2 \\ \\
 & \ne \ X[k] X^*[k] \quad = \Big| X[k] \Big|^2 \\
\end{align}$$

as $$X[k] = \mathcal{DFT} \{ x[r] \} = \sum_{r=0}^{N-1} x[r] e^{- j 2 \pi r k/N}$$

so where is my mistake? and how should I approach??


texts: How can I use time-series transforms for detecting malware?

texts:
I am student of network security, and very unfamiliar with the domain of signal processing. Do pardon my naivety at asking very basic stuff.

My work deals with detecting malicious activity in network logs -say, differentiating between botnet traffic and benign Internet traffic. I came across this interesting article titled Detecting and identifying malware: a new signal processing goal. Since then, I have been exploring the world of FFTs, DTFTs, Wavelet transforms, cepstrum and the ilk. But I have not been able to make much progress with the application of these principles.

I wish to know from dsp experts that what kind of time-series transforms can be useful for my task.

To keep things clear, I will provide a brief description of data I deal with: As I said, my task is of separating botnet traffic from Internet traffic. Lets define Internet traffic as the traffic seen from the systems of regular users of the Internet like you and me, who browse the web, watch a few videos, check mail, maybe download a few movies, and also exhibit periods of inactivity say while they sleep, eat, etc.

And lets define botnet traffic as the traffic of a covert malware/virus (a 'bot') on your machine calling home to its master or contacting fellow 'bots' (just to maintain connectivity), and also the commands sent by the master to its bots or those exchanged by bots amongst themselves. This traffic does typically have patterns and periodicity.

If I am right, I am dealing with signals of botnet traffic mixed with Internet traffic (which does not have any specific pattern?) What kind of time-series transforms can be useful here? DFTs? FFTs? Cepstral analysis {or is that being too creative? :)}


texts: Number of triggers in a given interval for a given bandwidth limited noise

texts:
This looked initially a pretty simple question but it is turning to be something I can't figure out:

Typical problem:

We want to detect a pulse (signal) in a given interval of time (say 1us) by simply setting a threshold with a comparator. The noise (added to the signal) is bandwidth limited (BW) and Gaussian (known sigma). An event is defined as the comparator going from zero to one. If the threshold is low enough (set to be able to detect small signals), I'll have false positives.

How do I compute how many times the comparator will trigger in that given interval due to noise (no signal present)?

The temptation is to answer "you integrate the area below the Gaussian pdf (probability distribution function) for all values above the threshold". But that is an answer for discrete systems. I.e., that would tell me something like, if you have 1000 samples, 5% will result on false positive.

Nevertheless, here I am in continuous time domain.

If I want to go down that path, how many samples I assume I have in the 1us interval?
And how do we account for the fact that samples are not totally
uncorrelated from the neighboring ones (as the noise BW is limited)?  I.e., the signal may get above the threshold and stay there for a bit
but I only want to account for the 0 to 1 step.


texts: Can a narrowband beamformer be used for speech separation

texts:
In my master thesis I am trying to implement a beamformer.

I've already done the delay-sum part 1 year ago. I have been told:

in FIR filtering we can do

FFT --> null the unwanted frequency bin --> IFFT .

We can to the same in beamformers. If we know the interference DOA (like 0 in angle 25 and 1 in everywhere else between -90 to 90) output we can ---> IFFT and use the weights in aparture elements.

Whatever I tried it didn't work. Than I begin to read books , surprisingly couldn't find the method that my advisor told me. Instead I found out methods like MVDR, LCMV. Now I am tring to use matlab method lcmvweights to get correct weights for each element and apply in my delay-sum beamformer.   Even I succeed to use this method I am curious if narrowband-beamformers could be used in complex signals like speech?


texts:
Let's say you have a sequence $\{x_i\}_{i = 1}^N$ of ones and zeros. You know that $P(x_i = 1) = \frac{1}{3}$.
You want to test two hypotheses
$H_0$: The sequence is $iid$ with $P(x_i = 1) \ \forall \ i$
$H_1$: The sequence is full of $001$ sub-sequences, but has noise. For example, the sequence might start off as $001001$, then have a period of random noise (where $P(x_i = 1) = \frac{1}{3}$).
After the period of noise, the sequence matches the $001001$ pattern again. Importantly, the $1$ values might land on different values than when it started.
That is, we are not testing whether $mod(i, 3) = 0 \implies x_i = 1$. We are merely testing whether the "normal" state of this sequence is batches of $001001001$ but those batches could start at any value.
Another way of putting this is that we allow for "extra" bits to be inserted.
Ideally, I would like to find a test statistic that enables me to reject the null in this scenario. One possible solution, suggested in the comments below, is to count the number of $001$ sequences, and compare to the number of $001$ sequences you would find under the null.
This is an interesting solution. I will have to think more about how one might construct a confidence interval or assymptotics for this statistic.
I appreciate your comments.
Update: After thinking about the scenario that we are working with more, I think I can safely assume that only $0$ values are inserted. This is a much simpler problem.
$H_0$: The sequence is $iid$ with $P(x_i = 1) = \sum_{i = 1}^N x_i$. We guess it's Bernoulli distributed according to the number of $1$s we observe in the data.
$H_1$: The sequence has lots of $001001001$ segments, but extra $0$ values get inserted at random into the sequence (which creates offsets as above).
I don't think this materially changes the approach too much, but means we no longer need to worry about the distribution of the "Noise" sequences.


texts:
I've always obtained harmonics using simulation and never by hand.

My question is how can someone find the harmonics for a signal (say a square wave) by hand? What equations come in handy for finding the magnitudes at which each harmonic and sub-harmonic occur?

I want equations or techniques that are useful to find a closed form equation that gives us the magnitude of the harmonic and sub-harmonic for a given harmonic n or sub-harmonic $n\pm \alpha  \ \ \ \  \alpha \in  \mathbb{N}$


texts: How to discover the caracteristic frequency of the use of an app by someone

texts:
Let's say I have an user that uses the application one time every monday exactly... That means once a week. If I do the dfft I can see a peak in this frequency

How can I analyse the general case for many users and with apparently random frequencies of use?

Is the fft the best choice?

I can use mat lab or excel to try something

This is the fft of an user of the app by day

I am assuming by it that I can say he uses the app mostly each 2.3 days (1/0.4219)... It is a coeherent conclusion? How can I get the information of all the other peaks?

EDIT
This is the signal I am making the dft


texts:
After reading this question: PSD (Power spectral density) explanation I am still a little confused as to what extra information the PSD gives us over simply taking the magnitude of the fourier transform.

So my understanding is that the PSD is equal to:

$$|X(\omega)|^2$$

but what does that tell me that simply

$$|X(\omega)|$$

does not. I am assuming that squaring the fourier transform's magnitude somehow makes the number more physically (or mathematically) relevant? So how do I interpret the values of the power spectral density, especially when the signal is not a physical one and hence has no actual energy (say for example a financial signal or an image)?

Also, does the power spectral density contain information about the probability of the frequencies in the signal? As in is there a way to use the power spectral density to make a statement about the significance level of making a claim about a harmonic frequency in a stochastic signal? So something kind of like checking the significance of the coefficients from an AR model?


texts: Are there any good published approach for designing parametric EQs as FIR filters.  The standard techniques discussed in DSP textbooks are frequency-domain-sampling or using Parks-McClellan, which this involves passband, stopband, transition band, etc.  This is nice for rejecting a certain portion of the frequency spectrum, or mimicking and existing analog/digital filter.  However what if I want to design a filter directly as an FIR filter, for example a peaking/notching/shelving/low-pass/high-pass filter which takes frequency, gain, and bandwidth parameters?  Is there a standard technique for designing parametric EQs directly as FIR filters?


texts: Attempting to use the trapezoidal rule to form a difference equation representing a circuit

texts:
I have a differential equation that has been proven to be correct.

The transfer function obtained by Laplace domain analysis and Matlab freqs match up and all is well.

The problem is somewhere in my attempt to digitize the differential equation. I am required to do this using the trapezium rule to approximate the analog signal.

The goal is to get a digitized equation in the form of..

Vo^n+1 = alpha1(Vi^n+1) + alpha2(Vi^n) + alpha3(Vo^n)

Where each alpha value is made up of a different combination of T, R1, R2 and
C all numerical parameters.

I am following some guidelines set by my lecturer but if the approach seems wrong please let me know.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Current incomplete solution..

Then I am trying to convert that equation to the Z domain and therefore use the freqz tool in Matlab. Please see the working out below.

Here is the Matlab plot that shows what has gone wrong. The reason for the multiple lines are varying values of capacitance for C.

The blue lines represent the validated analogue freqs(laplace domain transfer function) frequency response.

The green lines show my attempt at using the freqz(z domain discrete transfer function) frequency response.

If it is of any further interest, the code to generate those plots can be found below as well.

Any help would be sincerely appreciated, clutching at straws and the occasional hair at the moment!

Cheers

MATLAB code:

%% Comparing the impulse amlitude response using two different methods
%
%  Basically checking if freqs matches freqz

clc; clear all;

% Circuit Parameters
R1 = 2.2e3;
C = 0.01e-6;
R2 = 10e3;

fs = 10000;   % Sampling frequency (Hz)
T = 1/fs;     % Timestep

% Coefficients
den = (T*R1 + T*R2 + 2*R1*R2*C);

N = 1000;

% Digital parameters
y = zeros(N,1);
y(1) = 1;
result = zeros(N,1);

% Analogue parameters
fa = 0:fs/N:fs-fs/N;
w = 2*pi*fa;
j =sqrt(-1);

lastValue = 0;

clf;
figure(1);

hold on;

for i=1:5

% Analogue Recalculations
b = 1/(R1*C);
a = (R1 + R2)/(R1*R2*C);
Ha = freqs(b,[1 a], w);

% Digital Recalculations
alpha1 = (T*R2)/den;
alpha2 = alpha1;
alpha3 = (2*R1*R2*C - T*R1 - T*R2)/den;

[Hd,fd] = freqz([alpha1 alpha1],[1 alpha3],N,fs);

for n=1:N-1

 currentValue = alpha1*y(n+1) + alpha2*y(n) - alpha3*lastValue;
 result(n) = currentValue;
 lastValue = currentValue;
end

C = 1.5*C;

plot(fa,abs(Ha),fd,abs(Hd)),xlabel('Frequency'),ylabel('H(s)');

end

hold off;


texts:
I'm looking everywhere for solutions for audio downsampling. However for one reason or another they are incomplete, sometimes buggy, and sometimes are in a programming language I cannot understand.

So here's my use case:

I have an array containing two channels (left-right, it is a microphone) with Float32 data that gets interleaved and then converted to PCM like this:

function interleave(left, right) {
    var length = left.length + right.length;
    var result = new Float32Array(length);
    var _index = 0;
    for(var index = 0; index < length;) {
        result[index++] = left[_index];
        result[index++] = right[_index];
        _index++;
    }
    return result;
}

function convertToPCM(raw) {
    var output = new Buffer(raw.length*2);
    for (var i = 0, offset = 0; i < raw.length; i++, offset += 2){
        var s = Math.max(-1, Math.min(1, raw[i]));
        output.writeInt16LE(s < 0 ? s*0x8000 : s*0x7FFF, offset);
    }
    return output;
}

This is NodeJS\Javascript, but I think it's pretty clear how it works.

Now here's the issue. The output of these function needs to generate a WAV file downsampled to 22000 or 16000, but the source has a sample rate of 44100.

Could you please highlight what algorithm should I use in order to achieve this?

Thank you very much!


texts: Doubt on the relationship between the sensitivity and the complementary sensitivity function

texts:
I am doing loop shaping with the following transfer functions:

G = 10/((s+10)*(s+1));
K1 = 0.5/s;

where G is the process and K1 is the controller, and If I increase the badwidth of the seisitivity function in this way:

I have that also the bandwidth of the complementary sensitivity function increases:

And this is what I don't understand. Infact, as far as I know, the relationship between the sensitivity and the complementary sensitivity function is $S+T=1$ in the case of SISO systems, so how is it possible the if I increase the sensitivity, also the complementary sensitivity increases?

Can someone help me?

[EDIT] I konow that if we increase the bandwidth of the sensitivity function, the bandwidth of the complementary sensitivity function should decrease. Am I wrong?


texts: Convolution of two bipolar rectangular pulses

texts:
I'm having a lot of trouble wrapping my head around what the convolution of two identical rectangular pulses that go from amplitude +A to -A with period T looks like. Please see my drawing below.

I know that when a pulse has amplitude 0 to A, the resulting convolution of two identical pulses is a triangular pulse from 0 to 2T. For a pulse from -A to A, would the resulting convolution be a triangular pulse shifted down?
EDIT: Here is my attempt with integrals:

EDIT 2: Here is my second attempt. I got stuck setting it up I think.

EDIT3: This time I think I figured it out a bit more, I needed to vertically shift the rectangular pulse I think. But then when I get to the integral I get pretty stuck.


texts: Does this lowpass filter have a noncausal impulse response?

texts:
I'm doing some measurements with my sound card, I have one output channel connected to one input channel.

I then send the sound card a unit impulse, i.e. a signal 1 value followed by zeros.

The recorded response is shown below.

I know that the Fourier transform of a Rect function, or LPF, will result in a Sinc function - which is what the response below seems to be.  But I'm not quite sure as to the reason for the pre-ringing in the response.


texts: Discontinuity in the angle of a complex exponential signal

texts:
Plotting this complex expontential:

$$z[n]=100e^{j0.1n},\quad\text{we have a discontinuity at}\quad \arg[n]=10\pi$$

I guess this is related to the angle formula:

$$\theta=\arctan\left(\frac{\Im\{z[n]\}}{\Re\{z[n]\}}\right)$$

But I do not quite see the relationship. Can anyone tell me exactly why we have a discontinuity at $10\pi$?


texts: PCA to reduce dimensionality to 99% variance

texts:
I'm attempting to use PCA to reduce the dimensionality of a dataset I have. I want to explain 99% of the variance in the dataset, and I think I've been able to determine that, but I'm unsure what I have to do to my original dataset to reduce the dimensions. Here's what I've got so far (MATLAB code):

rng 'default'
M = 1000; % Number of observations
N = 500; % Number of variables observed
X = rand(M,N);

% Remove mean.
X = (X - repmat(mean(X),[size(X,1) 1]));

% Determine the eigenvector (V) and eigenvalues (D) of the covariance of
% the matrix X.
[V, D] = eig(cov(X));

% Calculate variance of the vectors (largest to smallest).
var_vec = flipud(diag(D));

% Calculate the cumulative percentage of the variances.
percentages = cumsum(var_vec) / sum(diag(D));

% Find the 99% variance
PC99 = find(percentages >= 0.99, 1);

PC99 tells me the that components 1 to 464 (out of 500) contain 99% of the variance, which I believe to be correct, but I'm now unsure on how to manipulate my original data in order to reduce the dimension from 1000x500 to 1000x464.

Thanks for any help.


texts:
I am doing some analysis in python working with a photodiode. The signal is more or less periodic with some phase shifting in certain areas that give rise to faster or slower periods but overall still very periodic.

I am trying to see how "good" our signal is by computing the Signal-to-Noise ratio (SNR), but so far I have only read from a book on DSP that SNR is defined only as the mean divided by the standard deviation of the signal. Also the book defines Coefficient of variation (CV) as the standard deviation divided by the mean, multiplied by 100. They say a good signal has high SNR and low CV.

Is this simply the definition of SNR or is it something that should be adjusted depending on the signal? How would i go about calculating SNR for my signal?


texts:
Hi guys i'm studying signals and systems, and my professor told us that
$$y(t) = \int\limits_{  t+T }^{t-T/2}  {x(a+T/2)}\mathrm{d} a$$
is a linear system.
But a primitive of $x$ isn't $ x^2$ ? How it's possible that's linear ?


texts:
If $x[n]$ is a discrete random sequence with uniform distribution having mean $\mu = 2$ and variance $\sigma^2 = 3$, if passed through a moving average filter to get an output of

$$\frac{x[n] + x[n-1] + x[n-2]}{3}$$

what would be the the variance of the new signal?

I am getting 2 answers like 1 and 3. Which is correct?


texts: why does the spectral envelope of human speech not change w.r.t. pitch when taking a Fourier transform?

texts:
In the context of speech recognition (recognizing individual speech sounds), the pitch of a certain person can change at different times.

Excerpt from Statistical Signal Processing by Steven Kay:

  This is a natural variability due to the nature of human speech. The
  spectral envelope will not change with pitch since the Fourier
  transform of a periodic signal is a sampled version of the Fourier
  transform one one period of the signal.

What does the part in bold above mean?


texts: Power in a frequency band: Spectral estimation versus time domain

texts:
I wish to find total power in a given frequency band within different time windows of a signal.
I see two methods of doing so, first in the frequency domain. One could estimate the power spectral density within the windows (i.e. tapering and then apply FFT), and integrate over the frequency band of interest.
In the time domain, one could apply a bandpass filter to the whole signal, and then estimate power as the mean square of the signal within the windows.
What would be the differences between the results of the two methods, could one of them be considered superior in this case?


texts: Finding the amplidude of a single frequency in signal

texts: I'm not experienced whatsoever in signal processing. I want to isolate a single frequency (83 Hz) out of a noisy signal. Goertzel works just fine but was wondering if there was any other, maybe even (computationally) simpler technique to do that. I only want the amplitude of that single frequency.


texts:
Let's say that I have a sampled signal x[n], it is being, in this exact order, up sampled by 2, down sampled by4, up sampled by 4 and down sampled by 2 to produce y[n].

It seems to me that it should be pretty self evident that since we up sampled the signal by 2 and down sampled it by 2, then up sampled it by 4 and down sampled by 4, I should just get the original x[n] back.

Am I right?

So the real question is, can the various up/down sampling pieces be readily swapped?


texts: Why is the high-pass filter result in a discrete wavelet transform (DWT) downsampled?

texts:
From Wikipedia's description of the Discrete Wavelet Transform, a signal yields a set of:

approximation coefficients (low-pass: by averaging + downsampling)
detail coefficients (high-pass: convolving with wavelet + downsampling)

This process is cascaded over approximation coefficients:

Why is the high-frequency part of a signal downsampled and how does it retain information? Can it be reconstructed? Is information lost due to the Nyquist theorem?

Sources I looked at:

Mathworks: Wavelet decomposition algorithm
Guide for wavelet transforms for machine learning


texts:
I need a speaker to play broadband white noise for my scientific application. I would like to know whether my relative naive implementation is correct or not. The speakers I use have a large frequency range but the response is not flat, so I need to equalize the sound. What I do is the following:

Software used: Matlab 2016a with Psychtoolbox 3 (latest version) for minimum latency playback.

Hardware used: Windows 10 PC (i5, 8 GB RAM), ASUS soundcard (192 KHz), National Instruments DAS card (250 kHz), profesional microphone, speakers, soundproof box.

First I generate a randn array of a desired length, with the sampling frequency of the soundcard. The normally distributed random values are properly truncated so they don't exceed +1 or -1, which is the maximum range of the input signal, but also in a way that the gaussian distribution is minimally disrupted.
Then I play the sound through the speaker and I record it with the mic and the NI card (at the card's maximum sampling frequency). I discard the beginning and the end of the signal to ensure that I have something stable, and I divide it in chunks of equal length (I discard whatever reminder they may be). After that I calculate the fft for each chunk, I obtain the absolute value, and I average it for all the chunks. As expected, the amplitude profile is not flat.
Finally, I generate a new signal in the same way as I did the first time (I could reuse the original, I guess) and I obtain its fft. Then I multiply it point by point with the inverse of the average absolute fft of the recorded signal from the last step, properly interpolated so it has the same number of frequency points, and reflected at the middle frequency so the symmetry is respected. I take the ifft and thus it becomes my equalized signal. When I play and record it, I observe indeed that the frequency response is much flatter than the original signal.

I posted another question that describes the process more extensively. Here I omitted many details to focus just on the equalization part.


texts: Is there a way to evaluate block size when doing image processing or video processing

texts:
I am currently doing foreground segmentation in image sequences. A DCT 8 by 8 feature is extracted for each pixel.

Now i want to explore dynamic block size for different scenes. Is there any rules or criterion to decide optimal block size?

Thank you!


texts:
I have implemented an infinite kernel sinc interpolation.
For some signals I notice an artifact, visible at the right end of the plot.
I am wondering: is it a bug in my code or a phenomenon usual for this method?

red: 2x upsampled signal
blue: signal expected to be an output of the interpolation
sr (each) = 1000


texts: How can I get frequency information in wavelet?

texts: I am working in image processing. I am confused while getting into wavelet. I applied the fft2() function on Lena image and I got frequency information for the same. But when I applied bior4.4, a popular bi-orthogonal wavelet, I got edge information HORIZONTAL, VERTICAL and DIAGONAL orientation. May you plz. tell me how to get frequency information in wavelet? How time-frequency is localized in bior4.4 wavelet after two level decomposition for Lena image?


texts:
I want to search for a patch in a region of image, and I will use the normalized sum of squared differences.

I know that the sum of the squared differences is:

$SSD = \sum {\left(F - I\right)^2}$

Where:
$F$: is the reference patch
and
$I$ is the patch from the image to match with $F$

My question is:  what does it means normalized? is it the same as normalized correlation?


texts: Does FFT magnitude of a sound drop to 1/10 of its value if sound level is decreased by 20dB?

texts:
I understand decibel = 20 * log (magnitude/reference value). To truly appreciate the meaning of this, if I have a single frequency tone that corresponds to a certain FFT magnitude shown on a PC that's constantly recording. If I lower the tone volume by 20 dB (say, by monitoring with a SPL meter), then I should see the FFT magnitude that's 1/10 of its previous value right?

I'm only trying to understand this from a theoretical perspective, ignoring complicating real life factors.

Thanks


texts:
I'm looking for python functions (package) to calculate SMA (signal magnitude area), SVM (signal vector magnitude) and PSD (Power Spectral Density). The goal is to extract features from an accelerometer data.
Thanks


texts: How to calculate the zero state response?

texts: In the following question and answer I kind of get it how it is calculated at surface but I don't get it fully. Can someone please explain the answer in depth?


texts: Why can so little digital information be stored on a cassette tape?

texts:
I had heard that tape is still the best medium for storing large amounts of data. So I figured I can store a relatively large amount of data on a cassette tape. I was thinking of a little project to read/write digital data on a cassette tape from my computer sound card just for the retro feeling. (And perhaps read/write that tape with an Arduino too).
But after reading up about it for a bit it turns out that they can store very small amounts of data. With baud rates varying between 300 to 2400 something between ~200KB to ~1.5MB can be stored on a 90 minute (2x45min) standard cassette tape.
Now I have a lot of problems with understanding why that is.
1- These guys can store 90 minutes of audio. Even if we assume the analog audio quality on them was equivalent of 32Kbps that's about 21MB of data. I have a hard time believing what I listened to was 300bps quality audio.
2- I read about the Kansas City standard and I can't understand why the maximum frequency they're using is 4800Hz yielding a 2400 baud. Tape (according to my internet search) can go up to 15KHz. Why not use 10KHz frequency and achieve higher bauds?
3- Why do all FSK modulations assign a frequency spacing equal to baud rate? In the Kansas example they are using 4800Hz and 2400Hz signals for '1' and '0' bits. In MFSK-16 spacing is equal to baud rate as well.
Why don't they use a MFSK system with a 256-element alphabet? With 20Hz space between each frequency the required bandwidth would be ~5KHZ. We have 10KHz in cassette tape so that should be plenty. Now even if all our symbols were the slowest one (5KHz) we would have 5*8 = 40000 baud. That's 27MB of data. Not too far from the 21MB estimation above.
4- If tape is so bad then how do they store Terabaytes on it?


texts: Verification of all steps needed to extract MFCCs from raw audio data

texts:
I need some verification on steps required to extract MFCCs from raw audio as I'm finding that some sources outline them slightly differently.

Get raw audio frame
Run window function (eg Blackman) on raw audio data by multiplying each datapoint with the window
Perform FFT on windowed audio frame.
Calculate magnitudes by powering and summing real and imaginary parts of first half of FFT real^2 + imaginary^2
Convert magnitudes to dBv using 10 * Math.log10(magnitude)
Construct Mel Filter Bank consisting of eg 26 triangular filters spaced out across entire spectrum
Multiply dBv data with Mel Filter Bank to get 26 coefficients
Run log10 on each of the 26 coefficients
Perform DCT/FFT or ?iFFT? on 26 coefficients
Result produced is 26 MFCCs?

Regarding point 7: I'm not certain of input for multiplying with Mel Filter Bank. Should it be dBv, magnitudes, magnitudes converted to Mel scale or something else?

Point 9: I found some sources saying that said 26 coefficients should then be used as an input for DCT/FFTs as though they would be a signal. Other sources say the should be used for an inverse FFT as the result is mean to be a cepstrum. Can someone clarify?

Can someone verify this process and point out any mistakes?

I find it difficult to find solid points of reference covering these techniques and providing reasoning behind them. I was wondering if there's a book covering all of the above with technical examples, starting with theory and explanation of DSP concepts along with MFCCs and related speech analysis techniques. Most books I'm seeing focus mainly on Mixed Markov Models and don't seem cover cepstrums and MFCCs at all (at least by looking at their tables of contents).


texts: Indian Space Research Organization - Extent of spectral spread 1/3rd Octave Analysis

texts:
I am a scientist at Indian Space Research Organization (ISRO) and will be representing my team. We work on Telemetry and Data Handling units for our Launch Vehicles.
We are preparing for our upcoming SSLV Launch (Small Satellite Launch Vehicle) and need some information to confirm if we are at par with the industry, or if we need to switch to better available options.
It would be really helpful if you share the name of the company which excel in software or equipment for 1/3rd octave analysis of acoustics signals, that you know of or have used and can vouch for best accuracy.
Please mention what is:

Order of band pass filter

Type of filter (Elliptic/butterworth etc.)

Order of Low pass filter (If one is being used in the design), type of low pass filter, its stop band attenuation and passband ripple.

Your help is duly appreciated.
Warm regards from our entire team at ISRO.

Rekhanshi Varma
Scientist/Engineer 'SC'
Vikram Sarabhai Space Center
Indian Space Research Organization (ISRO)
Office Ph: 04712564741 | Country Code: +91


texts: how to find breakpoints of a signal based on the frequency of the signal

texts:
There are 4 cos signals with 10,20,30 and 100 Hz each.
The main signal is the sum of those 4 and I have to create a low pass filter, on the main signal for the frequency's > 50 Hz.

% design of low pass filter
f = [0 0.6 0.6 1];
m = [1 1 0 0 ];
b = fir2(30, f, m);
[h, w] = freqz(b,1,128);

hold on;
plot(f,m,'b')
plot(w/pi, abs(h), 'r')
xlabel('Normalized Frequency (\times\pi rad/sample)')
ylabel('Magnitude')
legend('Ideal', 'fir2 designed')
legend boxoff
title('comparison of frequency Response Magnitytes');
hold off;

That's the example code that our professor gave us.On maltab using help fir2 there is a similar example

% Example 1:
%   Design a 30th-order lowpass filter and overplot the desired
%   frequency response with the actual frequency response.

f = [0 0.6 0.6 1];      % Frequency breakpoints
m = [1 1 0 0];          % Magnitude breakpoints
b = fir2(30,f,m);       % Frequency sampling-based FIR filter design
[h,w] = freqz(b,1,128); % Frequency response of filter
plot(f,m,w/pi,abs(h))
legend('Ideal','fir2 Designed')
title('Comparison of Frequency Response Magnitudes')

What i don't understand is how to find the frequency breakpoints and the magnitude breakpoints?
Also whats the relation of the filter order with the low-high, band filters?


texts: Using the log power spectrum as features for a Classifier

texts:
I have a set of time series signals for which I have to develop a anomaly detection algorithm. I am considering using classifiers like SVM to do this.

However I am confused about how to properly process the features from the time series.
I used FFT to get the frequency domain power. If I want to use these features to train the SVM model, is it a good practice to use logarithmic power values or the simple absolute power values ?

If I use the logarithmic values of the power features, is there a chance that the model performance might be negatively affected ?


texts: In the below screenshot I was unable to understand how the equation 4.3 is derived from the above equation.. How $x(nT)$ has become $x(n)$ ? Please clear my doubt and suggest some link to understand DFT. I am sorry for the poor image quality.


texts: Import MSI antenna file into a custom antenna element

texts:
Hello i've downloaded a correct MSI radiation pattern file. I've imported it using MSI read, i'm able to visualize to azimuth and elevation cut patterns.

I want to use its radiation pattern and create a custom antenna element using phased.CustomAntennaElement

the issue is when i try using phased.CustomAntennaElement arguments  'HorizontalMagnitudePattern', and 'VerticalMagnitudePattern' i get a size error since the vertical and horizontal magnitute patterns ive imported from the msi files have 360x1 size instead the arguments of the custom antenna expects 181x361?

Error using phased.internal.AbstractElement (line 25)
Expected HorizontalMagnitudePattern to be of size 181x361, but it is of size 360x1.

here is my code

clear;clc;
azang = [-180:180];
elang = [-90:90];
[Horizontal,Vertical,Optional] = msiread('Kathrein\80010652_2655_x_co_p45_08t_rs.msi');
phasepattern = zeros(361);
antena = phased.CustomAntennaElement('AzimuthAngles',azang, ...
    'ElevationAngles',elang,'SpecifyPolarizationPattern',true,...
    'HorizontalMagnitudePattern', Horizontal.Magnitude, ...
    'VerticalMagnitudePattern',Vertical.Magnitude,'PhasePattern',phasepattern);
pattern(antena,2.655e9,[-180:180],[-180:180],'CoordinateSystem',...
    'Polar','Type','powerdb')


texts: What is done to minimize distortion due to the hold operation?

texts:
A hold operation can be modeled using a step function over one sampling period i.e.

$R(t) = 1/T * (h(t) - h(t-T))$, $h(t)$ the step function

In frequency domain this is equivalent to

$R(jw) = e^{-jwT/2}*sinc(wT/2)$

We see there exists a phase distortion of $T/2$ and a magnitude distortion from the $ sinc(wT/2)$ term.

This means that all the reconstructed signal will be distorted unless operated at very low frequency.

Can someone explain what induces this distortion and what is done to minimize both the phase and magnitude distortion


texts: How Butterworth low-pass filter can be applied on a digital signal (i.e. discrete representation of a signal)?

texts:
I would like to know how to apply a low pass filter (Butterworth) to a digital signal. So, I have some values of the signal, let's say $S(t)$. Those values are equally spaced in time. I have read the Wikipedia's article, but I do not understand how to apply the transfer function $H$. I assume that I have to use a Z-transformation and apply it on $S$ but I am not certain to know how to do that. By the way, the part Digital implementation of this article is not really detailed.

Can someone help me to understand those things ? I would really appreciate any answers :)

P.S. I know there are functions in Python (e.g. scipy) that handle that issue, but I would like to know the mathematics behind it.

Thanks.


texts:
I have a short term fourier transform plot that I plot using matplotlib's pcolormesh() function:

If I zoom in the plot, I see this:

Now, I want the plot to just show the zoomed-in range on the y-axis - till 4 or 3 kHz. Is there any way to do this without having to manually zoom in? I want to do a comparison for multiple waveforms in the frequency range as this is my passband in the passband filter I apply on the data.
Here is the code I use to compute and plot the stft:
sampleFreq, segmentTimes, stftX = sp.stft(filteredY, fs)
segmentTimes += (1.5 / 1000)
plt.pcolormesh(segmentTimes, sampleFreq, np.abs(stftX), shading='gouraud')
plt.ylabel("Frequency (Hz)")
plt.xlabel("Time (s)")
plt.title("Sort Term FFT")
plt.show()

I add 1.5 to the segmentTimes because I trim my original data from 1.5 to 2.5 ms, and for some reason, if I don't add 1.5 here, the stft starts from 0.0 s. And the division by 1000 is for conversion to seconds from milliseconds.
Also, sampleFreq and segmentTimes are simple lists but stftX is a list of lists.


texts:
I thought my network was experiencing outages. I collected bandwidth (Mbps) measurements every 30 min.

A cumulative probability distribution shows the probability that bandwidth will exceed any given value (e.g. P(x > X)). However, this was not very insightful.

A continuous wavelet transform using PyWavelets did not show any strong peaks (i.e. heat map of cwt in scale and time). That meant to me that there was not a consistent duration for the outages.

What would be some ways to analyze the signal to see the time scale of outages?

Sample Data

Cumulative Probability

CWT using PyWavelet


texts:
I am trying to build a Butterworth bandpass filter. My intent is to have a pass band between $250\textrm{ Hz}$ and $1000\textrm{ Hz}$. However the plot doesn't look right, as can be seen from the following graph:

Below is my code:

import scipy
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt

#apply bandpass filter
fs = 8000
fso2 = fs/2.
N,Wn = scipy.signal.buttord(wp=[250./fso2,1000./fso2], ws=[200./fso2,1200./fso2],
   gpass=0.1, gstop=30.0)

b, a = signal.butter(N, Wn, 'band', True)
w, h = signal.freqs(b, a, np.logspace(0, 4, 500))
plt.semilogx(w, 20 * np.log10(abs(h)))
plt.title('Butterworth bandpass filter fit to constraints')
plt.xlabel('Frequency [radians / second]')
plt.ylabel('Amplitude [dB]')
plt.grid(which='both', axis='both')
plt.show()


texts:
I'm trying to build an SOQPSK-TG signal in MATLAB/Octave. I am following this paper for formulas.

I'm trying to generate a waveform for the phase, equation 2.4:

Where q(t) is the phase pulse, equation 2.3:

f is the partial-response frequency pulse (L=8 for SOQPSK-TG):

and w is the window function:

for SOQPSK-TG, we have the following values:

p = 0.7, A = 0.3112, B = 1.25, T1 = 1.5, T2 = 0.5, L = 8, h = 0.5, T = 1

One point of confusion I am seeing is that when I plot ftg(t) as written, the pulse is centered around t=0:

However the image of ftg in the paper shows an unexplained shift in time:

The formula for q(t) also supports this time shift, showing that the integral must start at t=0, and should end up at 0.5.

I can just accept for now that there is a time shift by L*T/2, so I can adjust my integration indices, and shift everything in time, no big deal:

When I plot the resulting phase using the time shifted version of ftg, I end up with a smooth moving waveform, which is the desired behavior:

However, when I look at the mod(2*pi) results, and sample once per symbol-duration-period, I am seeing 8 discrete phase states:

The document claims I should only see 4 discrete phase states. Interestingly enough, if I don't time shift ftg, I end up with a non-smooth phase state:

But with this waveform I am seeing the 4 discrete phase states:

How can I get a smooth looking waveform with 4 discrete phase states?


texts:
A few months ago, as part of my summer internship, I had performed interfacing of an ADC with FPGA (Zynq-7000). The goal was to take an analog signal from a signal generator, feed it to the ADC and present the digitized output to the FPGA. The FPGA was supposed to perform FFT on the data through an algorithm which we had written on Vivado Suite. The magnitude spectrum was successfully obtained on the waveform viewer.

We then decided to calculate the SNR and SFDR values from the data. The way I proceeded for computing SFDR was to record the value of the amplitude of fundamental frequency (which kept fluctuating, but not much) and value of the next highest peak (the highest spur) in the first Nyquist zone. The ratio of these two values would fetch me the SFDR.

The input to the ADC was a 200 kHz sinewave.
To check for consistency, we performed three different sized FFTs, 2k-, 8k- and 32k- and in each trial the strength of the analog signal was varied from -60 dBm to 0 dBm (in steps of 10dBm).  The value of SFDR always hovered around 23 dBc.

The value of SFDR given in the ADC datasheet is around 80 to 90 dBc, but we ended up with a value much less than that (23dBc).

I understand that the conditions under which the datasheet values were calculated were quite different from ours in terms of strength and frequency of input signal.

My major concern which I wish to clarify from the experts sitting on this platform is whether or not my procedure was proper enough, or atleast worth appreciating? Was there any major flaw(s) which I may have failed to notice in my approach? I am sure there certainly were. This concern arises because whenever I think of mentioning this project in my resume, I wonder if the examiner will ridicule me of missing anything fundamental. There wasn't a subject expert at that time who could point out if I was going on the right path.


texts: Pedestrian Re-identification during tracking

texts: During the multi-camera tracking, there is a situation where one person moves from one camera's coverage area to another. In that case that person has to be re-identified(as the one from previous camera's previous view) in order to keep tracking the particular object. What is the easiest way to do this? Color matching? Can anyone give me some suggestions?


texts: Good Heuristic Point Where Sending FFT to GPU is Computationally Worth It?

texts:
This is a rather simple question, but I haven't found much posted within the last 5 years or so regarding a good rule of thumb for computing an FFT on the GPU vs the CPU. I know that most of the overhead of GPU-calculated FFTs is that you have to first write the data to a buffer and then transmit that data to the GPU, from the CPU, in order to compute the transform.

This implies naturally that GPU calculating of the FFT is more suited for larger FFT computations where the number of writes to the GPU is relatively small compared to the number of calculations performed by the GPU. But the issue then becomes knowing at what point that the FFT performs better on the CPU vs GPU. The best I've found is on the lines of "when you're computing larger FFTs", but that's a little relativistic to be particularly meaningful guideline for practitioners, especially considering that GPU technology has been accelerating so rapidly in the past few years.

I'm just looking for a more concrete estimate of at what point it becomes efficient to compute the transform on the GPU vs CPU (perhaps there's a benchmark somewhere out there?). Thanks in advance for any help you can provide.


texts:
I am trying to do an inverse FFT to get the real signal from a derived formula which describes the Fourier transformed signal. I am doing this with FFT.

I am fairly new to the theory of FFTs, so my questions may be naive.

Taking a modified equation for greens function for 3D diffusion
\begin{equation}
f(r,t) = \frac{r}{(4\pi D t)^{2/3}}e^{-\frac{r^2}{4Dt}-t/\tau}
\end{equation}
the Fourier transform with my convention (normalization $1/2\pi$ and negative exponent on the reciprocal-to-real transform)
\begin{equation}
\hat{f}(q,\omega) = \frac{1}{2\pi}\frac{iq}{-i\omega +Dq^2 + 1/\tau}
\end{equation}

The function $f(r,t)$ is non-continuous and defined for positive values only (it's a radial function on $r$).

Now, when doing the FFT, I have understood that the forward FFT produces a complex conjugate result of positive and negative "frequencies." Therefore, when doing my inverse FFT, I am giving as input both negative and positive values of $q$ and $\omega$, evenly spaced around 0.

My question is, why the result in real space (plotted on $r$ axis) has both positive and negative values, and how to know which one to use?

The picture below shows the output of the FFT algorithm of $\hat{f}(q,\omega)$ as well as the analytical result $f(r,t)$. It is clear that the two peaks from the FFT can both be shifted/mirrored as appropriate to match exactly the analytical result, except for the peaks which I also cannot explain.

In my actual problem, I have a more complicated version of $\hat{f}$ which does not have an analytical expression in real space. This is why I am looking at the reverse FFT only. The FFT output is shown below.

Obviously there is a problem of some sort on the left peak, which is why I am thinking I need to shift and mirror the peak on the right. But this is all too handwaving for me, so I would greatly appreciate if someone could help me out.


texts: Is it possible to detect or localize movement of objects using LPWA (or LPWAN) such as LoRa, DASH7, NB-FI?

texts: Assume that there is a moving human in the room without any device (or receiver). Is it possible to detect or localize movement of objects using LPWA (or LPWAN) such as LoRa, DASH7, NB-FI by analyzing the reflected signal?


texts: Calculating original signal from Discerete Fourier Transform

texts:
I am trying to calculate the original equation using a DFT. I start with a equation, generate values from this equation and then get the dft of these values. The aim is to generate the original equation using the dft values.

Consider the following equation
$$f(t) = 1 + 0.75\cos(2\pi t/4) + 0.2\cos(4\pi t/4) + 0.5\cos(6\pi t/4)$$

original signal for $t=[0,1,2,3]\Rightarrow [2.45,0.80,-0.05,0.80]$

DFT: $[4,2.5,0.8,2.5]$

From DFT (i.e $[4,2.5,0.8,2.5]$) how do I retrieve the coefficient $0.75, 0.2$ and $0.5$ present in the original equation?

Cheers,
Ambi.


texts:
The relationship between the Z-transform and DTFT can be expressed like:
$$ H(e^{j \omega}) = H(z)|_{z = e^{j \omega}}$$
Graphically, evaluating the Z-transform on the unit circle is shown as sweeping $\omega$ as $e^{j \omega}$ is plotted, represented as a phasor rotating around the unit circle.
My question is, isn't there a problem in that the argument of an exponential is supposed to be unitless? Any complex number (on the unit circle) can be represented as $e^{j \phi}$ where $\phi$ is the number's phase and is unitless (radians). But $\omega$ has units of frequency, so what's happening here? Is there implicitly a time unit of 1?
I've seen some texts cancel the units by normalizing the frequency, so instead of following $e^{j \omega}$ you follow $e^{j 2\pi (f / f_s)}$, where $f_s$ is a sampling frequency. How would assuming an arbitrary $f_s$ affect the calculated frequency response?


texts: Suppose we take a reading of a single rotating axis using 2 identical sensors. Intuitively, I think that averaging the outputs of both sensors will yield a less noisy result. But what if sensor A has a defect that makes it much noisier than sensor B. Will it still be wise to use the averaged data? Or will it be better to use only the data from sensor B?


texts: Minimum FFT sample time - guitar frequencies and harmonics

texts:
I am working on a project whereby I am trying to determine the exact note played on an electric guitar with a microcontroller (as quickly as possible after the string is plucked) and to use this information (ie digital value of note) to manipulate an audio output via DAC.

I am using an STM32F4, sampling the DC offset and active fitered guitar signal with a 12-bit ADC (sample rates pretty much as fast as I need with timer triggered ADC DMA) and the highest number of F32 FFT points I can achieve with the RAM available is 4096 (ie 8192 samples).

The guitar frequencies I need to measure are between 82Hz and about 831Hz, with a resolution at the low end of 2Hz and about 22Hz at the top.

Am I correct in saying minimum sample time to achieve this is about 0.5s, driven by the minimum frequency and resolution requirement?
And at higher frequencies I can sample for shorter (with a higher sample rate)?
Or is there (hopefully) something I'm missing?
Can I measure the lower frequencies with fewer FFT points (and thus samples), saving time?


texts: Prevent clicking noises during chirp generation

texts:
I am trying to generate a tonal sound which changes in frequency and amplitude over time. The goal is to emulate an engine order during driving. So I don't know the frequencies and the amplitudes upfront. They depend on the driving situation.
So far I managed to get it to work. However in the generated sound sometimes clicks occur. I think it happens when the amplitude changes too fast. As I can't control the amplitude I would like to know what I can do to prevent this clicking noise to happen?
Matlab code:
yo=sin(2*pi*cumtrapz(Time,(Rpm_vec/60*order(k)))+pi*start_phase(k)/180).*Amplitude(Time);
Rpm_vec and Time are vectors with the engine speed and the corresponding time trace obviously.
In the following picture the blue curve is the generated sound pressure, while the red curve is the absolute value of the sound pressure and the green curve is the amplitude that I have to deal with. In black I have encircled where a step in sound pressure happens causing a clicking sound.

Any help is kindly appreciated!
Edit
Thank you for the good comments! k is an enumerator in case I want to emulate multiple Engine Orders. For this example k can be just 1. I think the hint to keep the argument between 0 and 2pi makes sense. Using cumtrapz is not good. I'll try to avoid that. Further I had the idea to smoothen the Amplitude with a lowpass filter. The lower the frequency I want to emulate the lower should be the stopband of that lowpass-filter. Steep changes in the amplitude combined with a low frequency lead to clicks I guess.


texts:
What is the difference between the non-centered and centered Fourier transforms? In other words, when should you use one instead of the other?

Non-Centered: $\quad \displaystyle X_1(f)=\sum\limits_{n=0}^{N-1} x[n] \, e^{-i 2 \pi f n}$
Centered: $\quad\displaystyle X_2(f)=\sum\limits_{n=0}^{N-1} x[n] \, e^{-i 2 \pi f\left(n-\frac{N-1}{2}\right)}$

I am currently enrolled in a time series-analysis class, and our textbook uses both definitions without explaining the difference or the reason for the two different definitions.

Any help would be appreciated.


texts: Designing ideal lowpass filter in the form of FIR

texts: How to design a ideal lowpass filter by cutoff frequency of π/4 in the form of FIR filter by 64 samples using matlab?