texts: Harmonic distortion of sine signal. plotting resulting spectrum

texts:
I'm trying to learn about how the spectrum of a sine signal changes when fed into a waveshaper and i've learnt a great deal from you guys here on stackexchange. Specifically how a transfer function such as $y = x + x^7$ adds the fundamental frequency of $x$ and then odd overtones up to the $7^{th}$ overtone.

Since i'm no mathematician and just now learning some dsp for an effect plugin i'm developing i need to be able to plot the spectrum of $y$ to learn more about the behavior how ploynomials affect this spectrum.

I could use Fourier tranform in matlab on $y$, but it feels like an unnecessary step.

I would like to be able to plot it like in this stackexchang question: Add odd/even harmonics to signal?

Thanks in advance.


texts:
I have a question about the smoothing (backward) process of Kalman filter. Is it correct to say

$E[x_{t|T}] = x_{t|t}$

where $x_{t|t}$ is the estimated result from forward process?

I am struggling to understand the smoothing process of Kalman filter. Any help will be appreciated.


texts: How to determine the frequency of each row in a MATLAB spectrogram

texts:
I recently learned how to manually compute a spectrogram of an audio signal, which is essentially a matrix. Each column corresponds to a time frame (e.g. 10 ms or something) but I'm asking which row corresponds to which frequency?

See my implementation below:

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

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

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

signal_framewise = buffer(input , window_length_s , floor(window_length_s/2));
nfft =((window_length_s-1)/2)+1;

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

My theory: The topmost row must be 0.5*Fs (half of the sampling frequency) because of the sampling theorem. All other rows are linear increments to then match to 0.5*Fs. Example: 5 Rows, topmost is 5 Hz, then the first row is 1 Hz, the second is 2 Hz and so forth.


texts: I have a vector v1 of size N1, I want to pad it in a certain way until it reaches a size power of 2 (v2 of size N2). I need that the first N1 coefficients of the FFT output to stay the same as when I would apply FFT(v1), is that possible? If so, how to?


texts: Are There Good Methods for Converting Color Image to Gray Scale Image?

texts: Converting color image to gray-scale image is often the first step of many image processing tasks. There exists many gray-scale image conversion methods. Most them, however, is to give R G B bands a weighting factor and then the gray-scale image is the weighted sum of R G B bands. I think this is not right in many cases. For example, the most straightforward of way of conversion is to average the R G B bands: gray=0.33*(R+G+B). If we use this formula for generating gray-scale image, then a red object with pixel value R=250 G=0 B=0 will have the same value with a green object (R=0,G=255,B=0). Any ideas of smart color conversion? Thanks.


texts: The DTFT without $(-1)^{n}$ is relatively easy but with $(-1)^{n}$ I am not sure how it would be solved. I hope anyone can help


texts: What is the coherence bandwidth of the channel?

texts: I read the following sentence.  "In wideband systems, the transmission bandwidth of a single channel is much larger than the coherence bandwidth of the channel."  What is  'coherence bandwidth of the channel'?


texts: Is there any difference in energy content of baseband and bandpass signals? When we see their representation in frequency domain, it looks like a bandpass signal has double the energy content compared to basband. But my friend says there's no difference. Someone please clarify.


texts: What is the difference between undersampling and oversampling in analog to digital conversion ?

texts:
When converting a signal from analog to digital, we observe undersampling and oversampling.

Does oversampling means that the sampling frequency is greater that the signal's frequency and does undersampling means that the sampling frequency is less than the signal's frequency ?


texts: Reduce the Number of Intensity Levels of a Grayscale Image in MATLAB

texts:
I have written a Matlab script to reduce the number of intensity levels of each pixel of a grayscale image from 256 to some power of 2.

img_color = imread('photo.jpg');
img_gray = rgb2gray(img_color);
imshow(img_gray);
[rows, cols] = size(img_gray);
noOfDesiredIntensityLevels = 2; // test data. will check for 4,8,16,32,etc.
bitsNeededToRepresentIntensityLevels = log2(noOfDesiredIntensityLevels);
new_img = img_gray;
for i = 1 : rows
    for j = 1 : cols
        new_img(i,j) = floor(img_gray(i,j)/(2^(8-bitsNeededToRepresentIntensityLevels)));
    end
end
figure
imshow(new_img);

On execution, the script returns a black image. My expectation was that the image will be turned into black-and-white (intensity value for each pixel will be either a 0 or a 1).

What am I missing here?

P.S: I am a novice in Matlab and Image Processing. So, please ignore any mistakes in my understanding.


texts: How can slope of low-pass biquad be configured?

