texts: GnuRadio: Clock Recovery MM: imu out of bounds

texts:
I have created a flowgraph, based on an example of Michael Ossmann, which takes in a signal, and should output bits.

I need to use the clock recovery MM block, which I do not fully understand yet. However, after reading some blogposts, I am quite sure that I can leave most of the settings default, except for the Omega one. Here's my flowgraph:

When running this flowgraph, it gives me the following error:

thread[thread-per-block[5]:<block clock_recovery_mm_ff (9)>]: mmse_fir_interpolator_ff: imu out of bounds.

While searching, I stumbled upon this piece of code in the source of GnuRadio:

int imu = (int)rint(mu * NSTEPS);
  if((imu < 0) || (imu > NSTEPS)) {
    throw std::runtime_error("mmse_fir_interpolator_ff: imu out of bounds.\n");
  }

So, I suspect it is not due to my Omega setting (which might be wrong, I have to play with that setting), but that it is due to my Mu setting, which is just the default (0.5). However, I understand that Mu needs to be between 0 and 1, so I do not really understand what the problem is. Anyone who does?

Environment details:

GNU Radio Companion 3.7.7.1
Running a GNU Radio live DVD in a virtual machine (VirtualBox 4.2.12) on Windows 7.
Using Volk machine: ssse3_64


texts: Adding a constant to a bandpass-signal in transmission

texts:
I do understand AM-DSB-SC and AM-DSB-TC, but can't see the point in adding a constant DC-offset of 2 in the upper part of this Simulink-model?

Source


texts: I am studying Block Normalized LMS, and when I compare this with Affine Projection LMS (if updated every M samples) I think that they are the same. I would really appreciate if anyone can point out if there is a gap in my understanding. Also, I it will be really helpful if anyone can suggest some good material on Block NLMS.


texts:
Matlab function rpmfreqmap doesn't show diagonal lines though there is variation in speed. I'm using vibration and tachometer data from dataset. I'm trying to perform order analysis as shown in Matlab example
However rpmfreqmap doesn't show any diagonal lines which i understand it's necessary for order analysis.I have attached my output
I don't understand why it doesn't show any diagonal lines as shown in matlab example though there is change in speed.


texts:
My problem: create a device that can take a scan of a target via a camera and a shooting rig (that I am building).

The camera is connected to a motor that rotates the camera, and this is connected to a belt that translates left/right on a rail.

Diagram:

I leave the translation motor's speed alone and let it go fully from start to finish without giving it any other commands. However for the rotation motor I compare the desired position with the actual position and give it an error value via an error function (negative means its too slow and positive means its too fast). Depending on the magnitude of the error value I either speed up or slow down the rotation motor.

However I am not getting much success as the tracking of the target is quite inaccurate. And I made up the error function - I have been trying to tweak it using trial and error but it isn't providing satisfying results.

Anybody have tips on how to solve this either than tweaking my error function? Is there any resources (books, internet guideS) for such a Tracking Acquisition project?


texts: Implementing Felzenszwalb's segmentation for 3D images

texts:
Is there an implementation available for unsupervised 3D segmentation using the Felzenszwalb's Graph Cut algorithm?
If implemented what do you think are the bottlenecks of such an algorithm?
In general, I am looking for a robust unsupervised 3D image segmentation algorithm. I will welcome your suggestions.
A reference to the original paper is here -
http://people.cs.uchicago.edu/~pff/papers/seg-ijcv.pdf
Thank you.


texts: Frequency response of a digital state variable (Chamberlin) filter

texts:
I recently implemented a digital state filter based on the recommendation here. I've tested this filter's performance as a very low cutoff low-pass filter with limited coefficient quantization precision and it's working entirely as expected. However, I've only tested it in the time domain. I'd additionally like to characterize it in terms of its frequency response. I've used Mason's gain formula to arrive at the following transfer function:
$
H(z) = \frac{f^2z^{-1}}{1-z^{-1}(2-qf-f^2)+z^{-2}(1-qf)},
$
where $f=2\sin(\pi f_c/f_s)$ and $q=1/Q$ are chosen constants (see this link). According to that link, $f_c=10\,\text{Hz}$ is the cutoff frequency, $f_s=500\,\text{kHz}$ is the sampling rate, and $Q=1/\sqrt{2}$. Here's a block diagram of the filter (taken from Musical Applications of Microprocessors) for reference:

However, when I plot the response ($H(e^{j\omega})$) it doesn't quite look as I expect. Here's the Python code for plotting:
import numpy as np
import matplotlib.pyplot as plt

fc = 1e1
fsample = 500e3
fnyquist = fsample / 2
q = 1 / np.sqrt(2)
Fc = 2 * np.sin(np.pi * fc / fsample)
Q = 1 / q

def tf(f):
    w = 2 * np.pi * f
    z = np.exp(-1 * 1j * w)
    return (
        Fc ** 2
        * z
        / (1 - z * (2 - Q * Fc - Fc ** 2) + z ** 2 * (1 - Q * Fc))
    )

freq = np.logspace(-10, np.log10(fnyquist), int(1e5))
resp = [20 * np.log10(abs(tf(f))) for f in freq]
_, ax = plt.subplots()
ax.plot(freq, resp)
ax.grid(b=True, which="major")
ax.set_ylim(-120, 10)
ax.set_xscale("log")
plt.show()

Here's the plotted frequency response

The shape is as I would have expected (low-pass and low q-value with 12dB/oct. rolloff). However, the cutoff frequency, which is roughly $2\times 10^{-5}\,\text{Hz}$ is much lower than the $10\,\text{Hz}$ I set. Additionally, I'm somewhat perturbed by the spikes in the frequency response, which I didn't expect. Have I set up this filter incorrectly, or calculated the frequency response incorrectly? This is my first time using Mason's gain formula, so it's possible I've done that incorrectly. Why do I not see a gain of $-3\,\text{dB}$ at $10\,\text{Hz}$? How can I achieve the correct cutoff frequency? Are those "spikes" a cause for concern? Why are they present and how can I remove them?


texts: What are the tradeoffs in HSB and HSV versus CIE color models in computer vision?

texts:
I coded a computer vision algorithm to detect objects in different lighting conditions using HSV. I recently read a convincing critique of HSV by Charles Poynton:

  HSB and HLS were developed to specify numerical Hue, Saturation and Brightness (or Hue, Lightness and Saturation) in an age when users had to specify colours numerically. The usual formulations of HSB and HLS are flawed with respect to the properties of colour vision. Now that users can choose colours visually, or choose colours related to other media (such as PANTONE), or use perceptually-based systems like Luv* and Lab*, HSB and HLS should be abandoned.

  Here are some of problems of HSB and HLS. In colour selection where "lightness" runs from zero to 100, a lightness of 50 should appear to be half as bright as a lightness of 100. But the usual formulations of HSB and HLS make no reference to the linearity or nonlinearity of the underlying RGB, and make no reference to the lightness perception of human vision.

  The usual formulation of HSB and HLS compute so-called "lightness" or "brightness" as (R+G+B)/3. This computation conflicts badly with the properties of colour vision, as it computes yellow to be about six times more intense than blue with the same "lightness" value (say L=50).

  HSB and HSL are not useful for image computation because of the discontinuity of hue at 360 degrees. You cannot perform arithmetic mixtures of colours expressed in polar coordinates.

  Nearly all formulations of HSB and HLS involve different computations around 60 degree segments of the hue circle. These calculations introduce visible discontinuities in colour space.

  Although the claim is made that HSB and HLS are "device independent", the ubiquitous formulations are based on RGB components whose chromaticities and white point are unspecified. Consequently, HSB and HLS are useless for conveyance of accurate colour information.

  If you really need to specify hue and saturation by numerical values, rather than HSB and HSL you should use polar coordinate version of u* and v*: h*uv for hue angle and c*uv for chroma.

I understand that HSV is better than RGB and that HSV has some advantages, such as removing shadows:

  The Saturation component is regarded as invariant in shadow (only intensity
  changes), so processing the image in HSV space is better suit for shadow
  removing.

and easy computation:

  HSV is often used simply because the code
  for converting between RGB and HSV is widely available and can also be easily
  implemented.

What are the tradeoffs of using HSB and HSV, which are inaccurate according to Poynton, compared to the standardized CIE color models such as CIELAB, CIELuv, and others?


texts:
I created the lowpass filter

h = firls(100, [0 .2 .25 1], [ 1 1 0 0],[.001 60]);

My goal is to get four filters  $H_{k}(z) = H(W_{4}^{k}z)  k =0,1,2,3$

From my knowledge to get the polyphase components you would do the following

$H_{0}(z) = \sum h(4n)z^{-n}$
$H_{1}(z) = \sum h(4n+1)z^{-n}$
$H_{2}(z) = \sum h(4n+2)z^{-n}$
$H_{3}(z) = \sum h(4n+3)z^{-n}$

To do this in matlab i just did\

 h0=h(1:4:end);
 h1=h(2:4:end);
 h2=h(3:4:end);
 h3=h(4:4:end);

This doesn't seem to produce the right results.... If anyone can clarify how to do polyphase decomposition in mat lab or tell me what I am doing wrong I would appreciate it

EDIT:

I have a signal x[n] that is a FDM (frequency Division Multiplex) signal made up of four real valued baseband signals interpolated by a value of of 4 and modulated using the complex carrier $e^{j \frac{2*pi*k}{4}n}$  thefour base band signals are added to make the FDM signal x[n].

My goal is to estimate each of the 4 base band signals using the polyphase components of the lowpass filter.  The matlab code I am using is:

h = firls(100, [0 ,2 ,.25 1], [ 1 1 0 0],[.001 60]);
h0=h(1:4:end);
h1=h(2:4:end);
h2=h(3:4:end);
h3=h(4:4:end);

%first baseband signal
y0 = conv(x,h0);
y0 = downsample(y0, 4);
y0 = abs(fft(y0));

Here are the 4 estimated baseband signals I get compared to the actual

The polyphase components don't seem to be changing anything

I also tried setting up the filters like this

% Lowpass Filter
h0 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);
h1 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);
h2 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);
h3 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);
figure(1)
impz(h);
figure(2);
freqz(h);

% PolyPhase Componets
h0(2:4:end)=0;
h0(3:4:end)=0;
h0(4:4:end)=0;

h1(1:4:end)=0;
h1(3:4:end)=0;
h1(4:4:end)=0;

h2(1:4:end)=0;
h2(2:4:end)=0;
h2(4:4:end)=0;

h3(1:4:end)=0;
h3(2:4:end)=0;
h3(3:4:end)=0;

and ended up with these plots

still seems to be something wrong

(NOTE: Orange is actual signals.  Blue is my estimate.)


texts:
I am trying to implement a digital communication system as a learning exercise. For error correction, I am using two concatenated codes (RS and convolutional). However, I read that, in order to reduce the damage caused by burst errors (and in some cases controlling the DC level of the output signal), it is a good practice to add an interleaver/scrambler between them.

I know how an interleaver and a scrambler work, but I do not get what is the point of choosing one or another (if they are not both required). In what scenarios would one work better than the other and why?