texts:
I have a biquad filter, configuread as a low-pass filter (using Zolzer's formulas, similar to these). It does not overshoot and decays nicely in what I assume is -40dB/dec.

How can I device a calculation, that takes not only desired_cutoff_frequency as a parameter, but also desired_decay_slope?


texts: Strange Response of a fir1 Filter in Matlab

texts:
i have been tinkering with some fir filters to bandpass-filter a signal. Even though the filter looks pretty descent in frequency domain, i receive a quite strange "filtered" signal in time-domain. I think, i'm oversseing something simple... Maybe one of you knows what i am doing wrong.

First of all, here's the code:

Fs          = 200; % hz
nyquistFreq = Fs/2;
frange      = [45 55];
order       = round( 30*Fs/frange(1) );
filtKern    = fir1(order,frange/nyquistFreq);
filtSignal  = filter(filtKern,1,signal);

I plotted the data stored in signal and filtSignal into one plot and the filter-shape is received at the beginning of the filtered signal:

Here's a picture of the filter in time-domain, in frequency-domain and in frequncy-domain with logarithmic scale. According to the plot in frequency domain, the cut-off frequencies fit pretty much what i requested...

Thank you so much, i appreciate every input!


texts: Do I get less accurate results if I do not use a power of 2 points for my FFT?

texts:
I heard that the padding with zeros is mainly for efficiency and speed, other than that, is there a downside to use fft(signal) instead of fft(signal, N) where N is a power of 2 assuming signal length is not a power of 2.
Thank you


texts: Calculation of sampling rate and its effect on an Image?

texts:
I know that for a given signal, the sampling frequency $F_s$ must be twice or more than maximum frequency of the signal $F_m$. It is easy to understand the concept for a 1D signal. But I don't know how to calculate sampling frequency or Nyquist rate for a 2D image.

Also what is effect of over-sampling and under-sampling in case of image shown below (dimensions $\text{width} \cdot \text{height}=204\cdot226$)?


texts: How to apply a 1D filter (CSF) to an image?

texts:
I am facing the following problem:
I have an image and a contrast sentivity function (CSF). The CSF is a function defined in the frequency domain and it is just a band-pass filter. The problem is that it is a 1D filter so I do not know how to apply it to the Fourier transform of the image.

I thought about creating a 2D filter based on the revolution around the zero frequency of the 1D filter but I do not know if it is mathematically correct or if it is the common procedure.

Thanks in advance!


texts: Where is the flaw in this derivation of the DTFT of the unit step sequence $u[n]$?

texts:
This question is related to this other question of mine where I ask for derivations of the discrete-time Fourier transform (DTFT) of the unit step sequence $u[n]$. During my search for derivations I found one which is amazingly simple. I first saw it on page 138 of this book by B.A. Shenoi. I also came across it on mathematics.SE in this answer.

Since the argument is short and simple I will repeat it here for convenience.

  The unit step sequence can be written as
  $$u[n]=f[n]+\frac12\tag{1}$$
  with
  $$f[n]=\begin{cases}\frac12,\quad n\ge 0\\-\frac12,\quad n<0\end{cases}\tag{2}$$
  Obviously,
  $$f[n]-f[n-1]=\delta[n]\tag{3}$$
  Applying the DTFT on both sided of $(3)$ gives
  $$F(\omega)\left(1-e^{-j\omega}\right)=1\tag{4}$$
  where $F(\omega)$ is the DTFT of $f[n]$. From $(4)$ we get
  $$F(\omega)=\frac{1}{1-e^{-j\omega}}\tag{5}$$
  From $(5)$ and $(1)$ we get for the DTFT of $u[n]$
  $$U(\omega)=F(\omega)+\pi\delta(\omega)=\frac{1}{1-e^{-j\omega}}+\pi\delta(\omega),\quad -\pi\le\omega <\pi\tag{6}$$
  where I've used $\text{DTFT}\{1\}=2\pi\delta(\omega)$, $-\pi\le\omega <\pi$.

Eq. $(6)$ for the DTFT of $u[n]$ is no doubt correct. However, the derivation is flawed.

The question is: find and explain the flaw in above derivation.

Please prepend your answer with the spoiler tag >!.


texts:
Is the given input signal x[n] an energy or power signal?
The image shows what I did so far. Is it correct?
Thank you!
EDIT:
I solved it again, please tell me if I did it correctly this time.
$$E= \lim\limits_{n \to \infty}\sum_{n=-N}^N = |4^nu[n]|$$
$$E= \lim\limits_{n \to \infty}\frac{1-4^{2(N+1)}}{1-4^2}$$
$$E=\infty$$
$$P= \lim\limits_{n \to \infty}\frac{1}{2N+1}\sum_{n=-N}^N = |4^nu[n]|$$
$$P= \lim\limits_{n \to \infty}\frac{1}{2N+1}(\frac{1-4^{2(N+1})}{1-4^2})$$
$$P=\infty$$
Since both P and E are infinite, then it is neither an energy or power signal.


texts: Calculating the system output using frequency response

texts:
Given an input signal $$x(n)=\cos(6\pi n +\frac{\pi}{6})$$ and system $$y(n)=0.5x(n)-0.1x(n-1)$$. In this case, the coefficients of the difference equation are $a_0=1$, $b_0=0.5$, and $b_1=$. The frequency response to this system is $$H(\omega)= b_0 + b_1e^{-j\omega}= 0.5 - 0.1 \cos(\omega)+0.1 j \sin(\omega)$$

Since the input $x(n)$ is a sinusoid of the form $$x(n)=A \cos(\omega n +\theta_0)$$, we can express the system's output as

$$y(n)=A|H(\omega_0)|\cos\left(\omega_0 n+\theta_0+angle(H(\omega_0))\right)$$

I can see that $A=1$, $\omega_0=6\pi$, and $\theta_0=\frac{\pi}{6}$ in this formula.  Hence, I have deduced that

$$|H(\omega_0)|= |0.5 - 0.1 \cos(6\pi)+0.1j \sin(6\pi)| = 0.4$$

Furthermore, since $H(\omega_0) = 0.4$ (a positive real number), I conjecture that $$angle(H(\omega_0))=0$$

Have I made the correct assumptions/conclusions?


texts: JPEG: In image compression why are higher frequency components divided by a larger number during quantization

texts:
Once 2D FDCT has been carried out on 8x8 blocks of the image data, the coefficients are quantized. This involves use of a quantization matrix where we simply divide each FDCT coefficient by the corresponding value in the 8x8 quantization matrix.

The quantization matrix has bigger numbers on the bottom right and smaller numbers on the top left. Bottom right are the highest frequencies and conversely, top left is DC. Why is quantization not uniform?


texts:
I would like to limit discussion to discrete time causal Wiener filter.

By definition it is an FIR filter, and it also has optimality under Mean Square Error criterion within the class of linear filters.

How do we know that there isn't a better IIR filter (something with a feedback loop), which is also linear?


texts: The DTFT of $\{1,1\}$ is $1+e^{-j\omega}$ but what is the DTFT of $\{1,-1\}$?

texts:
So I know that the DTFT of $\{1,1\}$ is equivalent to $1+e^{j\omega }$.

But what is the DTFT of $\{1,-1\}$ equivalent to?  Is it equivalent to $1-e^{j\omega }$?


texts: Correlation between slightly misaligned images

texts:
I am matching camera images of projection screens with rendered pages of PDF documents using Pearson's and Spearman's correlation coefficient. When the images (3, 4, 5) are aligned, this works fine in spite of the clear shortcomings (optical aberration in the camera images, the random sample is not independent, uneven illumination, etc.).

In the figure below, Pearson's r between the left and middle images is 0.8395 and Spearman's r is 0.6499. Pearson's r between the left and right images is 0.7139 and Spearman's r is 0.5066.

However, when the content of the rendered PDF page differs slightly from the document in the camera image or when the images (8, 9, 10) are more than slightly misaligned, the correlation coefficient ceases to be useful.

In the figure below, Pearson's r between the left and middle images is 0.771 and Spearman's r is 0.4719. Pearson's r between the left and right images is 0.779 and Spearman's r is 0.4963.

Reducing the images to density estimates (i.e. discarding the pixel positions and comparing histograms) would likely remove valuable information. Non-feature-based image registration seems like a more promising direction. What technique would you recommend to attack this problem?


texts: references for techniques to reduce recursive filter startup transients

texts:
I am trying to track down references (published articles or reports ideally) that establish the basis for some of the techniques being used to minimize the effect of recursive digital filter startup transients on the sampled signal. My specific application is the digital filtering of acceleration signals that have already been acquired (post-processing). The examples below are based on Python and the scipy.signal module.

An example of the techniques I am referring to is illustrated in scipy.signal.filtfilt (and presumably the Matlab version). In this function, there are options to specify a padding type and padding length presumably to get the filter initialized and dissipate the transient before running into the "real" data. Another technique and a reference to F. Gustaffson, “Determining the initial states in forward-backward filtering”, Transactions on Signal Processing, Vol. 46, pp. 988-992, 1996, is also implemented in the filter.

Another example is scipy.signal.lfilter_zi that describes a technique in the notes to set the initial filter delays from the initial value of the signal. (Interestingly, this is also implemented within the filtfilt function referenced above, in addition to the padding.) The notes describe the derivation of the technique, but there are no references in the source code for this function. There is also no discussion of the pros and cons of this technique. I have found a reference that seems to describe this technique by Fletcher (1973). Can someone confirm that this is the correct, general reference?

Another source I have found for a more general technique is a report out of MIT by Chornoboy (1990). I have not seen this technique implemented in any libraries and I have not found a comparison of this technique with others, other than what is in the report. This report mentions the Fletcher report.

Finally, I have perused a number of books on digital signal processing. The book I own ("Digital Filters" by Hamming) specifically states that a general-purpose technique that is independent of the input signal has not been found. Other books do not mention the filter startup transient or, if it is mentioned, practical methods to minimize the effect are not discussed.

Is anyone aware of a single resource that discusses each of these techniques in the context of post-processing (filtering) digital signals? Short of that, are there any references for the (obvious) technique of padding the signal and discussing the various techniques of padding (i.e. odd, even, constant)?


texts: What is the unit of x-axis of a sound signal?

texts:
I'm confused about the unit of x-axis.

The below signal has a duration of 3 second and sampling frequency 44100. So should i write Time(s) for the unit of x-axis.

However, in the graph, it shows the number of samples i.e 44100 * 3 = 132300.


texts: Is there a way to obtain the original signal (stationary process) from its combination through filtering (matlab) and crosscorrelation?

texts:
I have a stationary process $w_1(t)$, white in band $B=[-2, 2] KHz$, and another process: $x(t)=w_1(t)-w_1(t+t_0)$, where $t_0=250\mu s$.

I want to re-obtain $w_1(t)$ by filtering $x(t)$ through $h(t)$: $w_1(t)=x(t)*h(t)$ (where $*$ is the convolution operator).

I know that $r_{w_1x}=r_x*h$, ($r_{w_1x}$ is cross-correlation and $r_x$ is autocorrelation)

from this one I can conclude that $S_{yx}(f)=S_x(f)\cdot H(f)$, so my filter will be $H(f)=\frac{S_{yx}(f)}{S_x(f)}$. ($S$ is the Power Spectral Density)

Is this right? Then from antitransforming I should obtain the time domain representation of my filter.

My problem occurs when I try to calculate it with Matlab:

I have already the autocorrelation of x, and its Power Spectral Density, but I can't figure out how to calculate the cross-correlation of my processes. For example $w_1=randn(8000,1000);$, then filtered, but it's still 1000 representations of a white gaussian noise, and so is $x$.

I thought about doing the mean of all 1000 crosscorrelations and then transform with fft:

Rwx=0;
for i=1:1000
    Rwx=Rwx+xcorr(w1(:,i),x(:,i));
end
Rwx=Rwx/1000;
Swx=fftshift(fft(Rwx));

But this doesn't seem to work.

Do you have an idea on how to solve this?


texts:
I'm trying to make a music instrument based on a resonator with a high Q, such as Ableton's Corpus and Ableton's Resonator (I think the former is based on a simple 2nd order resonant filter while the latter is based on feedback combs).

I could make the filters in Matlab without difficulty but my problem is with their gain and the range of their output.

Indeed, to avoid overflowing/saturation of the sound signal, I need to have an output always bounded to the [-1 ; 1] range. Furthermore, these resonators should be suited for processing any type of input : very small transients for percussive sounds as well as continuous noise or oscillators.

I have normalized my biquad and comb resonators to have unit gain at the resonance(s) independently of the Q factor or resonant frequency, based on JOS' book and the STK examples, to prevent overflowing in all cases. But obviously, depending on my filter's input length, the output range varies greatly (even if the input's range is [-1 ; 1]). Depending on the Q factor, there's also a huge variation.

I think I understand the reasons for that : if we take white noise for example, the power is distributed over the whole spectrum, so if you normalize the resonance gain so that it stays at 0dB and filter the noise with a high-Q, you're going to reduce the power of the signal a lot.

If you fix the resonance but change the input signal, it also makes sense that the length of you input is going to change the range of the output, given the recursive nature of the filter.

So my question is : is there some trick to normalise a filter to have an output in almost the same range as the input (or at least a quite constant range), regardless of the filter's Q and the input's length? If not, how are Ableton and other plug-ins designers doing it?

EDIT : One solution that I thought of would be to maximize the SNR for the average type of input, and then provide gain control at the input of the filter and/or a limiter at the output. Is there any better way of achieving what I want?

EDIT2 : Still no answer and I would really like to have some help with that... Any comment is welcome!
I have tried on Matlab to find a way to predict the output range depending on

the filter's parameters
its frequency response
the input's RMS
the input's amplitude

but I haven't found it yet... If someone has a hint or a pointer I would really appreciate!

EDIT3 : By calculating the overshoot of the 2 poles filter (ie the maximum of the step-response), I can guess the maximum range of the output, which is already a start but the analytic solution of the filter's overshoot is very heavy, and it doesn't help finding a relation with the input's length/power, does it?

EDIT4 : After analysing Ableton's corpus a bit more deeply, it seems like there's not much done after all... here are some captures of Corpus' response to some inputs (settings are : type=beam medium, $tune=324.91$, $decay=5.0s$, $Dry/Wet=100%$ and all the rest at $0$) :
 ^ Impulse response, -30dB

 ^ Sine sweep, -30dB

 ^ noise, -30dB

But for example, if I input an impulse at 0dB I'm going to hear the sound clearly and if I input 0dB-peak white noise, I'm also going to hear the resonance perfectly whithout distortion (sound here)
With my resonators - either from the EQ cookbook or from JOS's constant gain resonators, I have an extremely quiet output to impulse and normal for noise...


texts:
I need to filter 9 Hz from a signal sampled by 256 Hz using a linear phase filter.

If someone can bring an explanation or a code example I would greatly appreciate it.

I have tested his code

function [Hd1,Hd2]=NotchFIR(FS,F0,FG,FGAINdB) % Design
    if (F0 > FS/2)
        warnstr =['WARNING! The Sampling frequency is less than twice the notch frequency. Response will be inaccurate.']
    end
    if (FG == F0)
        warnstr =['WARNING! User should not set the gain of the notch frequency. Response will be inaccurate.']
    end
    FGAIN = 10^(FGAINdB/20);
    w0 = 2*pi*F0/FS;
    wg = 2*pi*FG/FS;
    GH = abs(1 - 2*cos(w0)*exp(-j*wg) + exp(-j*2*wg));
    G = FGAIN/GH;
    h = [1 -2*cos(w0) 1];
    freqz(G*h,100,[], FS);
    Hd1=G*h;
    Hd2=100; end

     t=0:1/256:1;
     y=sin(2*pi*9*t);    [Hd1,Hd2]=NotchFIR(256,8.9,9.1,1)
     x=filter(Hd1,Hd2,y);
     figure
     plot(t,x);

But the frequency response of the digital filter shows that the selection of the notch frequency wasn't sharp and many frequencies were attenuated.


texts: Speech Compression - In LPC how does the linear predictive filter work on a general level?

texts:
Hi I'm taking a multimedia systems course and I'm preparing for my exam on tuesday.  I'm trying to get my head around LPC compression on a general level, but I'm having trouble with what is going on with the linear predictive filter part.  This is my understanding so far:
LPC works by digitising the analog signal and splitting it into segments.  For each of the segments we determine the key features of the signal and try to encode these as accurately as possible.  The key features are the pitch of the signal (i.e. the basic formant frequency), the loudness of the signal and whether the sound is voiced or unvoiced.  Parameters called vocal tract excitation parameters are also determined which are used in the vocal tract model to better model the state of the vocal tract which generated the sound.  This data is passed over the network and decoded at the receiver.  The pitch of the signal is used as input to either a voiced or unvoiced synthesiser, and the loudness data is used to boost the amplitude of this resulting signal.  Finally the vocal cord model filters this sound by applying the LPC coefficients which were sent over the network.
In my notes it says that the vocal tract model uses a linear predictive filter and that the nth sample is a linear combination of the previous p samples plus an error term, which comes from the synthesiser.

does this mean that we keep a running average of last p samples at both the encoder and decoder?  So that at the encoder we only transmit data that corresponds to the difference between this average and actual signal?

Why is it an a linear combination of these previous samples?  My understanding is that we extract the loudness, frequency and voiced/unvoiced nature of the sound and then generate these vocal tract excitation parameters by choosing them so that the difference between the actual signal and the predicted signal is as small as possible.  Surely an AVERAGE of these previous samples would be a better indication of the next sample?

If there are any holes in my understanding if you could point them out that would be great!  Thanks in advance!


texts: When to Apply Circular Convolution Formulas?

texts:
Context

I am studying the family of Discrete Trignometric Transforms (DTT): Discrete Cosine Transforms (DCT) and Discrete Sine Transforms (DST). And trying to understanding more their properties, I came up to the following concepts.

Linear Convolution

$$y[n] = x[n] \star h[n] = \sum_{k=0}^{N-1}x[k] \, h[n-k]$$

Finite Sequence

$$x = {x_0, x_1, ..., x_{n-1}}$$

Which is usually extended by:

$$
x[n]=
\begin{cases}
x_n, &\text{for } n \in [0, N-1]\\
0, &\text{o.w.}\\
\end{cases}
$$

Then, we have this section of this book:

Question

  How to properly use the formulas for circular convolution and skew-circular convolution? Why to use these if they are equivalent to the traditional convolution formula?

My first thought was for avoiding re-calculations. But I didn't quite visualized and example.

[Updated]
I know that, as defined by the convolution theorem property, the convolution in frequency domain, (for instance the Fourier Domain) requires less operations for signals above a certain size, then operating it in the spatial domain. This is not what I am looking for.


texts:
Calculate the entropy of Turkish alphabet and compare with the entropy of English alphabet with using Matlab?
  How can ı do this question anybody help please?..


texts: Clarification on Discrete-time convolution and signal shifting

texts:
What are $y_1[n]=x_1[n]*h[n]$ and $y_2[n]=x_2[n]*h[n]$?
  $$x_1[n]=(0.1)^nu[n],\quad x_2[n]=(0.2)^n,\quad h[n]=(0.3)^nu[n]$$

I am confused about how to calculate $y_{1}[n]$. The formula for discrete convolution is:
 $$\sum_{m=-\infty}^{\infty}x[m]h[n-m] = \sum_{m=-\infty}^{\infty}h[m]x[n-m]$$.

My attempt:
I chose to shift $x_{1}[n]$ along m-axis:
$$y_{1}[n] = \sum_{m=0}^{n} (0.3)^{m}(0.1)^{n-m}$$
$$y_{1}[n] =(0.1)^{n}\sum_{m=0}^{n}(\frac{0.3}{0.1})^{m}$$
$$y_{1}[n] = (0.1)^{n}\sum_{m=0}^{n}(3)^{m}$$

This gives me $y_{1}[n] = \infty$. However, when I shift $h[n]$ along the m-axis I get $ y_{1}[n]$ as a finite value. My understanding of discrete time convolution was that shifting either $x[n]$ or $h[n]$ would result in the same answer.


texts:
For a project I'm trying to implement a BPSK demodulator on some random wave files, I'm getting a few difficulties:

How do I know my bit rate, i.e. how many bits each 'real data bit' I'm having.
How can I figure out the size of my real data.
I don't know exactly the corner frequency $f_c$, is it OK for me to estimate it for the carrier wave?


texts:
Can anyone point me to good methodologies for designing fixed point versions of possibly nonlinear signal processing algorithms?
Are there any systematic methods other than simulation for optimizing and analyzing finite word length effects?  References would be appreciated!

Two algorithms of interest are IQ balancers and digital AGC loops.


texts:
Here is the code I use to plot a function in frequency domain in Matlab:

    dt = 1/10000; % sampling rate
    et = 0.1; % end of the interval
    t = 0:dt:et; % sampling range
    y = 2+sin(2.*pi.*50.*t)+18.*sin(2.*pi.*90.*t)+6.*sin(2.*pi.*180.*t); %     sample the signal
    subplot(2,1,1); % first of two plots
    plot(t,y); grid on % plot with grid
    xlabel('Time (s)'); % time expressed in seconds
    ylabel('Amplitude'); % amplitude as function of time
    Y = fft(y); % compute Fourier transform
    n = size(y,2)/2; % 2nd half are complex conjugates
    amp_spec = abs(Y)/n; % absolute value and normalize
    subplot(2,1,2); % second of two plots
    freq = (0:100)/(2*n*dt); % abscissa viewing window
    stem(freq,amp_spec(1:101)); grid on % plot amplitude spectrum
    xlabel('Frequency (Hz)'); % 1 Herz = number of cycles/second
    ylabel('Amplitude'); % amplitude as function of frequency

The problem is, when I zoom in my graph I don't see peaks exactly on 50Hz, 90Hz and 180Hz.

What did I do wrong in my code?


texts:
I have a signal of bandwidth DC to ,say, 100 Hz. I am interested in the range DC-10 Hz. I oversample by a factor of, say, 30. Thus the sampling rate is 600 samples/sec. Then I bandpass filter and decimate it over a number of stages, say 3 stages (e.g. by a factors of 5, 3 and 2). Thus I get the original signal.

This gives me the advantage of having simpler anti-aliasing filter.

However, there is another advanage of oversampling, which is reducing the noise by taking an average of adjacent (extra) samples. For example, if we oversample by 4, then we take average of every 4 samples.

My questions: Do I need to do filtering before the averaging, as is the case with the downsampling?

EDITED TO CLARIFY.


texts: Is there a way to obtain the transfer function from a bode plot on Python? (I know that it is possible on Matlab)

texts:
Quite simply, I have a bode plot obtained from a source signal.
Now I wish to obtain the transfer function.

I know it is possible with Matlab: http://www.mathworks.com/help/ident/examples/frequency-domain-identification-estimating-models-using-frequency-domain-data.html?prodcode=ID&language=en

So, I'm asking if anyone knows if there is a way to do the same with Python and where can I search for it?

Thanks in advance


texts: what are the advanatages of using a scrambler

texts:
What is the purpose of using a scrambler in communication systems?
The link wiki_for_scrambling says that it is used to randomize data. But the data is already random (like speech,audio,video,etc..), what is the purpose of randomizing again?

Even if we ex-or the sequence for randomizing? does it guarantee a non-repeating pattern?

And regarding the statement "Scrambler removes dependency of a signal's power spectrum on the actual transmitted data." in the article, what is the use of that?.

regards,
phani tej


texts:
Hi I am trying to get the image size of the uploaded image in MATLAB. So far I have got :

read=imread(image.png)

ymax=size(read) (1);
xmax=size(read) (2);

However this gives me an error. The image size is 300px by 256px, and I want my ymax and xmax to automatically get the pixel values. How do I do this?


texts:
I am working on peak detection in different signals, the signal plot looks like this:

After applying peak detection algorithm and tuning it for each signal, final output looks like this:

As you can see in figure 3 and figure 4, there are more than 2 peaks in a single point, for example in figure 3 there are two peaks from time 0.4 to 0.5 and 0.3 to 0.35 also two peaks. I am quite new in DSP, I wanted to confirm, is it ok to showcase this diagram, the algorithm is detecting the peaks correctly or should I show only one peak in figure 3 from 0.3 to 0.35 and 0.4 to 0.5 like below diagram?

Thanks!


texts:
Basically my question is the same as the title: Are the 4 types of linear phase FIR filters the only linear phase FIR filters one can come up with? And if so, then why?

I'm pretty sure that they are the only ones but I really can't explain why. Can someone articulate it clearly?


texts: Pattern classifier experiment for determining sex from face image of persons using kNN?

texts: I am very much interested in pattern classification experiments and its theory etc. So I am trying some home brew experiments using MATLAB. As a first major experiment, I would like to classify persons based on sex from facial images. My doubt is basically is it worth attempting it, because right now I don't have idea on what are the basic facial features to extract and how to do that? I want basic facial features to distinguish between males and females. I am using kNN classifier.


texts: In fourier space, how to apply transfer function with n frequencies to input data with m>>n frequencies

texts:
I have a transfer function in Fourier space with $N=2028$ frequencies $(\frac {0, 1}{(N\cdot dx)} \dots ) $

Where $dx = 0.1m$.

I need to apply this transfer function to a signal with 20000 samples (also $dx=0.1m$).
When I transform this signal to Fourier space I get 20000 frequencies.
 So, the sizes don't match. What do I need to do to be able to apply the transfer function (i.e. to multiply the Fourier transforms)? I guess, I could just remove the first $20000-2028=17952$ frequencies from the Fourier transform of the input signal, since they are not present in the transfer function.

But is that correct?


texts: Nyquist zero ISI criterion for rectanguar pulses in the frequency domain

texts:
Nyquist criterion for zero ISI states that in the frequency domain, the replicas of the frequency characteristic of combined:

  TX pulse shaping filter - channel - RX pulse shaping filter

must add up to a constant value in order to ensure zero ISI.

How does it work in case of rectangular pulse signalling when the communication channel has an infinite bandwidth?

As I understand, the combined spectrum is then just a rectangular pulse spectrum (sinc function in the frequency domain) and I do not see how its replicas can add to obtain a constant value over the frequency. But in case of infinite channel BW, the pulses will not be smeared in the time domain, so ISI should not occur.


texts:
I want to compute the output image by first dividing the image into 8*8 blocks and applying laplace filter separately and combine them but I am not getting the correct output
Here is the code:
I=imread('moon.tif');
figure;
imshow(I);
title('Original Image');
g=[0 1 0;1 -4 1;0 1 0];
[N, M] = size(I);
output = zeros(N,M);
for i=1:8:N
    for j=1:8:M
        a = min(i+7,N);
        b = min(j+7,M);
        img = I(i:a,j:b);
        r = imfilter(im2double(img),g);
        output(i:a,j:b) = im2double(img)-r;
    end
end
figure;
imshow(output);

Here is the output I am getting blocks by blocks discontinuous
But when I run this code
I=imread('moon.tif');
figure;
imshow(I);
title('Original Image');
g=[0 1 0;1 -4 1;0 1 0];
resp=imfilter(I,g);
output = I-resp;
figure;
imshow(output);
title('Sharpened image');

I am getting the correct output. How to get this by dividing the image into 8x8 blocks and combining them


texts: Adaptive equalizer for BPSK signals with frequency offset

texts:
I'm trying to equalize a BPSK signal which has a residual frequency offset on it. This frequency offset is dealt with at a later stage in the DSP chain, along with phase estimation.

I have implemented a FIR filter which updates its filter taps using gradient descent CMA:

The equalized signal (y) is a discrete-time convolution of the filter taps (W) and the input signal (X):

$$
y = W^HX
$$

The update error is:
$$
\epsilon = |y|^2-1
$$

Finally I compute the update as:
$$
W_{i+1} = W_i - \mu \epsilon y^*X
$$
Where $\mu$ is the step size = 0.001.

My problem is that due to the frequency offset, my input signal X is complex, which is resulting in complex filter taps in W. This in turn introduces a huge phase error into my signal. One possible solution I've looked at so far is putting the equalizer behind the frequency offset compensation stage. However, since the signal still contains some phase error, it's not entirely constrained to the real axis in the constellation diagram and I have the same problem. My workaround so far has been to update the filter taps as:
$$
W_{i+1} = W_i - real(\mu \epsilon y^*X)
$$
My reasoning being that after frequency offset compensation and phase estimation, there should only be noise in the quadrature part of the signal, and I can safely discard it.

I'm unhappy with this solution for 2 reasons:

I'm not entirely sure it's theoretically sound, and at the very least it's rather unorthodox.
I would prefer to equalize the signal upstream in the DSP chain.

I would appreciate any help or insights!


texts: How to determine the sine Fourier coefficients of discrete data?

texts:
The following relation gives me the measurements of interest $w$ at equally distanced locations $x_j$ in space:
$$w_j=\sum_{m=1}^{11}A_m\sin\left(\frac{mπx_j}{L}\right)$$
where $A_m$ are the Fourier coefficients of sine series and $L$ the total length is physical space. I also assume $m = 1,2,...,11$.
Now, how can I obtain the coefficients $A_m$ given the data $w_j$ ?


texts: Variation of channel attenuation with frequency

texts:
Consider a standard RF channel over which signals are being transmitted over a 10 MHz bandwidth at 1800 MHz (using OFDM).

How does the channel's intrinsic attenuation vary over frequency?
More precisely, the subcarriers OFDM would be communicating over would be doing so over different bands of frequencies within the 10 MHz bandwidth.Would the channel attenuate the subcarriers differently based on whether they lie in the lower/higher frequencies within the bandwidth.
Is 10 MHz too small a bandwidth to observe any significant variations?

Note: I am not referring to the Doppler spectrum (multi-path propagation) which causes small scale frequency spread and is a property of the physical surroundings, but to the attenuation that results from the medium itself.


texts: What is the difference between Goertzel algorithm and cross correlation in time

texts:
Im reading https://en.wikipedia.org/wiki/Goertzel_algorithm,
when we want to discover the amplitude of a some frequency in a given signal what is the difference between applying Goertzel algorithm and doing cross-correlation in time between our signal and a complex exponential with the desired frequency.
It seems like in the button line Goertzel algorithm does exactly that,
then why couldn't we apply the correlation in the first place and instead used the IIR filter ?

Thank you.


texts:
this is my first question in this forum, and although I read several threads on this side and googled a lot I could not find the answer to my question (maybe it is too basic)?

For anyone reading this thread with a similar question: The code is now adapted in a way that the answer is partly given in this question. For the explanations look in the answers below.

I found this one, but it only covered my answer partly:
Understanding the FFT phase spectrum with a simple example
If you have good literature that covers this topic, I'm grateful if you can share it.

So, let's assume I have a very basic signal in the time domain, for example:
5*sin(3*2*pi*x-2) with amplitude=5, frequency=3 and shift of 2.

import matplotlib.pyplot as plt
import numpy as np
npts  = 100
tmax  = 10
dt = tmax / npts[![enter image description here][1]][1]
fs = 1 / dt
t     = np.linspace(0, tmax-dt, npts)
y     = 5 * np.sin(3 * 2*np.pi * t - 2)
N = y.size

freq = np.fft.fftshift(np.fft.fftfreq(N)*fs)
yfft = np.fft.fft(y)
yfft = np.where(abs(yfft) < 1.0e-10, 0, yfft)
magn = np.fft.fftshift(np.abs(yfft*dt)/(N*dt))
phase = np.fft.fftshift(np.angle(yfft))
psd = np.fft.fftshift(np.abs(yfft*dt)**2/(N*dt))
yfft = np.fft.fftshift(np.fft.fft(y))

How do I get the frequency 3 and the shift of 2 to show?
Is that even possible?

fig, ax = plt.subplots(3, 2)
fig.tight_layout()
ax[0,0].plot(t, y)
ax[0,0].set_title('Time-Domain')
ax[0,1].plot(freq, yfft)
ax[0,1].set_title('Frequency-Domain')
ax[1,0].plot(freq, magn)
ax[1,0].set_title('Magnitude')
ax[1,1].plot(freq, phase)
ax[1,1].set_title('Phase')
ax[2,0].plot(freq, psd)
ax[2,0].set_title('PSD')

Best regards
Jonas


texts: In image processing, what is the difference or relationship between noise and artifact?

texts:
I would like to know the theoretical difference or relationship between noise and artifact in images, I barely know the relation between noise and distributions, but I'd like a deep explanation if it is possible related to medical imaging field.

Do you have a link, paper at hand?


texts: Is there any other method to get the DFT of a signal without actually computing it using normal calculation

texts:
Is there any other method to get the DFT of a signal without actually computing it using a normal calculation.
Please help me out in this query


texts:
I have a project to do about what happens to a periodic function when we pass it through a low-pass, high-pass and band-pass filter.
I have no expressions for the filters or the function, I just have to analyse graphics.
I already concluded that the low-pass filter passes the zones of the graphic that have a low variation, and that the high pass filter passes the zones of the graphic that have a high variation. In the case of the band-pass filter the resulting wave consists on various sinusoids (it just passes certain intervals of variations).
Ok, I now have the general idea, but I was looking for a text that provided me  more rigorous explanation in terms of the frequencies, and their relation to the variation of a function.
Does anyone here knows a book, or a paper that covers this specific topic of signals filtering?
Thanks!


texts: Edge map based on a Haar Wavelet Transform

texts:
I have been implementing the paper  Blur Detection for Digital Images Using Wavelet Transform and was asking myself how the following formula could reconstruct the edges given a Haar Wavelet transformed image :

$$ \sqrt{LH_i^2 + HL_i^2 + HH_i^2} $$

This formula is on page 2, Algorithm 1, step 2.

I looked at the reference given, but couldn't find where this was explained.


texts: How to display the output as the input with a fractional delay?

texts:
I am trying to introduce a fractional delay in my input vector x[n] so the output is something like y[n]=x[n-M/N]. I am not supposed to use the MATLAB fracdelay function.So, I used sampling and delay. The three steps I followed are:

1)Upsample the input by M.

2)Delay the upsampled version.

3)Downsample the output obtained in step 2 to get y[n].

However I can't get the correct fractionally delayed output. Can someone please help? Here is my MATLAB code:

x=[1 2 3 4 1 3 4 5 6 3];
up=upsample(x,2);

z=zeros(1,10);

for n=1:10;
   k=n+1;
   z(1,k)=up(1,n);
end

y=downsample(z,2,1);
subplot(411);
stem(x)
subplot(412)
stem(up)
subplot(413);
stem(z)
subplot(414);
stem(y)

Here is how my output looks like:


texts: Changing camera and image properties to calibrate a camera

texts:
Is it OK to calibrate a camera using effects and filters such as increasing contrast and brightness etc. to improve the detection of corners of a chessboard?
Even if the used mode for detecting the chessboard is just plain gray scale?


texts: Total Harmonic Distortion calculation and its origins

texts:
I ve been researching about harmonic distortion and THD. From what i ve seen on the internet, HD is caused by non-linear signal processing. I want to calculate it using an digital signal processor. For this, i suppose i need to compare the distorted signal with the original one.

My question is, is it possible to generate THD in a digital signal only by digital processing? Or i need to cause it in an analogic enviroment then convert to digital for detection?

Cause i ve only found examples of it being caused by analogic processing like amplifiers.


texts:
So I'm reading Richard G. Lyons' book "Understanding Digital Signal Processing" and I've just started to make my way through the DFT chapter. While most of his examples and explanations make sense, I am a bit confused about one particular term he defined. This term is the "analysis frequency" defined as