texts:
How can I resolve the following issue: Unsupported conversion: PCM_SIGNED 8000.0 HZ, 16 bit, mono, 2 bytes/frame, 48000.0 frames/second, big-endian from PCM-SIGNED 48000.0 HZ, 16 bit, mono, 2 bytes/frame, big endian

On Mac High Sierra (10.13.6) I am running JAudio, a digital signal processing software implementing a number of common feature extraction algorithms for analysing audio files. The above message appears when I finally hit 'Extract Features'.
I have been converting the original .wav audio files numerous times using all sorts of different converters (VLC, iTunes, WAV converter, etc) and looked into codec but had to give up due to lack of knowledge and IT skills.

I would be grateful for any directions on what I would need to install or look for in order to resolve the issue.
Many thanks

------------ details of one of the audio files I used to extract from:
SAMPLING RATE: 48.0 kHz
BIT DEPTH: 16 bits
CHANNELS: mono
FRAME SIZE: 16 bits
FRAME RATE: 48000.0 frames per second
ENCODING: PCM_SIGNED
BYTE ORDER: big-endian
PROPERTIES: {}
SAMPLES PER CHANNEL: 2174706 samples


texts: Interpolated FIR filter (from Oppenheim and Schafer's Discrete-Time Signal Processing, 3rd ed)

texts:
[from Discrete-time Signal Processing by Oppenheim and Schafer, 3rd ed., p.196]
Two questions:

In this context, the filter with system function represented by Eq. (103) is called an interpolated FIR filter. This is because the corresponding impulse response can be seen to be the convolution of $h_1[n]$ with the second impulse response expanded by $M_1$.

This explanation as to why   Eq. (103) is called an
interpolated FIR filter is still not clear for me.
Why is the impulse response given by Eq (104) FIR?


texts: In digital image processing, I need to understand what does image resizing do? Does it only change the dimensions of the image, for example, from 256×256 to 128×128 with the same pixel spacing (the same dpi)? Or does it change the dpi or pixel spacing in an image? If I need to increase the size of the image and also increase its dpi, how can I do this?


texts:
I have an input signal with bandwidth 2.5 MHz. Let's say it's filtered using analog Butterworth low-pass filter. I would like to sample the signal using AD9203 10-bit 40 Msps ADC. If I understand correctly, in this case 5 Msps is enough and I could use decimation to effectively increase number of bits per sample.

Is it enough to just add up every 8 samples @ 40 Msps on input and push resulting 13-bit sum @ 5 Msps to the output? Or a little more sophisticated processing is required?


texts:
I am currently working on a BPSK demodulator and decoder for a satellite communication system using GnuRadio.
The system uses a BPSK modulation at roughly 2GHz with a symbol rate of 200 ksymb/s. I recorded the signal directly from the transceiver module connected to my Ettus b200mini via a coax cable and some attenuation in-between using 2.4 MS/s and therefore 12 SPS.
I create the following graph for demodulating the signal, which works while using it between different SDRs for sending and receiving. But when I try to demodulate the signal from the transceiver module, I get a really noisy constellation figure (see screenshot).
I already tried different ways of filtering, different levels of attenuation between the sender and receiver, and many different settings for the used blocks, so far nothing helped.
Can anyone help me here? Even some hints on what I could try would already be nice.
Kind regards
valkyrie


texts: Cepstrum Calculation of Rational Function H(z)

texts:
I am trying to solve my first problems at cepstrum calculation. I want to calculate the complex cepstrum $\hat{h}[n]$ of a signal $h[n]$ with Z-Transform:
$$H(z)=\frac{(1-0.5z^{-1})(1+4z^{-2})}{(1-0.64z^{-2})}$$
I know that $\hat{H}[z]=\log(H(z))$ and $\hat{h}[n]=\frac{1}{2π}\int_{-π}^{π}\log[H(e^{jω})]e^{jωn}dω$

Which is the easiest way to approach this?

I started by applying $\log()$ to H(z) which gave me:
$$\log(H(z))=\log(1-0.5z^{-1})+\log(1+4z^{-2})-\log(1-0.64z^{-2})\Rightarrow $$
$$\log(H(z))=\log(1-0.5z^{-1})+\log(4(z^{-2}+\frac{1}{4}))-\log((1-0.8z^{-1})(1+0.8z^{-1}))\Rightarrow$$
$$\log(H(z))=\log(1-0.5z^{-1})+\log(4(z^{-1}+\frac{j}{2})(z^{-1}-\frac{j}{2}))-\log((1-0.8z^{-1})(1+0.8z^{-1}))\Rightarrow$$
$$\log(H(z))=\log(1-0.5z^{-1})+\log(4)+\log(z^{-1}+\frac{j}{2})+\log(z^{-1}-\frac{j}{2}))-\log(1-0.8z^{-1})-\log(1+0.8z^{-1})$$

Is this apporach right? If so, how do I go on? Any help is appreciated. Thanks in advance!


texts:
I need to improve my model of Convolutional Neural Network (CNN). The goal is to recognize facial expression.
I've been using some strategies like dropout for regularization and Adam optimazer, but i can get a good accuracy. Therefore I'm trying to implement PCA.
I use to filters for convolution, max pooling after each one and relu for activation. The highest accuracy i could get was 0.6.
I am working with Tensorflow. How can I do that?
Or there is another way to implemente pre-training to a CNN.
Thanks in Advance


texts:
OpenCV library offers a fisheye calibration method. I have looked at the code and looked at some papers and still don't understand how it works completely. The reason why I am interested is following:
I implemented the CV calibration and can calibrate my lenses fine other than the reprojection error. The reprojection error I get is 0.5px. I wish to know what I need to do change to go in the direction of further decreasing the error. And also how to go about reproducing an optimal calibration. There are many variable parameters. Like whether to use the chessboard or the blobs. Then the amount calibration images and the amount of points on the target along with their position and the target tilt. As the algorithm is doing some polynomial fitting the design of experiment comes to mind as well. So what can be optimized? What is the best algorithm and so on.
Anyways, some stackexchange user mentioned getting the reprojection error routinely down to under 0.1px.
I wish to get an error that small as well and to be able to write down and explain the method and its limitations. Maybe there is another more precise library or algorithm.


texts: What do triangles mean in frequency aliasing depiction?

texts: How edges of the triangle get on both sides of fs? What is their purpose? Why fs in the center? (from Lyons Understanding DSP)


texts: What is the difference between neural network and deep neural network. an example thank you

texts: What is the difference between neural network and deep neural network in speaker recognition .Can i have  an example of code sur Matlab thank you


texts:
OCR is a quite an old subject in Image Processing & Vision. However, the most literature that I had come across 1, 2, 3 shows various matured techniques which I am sure will give some good results in document processing.

Unfortunately, most OCR begins with document and that's when its utility gets limited. If you look at more generic scenario when a person goes to airport figures out where the sign board is and "reads" the signs board; now if we want to get a robot to achieve something like this, how does one go about achieving this?

Is there a more generic "text recognition" systems and algorithms?


texts: How do you alter the phase relationship between I and Q in a quadrature signal?

texts:
I am collection a quadrature signal from a radio.  The I and Q signals go through a sound card at a sample rate of 192000, and then a FFT is performed on the signals.
Due to various reasons, the signals are shifted slightly from the 90 degree phase difference and need to be corrected at some point. How can one go about doing this?
Thanks for your help.
Tom


texts: Assess quality of a bandpass filter without human intervention

texts:
I wanted to know if there is a way to assess the quality of a bandpass filter created by the Remez exchange algorithm. I am using the Remez algorithm to determine the best bandpass filter at a number of different sample frequencies and numbers of coefficients and was wondering if there some easy way to assess the quality of the bandpass filter created without just looking at it's frequency response?

I want to be able to iteratively explore the parameter space and return the sample frequency and number of coefficients that produce the best band-pass filter. I am aware that there is not an objective "best" filter, by "best" I mean the filter that best matches a certain specification.


texts: What Is the Difference between Parseval's Theorem and Plancherel Theorem?

texts:
Wikipedia gives Parseval's theorem as follows. Parseval's Theorem

  ,     is the Fourier transform of x(t).

And Plancheral's theorem is given as

,

where  is the fourier analog.

Plancheral theorem wiki link

Both look similar to me. What exactly is the difference between the two?


texts:
On many websites, including MathWorks, it was suggested to normalize the fft spectrum (MATLAB or numpy) by dividing it by the total number of samples ($N$). For a sinusoidal signal, for example:

$$x(t)=5cos(2\pi f_0t)$$

This produces a two-sided spectrum peak at $f_0$ with a peak amplitude of 2.5. However, that's not the result of the exact fourier transform, which should be:

$$X(f)=2.5(\delta(f-f_c)+\delta(f+f_c))$$

That is, I expect the amplitude to increase as the frequency bin shrinks (with the total area remaining at 2.5). That is not the case if I normalize with respect to $N$. If I normalize instead with respect to the sampling frequency ($F_s$), then it works out for the sinusoidal signal. The total power density is obviously finite ($P=\frac{1}{T}\int_{0}^{T}x(t)^2dt=12.5$); but the numerical power spectrum (unit^2/Hz) will have varying results depending on the bin size.

Questions:

Can I assume that the division by sampling frequency normalization would be more physically relevant for vibration analysis, if I want to extract things like $g^2/Hz$?
If my signal is a finite sum of sines, what's the best way to visualize the power? I would expect the power spectrum to vary again with the total sample time (i.e. not very useful).
If I assume all continuous signals can be represented by fourier series, how come non-sinusoidal signals have finite and well-defined power spectrum?


texts: Multirate Signal processing for matching DAC of the SDR

texts:
I have been breaking my head for a long time. Please help with this..any input would be helpful!

I am trying to implement a OFDM system using SDR (USRPN210 for Transmitter and USRP2 for receiver) using Simulink and my laptop (core i5).

Baseband specifications:
OFDM signal sample rate = 25.6MS/s
No. of samples in one frame = 10880
duration of one ofdm frame = 425e-6s
signal bandwidth = 25.6MHz
Used bandwidth is 22.4MHz

USRP specs:
DAC Master clock rate (fixed)= 100MHz
Interpolation factor = ??

As far as I have understood, I have to design a multirate system which converts 25.6MS/s to a sample rate which is a factor of the master clock rate i.e. 100MHz. And give the factor as the Interpolation factor.

For example, convert 25.6MS/s to 25MS/s and give interpolation factor as 4, so it matches with the 100MHz(25*4). However this causes Underrun. So I need to increase the interpolation factor and decrease the input baseband sample rate.

My problem is how to design a downsampler which will reduce the 25.6MS/s to a lower sample rate without loss of data.?


texts: In the convolution equation $y(n)=x(n)\circledast  h(n)$ if two things are given like $y(n)$ and $x(n)$ then how can find the $h(n)$?


texts:
I want to know about Kalman Filter but i tried searching different links including Electrical Engineering StackExchange but the information available there was hardly digestible.

All I am able to understand is that Kalman Filter is an estimator / predictor of future state of any system ,based on a model that is formed by previous measurements / readings.