$$f_\text{a} = \frac{mf_\text{s}} N$$

where $f_\text{s}$ is the sampling frequency, $m$ is the index of the current DFT term we're calculating, and $N$ is the length of the discrete, input signal $x[n]$.

So in the book it's stated that $f_\text{a}$ tells us, for each value of $m$, which specific frequency we're currently searching $x[n]$ for. And for each value of $m$ we've got a specific complex sinusoid that we're matching up with $x[n]$ point by point to calculate a single value for $X[m]$. The frequency of that complex sinusoid is said to be $f_\text{a}$ but when the sinusoid is written out explicitly, it does not seem to have the frequency one would expect.

Here are the specifics of the example in the book.

$$x_\text{c}(t) = \sin(2\pi \cdot 1000 \cdot t) + 0.5\sin(2\pi \cdot t + \frac{3\pi}4)$$
$$x[n] = x_\text{c}(n \, T_\text{s}) = \sin(2\pi \cdot 1000 \cdot n \, T_\text{s}) + 0.5\sin(2\pi n \, T_\text{s} + \frac{3\pi}4)$$
$$f_\text{s} \triangleq \frac{1}{T_\text{s}} = 8000 \text{ Hz}$$
$$N=8$$
$$f_\text{a} = \frac{1 \cdot 8000}8 = 1 \text{ kHz}$$
$$X[1]= \sum_{n=0}^7{x[n] \cos(2\pi \cdot n/8) - jx[n] \sin(2\pi \cdot n/8)}$$

So based on my understanding of the text, the $X[1]$ term is searching $x[n]$ to find frequency content at a frequency of $f_\text{a} = 1\text{ kHz}$. This is done by summing a point for point product of $x[n]$ with a complex sinusiod that has a frequency of $f_\text{a} = 1\text{ kHz}$. However, the sinusoid I wrote above doesn't appear to have that frequency.

So I guess my question is two fold. One, how do we come up with the idea of $f_\text{a}$ and how does it relate to the DFT? Second, why doesn't the complex sinusoid have the expected frequency? Is it because we're dealing with a discrete complex sinusoid?

If I have made any mistakes in understanding the problem or the concepts please let me know. I appreciate any help you guys can provide and if this post is too incoherent or "busy" then let me know and I'll try and fix it. Thanks in advance!


texts:
I have seen that matched filter should be used in TED (gardner loop) after
resampler

resampler --------->   matched filter  ---------> down sample ---------> loop filter -> interpolation control for resampler
     (4 samples/symbol)            (4 samples/symbol)     (2 samples/symbol)

is this right?

Can matched filter be used with carrier recovery through costas loop?


texts: Any meaning to the magnitude of a FFT when audio is recorded using a PC?

texts:
I understand the theoretical meaning of the magnitude of a FFT from a mathematical sense. But what about when the sound audio is recorded using a PC microphone using a package like PyAudio, and FFT is calculated using Python. It seems the magnitude is unitless and the range depends on factors like sound card, number of bits used in encoding, etc.

Is it fair to say that the magnitude in this case has no meaning in an absolute sense but can be used to compare two signals?


texts: improving pre-processing (noise removal) orange seven segment display for OCR reading

texts:
About this project: Older images have the date they where taken placed on the image, in the bottom left hand corner. The goal is to extract this date and put it in the EXIF data of the scanned photo.

I am new to the challenge of working with images. I have a code playground and git repo I am working with and posting my results, and have made some progress. But I have hit a wall with dealing with the noise near the extracted text. I am reaching out for any assistance and direction to solve this noise problem.

What I have done thus far:
https://gitlab.com/51m0nt3r4aar/OCR_Img_Date_From_Scanned_Jpeg/blob/master/ImageManipPLayground.pdf

What I need help with: the Morph-Close did not remove the largest bits of noise, as seen in the last image, yet doing more morphs has not been successful. I am looking for any guidance to help solve this problem.

Thanks!


texts: Finding the deterministic autocorrelation function (ACF) from its power spectrum

texts:
The power spectrum of a stationary discrete-time random signal is

  $$\Phi_{xx}(e^{j\omega})=\begin{cases} 1 & |\omega|<\pi/2 \\ 0 & \pi/2
  <|\omega| \le\pi \end{cases} $$

  (a) Determine the autocorrelation function $\phi_{xx}[m]$

I know that the power spectrum is the DTFT of the ACF at 0, but how can I find the ACF from the power spectrum, given that we need to find the ACF for all possible n values?


texts: How to extend hough lines over the image space

texts:
I need to extend lines over the image space. I used Hough transform to finde vanishing lines, but i need to get lines longer and see where is vanishing points.
How can i do it? Please help.
This is my code:

clear; clc;

I = imread('22pp.jpg');

%rotI = imrotate(I,33,'crop');
bw_I = rgb2gray(I);
BW = edge(bw_I,'canny');

figure, imshow(BW); %pause;

BW=edge(BW,'canny',(graythresh(I)*(0.3)),'horizontal');

figure, imshow(BW); %pause;

[H,T,R] = hough(BW);
imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
P  = houghpeaks(H,15,'threshold',ceil(0.3*max(H(:))));
x = T(P(:,2)); y = R(P(:,1));
plot(x,y,'s','color','white');
% Find lines and plot them
lines = houghlines(BW,T,R,P,'FillGap',200,'MinLength',200);
figure, imshow(I), hold on

for k = 1:length(lines)
   xy = [lines(k).point1; lines(k).point2];
   plot( xy(:,1) ,  xy(:,2),  'LineWidth',2,'Color','green');

   % Plot beginnings and ends of lines
   plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
   plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
end


texts: How to compute bit level soft decisions from an M-ary symbol?

texts: When working with a decoder such as LDPC that can take in soft-decision inputs (or channel posterior probabilities as I've seen them called as well), how are these soft-decision values calculated for general M-ary modulations like M-FSK, PSK, or QAM?  I have only been able to find the BPSK case so far in Todd Moon's Error Correction Coding Book. I'm assuming AWGN channels and binary FEC codewords over GF(2).  Sources to information are fine too if the answers to this would be too long.


texts: Determine the optimum receiver and the corresponding $P_{eM}$ for an AWGN channel

texts: I have a source that emits $M$ equiprobable messages, which are assigned signals $s_1, \dots,s_M,$ that are equidistant by $a$. That is, if we plot the $s_k$ signals in a horizontal axis they are dots separate by the same distance $a$. And so I would like to determine the optimum receiver and the corresponding error probability $P_{eM}$ for and AWGN channel as a function of $E_b/\cal N$.


texts: Question regarding estimation of signal tone parameters (frequency, amplitude, and phase) using Macleods algorithm

texts:
I plan to use Macleods algorithm in order to estimate the parameters (frequency, amplitude, and phase) of one or more sinusoids from a block of N uniformly spaced samples.

Before applying the mentioned algorithm, I would like to know how to pre- or postprocess the captured signal. Can you recommend the following two actions in order to ensure that Macleods algorithm delivers best results?

Capture more data points of the stationary signal to increase the resolution of the estimated parameters?
Postprocess the captured signal with a (hanning) window before
applying the algorithm

Thank you for your answers.


texts: Some may think this question is little primarily,I just want to know the differences between different wavelet filters like decomposition high pass,low pass,reconstruction high pass,low pass filters..Which one is best suited for an ECG type signal


texts: Is there a way to convert a FIR to an IIR filter with the most similar behavior?


texts: What is "Equivalent Time Sampling" and what is it good/used for?

texts:
The literature on this method seems scarce, but I know that it has been used on radar systems to 'get away with' not having to sample nearly as fast as Nyquist would otherwise dictate, (at the cost of additional time). Or so I think.

So, how does "Equivalent Time Sampling" work, and where can it be used? How does it square with the Nyquist Criterion?


texts: Under what condition is the available bandwidth $f_s$ instead of $\frac{f_s}{2}$?

texts:
Can someone help me with this interview question? It is about the sampling frequency rate.
Under what condition the available bandwidth is $f_s$ instead of $\frac{f_s}{2}$?


texts: Detection of interesting structure in images?

texts:
I'm looking for methods of computing some measure of structure in an image. (I do not have a rigorous definition of "structure" though........) Consider the 15 image blocks below:

Suppose for each pixel black = -1,  white = 1 and grey = 0. Anything significantly far from 0 is "interesting".

The ones with significant white regions clearly have some structure to them. One way to identify them is by averaging the absolute values of the pixels then set some minimum threshold.

This works, but it does not take into consideration any spatial patterns. So it is unlikely to detect that the blocks along the bottom, and along right, also arguably have some sort of structure to them.

In either case, arguably the top left two blocks have a low structure measure i.e. they looks mostly noise.

Are there any general measures of structure in images which might help for examples like this? Edge detection, filters, etc..... Where to start?


texts:
I am having a small clarification with the difference between LDPC and fountain codes.

In LDPC codes, each parity bit is depenedent on numerous data bits. Isn't that similar to fountain codes as the encoded blocks are dependent on each other(I'm thinking of luby transform codes)?

Also, my professor was explaining that it doesn't matter if some blocks are missed, as long as it receives a subset of the encoded blocks. Fountain codes can decode the message because it just keeps listening to receive more information as there is enough redundancy built in.

My doubt is that, if it just keeps listening, when does the transmitter transmit the next set of messages if it's always sending redundancy to make up for what could be possibly deleted? Especially since there is no feedback.
Or is it that the message sizes are so large and that the encoding is done so that the redundancy is built throughout the message so that even if certain blocks are lost, we can still decode the information?
Lastly, fountain code applications are lossy connection, etc. In which case, why is this only applied to erasure channels?
Because if it is good at combating lossy connection, then it should also be able to effectively combat deletion codes right?


texts: Why the curvature of straight line in curvature scale space is not zero?

texts:
I have read the paper "Shape similarity retrieval under affine transforms", and use c++ to implement it.The step as follow;

Calculate the first and second Gaussian Derivatives

Convolving each coordinate of the curve with a Gaussian function,and calculate the first and second Derivatives of x,y

Compute curvature of the curve

The paper main method as follow

Question:I compute the curvature of a rectangle as sigma is 0.66667. But the result what i got is strange. The curvature of four lines of rectangle are different and not zero? The curvature are 1.9, -6.3, -5.6, 1.5. Then, i roatate rectangle,the curvature of every point is different. Why? Can somebody help me ?Thank you very much


texts: Index of stationarity of a time domain signal

texts: During my internship, I've come across a software that calculates a percentage called "Index of stationarity". This index shows how much stationary is the signal. Does anyone have any idea on how to assess the stationarity of a signal?


texts: DFT-like transform using triangle waves instead of sin waves

texts:
We know that DFT (discrete Fourier transform) breaks down a signal into multiple frequencies of sine waves. Does there exist a transform that does the same thing, but for triangle waves?

For my purposes, im only talking about 1-d signals (like voltages, etc). I'm studying historical stock market data, and I just want to look at reversals in certain stocks. In other words, I want to perform a "low-pass" on the stock price using this transform.

Edit:
If yes, how can I do it?


texts:
It's well known that convolution in the spatial domain is equivalent to multiplication in the frequency domain. i have multiplied the Fourier transform of an image F with H. where H is the FT of a Gaussian function generated by the following code:

function H = gaussian_kernel(size, sigma)

    half_size = floor(size/2);
    [u,v]=meshgrid(-half_size:half_size,-half_size:half_size);
    H = exp(-(u.^2+v.^2) ./ (2 * sigma^2));
end

and the size of H is equal to the size of the image. my question is how to estimate h which is the blurring in spatial domain given that the FT of the gaussian is gaussian.


texts: Amplitude and Phase of FFT gives messy results - Matlab

texts:
I'm trying to calculate the spectrum magnitude and phase of a signal, but when I plot them I get pretty messy results:

The signal is displayed on the right, then I have the magnitude and phase of the fft in the centre and to the left accordingly.

I would have expected to see just few peaks in both the spectrums but instead there are a lot of peaks and it gets really messy.

This is my code:

T = mean(diff(t))
fs = 1/T

figure;
subplot(1,3,1)

plot(1000*t,sig);
title ('Time domain');
xlabel('Time(ms)')
subplot(1,3,2)
plot((0:9999)/10,abs(fft(sig))); % magnitude spectrum
title('Spectrum');legend({'Magnitude'});
xlabel('Frequency (Hz)')
subplot(1,3,3)
plot((0:9999)/10,angle(fft(sig))); % phase spectrum
title('Spectrum');legend({'Phase'});
xlabel('Frequency (Hz)')

Am I missing something or is it supposed to be like this?

I tried already rounding off to zero values that are close to zero, but that did not change anything.


texts: How to filter objects on basis of orientation of regionprops

texts:
I am trying to detect straight vertical lines in an image. I used vertical edge detection and then I tried to check which objects has the orientation > 80 & < 100.

Input Image:

Code:

% Vertical Edge Detection

v = edge(img,'sobel','vertical');
v = bwlabel(v);
stats = regionprops(v, 'All');

% ids = find([stats.Orientation] > 80 & [stats.Orientation] < 100);
% v = ismember(v,ids);

figure,imshow(v);title('Vertical');

Problem:

The problem is that most of the objects are having some weird orientation (some -ve value e.g. -53.xyz)

Output:

when I try to filter the objects, it gives me a full black image as an output.

Someone please explain this behavior. How can I get only straight vertical lines?


texts: Estimating the Signal by Deconvolution with a Prior on the Filter Coefficients and the Signal Samples

texts:
Assume I have signal $y[n]$ which is a result of convolution between channel $h[n]$ and signal $x[n]$. which means:

$$y[n] = h[n] \ast x[n]$$ where $\ast$ is the convolution operation

The signal $y[n]$ could be complex since we can consider the channel $h[n]$ to be complex too.

In normal case, $h[n]$ should be known in order to estimate $x[n]$ using deconvolution process.

My question what about if I only know that $ \forall n$, $$x[n] \in \left\{ -1, 1 \right\}$$ it means $x[n]$ is either $1$ or $-1$, it's a vector and each value in the vector is $1$ or $-1$ ($x[n]$ is a vector of +1/-1 we means I need to estimate the whole vector).

For example if its length is $4$ , it could be $[1,-1,-1,1]$ or $[1,1,1,1]$ and so on. Is it possible in that case to perform anyway, for example, deconvolution or any other method to estimate $x[n]$?

NP: The maximum length of $x[n]$ can be $256$ and maximum length of $h[n]$ can be $64$ , and we have a known information about vector $x[n]$ which is the $sum(x[n]) = 0$.


texts: Is Parks-Mcclellan algorithm guaranteed to stop?

texts: Is there any guarantee that Parks-Mcclellan eventually stop? If so, is there any formula that shows number of maximum interations that ensure that the algorithm stops?


texts:
I am playing around with FFT and cant seem to get the expected results. I have a sound clip that i recorded from a mic placed on an analogue clock. So it has a sound every second.

[wave,fs]=wavread('clock.wav');
t=0:1/fs:(length(wave)-1)/fs;
plot(t,wave);
n=length(wave)-1;
f=0:fs/n:fs;
wavefft=abs(fft(wave));
plot(f,wavefft);

This is the code that i am using. And here are the results.

I should be seeing a huge spike at 1hz but i am not.

The FFT followed by the sound wave.


texts: Obtaining the variance of the image noise

texts:
I am implementing a digital image correlation algorithm, and I found that for some calculations the variance of the image noise would be very interesting.