So please kindly explain in simple words, what is Kalman Filter? What are its applications in Signal / Image processing and how is it different from other filters like Low pass, high pass etc?


texts: Scipy fourier transform zero frequency spike (from DC offset) - de-meaning and hanning window have no effect

texts:
I am trying to plot the FFT of essentially a random signal that has a non-zero mean shown below.

The FFT of the signal is peaked over the zero frequency which usually indicates a DC offset. Although I have already demeaned and applied a hanning window to the data.

I am not sure what I am doing wrong here. I have also tried plotting from [1:] to ignore the zero frequency and applying a highpass filter which have had no effect. My code is below.
# a = signal.detrend(hhe_trim[0].data, type='constant')
a = hhe_trim[0].data.astype(np.float64)
a -= np.mean(a)

win = signal.hann(174001)
dt = 0.01
n = 174001

X = fftpack.fft(a*win, n=n)
freqs = fftpack.fftfreq(len(a), dt)
plt.plot(freqs, np.abs(X))
# plt.yscale("log")
plt.show()

My data has 174 001 samples and a sampling rate of 100Hz. Any help would be appreciated!


texts: Confusion regarding lacunarity of koch curves with same fractal dimension but different orders

texts:
I'm trying to use the concept of lacunarity to classify images, as per how a few research papers have done it. To verify whether my equations and implementation are correct, I'm trying to verify the output of my program - for images with same fractal dimension, lacunarity is inversely proportional to the denseness of an image - denser the image, lower is its lacunarity.

For example, if I plot two triangular Koch curves, one with order 4 and another with order 6(order meaning iterations), both would have the same fractal dimension. Then you would expect the image with order 4 to have comparatively higher lacunarity since its less dense.

Now, after computing the lacunarity, there are two possible plots you can get - non-normalized and normalized lacunarity. When I plot the non-normalized lacunarity, I get the correct output - the order 4 curve has higher lacunarity. Whereas when I plot the normalized lacunarity, the plots exchange their positions and the order 6 curve ends up having higher lacunarity which seems incorrect.

The research papers that I'm referring are only using normalized lacunarity in their applications. I'm not sure where am I making an error.

Lacunarity is defined as follows -
For a m x n binary image, you define box size r, where r ranges from, for example, from 1 to 100.
Lacunarity is defined for every r. For a given r, it is computed as the ratio of (A+B)/B
Where A = Variance of X
B = Square of the mean of X

Where X = no. of 1s within a box of size r x r. So you compute mean and variance over all possible boxes of size r x r in the m x n matrix. Then r is varied from 1 to 100 for example, and hence lacunarity value is computed for 100 values of r, after which you can plot lacunarity.

Normalized lacunarity is obtained by dividing Lacunarity[r] by Lacunarity[1] for all r.

So I need help with 2 questions:
[1] Am I making an error in the concept of lacunarity being inversely proportional to denseness, or is it that I'm making some mistake while plotting normalized lacunarity itself?

[2] Is there a way I can verify that I am implementing lacunarity calculation correctly? For example, if there are standard images whose lacunarity plots are well known. I can plot lacunarity for those standard images and verify that I am getting a similar lacunarity plot.


texts: Minimum length of windows and separable signals

texts:
I created a signal with lets say $\omega_1$ that is fixed at 1 bin in the FFT: $$A_1\cos(\omega_1t)$$

I was asked to find the closest $\omega_2$
to $\omega_1$ so that the signals $A_1\cos(\omega_1t)$ and $A_2\cos(\omega_2t)$ are separable.

I only know the ratio $A_1/A_2$ in dB and the $\omega_1$ that I chose.

$$s(t)=A_1\cos(\omega_1t)+A_2\cos(\omega_2t)$$

Now my questions are:

What is the minimum window length?
Number of points for the DFT?
What is the relationship (if any exists) between the ratio $\frac{A_1}{A_2}$ and the DFT points?


texts: Should I normalize my input vector when using a matched filter?

texts:
I am using a matched filter to recognize an audio sample within a noisy input stream by cross correlating my sample with the input array and checking if the maximum crosses over my threshold.

Currently my threshold is static and my input is not normalized, and my results are greatly affected by the gain of my input.

Should I normalize my input signal vector, or dynamically calculate my threshold based on the input gain? If either is a good choice, how would I go about implementing this?


texts: Why compressing a train of impulses in time domain produce a wide-spaced train of impulses in frequency domain and vice versa? i want to know the intuition behind that.


texts: How is downsampling and low-pass filtering done in MS-SSIM?

texts:
I am just studying the Multiscale Strutural Similarity measure for image quality and going through the original paper [1].

I think I understood the basic ides and "regular" structural similarity, but could someone clarify on how downsampling is done and which low-pass filter is applied when computing the MS-SSIM?

[1] Wang, Zhou, Eero P. Simoncelli, and Alan C. Bovik. "Multiscale structural similarity for image quality assessment." The Thrity-Seventh Asilomar Conference on Signals, Systems & Computers, 2003. Vol. 2. Ieee, 2003. Available online.


texts: Calculating the number of MACs in a system

texts:
I want to calculate the number of MACs. I am looking for the method.

How would I do it if I know the domain equations from a biquadratic digital filter. I have already calculated the Z domain equations, i know X(z), Y(z) and already calculated my zeros and poles, I also have all the A and B values.


texts: Clear examples of Fixed Point Algorithm Specification Block Diagram for FPGA Implementer

texts:
I have been working on converting a simple, floating point algorithm to fixed point and need to create a block diagram to help the guy who will implement this on an FPGA.  As often is the case, the output can be represented as a linear combination of (the real and imaginary parts) of some input signals.
I would like to create a clear block diagram that shows bit-widths, rounding vs truncation, saturation at each point, bit shifts (due to multliplying integers with fractions) etc. (Do you use Qmn notation in the diagram?). Most of what I've seen online is either so detailed with HW registers, etc that I can't actually tell what's going on or so high level, that it's essentially a conceptual representation of the algorithm with some annotations containing bit widths.
While I recognize that there is no one right answer, I'm curious to know how others create good diagrams to hand the algorithms off to implementers.
Thanks.


texts:
The continuous-time Fourier Transform (CTFT) of a signal $x(t)$ (with unit $unit$) is:

$$X(\omega)=\int_{-\infty}^{\infty} x(t)e^{-i\omega t}dt$$

which should be in $unit\cdot sec$ or $\frac{unit}{Hz}$.

The Energy Spectral Density (ESD) of $x(t)$ is defined as:

$$P(\omega)=|X(\omega)|^{2}$$

which should have unit $\frac{unit^2}{Hz^2}$. But that doesn't seem right and certainly doesn't jive with the textbooks.

So what gives?

This question has also been asked here: Power Spectral Density computation and units, but I found the answers unsatisfactory.


texts: breaking the input signal into segments while calculating DFT

texts:
Im reading a book about DSP and there is an example about investigating the sound that travel through the ocean. The sound was recorded as the time-domain signal and they tried to analyze it in frequency domain.

The input signal was broke up into 256 point segments. Each of these segments is multiplied by the Hamming window, then run through a 256 point DFT. The resulting frequency spectra are then averaged to form a single 129 point frequency spectrum. Please take a look at the figure

I don't understand:

How they break up the input signal into 256 segments?
How each segment was multiplied with the Hamming window?
How they calculate 256 DFT points?
How the frequency spectra was averaged?