How can I determine that parameter? The only thing I have are a set of 1000 images of a metal deformation process and no prior information about the noise in the image.


texts:
How did we get this final answer in example in fig attached.
I understand that delta(n) is a DT unit impulse where it is 1 at n = 0 and zero elsewhere.
I understand that u[n] is a unit-step where it is 1 for n>=0 and 0 elsewhere.

How do these two functions equate in final answer below and how did we get each of the final form of the three terms in the final answer? and why is the 3rd term still in u[n-2] form?


texts:
I want to make a plot of the power spectrum for a .wav sound file, over the frequency range from -2000 to 2000 Hz.

Attempt:

I used the following code, but the resulting plot is one sided. It doesn't plot the negative frequencies. But the graph I need to produce has to contain negative frequencies. What do I need to do?

Any help would be appreciated.

Here is my code:

[s, Fs] = wavread('chord.wav');
nfft = 2^nextpow2(length(s));
Pxx = abs(fft(s,nfft)).^2/length(s)/Fs;
Hpsd = dspdata.psd(Pxx(1:length(Pxx)/2),'Fs',Fs);
plot(Hpsd)
axis([-2 2 -150 -35])  %change axis range

Produces:


texts:
Having two different size of sets of points (2D for simplicity) dispersed within two different size squares the question are that:

1- how to find any occurrence of the the small one through the large one?
2- Any idea on how to rank the occurrences as shown on the following figure?

Here is a simple demonstration of the question and a desired solution:

Update 1:
The following figure shows a bit more realistic view of the problem being investigated.

Regarding the comments the following properties apply:

exact location of points are available
exact size of points are available

size can be zero(~1) = only a point

all points are black on a white background
there is no gray-scale/anti-aliasing effect

Here is my implementation of the method presented by endolith with some small changes (I rotated target instead of source since it is smaller and faster in rotation). I accepted 'endolith's answer because I was thinking about that before. About RANSAC I have no experience so far. Furthermore the implementation of RANSAC requires lots of code.


texts:
Suppose you have N samples of a sine wave of frequency $f_0$ sampled at $f_s$.

$$
x[n] = A\sin[2\pi(f_0 /f_s)n]
$$

How do you get a delta function in the frequency domain (i.e. all of the energy is in the center one bin of the FFT)?
Does the number of samples (N) need to be a prime number of cycles of $f_0$? If so, why?
Does $f_s$ need to be an integer multiple of $f_0$? If so, why?


texts: For Schwarz inequality for 2 signals $s_1(t)$ and $s_2(t)$, equality holds if $s_1(t) = c\cdot s_2(t)$ ($c$ is constant). Does $c$ have to be real?

texts:
I tried for 2 signals $s_1(t) = u(t)$ and $s_2(t) = (1+i) \cdot u(t)$.  $i$ is the complex unit ($i = (-1) ^{0.5}$).
I got the left hand side of the inequality as $(1-i)$ and the right hand side as $(1+i)^{0.5}$.
The inequality is L.H.S $\le$ R.H.S.

How is inequality established for complex signals?


texts: Data smoothing in temperature measurements from MLX90614 BCC IR sensor

texts:
I am trying to measure temperature with the MLX90614 BCC IR sensor for my project, and I am having problems with my precision requirement.  I had taken data for 1 second then took the mean of these values. I measured the hand of a human, which was 36.2°C. I took measurements for different distances also like 1 cm, 3 cm, and 5 cm. However, sometimes there is more than 0.1 °C difference between the mean of all measurements( I take measurements for 1 second always), and my goal is to compensate this difference to < 0.1 °C. I tried median, moving average, Savitzky-Golay filter, and a couple more, but none of them lowers the difference. When I checked the histogram of my data, I saw that even for a constant distance from the sensor, there is 0.4 °C variance. Is there any way to compensate for this difference by a filter, or do I need to use more physical requirements while taking measurements? Here are my histograms of data measurements for different distances and mean values:
Mean of the first figure - unfiltered: 32.2072
Mean of the second figure - unfiltered: 32.3612
Mean of the third figure - unfiltered:  32.2749
Mean of the fourth - unfiltered: 32.2735
Mean of the fifth figure  - unfiltered: 32.2243
Mean of the sixth figure - unfiltered: 32.1224
Mean of the seventh - unfiltered: 32.0925
Mean of the last figure - unfiltered: 32.2129
In summary, is there any way to decrease these mean differences up to max 0.1.


texts: Moving average algorithm that conserves integral

texts:
Suppose I have point array $y_i$ of size $N$. How to implement moving average algorithm that conserves quantity
$$
I = \sum_{i=1}^{N}y_i
$$
NOTE: I don't want time shift so I would prefer to use symmetric SMA in the middle:
$$
\hat{y}_i = \frac{1}{n}\sum_{k = i-\frac{n-1}{2}}^{i+\frac{n-1}{2}}y_k
$$
where $\hat{y}_i$  - filtered point, $n$ - window size of SMA.

It is easy to show that the above algorithm conserves $I$ "in the middle" but problem is when processing edges of a signal. So question is how to process edges of a signal in order to conserve $I$?

After several failures to construct simple method to do it I am here.


texts: Spectral leakage from mathematical point of view

texts: Does anyone can explain or propose a reference that mathematically and quantitively investigates the effect of leakage on the magnitude and phase of a signal?


texts: How to create different Time frequency images from a data

texts:
I'm new to Python.
I have a time series in a CSV file that has about 5000 rows and 3 columns.

I have split the data into training and testing in ratio 70:30 respectively.

However, I have a problem on how I use time window containing 1024 data points in one sample and every sample is converted to a time-frequency image (STFT) with size of 224 × 224 x 3.


texts: What is the type number of a discrete time system given $H(z)$?

texts: Given a continuous time impulse response $h(t)$, if I take the Laplace transform and count the no. of poles at origin, that gives the type number of the system. For e.g., $$H(s) = \frac{2}{s(s+2)}$$ Here, there is one pole at origin and hence it is type 1 system. This also implies that the number of integrators in the system is 1. I'm having difficulty in determining the system type when it comes to discrete time systems. For e.g., given the $Z$ transform of impulse response, $$H(z) = \frac1z+\frac1{z^6}$$ how to deduce the system type? Is it 6 because there are six poles at origin? Also how does it relate to no. of integrators in the system given that it is discrete time. Does it correspond to no. of accumulators in any way? I came across this while searching but it talks about the order of the input polynomial as the type of the system which makes the type number independent of the impulse response. Is this correct?


texts: Designing Rayleigh Fading Wireless Channel with particular properties

texts:
I have some information on particular wireless channel between an Access Point(AP) and K users as described in the picture below:

How i can create this channel in Matlab?


texts: Gibbs phenomenon in Hamming's digital filters

texts:
In 'Digital Filters' by Hamming there is a cryptic section where he describes how the Gibbs phenomenon can be viewed as the displacement between the centers of two functions as they are convolved together. This is on pages 112 - 113 of the 3rd edition.

In the process of this he shows that truncating the Fourier Series is the same as multiplying the Fourier coefficients with a rectangle function. He then goes on to show that the function that has 2N+1 coefficients which are 1 is:

$h(\theta)$ = $\frac{sin(2N+1/2)\theta}{sin(\theta /2)}$

I'm confused: I thought the frequency response of a rectangle was a sinc function, and another page he shows this (when he derives the Lanczos smoothing factors).

Could anyone please clear this up for me?


texts: Can I get more information from this signal other than magnitude?

texts:
First a bit of background. I'm working on a metal detector that produces a pulse across a coil. The pulse signal is influenced if metal is present within the coil aperture.This link provides more information on Pulse Induction Metal Detectors. The ideal signal looks like this:

Detection of metal relies on back EMF and the signal recovers after a pulse. I'm working on a design that removes all aspects of the signal except for this "recovery curve" aspect. In MATLAB there is a clear definition between the recovery curve when there is metal and no metal:

At the moment I am calculating the average of the entire "recovery curve" over a number of curves (reading in 50 curves and then calculating the average of each point in the curve) to create an average representative curve and then turning the curve in to just a single number i.e. the average single value of 50 curves. Here is a number of recovery curves of 4 different metal pieces.

And here is when I calculate the average of 50 for each metal piece to create one representative curve:

I am then turning the curve into a number and if it exceeds a set threshold then metal is considered present. Effectively I am turning the average of 50 curves into a single magnitude and then comparing it with a no metal reference value.
While this works, I feel like a better comparison can be made. I want to be able to generate a profile of what a no metal present "recovery curve" looks like and then compare subsequent curves to my reference curve. At the moment I am just using single magnitudes and a comparator to my reference curve. Are there any other techniques I can use to make a more detailed comparison?
Because the shape of the curve changes, i.e. the intial slope can be steeper, the knee of the signal can become rounder etc. is there any kind of technique or filter that I can use to more accurately profile the shape of the curve and compare the shapes rather just the average magnitude? I'm a complete newbie in regards to DSP so If I can be given some direction it would be appreciated.
thanks.


texts: How Can Telecommunication System Know Which Part Is Signal and Which Is Noise?

texts: When signal is received how can receiver know which part of received signal is signal and which part is noise??


texts: Is it possible to create a causal filter with a positively-sloped phase response?

texts:
I am currently prototyping a set of noise-cancelling headphones that utilize active EQ to modify the noise-cancelling signal, allowing the user to modify the frequencies that they hear or don't hear. I have been using biquad filters on an input signal from a microphone to play back a filtered signal in real time. Of course, the trouble with this within the context of noise-cancelling headphones is that the filters impose a phase change in the frequencies, and the inverted cancelling signal no longer lines up with the original sound signal.

I am curious if it is possible to create a stable, causal filter with a positively sloped phase response. Because if so, I would like to add such a filter in series with a highpass or lowpass filter (which have negatively-sloped phase responses) such that the phases add to a constant value. I know that it is impossible to do realtime zero-phase filtering, but what about realtime filtering where the phase at each frequency is, say, 360 degrees?

I tried creating an 'inverse' all pass filter where I switched the coefficients for the zeroes and poles of a normal all pass filter, which would have a theoretically positive phase response. But I quickly learned that this is an unstable filter and is impractical (I'm very new to DSP so this was not immediately obvious to me). So I'm wondering if there is any sort of filter that may have the effect I'm looking for, even if it delays the whole signal.

Is there possibly another solution I have not yet thought of? Maybe separating the signal into high and low frequencies and doing some sort of processing that way?

Any help is much appreciated, thanks!


texts: Is it common to impose the sparsity on the Fourier coefficient itself?

texts:
In compressive sensing, I see many works to impose the sparsity on the wavelet coefficients (e.g., by minimizing the L1 norm of such coefficients.) Another example in MRI is to impose sparsity on the gradient of the unknown image (total variation).
However, I'm interested in imposing the sparsity on the Fourier coefficients itself. I couldn't find for the moment. If there is any reference, could anyone let me know? Or, I'm not sure whether it doesn't make sense.


texts: Get sound from matlab and convert with FFT

texts: My question is simple but I am new to MATLAB's sound functions so I am unsure what to do. I would like to read the audio (from the microphone) then apply the fft(X,n) function to it where the n should be 256. I was applied the fft function to this code like fft(myRecording,256) but I kept getting zeros.


texts: CLAHE - Redistributing excess pixels among histogram bins

texts:
In order to clip an image's histogram to a maximum value, according to the CLAHE algorithm, the excess pixels (above the clip limit) will be distributed equally among all the histogram bins (While keeping track none of the bins exceed the max limit of course).

Now, when working with (8,8) region size and distributing 13 pixels on 256 bins, the uniform added value (13/256) will be rounded to zero and so the total number of pixels in histogram will be reduced from (8,8) -> 64px to 64 - 13 = 51px.

That doesn't make sense since I'll be neglecting 13 pixels of the region.

Any tips on how to tackle this part of the algorithm?


texts: Find CT Fourier transform of $ \left[ \frac{ \sin(\pi ~ t) }{\pi ~t} \right] \left[ \frac{ \sin(2\pi ~ (t-1)) }{\pi ~(t-1)} \right] $using properties

texts:
Use properties of Fourier Transform to solve the question.
The question is in the imgur link below.
I got $f_t$ of $\frac {sin(pi \cdot t)}  {pi \cdot t}$ as rectangular pulse with value $1$ from -pi to pi
second ft is $e^{-jw}$ from $-2 \pi$ to $2 \pi$.
I'm unable to get the resultant of two of them


texts: Is cutting EQ scientifically different than boosting EQ?

texts:
This is a fairly standard belief in the audio production scene that cutting EQ is somehow "cleaner" than boosting EQ. You hear arguments like there being different phase characteristics or whatever. The more careful arguers refer to psychoacoustics (that it's easier to listen to the effects of cuts, rather than boosts).

However, is there a difference in the filter in terms of cutting and boosting? And which one is "cleaner"?


texts: LTE system. How to compute precoder for resourse block

texts:
guys!

I am studying a massive Mimo system and 3gpp LTE system and have questions about precoding in the LTE system. In LTE RB (resource block) is used to group consecutive subcarriers.  To compute precoder and reduce the complexity of computation it is possible to compute one precoder for RB.

In this post, the frequency selective channel was discussed and mentioned: "to average the second-order statistics."  Does it mean: covariance, covariance function? I have read that it is used for signal, but how to use for RB ... I dont know...

Does anyone give me more details?


texts: Output signal is being attenuated after the Biquad filter direct Form 1, why?

texts:
Thought this would deserve a separate post on its own.
What's going on is that I finally got my low pass digital filter working on the STM32H753ZI using the PMODI2S2 peripheral and I noticed the output signal is extremely low ~340mVpp this is after the biquad filtering. If I take out the low pass filtering the output signal then raises to around ~600mVpp.
What's causing this phenomenon? The digital filter bode plot says the gain from very low frequencies up to the cut off is 0dB so I dont understand whats going on. The only thing I can think of is the biquad filter is causing an attenuation perhaps?
Analog Filter: $$ LPF_{Analog}=\frac{3.94e07}{s^2+8889s+3.94e07}$$
]3
Digital Filter: using tustin $$ LPF_{Digital}=\frac{0.00102z^2 +0.002041z+0.00102}{z^2-1.908z+0.9116}$$

Pictures:
Input signal(yellow) from wave gen and output signal(green) after the Biquad filter

Input signal(yellow) from wave gen and output signal(green) passthrough with the peripheral no digital processing

Bode plot from Oscilloscope with the biquad filter:

CODE:
#define ARM_MATH_CM7

#include "main.h"

#include "arm_math.h"

void init_Clock(void);
void init_I2S(void);
void init_Debugging(void);
void init_Interrupt(void);
void init_SpeedTest(void);

int32_t RxBuff[4];
int32_t TxBuff[4];
uint8_t TC_Callback = 0;
uint8_t HC_Callback = 0;

char uartBuff[8];
 float32_t iir_coeffs[5] = {0.00102f, 0.002041f, 0.00102f, 1.908f, -0.9116f}; //B0, B1, B2, A1, A2
float32_t iir_mono_state[4];

float32_t Rx_Buff_f[4];
float32_t Rx_Buff_f_out[4];

arm_biquad_casd_df1_inst_f32 monoChannel;

void DMA1_Stream0_IRQHandler(void) {

    if (((DMA1 -> LISR) & (DMA_LISR_TCIF0)) != 0){
        DMA1 -> LIFCR |= DMA_LIFCR_CTCIF0;
        TC_Callback = 1;
    }

    else if (((DMA1 -> LISR) & (DMA_LISR_HTIF0)) != 0){
         DMA1 -> LIFCR |= DMA_LIFCR_CHTIF0;
         HC_Callback = 1;

    }
}

int main(void) {

    init_Clock();
    init_I2S();
    //init_Debugging();
    init_Interrupt();
    //init_SpeedTest();
    arm_biquad_cascade_df1_init_f32(&monoChannel, 1, iir_coeffs, iir_mono_state);

  while (1)
  {

      if (HC_Callback == 1){

         // GPIOA->BSRR |= GPIO_BSRR_BS3_HIGH;

          for (int i = 0; i < 2; i++){
              Rx_Buff_f[i] = (float32_t)RxBuff[i];
          }

          arm_biquad_cascade_df1_f32(&monoChannel, Rx_Buff_f, Rx_Buff_f_out, 2);

          for (int i = 0; i < 2; i++){
                TxBuff[i] = (int32_t)Rx_Buff_f_out[i];
            }

          HC_Callback = 0;

      } else  if (TC_Callback == 1){

        //  GPIOA->BSRR |= GPIO_BSRR_BR3_LOW;

          for (int i = 2; i < 4; i++){
               Rx_Buff_f[i] = (float32_t)RxBuff[i];
            }

                  arm_biquad_cascade_df1_f32(&monoChannel, &Rx_Buff_f[2], &Rx_Buff_f_out[2], 2);

                  for (int i = 2; i < 4; i++){
                        TxBuff[i] =  (int32_t)Rx_Buff_f_out[i];
                    }

          TC_Callback = 0;

      }

  }

}


texts:
I try to work out the simplest system, whose response is $H(z) = 1 + cz + c^2z^2 + c^3z^3 + \cdots = 1 / (1-cz)$

Now, Z-transform done quick (Fourier connection) and 4.5 Transfer Function, Poles and Zeros say that we just need to plug $z => e^{iw}$ to get the frequency response. I am getting single pole at $w = i \ln c$. It is complex. What is the frequency response? The second link says that real coefficients must generate complex poles in pairs. Where is the second pair?


texts: Conjugate symmetry of real-coefficient filters in Oppenheime's Discrete Time Signal Processing

texts: Is someone able to tell me where and how I could look up the yellow part in Oppenheime's Discrete Time Signal Processing, or explain it?


texts: How to find Coefficients of Autoregressive (AR) model using least means square (LMS) Algorithm without having future signal?

texts:
I want to do two things.

Estimating Coefficients of AR model using LMS
Using Coefficients found in step 1 and predict future samples of a signal using AR equation.
I don't have a desired signal so I can't use future samples as well.

The equation of Autoregressive model is $$x(n) = \sum_{i=1}^p a_i x(n-i) + e(n)$$

where $p$ indicates the AR model order ($p=30$ in my case) and $\mathbf{a}$ shows the AR coefficients $\{a_1, a_2, a_3, a_4,\ldots, a_{30}\} $.

And LEAST MEANS SQUARE (LMS) algorithm is as follows:

Order=30;      % AR model order
M=30;           % No of filter coefficients same as AR model order
mu=0.001;      % Learning rate/ step size
x=signal(1,1:700);  % length of signal is 700 samples, x= input signal
N=length(x);
Predicted_signal=zeros(1,N);
w=zeros(1,M);               % weights / filter coefficients
for n=M:N
    pp=n-M+1;
    x1=x(n:-1:pp);
    Predicted_signal(n)=(w*x1');
    e(n)=x(n)-Predicted_signal(n);     %e(n)=d(n)-y(n); reference signal - actual signal
    w=w+2*mu*e(n)*x1;
    w1(n-M+1,:)=w(1,:);      % filter coefficients
end

Coefficients (weights/ w) found in previous code to be used in AR equation.

ts = prediction starting point that is 436th sample

Predicted_signal_ar= orignal_signal(1,1:436);
for i=1:Order
    t=ts-i;
    prediction1(1,i)=(w(1,i)*Predicted_signal_ar(t)); %% putting lms coefficients in AR equation
end

s1(1,a)=sum(prediction1(1,:));
Predicted_signal_ar(1,ts)=s1(1,a);

There is some error in my code and I am not sure what is it. The above code should give me close to actual Coefficients which then I pass to step 2 for AR prediction. In results of 2nd step there is a sudden jump in prediction of first few points and prediction performance is also poor.


texts:
How is FT of $ \delta $(t) equal to 1 ? Normal FT gives the result $\infty$. Can someone please explain? I did the normal integration and substituted the limits.

Is it because  $ \delta $(t) is a unit impulse function so as it's height is large it's width is very small so no matter what the FT will always be equal to 1 ? (I'm just trying to figure out the logic)


texts: Algorithm to remove vocal from audio file

texts:
I have tried some tutorials with audacity but was highly disappointed with the result (to be fair the resulting output is not that bad, but not good enough for prod).
What reputable algorithm could I use to process myself a mp3 file and remove the vocals while preserving the drums and centered instruments, and removing vocal echo?
NB: The "duplicates" are 5 years old.


texts: May a causal system depend on future values of its own output

texts:
For example, let's assume a system given as

y[n]-9y[n+2]=x[n]

I convert the difference equation to

y[n]=(y[n-2]-x[n-2])/9

and say that "the system is causal" and "not-memoryless" since it depends on past values of its output. But could it be possible to define a system to be "not-causal" and depend on any future value of its own output at the same time (no input term other than any present value of x[n] will be possible for this system and)?


texts: Computational burden of EMD/Huang-Hilbert vs wavelet

texts:
I am working on an online application of signal processing and pattern recognition. It involves sampling the signal at 2 MS/s, extracting features and classifying.

My classifier has pretty good accuracy so far using the DWT (discrete wavelet transform) with 3 decomposition levels. However, I have been studying the EMD (Empirical Mode Decomposition) and trying to apply it to the problem since my data is highly non-stationary. The algorithms that I got are waaaaaay slower than the wavelet and PSD (power spectral density) estimation by Welch's method (another one that I was using.)

Is this normal/expected behavior? For wideband data is possible to implement it to work online?

Sorry about the broad question, it seems that it is more a curiosity for discussion that anything.


texts: When you perform a discrete Fourier transform (DFT), and compute the DFT coefficients, $c_k$ and $X(K)$, what do these values tell us about the signal it came from?


texts: Noise Equivalent Bandwith of IIR and FIR Filters?

texts: How do you calculate the noise equivalent bandwidth for an IIR or FIR filter?


texts: Implementing a Kalman filter for position, velocity, acceleration

texts: I've used Kalman filters for various things in the past, but I'm now interested in using one to track position, speed and acceleration in the context of tracking position for smartphone apps.  It strikes me that this should be a text book example of a simple linear Kalman filter, but I can't seem to find any online links which discuss this.  I can think of various ways of doing this, but rather than researching it from scratch, perhaps someone here can point me in the right direction:Does anyone know the best way of setting up this system?  For example, given the recent history of position observations, what's the best way of predicting the next point in the Kalman filter state space?  What are the advantages and disadvantages of including acceleration in the state space?  If all measurements are position, then if speed and acceleration are in the state space can the system become unstable?  Etc ...Alternatively, does anyone know of a good reference for this application of Kalman filters?Thanks


texts: Compressed / Compressive Sensing - Sensor Placement

texts:
I have a beam fixed at one end and free at the other. It obviously results in vibrations due to the disturbances in the environment or when induced. This system can be represented using a differential equation. The vibrations are sensed using sensors, analyzed and reduced. Now, the sensing is done through compressed sensing technique.

How is it possible to find the optimal sensor placement (minimal number of sensors along with the details of its spatial position) just with the help of the measurement matrix (that we design in compressed sensing for reconstruction purpose)?

Suppose we want to retrieve $\mathbf x$ (vibrational info) from: $\mathbf{y= Cx}$, where $\mathbf C$ is the fat matrix (measurement matrix * sparse matrix). I want to find a relationship that the measurement matrix can hold with the placement of sensors. It's like an inverse problem, instead of designing a measurement matrix with respect to the sensors placed, I want to place the sensors with the knowledge I have about the measurement matrix.


texts:
I have a simulink model over 2.4GHz.

In the transmitter part, the modulation  is O-QPSK modulated baseband instead of passband modulation.

In Matlab Help this is the reason of using baseband modulator instead of passband one .

But I still can't understand how can linear channel  be  represented as baseband system as it can be represented as RF passband system.

I confused also between baseband and complex envelope.,


texts: Computing the gains of a piecewise affine system

texts:
I have a piecewise affine (and memoryless) system, e.g., a response like the following one.

I could manually find the gain in each region by applying a ramp signal. However, the system's input must be a sine wave.

Is there any technique that could be used to find the individual gain and slopes in each region?


texts: I wish to create a GNU Radio program in C++ that doesn't need GRC or Python, is there a reference or template for this?

texts:
I want to create a functionally equivalent C++ file to the Python top_block.py file that is generated by GRC when executing a (blank example) flow chart.

I know that C++ can be used to define blocks specifically, and so I would assume that by creating a C++ file and including and using the methods from defined blocks through the relevant header files would allow for, essentially, the creation of GNURadio programs without the use of GRC or Python.

Has anyone created similar programs to this? Is there any chance I can make GRC generate such a file, or can someone point me to reference programs / documentation?

At it's core my question is how would I make the following Python file in C++?

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Wed Oct 16 17:45:58 2019
##################################################

if __name__ == '__main__':
    import ctypes
    import sys
    if sys.platform.startswith('linux'):
        try:
            x11 = ctypes.cdll.LoadLibrary('libX11.so')
            x11.XInitThreads()
        except:
            print "Warning: failed to XInitThreads()"

from PyQt4 import Qt
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import sys

class top_block(gr.top_block, Qt.QWidget):

    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################

    def closeEvent(self, event):
        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.settings.setValue("geometry", self.saveGeometry())
        event.accept()

    def get_samp_rate(self):
        return self.samp_rate

    def set_samp_rate(self, samp_rate):
        self.samp_rate = samp_rate

def main(top_block_cls=top_block, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()

if __name__ == '__main__':
    main()

Apologies as I am unsure if this question is better suited here or on stack overflow, feel free to mark it for migration if it is not appropriate here!


texts: Why root raised cosine filter can eliminate intersymbol interference (ISI) ?

texts:
My question is kinda silly, I know it. But I cannot understand why root raised cosine filter or raised cosine filter can eliminate ISI.
I googled before, but those explanation is not easy for me to understand. Maybe someone can help me this with some figures? Thank you so much for you help in advance.


texts: Why did a digital HPF increase the gain of high-frequency signal?

texts:
Background: I was trying to remove the DC component of a load cell signal using a high-pass filter. I don't care about that anymore. I'm curious why a digital filter and an analog filter behave differently under the same conditions.

Here (link 1, link 2) is the data I'm working with, and below is my Python code:

import numpy as np
import math as m
from scipy import signal
from scipy import fftpack
from myLib import myFFT
import matplotlib.pyplot as plt

# load data

filename = "raw_data.txt"
fSampling = 1E3
fNyquist = 0.5*fSampling
data = np.loadtxt(filename,skiprows=0)
i1 = 1000
i2 = 5000
t = data[:,0]
x = data[:,3]

# remove DC component

fCutoff = 0.01/fNyquist
bd, ad = signal.butter(4, fCutoff, 'high', analog=False)
xd = signal.filtfilt(bd,ad,x)
ba, aa = signal.butter(4, fCutoff, 'high', analog=True)
xa = signal.filtfilt(ba,aa,x)

# plot results

f, axarr = plt.subplots(3, sharex=True)
axarr[0].plot(t, x)
axarr[0].set_title("raw")
axarr[0].set_ylabel("x [-]")
axarr[1].plot(t, xd)
axarr[1].set_title("digital")
axarr[1].set_ylabel("x [-]")
axarr[2].plot(t, xa)
axarr[2].set_title("analog")
axarr[2].set_xlabel("t [s]")
axarr[2].set_ylabel("x [-]")

plt.show()

Problem The digital filter doubles the values, while the analog filter does not.

Why does the digital filter behave differently? Is something weird about my data, or do digital and analog filters behave differently? I'm new to signals processing (this all originated from me leaving the analog flag with the default "False"), but I thought analog and digital filters were generally different means to the same end.

Edit: I did some research online, and I've learned that I should use a digital filter to filter regularly sampled data. I don't know why yet (digital filters perform better at a known range?), but this is just making even more curious why my digital filter increased the gain of my signal. I analyzed the frequency response of the digital filter, and theoretically I should get a gain of 0:

I want to chalk this up to numerical errors since the digital filter's numerator and denominator are so close, but so are the analog filter's numerator and denominator:

b digital = [ 0.99991791 -3.99967164  5.99950746 -3.99967164  0.99991791]
a digital = [ 1.         -3.99983581  5.99950745 -3.99950746  0.99983583]
b analog = [ 1.  0.  0.  0.  0.]
a analog = [  1.00000000e+00   5.22625186e-05   1.36568542e-09   2.09050074e-14
   1.60000000e-19]


texts: Prove that a specific auto-correlation function is even

texts:
Background (from digital signal processing):
The $\delta$ function is defined as below:
$$\delta[n]=\begin{cases}
1 \quad \mbox{if} \hspace{.4em} n=0\\
0 \quad \mbox{o.w.}
\end{cases}$$
In an LTI (Linear Time-Invariant) system, we denote the response to the $\delta$ function by $h$.

Question:

Assume that $h$ is defined as below:
$$h(n)=\sum_{k=1}^p a_k h[n-k]+G \delta[n]$$
where $a_k$'s are some defined coefficients, and $G$ is another fixed
coefficient like them. $p$ also a fixed value.
Also, let the auto-correlation function $\hat{R}(m)$ be defined as
follows:
$$\hat{R}(m)=\sum_{n=0}^{\infty}h[n]h[n+m]$$
Prove that $\hat{R}(m)=\hat{R}(-m)$

My try:
I managed to define a new variable $v=n+m$. Since $n$ was from $0$ to $\infty$, $v$ will be from m to $\infty$. Re-writing $\hat{R}(m)$ using the variable, we have:
\begin{align}
\hat{R}(m)&=\sum_{v=m}^{\infty}h[v-m]h[v]\\
&=\sum_{v=0}^{\infty}h[v-m]h[v]-\sum_{v=0}^{m-1}h[v-m]h[v]\\
&=\sum_{n=0}^{\infty} h[n-m]h[n]-\sum_{n=0}^{m-1}h[n-m]h[n]\\
&=\hat{R}(-m)-\sum_{n=0}^{m-1}h[n-m]h[n]
\end{align}
Now I need to somehow prove that $\sum_{n=0}^{m-1}h[n-m]h[n]$ is equal to $0$. However, I do not know how. It looks like a deadend.

Note: Denoting the functions like $f[n]$ instead of $f(n)$ in this context is due to the fact that we are working with digital signals where we assume that the domain consists only of the integers.


texts:
If these 2 signals, that form this duplex, have ranges of 15-30 [kHz] and 30-45 [kHz] using:

$NoiseFloor_{dBm} =10\log _{10}(k\times T_{0}\times 1000)+NF+10\log _{10}(BW)$ (formula from wikipedia)

and if $k,T,NF$ and $\Delta f$ are given, only thing left to figure out is the $BW$ (bandwidth). Is the $ BW=2(\Delta f+f_{m})$ where $f_{m}=2\times 15=30 [kHz]$ correct formula for the bandwidth of this duplex?


texts:
I have a signal of some length, say 1000 samples. I would like to extend this signal to 5000 samples, sampled at the same rate as the original (i.e., I want to predict what the signal would be if I continued to sample it for a longer period of time). The signal is composed of several sinusoidal components added together.

The method that first came to me was to take the entire FFT, and extend it, but this leaves a very strong discontinuity at frame 1001. I've also considered only using the part of the spectrum near the peaks, and while this seems to improve the signal somewhat, it doesn't seem to me that the phase is guaranteed to be correct. What is the best method for extending this signal?

Here's some MATLAB code showing an idealized method of what I want. Of course, I won't know beforehand that there are exactly 3 sinusoidal components, nor their exact phase and frequency. I want to make sure that the function is continuous, that there isn't a jump as we move to point 501,

vals = 1:50;
signal = 100+5*sin(vals/3.7+.3)+3*sin(vals/1.3+.1)+2*sin(vals/34.7+.7); % This is the measured signal
% Note, the real signal will have noise and not be known exactly.
output_vals = 1:200;
output_signal = 100+5*sin(output_vals/3.7+.3)+3*sin(output_vals/1.3+.1)+2*sin(output_vals/34.7+.7); % This is the output signal

figure;
plot(output_signal);
hold all;
plot(signal);

Basically, given the green line, I want to find the blue line.


texts: What filters are used to get an image like one on the left? I need to find the body pose of a person in a picture.


texts: What is the difference between an impulse response and a kernel?

texts:
It seems to me they are two terms used to refer to the same concept, but, according to the Wikipedia page on Guassian filter

  a Gaussian filter is a filter whose impulse response is a Gaussian function

So, what is the difference between an impulse response and a kernel? I am particularly interested in knowing the difference in the context of computer vision and image processing.


texts: How to design a cosine filter for bpsk using liquid dsp?

texts:
I was trying to build a (B)PSK-63 modulator as my hobby project.
Here is my code and the link to specs:
How to modulate PSK63 with liquiddsp?
Now it is working, but since I am using a NCO to shift the signal from zero to 500 Hz, i have a lot of harmonics:

I have found a function that designs a kaiser filter:
unsigned int h_len=100;  // filter order
float h[h_len];

float fc=0.0525f;             // cutoff frequency
float As=60.0f;
liquid_firdes_kaiser(h_len, fc, As, 0, h);

And it works. But as you can see it is a low-pass filter, where I need a band-pass filter.
The specs on ARRL suggest that I use a cosine filter between the modulator and the output.
So, here is the question: how to set up the cosine filter in liquid dsp or what filter should I use instead?