texts: Question about a transient response statement (Oppenheim-Schafer"s discrete-time signal processing book, 3rd ed)

texts:
This is the statement from the book:
Eq. (129) only ensures that $y_t[n]$  will be bounded  for all values of $n$.
For example, this may include a case where $y_t[n]$ oscillates
and hence never becomes small. Hence, it is not clear how one can conclude that the transient response must become increasingly smaller as $n\to\infty$ when Eq. (129) is satisfied.


texts: What is the difference between (Sample Timing Offset), (Carrier Frequency offset), and (Sampling Frequency Offset)?

texts:
Briefly, can anyone explain to me what is the difference between (Sample Timing Offset), (Carrier Frequency offset), and (Sampling Frequency Offset)?

and is Sampling Frequency Offset (SFO) like STO or like CFO?
I found that some papers say SFO is STO, while others say SFO is like CFO so I am a bit confused!
I would appreciate it if someone explains CFO, STO, SFO
thanks in advance


texts: Difference between transfer function and frequency response?

texts:
AFAIK both represent the ratio of the output response $Y(j\omega)$ to the input excitation $X(j\omega)$:

$$H(j\omega)=\frac{Y(j\omega)}{X(j\omega)}$$

Are there any difference?


texts: How to window a time domain signal for 6 symbols with cyclic prefix length of 512 samples?

texts: Based on LTE stds. I am running a simulation for 6 symbols (each having 1200 central subcarriers) each in a 2048 FFT/IFFT bin. To these symbols are appended 512 samples as cyclic prefixes. I have to window each symbol to see the impact on OOB. How do i window them ?


texts:
I have to write some simple examples in Matlab which use spectral subtraction. These examples will be included in a paper to help a friend understand spectral subtraction. But I don't know where to start with spectral subtraction ?
Please, explain the technique and maybe give me some tips for what can I do with this method in Matlab. Some snippets of code would be very useful for me as I am not an expert in Matlab.


texts:
I have a waveform containing

voice
some children screaming
some times when there is no noise at all
some times there are cars driving by when talking

I want to detect the start and ending times of the loudest voice or the areas in which the same speaker is talking to cut them out.

What I did was a FFT on the waveform to realize that voice means there is(in a small time unit of a few ms) always a high amplitude at the base frequency to be followed by equidistant frequencies, being apart in the integral multiple of the base frequency.

But this also applied to some noises.

The goal is to detect voice and cut the parts containing voice out(ie. keep them) with all background sounds. It is not about only having voice but finding out where voice is and cutting it out with all cars children or whatever was surrounding the microphone while recording. The problem is that I get many false positives when music(no voice) is being played or some squealing sound can be heard.

What is a better approach to filter out the times voice is at in a wav file with these given features?


texts: z-space replaces multiplication with convolution and frequency eigenvectors

texts:
The frequency domain is allegedly preferred because it replaces convolution of complexity $n^2$ with a diagonal matrix multiplication. Yet, I see that in z-domain we have multiplication of polynomials, $(a_0z+a_1z^{-1}+a_2z^{-2}+\ldots)(b_0z+b_1z^{-1}+b_2z^{-2}+\ldots)$, which is, despite its name, is nothing more than convolution with $n^2$ operations: you need multiply one polynomial with every term of the other and combine the terms. This looks like square convolution matrix rather than diagonal one. What is the benefit?

In this regards, I recalled my old question: why nobody speaks about eigenfunctions of the s- and z-domains? Everybody speaks that transfer function is linear and diagonal in the frequency (s- and z-domains). But, when you speak about linear operators, you must bring up their natural basis, especially when speak about diagonalization. How do eigenvectors look like in the Laplace and z-domain? What is the basis of this domain? Might be you do not need to prove the convolution theorem then?


texts: How I can perform SIMO channel convolution in MATLAB

texts:
In OFDM system, I need to transmit a signal $x$ in SIMO channel $H$ of  single Tx antenna and $4$ Rx antennas. The initial equation for that convolution is $r = Hx + n$ where $n$ is the noise.

As known, in OFDM, after serial/Parallel conversion with dimension $(Number of subcarriers, Number of symbols)$, we perform the $IFFT$ and then add Cyclic prefix. Than, P/S conversion in order to do convolution between signal and channel. In case if we are using SISO system, we perform in $MATLAB$ the command $conv(H,x)$, regardless the dimensions in length of channel and transmitted signal,  but the problem I'm facing now, what's about if we are using SIMO channel? the convolution operation should be replaced by product since we have matrices, as mentioned,  $r = Hx$

Below is the code, the issue is in the last line, how can I get the received signal $r$ in case if $H$ and $x$ don't have similar dimensions to do the matrices product operation?

clear all;
clc;

    N = 128;       %Number of subcarriers
    P = 32;        % CP length
    Q = N + P;    % subcarriers + CP
    AA = 1000;     %number of symbole
    M = 15;        % IR order
    p = 4;         % # of Rx antennas

    sn=sign(randn(N,AA))+1i*sign(randn(N,AA));     %generate a signal ()
    xn=ifft(sn);   %    FFT
    cp(1:P,1:AA)=xn(N-P+1:N,1:AA);                  % Get CP
    x=[cp;xn];                                      %Add cp into signal
    H = (randn(p,M+1)+1i*randn(p,M+1));            % randum channle (4x16)
    r = H*x;                                       %% The received signal should be conv(H,x)


texts: Modeling ADC in Active Noise Cancellation

texts:
I'm tinkering in Matlab with a problem that's very similar to active noise cancellation.  In the literature, the secondary path is described as the transfer function from the output of the adaptive filter to the error input sensor.  The algorithm needs to model this path to obtain good results.

However, there is also the transfer function from the noise source to the adaptive filter.  The ADC will always have some transition band below the Nyquist rate.  When I simulate the ADC in Matlab, the adaptive filter tries to invert the ADC response as well as model the system I'm trying to cancel.  In fact, if the system is purely a delay, this is exactly the inverse system identification problem.

In some applications, the ADC can be ignored because the signal may already be digital, but I don't think that is ever the case with ANC.  Why is this not mentioned as being a problem?  Is it because, in practice, the impulse response of the ADC is short compared to the system response?


texts:
What is the best possible runtime for extracting SIFT keypoints and Descriptors?
I know it depends on #keypoints extracted. So, say for image of size 640x640, the code that I have been using requires around 3 seconds for description of ~2000 keypoints.

What is the best runtime achieved and how (on similar grounds)? How can I make it run in realtime?
Is hadoop with 100 clusters a solution?


texts: Construct IFFT from only the major frequencies of an input signal?

texts:
I have data which when plotted looks like the green line in the below image. The data is from the walking-motion of a reinforcement-learning-model in a simulation and therefore the values do not really correspond to time. But the  dataset is 10000 steps long. I used the steps as the time variable. This is just a part of the plot.

To me the signal looks like a periodic signal with a lot of noise. Therefore my idea was to use Fourier Transform to identify a few underlying main frequencies and then simplify the signal. Thus cancelling out the noise.

I create the FFT like this:

s = ppo2_df['obs_4'].values

fft = np.fft.fft(s)
T = 1           # sampling interval
N = s.size

# 1/T = frequency
f = np.linspace(0, 1 / T, N)

plt.figure(figsize=(20, 5))
plt.ylabel("Amplitude")
plt.xlabel("Frequency [1/Step]")
# plot only half the spectrum
barlist = plt.bar(f[:N // 2], np.abs(fft)[:N // 2], align='edge', width=0.001)

max_inds = np.argsort(np.abs(fft)[:N // 2])[-5:]
for i in max_inds:
    barlist[i].set_color('r')

plt.show()

Next I try to reconstruct the signal from the FFT using IFFT using the 5 strongest frequencies discovered. My issue is that the eventual plot does not fluctuate around 0 like the original plot but around 0.4 instead. I don't know the mistake I must have made:

# filter n max amplitude frequencies
max_freq = f[max_inds]
max_fft = np.zeros(N)
max_fft[max_inds] = fft[max_inds]

x = np.fft.ifft(max_fft)
fig = px.line(y=np.abs(x[:1000]))
fig.show()

Can you tell me what I did wrong? (e.g. I am unsure if i chose a sensible sampling interval T = 1)

EDIT:

The data can be copied from here:

https://justpaste.it/3st5t


texts:
Considering the following problem, What i know to convert from LP signal to BP signal is to:

Draw the FD of the LP equation
From it I can draw the FD for BP
From this graph I can deduce the equation of the BP signal.

My problem here is that the equation has an Imaginary value, so how can i plot this equation and how can i deduce the graph of BP signal from it؟
because i searched and i found results about Hilbert transform and imaginary odd symmetry but i didn't figure that out.


texts: Why are we still using Continuous Time Fourier Transform when we have Laplace Transform?

texts: I've read that Laplace Transform is more versatile and can cover a broad range of signals compared to Continuous Time Fourier Transform. Then why are we still using Continuous Time Fourier Transform ?


texts: Unstable plant transfer function identification

texts:
I would like to find the transfer function of an unknown unstable SISO plant.

If it was a stable plant, I would input a sine sweep and measure the frequency response at the output; but I cannot do this since the plant is unstable.

I use a controller to get a stable closed-loop.

Methods I have tried:

Sine-sweep at the input of the stable closed-loop. Problem: I have trouble extracting only the plant (without the controller) from the closed-loop transfer function.
Add a sine disturbance (at different frequencies) at the controller output, and then estimate the gain of the transfer function from the input of the plant to the measurements of the plant by dividing the peak-to-peak of each signal, and the phase by calculating the time between the input's peak to the measurements's peak (for each frequency).

This method takes a lot of time since it requires re-tuning the controller gains for different frequencies. Otherwise, with high gains at low frequencies, the input disturbance is attenuated, or with low gains at high frequencies, the output is saturated/unstable.

Also, this method gives periodic but non-sinusoidal signals. I'm not sure I'm calculating the gain and phase of the plant transfer function correctly in this case.

I have two questions:

Is the second method correct?
Is there a better way to find the transfer function of an unstable plant?


texts: Frequency of a periodic signal with distortions

texts:
I would like to evaluate frequency of some unstable periodic signal coming from a detector:

The signal is registered continuously and may or may not be present (i.e. be periodic). The frequency and amplitude of the periodic signal can change but stays in some certain range. The shape of the periodic signal is more or less the same as shown on the second image. It may sometimes have distortions of higher amplitude and frequency.

I need to check 1) if there is a periodic signal and 2) what frequency it has.

Is there any good way to do it?

Edit 1:

I am not sure if FFT is reliable in this case. What do you think?

Frequency spectrum for all data points:

Spectrum with last 512 points

The spectra were calculated using Octave (online) based on example from Matlab site

N = 512; % length(all_data)
x = all_data(1:N);
Fs = N;
xdft = fft(x);
xdft = xdft(1:N/2+1);
psdx = (1/(Fs*N)).*abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:Fs/length(x):Fs/2;
plot(freq,10*log10(psdx));


texts: Why is my resonance phase lag discontinous?

texts:
I am programming a phase-locked loop to track the resonance of a tuning fork so that the tuning fork is always on resonance. This will be used in condensed matter physics through atomic force microscopy.
Now, I am not certain about how to carry this out, so I was wondering if someone here could help me.
I have programmed an FPGA to output an arbitrary driving voltage, and this drives a tuning fork. This tuning fork then generates a signal that is eventually converted to a voltage and read by my device. Now, I also have a lock-in amplifier to detect the phase lag between my DAC (technically, the NCO that outputs via DAC) and ADC signals. I have made a graph of the phase difference after taking 4000 steps around the resonance frequency. Also, there is a graph of the LIA's detected magnitude*2.
I do not know what any of the transfer functions are, I apologize.

Phase difference (phase lag) graph on left. Resonance centered at 32.7635 kHz

However, my phase difference graph is likely incorrect. I found the following that displays continuous "pretty" graph that may be what I am supposed to have.
Phase lag in blue
Does anyone know why phase graph has a max/min of 1/-1? If so, does anyone know how I may fix it?
Thank you


texts: Why Would Pre Filtering Measurement Data Affect the Least Squares Estimate?

texts:
In estimating parameters in a discrete time model I've often seen the use of filters applied to the input data, before its applied to least squares processing. I've been told that the filters are useful if one wishes to remove bias or high frequency noise that's not considered a part of the model.

But I'm currently working with a problem where I'm using the Moore Penrose pseudoinverse to calculate the least squares. I'm filtering the input data with a lowpass filter to remove high frequency noise well beyond the model dynamics, but the choice of the filter pole seems to have a significant affect on the outcome of the estimate. And in any case the residues are near zero (they don't seem to be better or worse according to pole selection).

How should one chose to filter input data, and should it affect the estimate?


texts: How do I compare 2 audio files, returning a percentage of difference

texts:
Is there a way to compare 2 audio files, whereby a percentage of difference will be returned?
I am using C# VS08, .net framework 3.5.

Edited: difference in the sound (like for eg. Audio 1: "HELP", Audio 2:"HELP ME PLEASE", it will return the difference in percentage between this 2 audio.)

I am currently saving recorded files in wav format, and its bit rate and quality will also be the same as what will be recorded and compared against. I wish to ask if there is a way to compare the sound (not just the binaries) in 2 audio files of the same properties and same format (WAV), and show the percentage difference between the 2 sounds in the 2 audio files.

Help will be greatly appreciated.


texts: Parametric EQ vs multiple bandpass filters

texts:
Will filtering a signal through multiple bandpass filters, where each filter is passed the complete signal, and then combining the output have the same result as a parametric EQ?

What if the signal is passed into a series of bandpass filters?

Are there any performance issues or optimizations that can be made when EQing a signal this way?

Update:

After reading the answer in this question which-filter-for-an-audio-equalizer it seems splitting the signal through a filter bank (in parallel) is the correct way.

The answer explains how the bands need to blend together to avoid audio issues, how is this calculated if each bandpass filter can have a varied bandwidth?


texts: How to create a single variable describing these peaks?

texts:
First, I would like to point out that I am a complete outsider to the field of signal processing, so please bear with me and go easy on the jargon :) I nevertheless decided to post here, because I believe your field has developed the best methods for the kind of problem I have.
I want to do a statistical analysis on a dataset. I have a list of subjects, and a measurement was taken for each subject multiple times over a time period. To do my analysis, I want to first transform my data from longitudinal, time-series data to one single number per subject that somehow describes the "peak" in the data, if there was such a peak. I would like your advice on algorithms that can be used to calculate such a number.

I am including some example data in a picture. In my layperson terminology, I would say that:

example A has a single peak around day 23, but it is not very "large"
example B has no real peaks, it is mostly a flat line with a bit of randomness
example C has one "large" peak on day 33 and one "smaller" peak on day 50-51

I would like the algorithm to be able to produce a number that maps the "largeness" of the peak to a rational number and goes towards 0 when there is not really a peak. I don't have a perfect definition of my "largeness" measurement, but it should combine

The steepness of the peak start. If this were an ideal mathematical function and not a noisy measurement, I would have taken the function slope
The absolute height of the peak (the first peak in example C is higher than the peak in A because it reaches 20)
The relative height of the peak. It has to be relative to the "typical" height of the measurement for that example (I'm afraid in my picture all the data has roughly the same "typical" height between 0 and 5, but in reality, I have examples where it differs between subjects) - I am not yet sure if I want to relate it to an average over all measurements or to an average over the measurements which are not part of a recognized peak, the second is probably more informative but the first easier to calculate
The duration of the peak - the first peak in C is a very short one, but the second one has a kind of a plateau.

If there is more than one peak per subject, I am fine with taking the highest peak. A stretch goal would be to be able to recognize multiple peaks per subject, but I would have trouble defining a threshold for "real peak" and "noise". Another interesting extension would be to be able to repeat the inverse of this and recognize the largest dip per subject, defined by the same criteria as above but going under the typical height instead of upwards.
I suppose these four criteria won't be doable in a single calculation - that's OK, I can imagine taking a weighted sum of them and being able to play with adjusting my own weights. But if you know of a better way, I am open to it.
To make the task a bit harder (well, it's real-world data), the measurements are not taken at regular intervals, the intervals vary even within a single subject, and the duration of measurement varies considerably between subjects. Also, I expect that there are no underlying patterns in the noise, cyclic or otherwise. On the bright side, I am not doing any real-time calculations and I expect no more than 500 subjects, so I can afford computationally intensive algorithms.
I don't expect a full mathematical explanation of the workings of the algorithm(s) here within an answer. But as I don't have an overview over the field, I would be very grateful for sketching the kind of approach I can take, with names of algorithms and ideally pointers to books or publications that describe these algorithms. Also, if there are other important factors which determine something interesting about a peak, I am interested to hear about them.


texts: Which of these signals have same Nyquist rate as $x(t)$?

texts:
The options are:

$x^2(t)$
$x(2t)$
Time derivative of $x(t)$
Convolution of $x(t)$ with itself

I guess, the Nyquist rate remains the same as long as bandwidth of $X(w)$ remains the same, as Nyquist rate = 2 * bandwidth.

The Fourier transform of the fourth option is $X^2(w)$. I think this has the same bandwidth as $X{w}$, because the zero terms outside of the bandwidth give zero squares. So this is correct

The third option: Derivative leads to multiplication by jw. So, again, jw(X(w)) is zero outside of the bandwidth of $X(w)$. So this is correct

Second option: i think it's incorrect, because scaling time domain also scales w domain, which changes badnwidth.

First option: This leads to convolution in the w domain. I think convolution does not preserve bandwidth. Because, say, for some k within the bandwidth, the term $X(k)X(w-k)$ goes outisde the bandwidth.

Is my work right?


texts:
Usually, in speech recognition, the techniques that are used are based on the linear prediction model (Fant, 1960).

Parallel to this, the human speech production mechanism causes energy to drop across frequencies resulting in less information in the acoustic model. Especially, higher frequencies will have less energy compared to the lower ones, thus, getting poor results with the linear prediction model.

To cope with this, a high pass filter is applied on the signal in order to enhance these components and obtain a much evenly distributed spectrum. This is called the pre-emphasizing step.

I am working with Essentia (essentia.upf.edu) a library for audio analysis. I am using a pre-emphasize filter which is given by:

$x′(t)=x(t)−\alpha\times x(t−1)$

I construct a filter with the following parameters:

numerator = [1 0]
denominator = [1, $\alpha$], where $\alpha$ = 0.97

which correspond to the parameters of the transfer function in the Z domain of the above filter.

The following figure shows the spectrum of an audio frame (512 samples) and its filtered version.

I have two questions:

I am not seeing much enhancement in the high frequency components of the filtered spectrum, so is it looking like an expected result of this step (pre-emphasizing)?
How can I find an optimal cut-off frequency to design a more accurate filter? Is there, for example, a more robust pre-emphasizing technique that readjust the value of the cut-off frequency according to the frequency distribution of the given spectrum?

Here is the source code:

import essentia.standard as std

loader = std.MonoLoader(filename='../../data/audio.wav')
audio = loader()
f = std.FrameGenerator(audio, frameSize=512, hopSize=128, startFromZero=True)
s = std.Spectrum()
w = std.Windowing(type='hann')

specs = []
for frame in f:
    specs.append(s(w(frame))

filter = filter = std.IIR(denominator=[1, 0.97], numerator=[1, 0])

plot(specs[100], label="spectrum")
plot(filter(specs[100]), label="filtered spectrum")
legend(loc=1, borderaxespad=0.)


texts: Obtaining Subpixel Resolution for Video Processing in Python

texts:
I am working on a video processing application to calculate distance between two points using opencv
Specs :
Linear Pixels - 1600.

FOV - 100 mm

Resolution per pixel  using above data : 62 micron

The application is realtime and I want to reduce the resolution by using subpixel mechanism.

Can you please suggest how can I reduce the resolution using subpixel mechanism in realtime?


texts: How to remove modulation frequency and its harmonics

texts:
I have amplitude modulated sound file signal and after demodulation using FFT I got fundamental frequency and its harmonics and of course noise.

How to remove that fundamental modulation frequency and its harmonics from spectrum using Matlab… any suggestion… m-file…?


texts: Transform linear-phase FIR to minimum-phase FIR

texts:
Given a FIR filter (non-causal) with phase zero and real coefficients given by $$H(z) = \sum_{n=-M}^{M}h[n]z^{-n}$$ with ripple $\delta_2$.

How can I obtain a filter $H_{{\rm min}}(z)$ of minimum phase of $M+1$ coefficients, from $H(z)$? How are those filter related (amplitudes, $\omega$, ripple)?

I know that if the filter is causal with real coefficients I can use this relation between the original filter and the minimum one:

$$H(z) = H_{\rm min}(z) H_{\rm ap}(z),$$

but in this exercise I can't.

What can I do?


texts: Whats the Correct Approach to Estimate the PSF of a Moving Detector

texts:
In lab, I did a bunch of scans using a radiation source and a detector. My source emits a gaussian beam (whose dimensions I know), and my detector is a uniform 7mmx7mm square. These are stationary and I run my sample between them as the image below shows.

(sorry for not translating, "Provete" means sample, "Fonte" means source, and the grey thing is an arm that holds and moves my sample)

The thing is, the sample moves in steps way smaller than 7mm (usually 0.25mm) so my final image is convolved.

I've been trying to deconvolute my images with the Richardson-Lucy method by trial and error using different PSF's but with no success. I've tried gaussian, quadractic, a cone, truncated gaussian, pyramid, sinusoidal, a convolution between a square and a gaussian, and some others but to no success.

None of my results appeared any sharper than my original image. All of these I've tried through a range of dimensions and parameters, so in total I've tried thousands of possibilities.

To make sure I'm not committing some basic mistake I tried convolving the picture of "Lenna" and deconvolving it and it works beautifully.

Is there a better approach to this? Are there any obvious PSF's I'm not seeing?


texts: i am simulating OFDM transmitter in matlab....As u all know OFDM consists of different sub systems such as FEC coding, Bit interlever , Modulator , IFFT block and Adding cyclic prefix.... i have integrated all the subsystems.. now i have to check the datarate of the complete OFDM transmitter...how to find the datarate of this system.... i am comparing Different modulation technique, in the sense am using qpsk, 8 qam and 16 qam modulations and have to compare the datarate of these modulation techniques...


texts: Discrete Fourier Transform on images using OpenCV

texts:
I applied DFT on an edge image (attached both). I expected the output image to not have very low frequencies (~0).[Refer this link for more info]
But the output I got consisted of low and high frequencies.
So is my understanding wrong or is there an problem with the code?
ICopy = np.uint8(I) # I is input image
edge = cv2.Canny(ICopy,180,200) # Edge detection

f = cv2.dft(np.float32(edge), flags=cv2.DFT_COMPLEX_OUTPUT) #Perform DFT
f_shift = np.fft.fftshift(f) # Shift 0,0 to centre
f_complex = f_shift[:,:,0] + 1j*f_shift[:,:,1]
f_abs = np.abs(f_complex) + 1 # calculate magnitude and value lies between 1 and 1e6
f_bounded = 20 * np.log(f_abs) # To scale down values
f_img = 255 * f_bounded / np.max(f_bounded) # Scale between 0 and 255
f_img1 = f_img.astype(np.uint8) # Format arary to print

figure(figsize=(10,10))
plt.subplot(121);plt.imshow(edge , cmap = 'gray')
plt.subplot(122);plt.imshow(f_img1 , cmap = 'gray')

[L] This is the Canny edge applied on an image(Lena). [R] The magnitude spectrum of the canny edge image


texts:
If we have one image from BSD (The Berkeley Segmentation Dataset and Benchmark) and for this images Ground truth, how to calculate PR?

PR is the ratio of true to false edges and can be calculated by the formula:

  PR = True Edges (Edge pixels identified as Edges)/False Edges (Non
  edge pixels identified as edges) + (Edge pixels identified as Non-Edge
  pixels)

How to find those arguments in formula?


texts: Partitioning the energy of a signal between its components

texts:
In physics, the total energy of a system is the summed energy of its component subsystems, and energy must be conserved, ie, adding the energy of the components gives the total energy.
In signal analysis (discrete time signals), one would expect that the energy of a signal would be defined in such a way that energy would again be conserved.  This would make it consistent with normal usage in physics.
There are many types of component analysis. In general, there is no requirement that the components are zero-mean or orthogonal, and in data-dependent component extractions, the components are not even predictable, but in all cases it is expected that they linearly sum to the original signal values.
This is incompatible with the usual definition of signal energy as the sum of the squared component values, since the component energies do not sum to the original signal energy.
This is confusing.  Is there another approach to defining the component energies that conserves energy but does not destroy the requirement that the linear sum of components must be equal to the original signal?


texts:
I have telephone audio at 16kHz and I am trying to use it with a speech transcription engine that converts spoken letters to text. However, the engine has some difficulty transcribing certain letters such as "p" and "t" due to the low quality of the audio.

This is being used in a real time application so although I would like the user to speak clearly, into the microphone in a quiet environment, this won't often be the case. The transcription engine has its own background noise removal however it isn't trained on telephone audio.

In light of my ignorance, I was hoping someone could make some suggestions on how to artificially "improve" the quality of the audio. I know this is vague but I would like to try and make the speech in the audio more discernable and experiment with the transcription engine.

Can I try and remove the static sound?
Is it possible to "amplify signals" that are unique to a certain letter?

Thanks


texts: Polyphase components Spectrum formula in Discrete time

texts:
I am trying to understand the meaning behind some of the components of the formula for polyphase components in discrete time. Note that $\Omega$ indicates discrete in this notation and the formula is given by:

Polyphase components is dividing the spectrum into blocks of size $L$ and each block divided into $k$ parts. If we remove the exponentials $e$ we have the formula for downsampling which makes sense since we are getting rid of the other polyphase components. The first exponential $e^{jk \Omega/L}$ seems to be the shift to move the index $k$ of the block of size $L$. However, I do not know what is the purpose of the second exponential $e^{-2\pi jkp/L}$

Thank you


texts: Applying frequency-domain filters on a centered Fourier transform

texts:
I understand why we shift the Fourier transform such that the 0-frequency is centered for visualization. In the shifted DFT(u,v) of an M*N 2-dimensional image,

the top-left corner of the 4th quadrant is (0,0) frequency or (low u, low v)
the bottom-left corner of the 1st quadrant, (M-1,0) or (high u, low v);
the bottom-right corner of the 2nd quadrant, (M-1,N-1) or (high u, high v); and
the top-right corner of the 3rd quadrant, (0,N-1) or (low u, high v).

Now, when we apply filters (centered again) on the centered DFT, aren't we changing both low and high frequencies closer/further to/from the center?

For example, the centered Gaussian high-pass filter is centered at M/2 and N/2, and supposed to attenuate only low frequencies (is it?). However, applying this filter to the shifted DFT will attenuate not only low frequencies, but also high frequencies in the 1st, 2nd, and 3rd quadrants.

I did a little experiment and can confirm this effect. Applying the centered Gaussian high-pass filter to a centered DFT was not equivalent to applying the non-centered Gaussian high-pass filter to the same non-centered DFT. I had to apply the filter three more times at each corner of the non-centered DFT to get the same result.

I couldn't find any good explanations why this (high-pass filter changing high frequencies around the center or low-pass filter changing low frequencies) is acceptable.

To simplify this question, let's take a one-dimensional image as example. The non-shifted DFT has the 0-frequency on the left edge while the M-1 frequency on the right edge. The shifted DFT has the 0-frequency at the center and the M-1 frequency right next to it on the left side. Attenuating this center in effect changes both the 0 and M-1 frequencies. This is different from attenuating the 0-frequency on the non-shifted DFT.

Thanks in advance!


texts: How to add a fake thermal effect to images

texts:
I am working on a project to convert a normal RGB image to thermal images. I applied color maps using Matplotlib library and got an array which then I converted back to the RGBA image using Image.fromarray() available in the PIL library.
Expected Output:

Actual Output

My code is given below:
from PIL import Image, ImageOps
import matplotlib as mpl
import matplotlib.cm as mtplitcm
import PIL
import numpy as np
from matplotlib import cm

input_image = Image.open("/Users/adwaitnaik/Desktop/github/blendpy/test_data_for_yolo/lion.png")
gray = ImageOps.grayscale(input_image)

gray.show()

#initialize the colormap
colormap = mpl.cm.jet

#normalize
cNorm = mpl.colors.Normalize(vmin=0, vmax=255)

#initialize the mapping
scalarMap = mtplitcm.ScalarMappable(norm=cNorm, cmap=colormap)

#create image array
image_array = scalarMap.to_rgba(gray)

#convert to numpy array
image_np = np.asarray(image_array)

image_np

#image_array
image_colored = Image.fromarray(image_np,'RGB')

image_colored.show()

This is the image I used as Input

Can anyone suggest a workaround?
Thanks


texts: What is the meaning of **Sample** in **Sample ACF**

texts: What is the meaning of Sample in Sample ACF (autocorrelation function)


texts:
Is this filter a BPF?
$$\dfrac{z}{z-a}$$

where $a$ is some complex number?

If we put a pole somewhere on the unit circle it will emphasise a certain frequency, is that right?


texts:
I'm sorry if my question might be simple, but I don't have a strong background on signal processing. I have a csv file of a 8 MHz bandwidth, sampled with a resolution bandwidth of 100 KHz. What I want to do is to compute the PSD over the 8 MHz bandwidth, but I'm not sure if I am doing this correctly.

For a "stable" signal, I multiply the received power over the 100 KHz sample, and then average it at the end over 8 MHz. Is that correct? Does this give me a rough estimation of the PSD?

Are there tools like octave or even python programming that can help in this process? I looked on the internet but didn't had luck.


texts: Relationship of Fourier Transform and Spatial Directivity Pattern

texts:
I am reading over and over the Section 1.2 of most  understandable mic array tutorial for me  .

A sound wave is dependent on time and space which can be observed in the great link.

But I can't understand why the Fourier transform of the spatially sampled data gives the directivity pattern of the microphone array (which can be seen in the section 1.3.2 of the first document)?

Is there any one who can describe this in more computer sciencist way?


texts: Discrete-time Fourier Transform of the unit step sequence $u[n]$

texts:
From text books we know that the DTFT of $u[n]$ is given by

$$U(\omega)=\pi\delta(\omega)+\frac{1}{1-e^{-j\omega}},\qquad -\pi\le\omega <\pi\tag{1}$$

However, I haven't seen a DSP textbook that at least pretends to give a more or less sound derivation of $(1)$.

Proakis [1] derives the right half of the right-hand side of $(1)$ by setting $z=e^{j\omega}$ in the $\mathcal{Z}$-transform of $u[n]$, and says that it is valid except for $\omega=2\pi k$ (which is of course correct). He then states that at the pole of the $\mathcal{Z}$-transform we have to add a delta impulse with an area of $\pi$, but that appears more like a recipe to me than anything else.

Oppenheim and Schafer [2] mention in this context

  Although it is not completely straightforward to show, this sequence can be represented by the following Fourier transform:

which is followed by a formula equivalent to $(1)$. Unfortunately, they didn't take the trouble to show us that "not completely straightforward" proof.

A book that I actually didn't know, but which I found when looking for a proof of $(1)$ is Introduction to Digital Signal Processing and Filter Design by B.A. Shenoi. On page 138 there's a "derivation" of $(1)$, but unfortunately it is wrong. I asked a "DSP-puzzle" question to have people show what is wrong with that proof.]

So my question is:

Can anybody provide a proof/derivation of $(1)$ that is sound or even rigorous while being accessible for mathematically inclined engineers? It doesn't matter if it's just copied from a book. I think it would be good to have it on this site anyway.

Note that even on math.SE almost nothing relevant is to be found: this question has no answers, and that one has two answers, one of which is wrong (identical to Shenoi's argument), and the other one uses the "accumulation property", which I would be happy with, but then one needs to proof that property, which puts you back to the start (because both proofs basically prove the same thing).

As a final note, I did come up with something like a proof (well, I'm an engineer), and I will also post it as an answer some days from now, but I would be happy to collect other published or unpublished proofs that are simple and elegant, and, most importantly, that are accessible for DSP engineers.

PS: I do not doubt the validity of $(1)$, I would just like to see one or several relatively straightforward proofs.

[1] Proakis, J.G. and D.G. Manolakis, Digital Signal Processing: Principles, Algorithms, and Applications, 3rd edition, Section 4.2.8

[2] Oppenheim, A.V. and R.W. Schafer, Discrete-Time Signal Processing, 2nd edition, p. 54.

Inspired by a comment by Marcus Müller, I'd like to show that $U(\omega)$ as given by Eq. $(1)$ satisfies the requirement

$$u[n]=u^2[n]\rightarrow U(\omega)=\frac{1}{2\pi}(U\star U)(\omega)$$

If $U(\omega)$ is the DTFT of $u[n]$, then

$$V(\omega)=\frac{1}{1-e^{-j\omega}}$$

must be the DTFT of

$$v[n]=\frac12\text{sign}[n]$$

(where we define $\text{sign}[0]=1$), because

$$V(\omega)=U(\omega)-\pi\delta(\omega)\Longleftrightarrow u[n]-\frac12=\frac12\text{sign}[n]$$

So we have

$$\frac{1}{2\pi}(V\star V)(\omega)\Longleftrightarrow \left(\frac12\text{sign}[n]\right)^2=\frac14$$

from which it follows that

$$\frac{1}{2\pi}(V\star V)(\omega)=\text{DTFT}\left\{\frac14\right\}=\frac{\pi}{2}\delta(\omega)$$

With this we get

$$\begin{align}\frac{1}{2\pi}(U\star U)(\omega)&=\frac{1}{2\pi}\left[(\pi\delta(\omega)+V(\omega))\star (\pi\delta(\omega)+V(\omega))\right]\\&=\frac{1}{2\pi}\left[\pi^2\delta(\omega)+2\pi V(\omega)+(V\star V)(\omega)\right]\\&=\frac{\pi}{2}\delta(\omega)+V(\omega)+\frac{\pi}{2}\delta(\omega)\\&=U(\omega)\qquad\text{q.e.d.}\end{align}$$


texts:
I have this signal:
$$x(t)=\sum \mathrm{rect}\left(\frac {t-kT_0} {20}\right)+\mathrm{rect}\left(\frac {t-kT_0} {40}\right)+\mathrm{rect}\left(\frac {t-kT_0} {80}\right)$$
with $T_0=140$, pass it through the filter $H(f)={\mathrm{rect}}\left(\frac f F\right)$.
What is the value of $F$ such that power is $P=1$?

Fourier Trasform is: $\sum C_n\delta(f-nf_0)$
$C_n=\frac 1 {T_0}[sinc(20nf_0)+sinc(n40f_0)+sinc(n80f_0)]$

if call y(t) the signal output, I have:
$Y(f)=X(f)H(f)$.

the power spectral density is:  $P(f)= \sum (|C_n|^2\delta(f-nf_0))|H(f)|^2$
 with  $P_x(f)=\sum (|C_n|^2\delta(f-nf_0) $
don't know find F

if don't error for n=0 $C_n=1$
 so for $0<F<\frac 1 {T_0}$ the power should be 1. but I'don't sure


texts: How to deal with overlap in STFT when considering the highest energy among multiple channels

texts:
I have a 4 channels audio file. As a pre-processing step, it goes through an STFT with $T$ frames and $M$ frequencies. The output is divided into magnitude and phase per channel, so for $C$ channels, we have a $T\times M\times 2\cdot C$ tensor.

I wish to focus on the channel with the highest energy per frame $T$. If the STFT had no overlap, I could simply take the highest energy channel per frame and concatenate to a single channel audio file. The $T$ frames, however, are produced by 50% overlapping windows.

In my case for example:

Audio length = 2880000

number of channels, $C$ = 4

Window Length = 1920

hop size = 960

number of FFT bins = 2048

number of frequencies, $M$ = 1024

Hence the output size:

$T = \frac{2880000}{960} + 1$ = 3001

How do I produce a single channel audio file, with the highest energy per window?

For reproduction:
I am using librosa.core.stft for the STFT  with a Hanning window.


texts: Variable Window Size of Blackman FIR filter

texts:
I am trying to implement an FIR filter with a Blackman window function. The solution I got for my signal filtering problem is to have different window sizes for certain characteristics of the input signal. My current solution uses a set of filters working in parallel and the output switches between them based on the input signal characteristics.
However, some discontinuities may occur in the output signal.
My question: Is there an efficient way to implement an FIR filter with variable (or adaptive) window size or this whole idea is unreliable?


texts:
Let $H(z)$ be the rational system function of an LTI system.
How can we show that $|H(e^{j\omega})|=|H(e^{-j\omega})|$?


texts: Pixel time series trend: What are the causes?

texts:
I have taken an video of the following static scene for 10 mins (3 frames/Sec); totally 1800 frames for 10 mins.

I also show here the pixel time series, that is, a set of values of a particular pixel say (1,1) for 1800 frames..

I could see a linear trend in the series. For some pixels the trend is increasing and for some the trend is decreasing. Due to trend, though the scene is static, there appears to be a small movement in the object. It is possible to de-trend it.

My Question is: what are the causes of this trend? I use a standard camera fixed on a immovable plane and I illuminate with light in order to photograph it.


texts: short time energy matlab code for audio feature extraction

texts:
Is there code in matlab for short time energy feature extraction in matlab??

I want to extract audio feature (Short time energy) using matlab code


texts: Why isn't this AM Demod GNU Radio flow graph working with different sampling rates?

texts:
I am trying to demodulate an AM signal in GNU Radio, and I am having problems with the sampling rates.  I will start off with an example where the flow graph was working. The sampling rate is 256kHz, and it works just fine:

Next, I tried a sampling rate of 192kHz, and then it didn't work.  Is there a problem with this flow graph?

Next, I modified the 2nd flow graph (changed the sampling rate, but didn't need to), and it worked almost perfectly, other than that the voice sounded very slightly too low pitch/slow.  This sampling rate suffered from the same problem as that of figure 2, however I tweaked the rational resampler block until the voices sounded normal.

As some background, I am running an RTL SDR (DVB-T) dongle, on an Odroid U3 (ARM architecture).  I have a "Ham it up" upconverter, so that the AM (810Kkz) is shifted up by 125MHz, into the VHF band that the dongle can actually receive.

UPDATE:  There were two issues with the flow graph:

The filter cutoff frequency needed to be calculated using normalized frequency (see MBaz's detailed answer).
The R820T chip does indeed, as MBaz ascertained in the comment section, have only a limited set of sampling rates that it supports.

In order for the flow graph to output natural sounding audio, it must use one of the acceptable sampling rates, and also have the proper filter setting.  The 2nd and 3rd flow graphs didn't work because they had the wrong sample rates.


texts: How to show that an ergodic process must be a strict-sense stationary one?

texts:
I have trouble to distinguish these two concepts namely ergodic process and strict-sense stationary process. I look at one of the books about the signal processing that says an ergodic process must be a strict-sense stationary one. So how to show this property?

Can anyone help??

Thanks,
Victor


texts: How do I pick an optimal window size for overlap add/save method algorithmically

texts:
Currently I've implemented an overlap-add method using resources on the internet, but I couldn't find a well documented way to minimize the cost of the method. In other words, how do I pick the window size so that the algorithm would work with the best performance possible? For now I use impulse response size and a constant multiplier to determine window size, but since the input signal size might vary, how to determine multiplier in relation to the input signal size?

My concern is performance, but the bottleneck is not addition, but the amount of performed FFT convolutions. Experimentally I found out that for each impulse response size there is an optimal window size, yet it varies. For example, if I pick 40000 samples of input signal and 128 samples of impulse response signal the optimal ratio between window and impulse response lengths is approximately 1:24.

It seems that Wikipedia suggests to use 1:8 ratio for both methods, as seen in the pseudocode of both overlap-add and overlap-save methods, then in the next section they provide measures of complexity for the methods, but I'm unable to wrap my head around how to utilize this information.


texts:
How get cross-correlation peak and based on it calculate correlation score for similarity of two audio samples. SO far I've

FFT two samples
complex conjugate second
multiply results
IFFT
cross-correlate with itself(autocorrelate)

Thanks for any advice


texts: How is the DTFT of a periodic, sampled signal linked to the DFT?

texts:
I am trying to understand the connection between FT, DTFT and ultimately the DFT. But I am failing to link the DTFT to the DFT.
This is how far I am getting: Say I have a function $f(t)$, and its Fourier Transform $F(t)=\mathcal{F}\{f(t)\}(\nu)$ defined as $F(t)= \int_{-\infty}^{\infty} dt \, f(t)\exp(-i \,2\pi\nu t)$. Lets then say we have ideally sampled the signal at time intervals $\Delta T$ like so:
$$\bar{f}(t)=f(t)\sum_{n=-\infty}^{\infty} \delta(t-n\Delta T).$$
I understand that the FT of this signal leads me to the DTFT:
$$\bar{F}(\nu) = \mathcal{F}\{\bar{f}(t)\}(\nu) = \sum_{n=-\infty}^{\infty} f_n \exp(-i\,2\pi \nu n\,\Delta T), \, f_n = f(n \, \Delta T)$$
I also understand that $\bar{F}(\nu)$ is linked to the (continous time) Fourier Transform via:
$$\bar{F}(\nu) = \frac{1}{\Delta T}\sum_{n=-\infty}^{\infty}F\left(\nu - \frac{n}{\Delta T}\right),$$
which is a periodic function with period $1/\Delta T$. If $f(t)$ is bandlimited then the values of the DTFT at discrete frequencies $\nu_m = m/M \cdot \Delta T, \, m=0,1,...,M-1$ will give me a value proportional to the FT of $f$ at these frequencies. I also understand that I only need $M$ samples in Fourier space due to the periodicity of $\bar{F}$
Where I am struggling is to understand how to get from here to the DFT. I'll plug the discrete frequencies into the DTFT above and I further assume that the sequence $f_n$ is $M$-perdiodic such that $f_{n-kM}=f_{n}, \, k\in \mathbb{Z}$. Following this wiki article I write:
$$\begin{eqnarray}
\bar{F}(\nu_m)=\bar{F}_m &=& \sum_{n=-\infty}^{\infty} f_n \exp\left(-i \,2\pi \frac{m}{M}n\right) \\
&=& \sum_{k=-\infty}^{\infty} \left(\sum_{n=0}^{M-1}\exp\left(-i \,2\pi \frac{m}{M}n\right) f_{n-kM}\right) \\
&=& \sum_{n=0}^{M-1} \exp\left(-i \,2\pi \frac{m}{M}n\right)  \sum_{k=-\infty}^{\infty}f_{n-kM}
\end{eqnarray}$$
The wikipedia article then calls the inner sum $\tilde{f}[n]$, which leads us to the DFT. But I fail to see how this infinite sum of a periodic series relates to the cyclic extension of a finite series. I just don't see it.
I know that this topic is a perpetual source of confusion for people and we have excellent answers e.g. here, here, and here. But I don't quite get it yet.


texts: Neural network with much less positive examples

texts:
I am developing a medical algorithm working on large amounts of data. However, as in many medical scenarios I have a lot of negative example and only a few positive ones. So any neural network I train is clearly biased towards negative classification. In fact it misclassifies most positive examples and although overall accuracy is OK, false negative rate is sky high.

I wanted to know what is the best way to make the network achieve lower false negative rate, I thought about duplicating the positive examples several times or maybe reducing the negative examples randomly,
What do you think?


texts: Matlab freqz and custom implementation differences

texts:
I am making some homemade tools on Matlab. I made function that plot the frequency response of a discrete transfer function (just like freqz does). When I compare my result with the result from freqz, I get something very similar, but not exactly the same.

Can somebody see why ? I am a little confused here.

Observations

I first thought it was related to frequency warping, but when I
applied warping on my frequencies, I got a similar result.
We also see that the phase does not wrap correctly, it passes from -179.3 to 180.7 (instead of a perfect -180 - 180);

Graph

Code

function [h,f] = py_freqz(b,a,fs,n)
%make sur both polynomials are same size
if (length(a) > length(b))
    b = [b, zeros(1,max(0,length(a)-1))];
elseif (length(b) > length(a))
    a = [a, zeros(1,max(0,length(b)-1))];
end
p = roots(a);
z = roots(b);

precision = fs/n;
w = linspace(0,pi-precision/2,n);
f = w/pi*fs/2;
h = ones(1,n);
phases = zeros(1,n);
unitcircle = exp(1i*w);
%Zeros
for k=1:length(z)
    v = unitcircle-z(k);
    h = h .* abs(v);
    phases = phases + angle(v);
end
%Poles
for k=1:length(p)
    v = unitcircle-p(k);
    h = h ./ abs(v);
    phases = phases - angle(v);
end

h = h * b(1);   % Input Gain

subplot(2,1,1);
xlabel('Frequency [Hz]');
ylabel('Magnitude');
plot(f,10*log(h));
grid on

subplot(2,1,2);
xlabel('Frequency [Hz]');
ylabel('Phase');
plot(f,phases/pi*180);
grid on
end

I generated the above graph using

py_freqz([0.09247185865855016 2*0.09247185865855016 0.09247185865855016 ], [1 -1.5668683171334845 0.9367557517676852], 1000,1000);


texts: Implementing real-time variable fractional delay line in Matlab

texts:
I am attempting to implement a fractional delay line in Matlab which operates in real time, uses an object-oriented approach, and whose length can be modulated each time a sample is processed. I have already successfully implemented a fractional delay line, but I am having some trouble with the modulation step.

Below are some graphs of my current output:

As you can see, discontinuities occur when the current position approaches a part of the buffer which has not been encountered yet, due to the changing length of the buffer. I am wondering if anyone may know of a way to smooth these discontinuities out. My delay line uses linear interpolation at the moment, and I was thinking of using the first-order all pass filter interpolation method instead, but I am not sure if that would help at all, so I wanted to seek some advice first.

The end goal is to have this be a flanger effect for audio, so if anyone has expertise on this particular topic it would be greatly appreciated.

Some specifics for graph interpretation:

LFO period: 2 seconds
LFO shape: triangle
Base delay time: 8 ms
Max delay time: 18 ms

Process function for delay line:

function xDelayed = process(obj, x, L)

    % Current position index
    i = obj.currentPos;

    % Modulate delay time
    L_int = floor(L);
    obj.bufferLen = L_int+1;
    obj.delta = L-L_int;
    obj.delayLen = L;

    % Output delayed sample
    if i < obj.bufferLen
        xDelayed = obj.delta*obj.buffer(i)+(1-obj.delta)*obj.buffer(i+1);
    else
        xDelayed = obj.delta*obj.buffer(i)+(1-obj.delta)*obj.buffer(1);
    end

    % Save current sample to buffer
    obj.buffer(i) = x;

    % Increment delay line or go back to beginning if currently at
    % last position
    if i >= obj.bufferLen
        obj.currentPos = 1;
    else
        obj.currentPos = i+1;
    end
end

Any advice on how to handle these discontinuities or improve my implementation would be greatly appreciated. Thank you, and please let me know if you need any additional information. I apologize if what I posted here is not sufficient.


texts: How to measure the quality (or difference in quality) of different images?

texts:
I would like to measure the quality of a color image, possibly as a difference to another image, but if possible, on its own too.

This question comes from the fact that we have a vision application, and improve lighting conditions, calbirations, and similar surrounding conditions. We want to measure the improvement of the quality of the image, such as:

Amount of detail
Contrast
Other things that describe the quality of an image or the amount of information in an image

Do you have ideas for this? Maybe histogram comparisons, or an advanced distance measure on the histogram? I'd love to hear some good ideas!

EDIT:

Of course the results of the vision application are a measure of the quality of the images. But:

it is not intended as a measurement for the quality, it is a measurement of something else
there are more parameters that influence the results of the application (for example the image itself), therefore it is only a rough measure of the quality of the image

I could use human evaluation, but I really want an objective measure, especially because the human eyes are not objective (our mind plays tricks, the monitor we watch it on influences the image, etc.).

FINAL EDIT:

After a discussion about what quality in an image is, I'll leave this question as is. My own ideas (and of my coworkers) are the following:

The range of the RGB channels (is it using all the colors possible)
The mean of the Sobel amplitude (the amount of detail or a rough measure of focus, also see this question about detail)
The amount of pixels that are clipped or 0 (no information in these pixels)
Also the mean of the RGB channels and the YCbCr channels (after conversion), to be able to see if the average color has changed (may lead to investigating light from other sources, or after changing our own lighting)

By combining these statistics we can get an impression of the quality from a more objective point of view, instead of just looking at the images. It also leads to pointers where the changes might come from.


texts: How do MATLAB and/or Python treat $2^n$ samples rule in FFT

texts:
As far as I have read, an FFT requires that the number of original data points must be a power of 2.

I'm wondering whether the tools like MATLAB or Python which have FFT functions take care of this fact.

Especially in MATLAB and Python; imagine I have samples of data in a file containing 13000 samples. If I want to read this file and plot its FFT, how does the FFT functions of MATLAB or Python treat the file? Does the function truncates the samples and obtain the number of samples as $2^n$ before performing the algorithm? Or should I sample it myself as $2^n$ samples at the beginning?


texts:
I am developing a machine vision project to find defects on metal surfaces. I want to learn and implement algorithms which commercial systems are use for metal surface defect. My sample object as below:

I am using OpenCV. I could find sharp defects with standard edge detection methods. But it is not sufficient. There is some samples of commercial solutions:
- http://www.keyence.co.uk/products/vision/vision-sys/cv-5000/features/movie06.jsp
- http://www.keyence.com/products/vision/vision-sys/cv-5000/features/movie09.jsp

Or like this picture:

Do you have any idea about algorithms which is used in commercial systems?


texts: Tone generation in Matlab (scientific paper)

texts:
I'm trying to generate sounds as described in a scientific paper that I found on the Internet.
What I need to do is to generate simple tones in a certain pattern, however I have some issues understanding how to do this correctly.
The attached image contains the full description of the method. I'm stuck at  "Thirteen tones of this sound .." .I'm confused about how this thirteen tones are selected and how to arrange them correctly.
If anyone could provide some help, it would be much appreciated.

My code so far:

function testaudio()

sampleRate = 44100;
duration  = 0.5;
freqs = [100 200 300 400 500 600 700 800 900 1000 1100 1200];

[signal t] = generateTone(freqs, sampleRate, duration);
sound(signal, sampleRate);

%generates a tone (pure or complex)
function [y t] = generateTone(freqs, sampleRate, duration)
    timeSamples = duration * sampleRate;

    t = linspace(0, duration, timeSamples);
    y = zeros(size(t));
    env = generateEnvelope(t);

    for i=1:length(freqs)
        temp = env.*sin(2*pi*freqs(i)*t);
        y = y + temp;
    end

    % amplitude normalisation
    y = y' / max(abs(y));

end

function y = generateEnvelope(t, alfa)
    alfa = 1;
    y = (-t.^alfa) .* log(t./max(t));
    y(1) = 0;
end

end


texts: Gain error when performing STFT spectogram of increasing frequency signal

texts:
I'm performing a STFT of a sine wave in which the frequency increases (up-chirp signal) using python numpy.fft as shown in the following code:

import numpy as np
import matplotlib.pyplot as plt

def stft(x, L, overlap, window):
    opoints = int(L*overlap)
    X = np.array([np.abs(np.fft.fft(window*x[i:i+L])[:L//2])
                 for i in range(0,len(x)-L,opoints)])
    return X

t = np.linspace(0, 5, 11025*5)

xf = np.linspace(0, 2000, 11025*5)
w = 2*np.pi*xf
x = np.sin(w*t)

f = np.linspace(0, 11025, 1024)

window = np.hanning(1024)

stft = stft(x,1024,0.5,window)

plt.imshow(stft[:,:1024//2].T, cmap = plt.get_cmap('gist_yarg'), origin='lower', aspect='auto',
                 interpolation='nearest', extent=(0,5, 0,11025/2))

plt.xlabel("Time [s]")
plt.ylabel("Frequency [Hz]")
plt.show()

It works for a constant frequency sinewave. However it shows not an offset but a gain error if using the up-chirp signal as input.

STFT of increasing frequency sine wave

I'm using:

Hanning window
Overlap = 0.5
Window size 1024
Sampling frequency 11025Hz
Total sample time: 5 seconds

What is causing the gain error that leads the 2 kHz signal appearing at double frequency at the end of the time window?

Thank you in advance,
Pedro


texts: Region of root locus not inside the feasible region for a given performance specification

texts:
I wanted to plot the root locus for a system, whose plant transfer function is
$$
P(s)= \frac{k}{Ts+1}e^{-ts}.
$$
A PI controller was suggested for this system, and the task is to find $K_p$ and  $K_i$ values, such that it satisfies the following performance specs:

Maximum peak overshoot < 5%
Settling time (2% band) < 0.8 seconds

This is how I modified the open loop transfer function to suit the format of root locus finding.
$$
G(s)H(s) = C(s)P(s)= K_p\frac{k(s+A)(2-ts)}{s(Ts+1)(2+ts)},
$$
where $A = K_i/K_p$ and Pade approximation was used. For starters, $A$ was assumed to be 1.
But, when I plot the root locus of the above, this is what I get.

Here, the white region is the feasible region which satisfies the performance specs.
As we can see, the root locus of the pole introduced by the integrator (at Im axis) ends up being completely inside the unfeasible region. This is the case for any $A$ value I take.
What should I do? Is my approach correct? And more importantly, how will this pole affect my performance?
I'm new to this field, and I'm a bit confused by this. Please help me out here. Thanks in advance.


texts: Matlab: What is the proper way to calculate mean square error for complex numbers

texts:
I am confused regarding the calculation of mean square error involving complex numbers. Considering, the true channel coefficients to be

h_true =

   0.7071 + 0.7071i
   0.4243 + 0.4243i
   0.2121 + 0.2121i

and the estimates to be

 h_e1 = 0.8100+0.8100i
 h_e2 = 0.5100 + 0.5100i
 h_e3 =  0.1200 +  0.1200i;

For training epoch 1, I calculated the error between the estimates and the actual  as

e = ((h_e1 - h_true(1)).^2) + ((h_e2 - h_true(2)).^2) + ((h_e3 - h_true(3)).^2)   ;

Then the mean square error is

mse = e/3;

which gives zero for the real part and some small number for the imaginary part.

mse = 0 + 0.0176i

Should I be calculating the error separetely for iamginary and real part or is this okay?


texts: How to use Kalman filter for altitude prediction based on barometer data?

texts:
I have barometer noisy data with known variance.
I studied Kalman filter but I did not find an answer to this problem:
My process model is: altitude is changed because of velocity that is changed because of acceleration that is normally distributed.
 s[k+1]=s[k]+v[k]*dt+a[k]dtdt/2
Is my process state just (altitude) or (altitude and velocity) or (altitude, velocity, acceleration)?
When I use velocity and acceleration - how shall I fill the measurement matrix when measuring just altitude? In some examples, I have seen 0 as a measurement of unknown variables, but it makes no sense to me, because velocity and acceleration remain constant, because no correction is applied to them.
My goal is to mainly compute velocity.
Is there some other recommended algorithm to estimate the vertical velocity?

UPDATE:
I will try to ask the more specific question about Kalman filter :-)

I have state X = (s, v, a) - trajectory, velocity, acceleration
I have state transition model F = ((1 dt dt*dt/2)(0 1 dt)(0 0 1)) (where dt is interval between last and current measurement)
I have one-dimensional measurement Z (I measure trajectory only)
So observation model H is (1 0 0)?

I have seen examples where only acceleration was measured and H was (0 0 1), but when acceleration was corrected, velocity and trajectory was updated also in "a priori state estimate" because velocity is dependent on acceleration. But will the velocity and acceleration be updated when they are not dependent on trajectory? See bold zeros in F matrix.


texts: Empirical Mode Decomposition and Sparsity

texts:
In what sense does empirical mode decomposition (EMD) bring out the sparsity in a signal?

For instance, if I had a signal $f$ and I broke it down into $n$ intrinsic mode functions (IMF), what should I do to get a representation that has very few nonzero components?

Generally when speaking of sparsity, we say that a signal is sparse in some basis. Since IMFs do not have a fixed basis, in what sense can they be (if at all) sparse?


texts: Compute $d^2$ entries of a 3D convolution faster than $O(d^3)$

texts:
Let $A,B\in \mathbb{R}^{d\times d\times d}$. The 3D circular convolution $\text{conv}(A,B)$ can then be computed as $F^{-1}(F(A)\odot F(B))$ where $F(\cdot)$ denotes the 3D discrete Fourier transform and $\odot$ denotes entry-wise multiplication. By using the fast Fourier transform I can then compute $\text{conv}(A,B)$ in $O(d^3\lg d)$ time.

I only need $d^2$ entries of $\text{conv}(A,B)$ and $A,B$ only contain $d^2$ non-zero entries. Is it possible to compute $d^2$ entries of $\text{conv}(A,B)$ faster than $O(d^3)$?

Specifically, $A_{i,j,k}=0$ for all $i\neq 0$ and $B_{i,j,k}=0$ for all $j\neq 0$, and I want the $d^2$ entires $\text{conv}(A,B)_{i,k,d-1}$ for $i,k=0,...,d-1$ .


texts:
In this paper of Lustig, he speaks about a something which appears unintuitive: sampling at random may exhibit better performance than sampling uniformly. I tried to understand this starting from page 15 of these slides, but I can't really make sense of anything.

Why, if we take random permutation of frequency coefficients, do we get a better reconstruction in terms of signal similarity? Why does this give better reconstruction, and what's the intuition behind the phenomenon?


texts: Estimating exterior camera parameters by matching lines using least square estimations (Lowe, 1991)

texts:
I'm new to computer vision and graphics. I want to estimate exterior camera parameters using non-linear least square estimation as suggested by "Lowe, David G. "Fitting parameterized three-dimensional models to images." IEEE transactions on pattern analysis and machine intelligence 13.5 (1991): 441-450.". However, I'm stuck at the implementation of the same. So, my question is, is there a MATLAB implementation of the same?

Note: I've also posted it in computer science stack exchange