texts:
Say I have an integrator with transfer function $\dfrac{\mathrm{F_s}}{s}$.

This integrator has an initial condition zero and integrates from $t=0$ to $t=\dfrac{1}{Fs}$.

If I apply a constant $V_{\mathrm{in}}$ together with a white noise source $e(t)$ ~ $N(0,\sigma^2)$ then I would have at the input $$\mathrm{SNR}=\dfrac{{\mathrm{Vin}}^2 }{\sigma^2 }$$

At the end of integration at $t=\dfrac{1}{Fs}$, the output power of the signal is $$P_{\mathrm{signal}} ={V_{\mathrm{in}} }^2 {F_s^2 \left(t\right)}^2 ={V_{\mathrm{in}} }^2$$
However, the output variance of the integrated noise (Brownian motion) is
$$P_{\mathrm{noise}} =\sigma^2 F_s^2 t=\sigma^2 F_s$$ resulting in SNR at the output Fs times lower than that at the input.

This calculation does not seem consistent with simulation.
Is there something wrong with my derivation?


texts: How many DFT bins must I use to get best precision when analyzing melody scale

texts:
I need to analyze some signals containing chords.

How big DFT spectrum is needed to identify each possible musical note in such a signal sampled at 44100 Hz? I can see that 8192 bins gives some frequencies close to some notes like C3 A4 etc., but how big should it be to contain the whole scale, let's say to C5 and with good precision, like for a very good tuner?


texts: How to apply band-pass filter and get the filtered back from frequency to time domain in python?

texts:
I know this is basic for signal processing, but, I am not sure what is wrong about my approach. I have a signal that behaves as damped sine signal with a sampling frequency of 5076Hz and 15,000 number of samples. I found from the following website how to convert a signal from a time domain to frequency domain and managed to get the FFT and frequency values. The code can be found below the link:
Machine Learning with Signal Processing Techniques
def get_fft_values(y_values, T_s, N, f_s):
    f_values = np.linspace(0.0, 1.0/(2.0*T), N//2)
    fft_values_ = np.fft.rfft(y_values)
    fft_values = 2.0/N * np.abs(fft_values_[0:N//2])
    return f_values, fft_values

I managed to get the frequency and FFT values. However, I need to implement filters to remove some noise from the signal, so, I created the following functions to implement the filter part:
def butter_bandpass(lowcut, highcut, fs, order):
    nyq = 0.5 * fs
    low = lowcut / nyq
    high = highcut / nyq
    b, a = butter(order, [low, high], btype='bandpass', output='ba')
    return b, a

def butter_bandpass_filter(data, lowcut, highcut, fs, order):
    b, a = butter_bandpass(lowcut, highcut, fs, order=order)
    y = filtfilt(b=b, a=a, x=data)
    # y = lfilter(b=b, a=a, x=data)
    return y

I know that I would need to implement the following steps:

Convert to the frequency domain
apply a bandpass filter to get rid of frequencies you don't care
about
convert back to the time domain by inverse Fourier transform

So, I created the following inverse transform function, but, I can't get the filtered signal back and the amplitudes don't almost match the original signal.
(For my case, I need to resample)
def get_ifft_values(fft_values, T, N, f_s):
    # Time axis:
    N = 9903
    S_T = 1 / S_F
    t_n = S_T * N  # seconds of sampling
    # Obtaining data in order to plot the graph:
    x_time = np.linspace(0, t_n, N)
    ifft_val = np.fft.irfft(fft_values, n=N)
    y_s, x_time = scipy.signal.resample(x=ifft_val, num=N, t=x_time)
    return x_time, y_s

My Approach and here are the results from the signal:
##### Converting the signal into fft:
f_val, fft_val = get_fft_values(y_values=y, T=S_T, N=N, f_s=S_F)
# Applying bandpass filter:
fft_filt_val = butter_bandpass_filter(data=fft_val, lowcut=50, highcut=600, fs=S_F, order=2)
# Applying the inverse transform of the frequency domain:
x_time, y = get_ifft_values(fft_values=fft_filt_val, T=S_T, N=N, f_s=S_F)

FFT of the original signal:

Filtered FFT of the original signal:

Converted Signal from Filtered FFT:

Without Applying the bandpass filter:

What am I doing wrong here?


texts: Frequency response of filter  signal mix

texts: This might be a weird question but here's the setup: I have a few biquads that filter a signal $x[n]$ and output the filtered signal $y[n]$. I can calculate the frequency response of those biquads with the z-transform. Now I mix $x[n]$ and the filtered signal $y[n]$ such that the mixed signal $y'[n]= a \cdot x[n] + (1 - a) \cdot y[n]$ where $0\leq a\leq 1$. How would I go about calculating the frequency response of $y'[n]$?


texts:
I would like to ask something regarding CICs (Cascaded Integrator-Comb filters) or more particular about the frequency response of it.

Assuming that I have as input IQ samples from a signal generator that are multiplied over a complex multiplier by another set of IQ samples; by changing the frequency of each of the IQ samples generators one can see a single spike on the spectrum analyser shifting left or right (exp()*exp()).

If I apply a CIC decimator in the output of that complex multiplier I would expect to see (according to some matlab code I have put together) that spike to be moved according to the decimation factor (forward in frequency by a factor of 2 if the decimation rate is 2).And that would occur if that spike “falls” within the CIC’s pass band.

That, I can confirm on matlab.

However, in an actual design by plotting on an actual Spectrum analyser (after DAC), the only think am getting in the output is the frequency response of the CIC.

Can you give some input on my thoughts?

G


texts: Generating a phase modulation frequency spectrum with jitter

texts:
I would like to produce a frequency spectrum plot like this:

(from All About Circuits)

I know that one can take the modulation frequency and multiply it by a given order and scale by the modulation depth to get a similar graph with infinitely sharp peaks, but I am interested in the fact that this spectrum shows some spreading of the frequency around each modulation order. Is there an equation that produces something like this plot, with a variable that influences the frequency spread (I guess caused by phase noise or jitter)?

I'm not interested in the time domain signal, just a means of plotting a signal in the frequency domain with some assumption about frequency spread and modulation depth.


texts: Is this jumbled image due to difference between Matlab and Python slicing?

texts:
When I import an image from Matlab I get the following jumbled image

rather than the (224x224x3 RGB) image of a single elephant I expected

I write the image from Matlab as a binary file

function save_bin(filename, input_image)
  r = input_image(:,:,1); % dump image for input to python
  g = input_image(:,:,2);
  b = input_image(:,:,3);
  fid = fopen(filename,'wb');
  fwrite(fid, r(:), 'float32');
  fwrite(fid, g(:), 'float32');
  fwrite(fid, b(:), 'float32');
  fclose(fid);
endfunction

And read it back into Python as follows

m_resized = np.reshape(np.fromfile('m_resized.bin', dtype=np.float32),(224,224,3))
image = Image.fromarray(np.uint8(m_resized), 'RGB')
image.show()

I've investigated the slicing differences creating a 3x3x3 tensor in Matlab and importing it and there's a fundamental difference in the slicing syntax between Matlab Python but this alone doesn't explain  what's going wrong

Any ideas?

Note: The reason I'm using a binary format rather than a jpg image is that I want to compare a Matlab CNN model to a Numpy implementation at each stage and using an image is an intelligible means of comparison rather than comparing lots of numbers.


texts: How to determine fundamental frequencies (beats/minute) of heartbeat? (matlab)

texts:
read = matfile('ECG.mat');
[cor, lags] = xcorr(read.ecg, read.ecg);
read.Fs;

So i have read.ecg (signal) and read.Fs. How can i find/count beats/minute in matlab?

Here is plot


texts: Evaluation of Keypoint Detector and Feature Descriptor Combos for Vehicle Detection

texts:
I am currently doing a research project into the effectiveness of different keypoint detector and feature descriptor combinations for the task of vehicle detection.

At the moment I am using a SVM for simple binary classification of vehicles testing both the bag-of-features model and pyramid match kernels for mapping the set of vectors detected to a single feature space.

I only have a limited dataset of around 5 minutes of video captured from a UAV, of which I have manually extracted the vehicle images and rotated them so that the cars direction is horizontal. Currently I am evaluating the performance of the different detector and descriptor combos using the F-measure (F1 score). However with the aim to find a combo that are invariant to image transformations, scale, rotation, illumination/lighting variations, colour and slight affine transformations as to generalize well and be sufficiently unique to maximise the accuracy of classification, should I also be evaluating the F-measure in different conditions such as scale changes, rotation, perspective rotation, camera yaw, motion blur, and varying static and dynamic lighting conditions.

However with a limited dataset I am finding it difficult to to understand how I should go about this. For example would it be appropriate to rotate my test set by varying degrees and then use the evaluated f-measures to compare the feature detector/descriptor combos accuracy under different rotation?

Any recommendations of how I should approach the evaluation/comparison of the keypoint detector and feature descriptors under these situations would be appreciated.


texts:
I have this image:

What methods should I use to extract the veins from this image.
Thank you.


texts:
Ok for first information I would like to let you know that I originally do not have any formal exposure in signal processing so I would appreciate if you consider me as a beginner. In particular in this project I have to deal with the method of compressed sensing (CS). As some of you might know that CS relies on the sparsity of the signal in some basis.

My first question is, when a reference mentions "wavelet" with no specification of which type of wavelet being referred to, what would be the type of wavelet which is common enough so that this reference doesn't mention it, if there is any?

Second, the main matrix equation in CS is
$$
\begin{align}
y &= \Phi \Psi s\\
\Updownarrow\\
y &= \Phi x,\quad x = \Psi s
\end{align}
$$
where $y$ the measured samples, $\Phi$ measurement matrix, $\Psi$ the representing basis matrix, and $s$ the expansion coefficients in $\{\Psi_i\}$ basis which we want to solve for. Ok up to this point I hope I haven't made any mistake in interpreting that equation.

My question is how do people normally chose the basis? I think this choice of basis is critical because the expansion coefficients $s$ depends on the chosen basis.
As we would want $s$ to be as sparse as possible, doesn't it also mean that we need to carefully choose the most favorable basis?
If so, how would I decide the right choice? I read in some references they mostly use wavelets representation as the basis.

and by the way, the mathematical expression of the expansion in wavelets domain contains all possible indices of the bases (wavelets), that is the signal is the sum over both indices (dilation and translation indices) of the bases.

How should I choose which pairs of indices I better put in the matrix $\Psi$, if for example the signal is $n$ elements long? In that case I obviously only need $n$ bases and the corresponding coefficients out of the infinite possibility.
Can I randomly take any $n$ bases provided any two different bases are always orthogonal?


texts:
Can you help me (show me how) to solve the following exercise?

For the process with transfer function $G(s)=e^{-2s}/(s+1)$ design a digital controller with sampling time $T_{s} = 1$ that meets the specifications:

$e_{∞}$ (steady state error) null whit a step as input;
dominant poles in closed loop with damping $ζ≥0,5$;
settling time $T_{a1}≤20sec $.


texts: How to remove noise from frequency spectrum?

texts:
I have a signal acquired at 40 MHz sampling rate, from an ultrasound transducer with center frequency of 5 MHz.
The frequency spectrum is shown in attached images (whole spectrum and zoomed).
There is ~400 KHz noise present in the whole spectrum (see red boxes).
How can I filter this noise? It looks like a abs(sinc) multiplied in frequency domain :/


texts:
i'm looking for a free/opensource solution for digital image processing with reasonable performances processing quite large images (e.g. actual smartphones have resolutions of 8-10Mpx) and being ready for fast-prototyping/research.

Octave would be a good solution as it provides a lot of statistical and matrix manipulation tools. However octave is too slow when running nested loops and the provided image package is too slow when displaying images.
Octave + MIJ would be a better solution but actually seems unusable and unstable because of slowness and because of the different datatype handling needs.
OpenCV has excellent performances but it's not really handy for fast prototyping because i actually would need something like a scripting language (no compilation, online code/variable modification and so on...) and some tools (like octave has) for plotting functions, graphs, histograms and make statistical calculations.

Any advise?
Thank you very much


texts: Determine whether a signal is periodic or not and get fundamental period

texts:
Here is my signal

Cos(n/2)*cos(pi*n/4)

cos(n/2) has period 4pi and cos(pi*n/4) has period 8

Now, the question is will the signal be periodic for fundamental period 32pi ?


texts: Meaning of channel capacity in the AWGN channel

texts:
I understand the concept of channel capacity as the maximal rate of the channel code I can apply without making a mistake in the receiver, in that sense the capacity is between 0 and 1.
What I don't understand is the meaning of the capacity in the AWGN channel case where it is calculated by C=(1/2)*log2(1+SNR) where clearly I get a number greater than 1 when the SNR is greater than 3 (linear scale).
How can I pass more than 1 bits/channel use when the SNR is very high?

Thanks


texts: How to calculate signal which is not changed by a filter?

texts:
Suppose that there is a FIR filter F and a signal S.  The filtered signal is the convolution of F and S, F * S.

The problem: how to calculate a signal S' such that F * S' = S' (the filtered version is the same as itself, up to a fixed time shift), and S' minimizes norm(S, S') (where norm is some kind of distance metric, for example sum of squared differences).

Loosely: how to calculate the most similar signal to a given signal which is not affected by a filter?

EDIT: The original problem may be over constrained because there may be very few (or no) signals for which F*S = S exactly.  An alternate formulation is to find S' which minimizes the combined error alpha*norm( F*S' - S') + beta*norm( S' - S ), for some weights alpha and beta.

EDIT: The specific filter I have in this case is F=[ 0.00097656, -0.00976562,  0.06347656, -0.15625   ,  0.18554688,   0.83203125,  0.18554688, -0.15625   ,  0.06347656, -0.00976562,    0.00097656] which is a fairly modest lowpass filter.  I was interested in the general case as well though.


texts: Active Noise cancellation for non periodic signals

texts: I observed that the coded algorithm for active noise cancellation is not able to cancel some of the signals like a human voice. Is there any solution for this? Can we really cancel non-periodic signals at least at the software level correctly? What changes do I need to make in the code?


texts: Simulating Noise Variance in OFDM with MATLAB

texts:
I got a task to simulate an OFDM system. It works quite, but my problem is the calculation of the noise variance (and further noise for AWGN).
Firstly, I'm calculating my noise variance in linear scale with:
NoiseVariance = $^{\frac{SNR+10\cdot log10(k)+10 \cdot log10(Sampling)+10\cdot log10(dataCarrier/subCarrier)}{10}^{-1}}$
Secondly, my noise is: $\sqrt{\frac{NoiseVariance}{2}}\cdot (randn(size(Signal)) + 1j\cdot randn(size(Signal)))$
I'm using a 512-(I)FFT, my Sampling is equal 2, since my original FFT size is 256.
The parameter k is $log2(M)$, while using a BPSK.
The SNR in this context is variable.
In Mathworks, they are calculating the Variance (https://de.mathworks.com/help/comm/gs/qpsk-and-ofdm-with-matlab-system-objects-1.html):
snrVec = SNR + 10log10(k) + 10log10(numDC/numSC), but this doesn't fit either for my noise power.
Please, if you know what's wrong or if you know an appropriate formula, help me.
For NoiseVariance, I'm using the values:
NoiseVariance = $10^{\frac{1+10log(1)+10log10(2)+10log10(255/512)}{10}^{-1}}$ (forgot the power of 10 before)
My noise is then:
noise = $\sqrt{\frac{NoiseVariance}{2}}\cdot randn(512)+1\cdot randn(512)$
What I'm expecting is a value between 0.98 and 1, since my signal power Ps is computed with 1 and after the convolution with my channel 0.98.
So my aim is to have a SNR = 1 (linear)
Excuse me.
k is already set on 1, I think you are talking about my Oversampling Factor, which is 2 (originally used 256-FFT, now 512-FFT). And you are right, I've just forgot the braces.
Exactly, I want to validate my system, when my input is EB/N0 = 0 [dB] and Ps = 1 (linear) or after convolution = 0.98, so that my Pn is around 1 for having an SNR = 1 (or 0 [dB]).


texts: Is there a name for $f(x) = |x|^n \cdot \operatorname{sgn}(x)$?

texts:
I'm looking for a name for the following function

$$f(x) = |x|^n  \cdot \operatorname{sgn}(x)$$

which is the exponent function, but with the sign stripped from the input and reattached to the output.

It seems useful enough for DSP that it ought to have a name, but Google's not much help with this sort of thing. Has anyone seen this function in any DSP software? What was it named?


texts:
Lets say we have a spectrum ranging from -X MHz to +X MHz. I would need to correct the frequency error in the spectrum by shifting the zero component to the middle (0 Hz).

If the output (the frequency spectrum) is calculated via FFT, as far as I know I can move the spectrum by adjusting the 'twiddle factors' (or coefficients, for complex data sine and cosine waves).

In the case of a size 1024 FFT (bin indexes from 0 to 1023), 0 Hz component should exist in bin number 511. However, due to possible frequency error the 0 hz component may actually be in bin 510 for example.

I cannot seem to find much information on this. Any help appreciated.

EDIT: Mistake in the question.


texts: Stitching together audio buffers with potential discontinuity at the boundary

texts:
I am writing a sound library for my c++ hobby game engine. The sound library mixes music and sound effects into a single buffer that is sent to the audio hardware.

While mixing, any number of source sounds may appear or disappear between two output buffers causing a discontinuity at the border between the buffers.

The discontinuity can be heard as a disturbing high frequency click when the mix is played by the audio hardware.

I have solved this by doing internal bookkeeping of what sound sources are playing and neatly fading sound sources in and out. However this is more involved than it would first seem. The mixing code becomes difficult to read and maintain.

So I would prefer to instead simply handle any discontinuities in the final mix buffer before sending it to the sound card.

I have experimented with a wavelet transform solution which takes an area around the border between two buffers and adjusts any excessively large coefficients until they fit in with the overall distribution.

However that technique seems tricky and introduces a latency to the output because potentially quite old samples have to be updated if the discontinuity carries all the way down to low frequencies...

It would be preferable if the solution would only alter the new buffer and potentially carry over any residual errors at the end of the new buffer to be resolved in the next buffer.

Are there any known techniques for this?

Any help is greatly appreciated!


texts: Approximate IIR filter with FIR filter with energy restrictions

texts:
Hi I was presented with this problem I would like some guidance to solve:

I am given the following DT channel model:
$$C(z) = 1-0.3z^{-1}$$

I am first asked to design an IIR linear zero forcing equalizer.

I am then asked to approximate the IIR filter obtained above with an FIR filter, where 80% of the energy of the IIR filter is captured in the FIR filter.

My initial thought was to transform the channel from the z domain to:
$$ y[n] = c[n] + 0.3c[n-1] + z[n] $$
 - where z is gaussian distributed noise

Apply a zero forcing 3 tap filter to this and obtain the 3 coefficients.

Once I obtain these coefficients however I am unsure to proceed. Do I then simply take the convolution to find the output of this filter, is that considered the IIR zero forcing equalizer?

Also once this is done how do I ensure 80% of the energy of the IIR filter is then captured in the FIR filter?

Any help would be greatly appreciated


texts: How does Correlation for 1D Signals work?

texts: On page 2 of the slide, I don't understand the example. Like $j$ and $s$ are both on the x-axis, what does j+s mean? The filter is $(f(−1), f(0), f(1)) = (−0.5, 0, 0.5)$. How can we use it? Could anyone explain how we get $r(j)$ with numbers?


texts: What is the difference between PSK (Phase Shift Keying) and QPSK (Quadrature Phase Shift Keying)? Doesn't PSK need quadrature component for its working?


texts: How to Reduce Speech Feature Dimensions?

texts:
I have been experimenting with speaker independent automatic speech recognition.  At this point, I understand that the signal is typically segmented into overlapping frames and MFCCs are extracted as features for each frame.

A lot of the texts I read talk about reducing the dimensionality of the features using (for example) Linear Discriminant Analysis or Primary Component Analysis.  While I think I understand the concepts involved in reducing dimensions in the abstract, I am not understanding how this feature reduction is supposed to be applied to the MFCC vectors.

I am interested primarily because several texts seem to suggest that reducing the dimensionality produces less variant features, which make recognizing patterns easier.  As a bonus, there is also less computational overhead.

Is the dimension reduction supposed to be applied on a per-frame basis?  For something like LDA, don't you need to know what class the data belongs to?

Thanks,
Carl


texts:
I know that the frequency resolution in a DFT is given by sampling rate upon the total number of samples. $$\Delta f = \frac{f_s}{N}$$
But, what I want to know is where does this relation comes from? Or What criteria(like Nyquist criteria limiting the maximum meaningful frequency)  governs it?


texts:
I am trying to extrapolate the bearing of a vehicle using GPS and a gyroscope.

To this end, I first obtain the yaw component using gyroscope readings and the (known) yaw axis of the vehicle, then integrate the result over time and add it to the previous bearing.

I have implemented a real-time visualization of:

the direction of the vehicle yaw axis
the direction of the rotation vector reported by the gyroscope
raw GPS bearing
extrapolated bearing

About half of the time this works very well: the extrapolated bearing smoothly moves as the vehicle turns, and the GPS (which updates a second later) aligns with it almost perfectly. The other half of the time the gyroscope seems to suffer from bias, causing the extrapolated bearing to drift even when the vehicle is stationary.

The visualization shows me that the gyroscope rotation vector changes direction at random as long as I'm not suffering from the bias problem and the vehicle is not turning (indicating I'm getting something close to white noise from the gyroscope, which is what I'd expect). When the bias problem occurs, the gyroscope direction remains constant, corroborating my suspicion that I'm suffering from bias.

Based on the assumption that a vehicle will never turn in the same direction for more than about 1–4 minutes, and on the observation that bias comes and goes at longer intervals (several minutes), I tried using a highpass filter to eliminate bias. I used a 5th-order Butterworth filter.

With an initial cutoff frequency of $\frac{1}{240} \text{Hz}$ (corresponding to a 4-minute period), when I rotate the device by 90° at roughly $\frac{\pi}{2} \frac{\text {rad}}{\text s}$, as soon as the rotation stops, the bearing drifts in the opposite direction. I then started working downward from there: at $\frac{1}{1800} \text{Hz}$ (a half-an-hour period) the effect was still visible but much weaker, and at $\frac{1}{3600} \text{Hz}$ (one hour) it was virtually gone.

A real-world test at $\frac{1}{3600} \text{Hz}$, however, still resulted in random bias, of an even greater magnitude than what I'd experienced with raw values.

I then tried increasing the frequency to $\frac{1}{15} \text{Hz}$ and noticed I am likely suffering from overshoot, as the bearing now bounces back and oscillates around a certain value somewhere between the old and the new bearing.

I then went back to the original $\frac{1}{240} \text{Hz}$ and experimented with the filter order and characteristics: First I tried a 1st-order Butterworth filter, then a 5th-order Bessel filter – to no avail.

Where's the error here, and how can I elimiate bias without introducing any other, even less desirable artifacts?


texts:
Apologies if this is too basic.

I need to implement a band-pass filter, for a realtime system.
Not sure what to use. FIR? IIR? Something else ?

Any tips would be highly appreciated.


texts:
I have some time series data (blue line lower plot) with a gaussian added into it (red line upper plot). I would like to estimate where the gaussian is in the data, and the height of the gaussian (these parameters can be bounded).
Is there an algorithm that can estimate and find where the gaussian is in the data (blue line, upper plot)?
Or a better question might be, is there a way I could come up with a probability curve for finding a gaussian in the data if I don't know what height or it's location (mean).
The model would be:
$$y(x)=A c_0 e^{-A c_0 \frac{(x-x_0)^2}{x_0}}$$
or
$$y(x)=\frac{A^2}{{(1+e^{-A c_0 \frac{(x-x_0)^2}{x_0}})}^2} c_0 e^{-A c_0 \frac{(x-x_0)^2}{x_0}}$$

Note: this is just a simulated gaussian, normally I have just the blue line in the upper plot.
Explanation of upper plot:
Red line, original data
Blue line, original data with gaussian added (the gaussian is in the lower plot has been added to the blue line in the upper plot)
I only have the blue line in the upper plot, I am trying to detect the location in the x direction of the gaussian (where it peaks parameter x_0) and maybe the height A
The gaussian is my signal, the blue line in the upper plot is my noise
the redline is an example of noise + gaussian and a typical time series that I work with.


texts: Ideal reconstruction after down sampling

texts:
The signal $x_a(t) = \cos(2\pi450t)$ is sampled.

F = 450
Fs = 1000 Hz
f = F/Fs = 450/1000   // Sampling theorem is fulfilled
x(n) = cos(2*pi*(450/1000))

The signal is then down sampled with a factor 3.

fNew = f*3 = 450*3/1000 = 1.35
xNew(n) = cos(2*pi*1.35)

Now the signal is prepared. How to make an ideal reconstruction using 1000Hz?


texts: Is there an easy way to translate a Fourier transform table from angular frequency $\omega$ to Hertz $f$?

texts:
I have a table with transform operations, e.g. scaling:

\begin{equation} \tag{0} \label{0} x(at) \iff \frac{1}{a} X(\frac{\omega}{a})  \end{equation}

or frequency shifting:

\begin{equation}\tag{1} \label{1} x(t)e^{jw_ot} \iff X(\omega - \omega_o) \end{equation}

I also have a table with transform pairs, for example:

\begin{equation}\tag{2} \label{2} e^{-a|t|} \iff \frac{2a}{a^2+\omega^2} \end{equation}

Now, I would like to use these tables but with hertz $f$ instead. Note that there are many more operations and transform pairs in the tables than I have mentioned. I hope those can be translated similary as the examples I have given. Is there an easy way to do this?

For instance, I have tried to find the inverse transformation of $X(f - f_o)$ using equation $\eqref{0}$ and $\eqref{1}$

\begin{equation} X(f - f_o) =^? X(\frac{\omega - \omega_o}{2\pi}) \iff //eq. \eqref{0}// \iff 2\pi \cdot x(2\pi t)\cdot e^{j2\pi w_ot} =   \end{equation}

\begin{equation}\tag{3} \label{3} = 2\pi \cdot x(2\pi t)\cdot e^{j4\pi^2 f_ot}     \end{equation}

but equation $\eqref{3}$ gives \begin{equation}\tag{4} \label{4} \frac{1}{2}(X(f - f_o) + X(f + f_o)) \iff  2\pi \cdot x(2\pi t)\cdot \frac{e^{j4\pi^2 f_ot} + e^{-j4\pi^2 f_ot}}{2} \end{equation}

which simplifies to

\begin{equation}\tag{5} \label{5} \frac{1}{2}(X(f - f_o) + X(f + f_o)) \iff 2\pi \cdot x(2\pi t)\cdot \cos(j4\pi^2 f_ot) \end{equation}

which doesn't equal the correct expression

\begin{equation}\tag{6} \label{6} \frac{1}{2}(X(f - f_o) + X(f + f_o))  \iff x(t)\cdot \cos(j2\pi f_ot) \end{equation}.

Even if equation $\eqref{5}$ is correct, there is non-trivial calculation involved. I would like a faster way similar to "replace $\omega$ with $2\pi f$"

Thanks


texts: Types of rounding in coefficients quantization

texts:
Suppose we have create an IIR filter with matlab function "ellip",  and then we want to quantize the coefficients using:

\begin{align*}
bq=Quantize('round',b,2^8); \cr
aq=Quantize('round',a,2^8);
\end{align*}

I have read that there are 4 major types of rounding:

truncate
round
convergent rounding
round-to-zero

What is the differences between of them and how i know which method is best to choose?


texts: audio for VOIP - filter and resample or viceversa?

texts:
I am a noob to signal processing, but I need to create some audio files for IVR for Asterisk VOIP.

So my lady friend with a nice voice records her message on a Windows machine and sends me a 44KHz, stereo 32bit wav file.

I currently squash it into a 8KHz, mono, 16bit signed wav file for Linux, and then convert the wav to alaw or ulaw PCM format.

One source of info for this process is this link.

I can do some magic with Audacity:

Stereo to mono
Equalize, using a "voip" or "telephone" filter: discard anything over 3KHz and under 300Hz.
compress volume/levels to -12 to -15 dB
Resample 44 -> 8KHz
Export as 16bit signed PCM wav
Move it to Linux and sox it to alaw or ulaw

The result is acceptable, but I feel it could be improved.
In particular, after resampling, the voice sounds muffled.

Is this order correct?

Do you have suggestions to get better results?


texts: How can i get Celsius/kelvin temperature from a thermal image in python language?

texts:
How can I convert RGB values of the thermal image into Celsius or kelvin temperature in python?
Here is the thermal image taken by a FLIR device:

Here I am reading image using OpenCV and getting the RGB values from it but I don't know how to convert these RGB values to temperature:
import cv2 as cv
import numpy as np

# read image
img = cv.imread('D:/Desktop/images/thermal.jpg')
img = cv.resize(img, (300, 300))

for i in range(img.shape[0]):
    for j in range(img.shape[1]):
        print(img[i, j])

cv.imshow('img', img)

cv.waitKey(0)
cv.destroyAllWindows()

Any help would be appreciated!


texts: What are the advantages and disadvantages of PN sequence over Walsh code

texts:
I would like to ask what are the disadvantages and advantages of PN sequence over Walsh code?  and also Gold code over Walsh code.

I have checked online, but I didn't get clear explanation for that.

Thank you


texts: What happens to signal, if we offset periodic auto-correlation?

texts:
suppose $x_n$ is an $N$-point sequence with periodic auto-correlation
$$
c_n=\sum_m x_m x_{(n+m) mod N}
$$

How to find $N$-point sequence $y_n$ with periodic auto-correlation $d_n = c_n - A$, where $A$ is a constant?


texts: Eigenfunctions of discrete-time LTI systems

texts:
Given a discrete-time signal x[n], how does one determine if it is an eigenfunction of a stable, discrete-time LTI system?

For example, consider

$5^nu[n]$
$2^nu[-n-1]$

Intuitively, second one seems to be an eigenfunction of an LTI system while first one does not. Since the second sequence is absolutely summable while first one is not, is this the criteria for deciding?


texts:
I have problem, not sure how to call it but I think it's something called "phase rotating", but not sure.

I make fast Fourier transform on simply square wave, and then I make inverse fast Fourier transform - just for fun :)
and after this forward/backward FFT on square wave I expect on a wave graph something like that:

But I get that:

Could anyone help me, which parameter I should change, to fix it?


texts: How the Gain Term $ K \left( n \right) $ Is Derived? Why Is It Called Gain?

texts:
In "adaptive filter theory" and "advance signal processing and Noise reduction" they have directly come up with the term gain without stating how they got it.

In adaptive filter theory they have jumped from equation 13.16 to 13.18.

Same in advance signal processing equation 7.74 to 7.76. I have shared the derivation from both the books.

In negative feedback control system,the Transfer function is g(s)/(1+g(s)h(s)).Is it any how related to this.


texts: Doubts and some confusion on variance for complex rv

texts:
This question is in continuation of the one asked here.

Let's say that the measurement noise $w$ or any random variable is circularly Gaussian complex.

If the imaginary and real components each has a variance of 0.5, then what would be the total variance? Should I write: $w \sim CN(0,\sigma^2_w)$?
If on the other hand, if $w \sim CN(0,2\sigma^2_w)$ then does it mean that the real and imaginary components each have variance 1, so the total variance is 2. Is my understanding correct?
Is there a rule of thumb whether the variance should be 0.5 for each component or can it be anything?


texts: How does one calculate a pole-zero plot?

texts: To my understanding, pole-zero plots are used to analyze or visualize transfer functions. Suppose there is some very simple system, for example a simple low-pass filter (so it is linear and time-invariant). How does one calculate the pole-zero plot of such system?


texts: How does the size of a spectrogram relate to window length and frame rate?

texts:
I'm trying to understand the methodology from section 4 in this report about audio classification but I have some trouble understanding how they pre-process the data (dsp is not my area).

$30$ seconds audio clips are available, sampled at $22050\textrm{ samples/s}$.
The STFT is computed "on $2048$ sample windows at a frame rate of $31.25\textrm{ frames/s}$"

Somehow this results in spectrograms of size $149\times 149$ which are then feeded to a neural network.

Does each spectrogram cover $2048$ samples of the audio clip?

If so, is then $149$ the number of segments that we divide each spectrogram in?

So that $2048/149 = 13.745$ is the number of samples that we use for computing the DFT in each segment? How can this be a non-integer?
To my understanding the frame rate is about how much overlap there are between windows, in this case the overlap would be $22050/31.25 = 705.6 \textrm{ samples}$, is that correct? How can this be a non-integer?


texts:
It is known that the total power of an OFDM signal equals to the sum of the powers on each individual subcarriers. I am a bit puzzled by the total transmit power of a generalized FDM system if subcarriers are not orthogonal and if it should remain the same or changed due to the non-orthogonality.

Let us consider the following OFDM transmit signal:
$$s(t) = \sum_{k = 0}^{N-1} a_k e^{j2\pi f_k t} = \sum_{k = 0}^{N-1} a_k e^{j2\pi \frac{k \: \phi}{T} t}, \quad 0\leq t\leq T,$$

where $k$ is the subcarrier index, $a_k$ are i.i.d. data symbols with zero mean, $N$ is the total number of subcarriers, $T$ is the FDM symbol duration, and $\phi < 1$ is introduced to break the orthogonality.

The transmit power is represented as

$$ P = \frac{1}{T} \int_{0}^{T} s(t) \: s^*(t) dt,$$

which can be further simplified as

$$P = \frac{1}{T} \sum_{k = 0}^{N-1} \sum_{k' = 0}^{N-1} a_k a^*_{k'} \int_{0}^{T} e^{j2\pi \phi (k - k')t/T} dt$$

Now, the value of the integral $\int_{0}^{T} e^{j2\pi \phi (k - k')t/T} dt$ does not equal to $0$ if $k \neq k'$ (due to the non-orthogonality introduced by $\phi$). This means that the transmit power in case of non-orthogonal subcarriers is no longer equals the sum of the power on each subcarrier? However, it is higher than the sum!!!

I feel there is something wrong in this simple derivation, as by intuition, if a power source spends a certain amount of power on each subcarrier, then how come the total power will be greater than the sum of these individual powers?

========================

Update

The following update to make the modeling of non-orthogonality more clear. Let us consider the FDM signal written as

$$s(t) = \sum_{k = 0}^{N-1} a_k e^{j2\pi (f_k + \delta_k) t} = \sum_{k = 0}^{N-1} a_k e^{j2\pi (\frac{k \:}{T} + \delta_k) t}, \quad 0\leq t\leq T,$$

where $\delta_k$ is the frequency offset on subcarrier $k$. Following similar approach, the power $P$ can be found as

$$P = \frac{1}{T} \sum_{k = 0}^{N-1} \sum_{k' = 0}^{N-1} a_k a^*_{k'} \int_{0}^{T} e^{j2\pi (k/T + \delta_k - k'/T - \delta_{k'})t} dt$$

which does not equal to the sum of power on individual subcarriers.


texts: What is databending and how does it actually work?

texts:
http://www.google.com/search?q=databending

It is, from what I understand, opening images as audio, applying effects, exporting back as image and voila! glitch-art

Example:

credit

But how does it really work? How/what change in frequencies(?) affect the pixels? It can't be totally random since some of them aren't completely distorted..

How does time(in audio) relate to the dimensions and colors of the image?


texts: How can I generate a pulse train in the frequency domain?

texts:
I just need to generate the equivalent train in the frequency domain by hand.

I know that the Fourier Transform of a pulse train is a pulse train, with the intervals of the pulses changed by (1/T).

However I'm confused on the implementation when you are also working with sampling rate of the original signal.

Can anyone quick point me in the correct direction.

Thanks!


texts:
I need to model a noise with a given PSD. To do this, I am starting from a white gaussian noise (WGN) and feed with the WGN a transfer function, which will act like a filter. In fact,it's easy to prove that if you choose a PSD of the white noise equal to $1 {\rm unit}^2/{\rm Hz}$,then the output is $ H(f) \times 1$.
Thus
$$ PSD =|H(f)|^2 $$

Gain in the transfer function acts properly, translating the PSD up or down.
The problem is with the zeros and poles. No matter how I create the transfer function (1st, 2nd, or higher order), the PSD will be flat in the region of interest $f_{\rm range} = [10^{-6}, 10] {\rm Hz} $

The transfer function is
$$ H = \frac{10^{-11}(s+2 \times 10^{-3})^2}{(s+10^{-9})^2}; $$

It is easy to build in Simulink band limited white noise with PSD = 1 (choosing sample and power).

Evaluate then the output of the TF in matlab with this

%% PSD estimation
for i =[1e-8 1e-7 1e-6 1e-5, 1e-4, 1e-3, 1e-2 1e-1 1]
    f_range = linspace(i,i*10,1000);

    [pxx_white] = pwelch(white,[],[],f_range);

    [pxx_color] = pwelch(color,[],[],f_range);

    loglog(f_range,sqrt(pxx_white./(2*pi)),'k')
    hold on
    loglog(f_range,sqrt(pxx_color./(2*pi)),'r')

end

xlabel('Frequency (Hz)')
ylabel('RPSD (unit/Hz^(1/2))')
legend('white','color')
grid on

Now my question is: Am I doing something theoretically wrong? Maybe I can't reach PSD in the low frequency region due to the simulation time? I simulate for 10000 s (1e-4 Hz).

In black: white noise PSD, in red: flat the colored noise PSD, the curve is the plot of the tf.


texts: How to calculate the impulse response of an RC circuit using time-domain method

texts:
I have an $RC$ circuit and I calculate the differential equation as
$$RC \frac{dV_c}{ dt} + V_c = V_g$$  that is the same of
$$RCy'(t) + y(t) = x'(t).$$
 If I assume $x(t) = u(t)$ I have that the equation is  $$RCg’(t) + g(t) = 0$$  and the solution is  $$g(t) = K_1 e^{-t/RC} + K_0$$  now for have the impulse response I have to calculate this for $t > 0$, $t < 0$ and $ t= 0$ but I have no idea how to do. Can you please help me ?


texts: Fourier transform for non-sinusoidal signal

texts:
Using MATLAB's fft function, I would like to retrieve the amplitude and frequency of this particular signal :

My data file (a) has 2 columns, first one for time ans the second for amplitude, I tried this script

    DT = (a(2,1)-a(1,1));
    Fs = 1/DT; % sampling frequency
    NFFT = 2^nextpow2(n);
    xdft = fft(a(:,2),NFFT)/n;
    f = Fs/2*linspace(0,1,NFFT/2+1);

    plot(f,2*abs(xdft(1:NFFT/2+1)))

The output is :

which is not corresponding to my amplitude. Thanks a lot for your help.

fft with all the harmonics :


texts: Implementing inverse FFT using forward FFT

texts:
I am trying to implement an inverse FFT using the forward FFT. For clarity:

Let S[t] be a signal in time, and S[w] the transformed signal. As per this site, it seems one can reverse S[w], use the forward FFT routine, then reverse the resulting signal again and this should give S[t]. I won't go into why should it work but it's all in the link provided.

I attempted to try this method, and it seems to recreate the signal when I use a high sample rate. However, it seems that even if I do not go over the niquist frequency, I encounter some weird effect. Here is my code in numpy:

# Generate a signal of s cosine with 200 [Hz]
f = 200
Fs = 10
t = np.linspace(-10,10,Fs*20)
s = cos(2*np.pi*f*t)

# Take fft
u = np.fft.fft(s)

# Reverse in time
u = u[::-1]

# Transform again
u_t = np.fft.fft(u)

# Reverse and normalize

s_new = np.divide(u_t[::-1],s.shape[-1])

# Finally slice for easier viewing
plt.plot(t[1:100],s_new[1:100])
plt.plot(t[1:100],s[1:100])

This code yields the following graph:

I am a little confused, the theory looked sound and I can't think what I did wrong here.

Note: I tried calling np.fft.fft and then np.fft.ifft and the reconstruction goes as planned. Therefore I believe this problem is not due to aliasing.

Edit: I made way by simply taking the complex conjugation instead of reversing (using np.conj() where I reverse). This solves the problem, but I still do not understand why reversing in time does not accomplish a conjugation, so I'd love someone to explain it to me. I leave the modified code in case it helps someone else:

# Generate a signal
f = 200
Fs = 10
t = np.linspace(-10,10,Fs*20)
s = cos(2*np.pi*f*t)

# Take fft
u = np.fft.fft(s)

# Conjugate
u = np.conj(u)

# Transform again
u_t = np.fft.fft(u)

# conjugate and normalize

s_new = np.divide(np.conj(u_t),s.shape[-1])

# Finally slice for easier viewing
plt.plot(t[1:100],s_new[1:100])
plt.plot(t[1:100],s[1:100])


texts:
This will probably be an extremely simple question for some one with any background in signal processing(not my background)

Let say I have signal $$x(t)=A\sin(\omega t)$$ where A is known and $\omega$ is unknown. Let say I only observe a noisy signal of $x(t)$ at discrete time periods $t=1,2,3....$. My signal $y(n)$ has the following form
$$y(n)=x(n)+\epsilon$$ where $\epsilon\sim N(0,\sigma^2)$.
My question is , what would be the best estimate of $y(n+1)$ given the observations till time time period $n$.


texts: Fractional equalizer with non-integer oversampled signal as input

texts:
I would like to know how the output sequence from a fractionally spaced equalizer, with a non-integer oversampled input signal, is generated.

For example, for $T=T_{sym}/2$, my actual code is something like:

for ktime=1:2:L
    nindex                               = ktime+(Ntaps:-1:1);
    inputequalizer_block                 = inputsignal(nindex);
    outputequalizer(floor((ktime+1)/2))  = W*inputequalizer_block;
end

Now, let's say I have an input signal with $T=2T_{sym}/3$. I understand I should have 2 different filters, but I dont know how the baudrate-output is generated:

 for ktime=1:3:L
    nindex                               = ktime+(Ntaps:-1:1);
    inputequalizer_block                 = inputsignal(nindex);
    for i=1:2
       output_aux(i)  = W{i}*inputequalizer_block;
    end
    % Some processing on output_aux(1) and output_aux(2)?
    outputequalizer    =....
 end

I am not sure I am close to the solution, or miles and miles far away.
Any suggestion?

Thanks


texts: DSSS direct sequence spread spectrum - encoding each raw data bit (question)

texts:
For implementing DSSS, it is understood that each raw data bit needs to be encoded as a new recognizeable/identifiable bit pattern.

In many literature involving DSSS, there is mention of using PN sequences involving LFSR (linear feedback shift registers).

It appears that maximal length linear shift registers have a maximal length that is always an odd-valued number, such as 15. So, while LFSR generators can be relatively fast and hard-ware implementable, there could be a hardware implementation problem elsewhere.

A pseudorandom sequence from a maximal length LFSR has bit pattern that has an odd number (such as 15 bits). So if (for example) the raw data bit has a bit-rate of 1 bit per second, then to encode each raw data bit with this 15 bit pattern would require the PN generator to operate at 15 bits per second (ie. 15 times higher clock rate than the raw bit rate).

Will this mean that we have to find hardware that generates a clock rate (for the PN generator) having 15 times the frequency of the raw bit rate?

Initially, I was thinking that a high frequency clock could be used as a reference. However, conventional flip flop frequency dividing methods divide frequencies by even amounts, like divide by 2, divide by 4 etc. There is no option for 'divide by 15' (or divide by an odd number).

So if I want to use LFSR PN sequence patterns for encoding raw data bits, then what kind of method should be used? Is this the usual problem faced when using maximal LFSR generators for encoding raw data bits?

My assumption is that a maximal LFSR produces a repetitive cyclic pattern.... such as 0100101 (eg. 7 bit sequence for a 3 bit LFSR), which keeps repeating as 0100101. So at the beginning of every repetition cycle, we can use this pattern to encode our raw data bit.

So a raw data bit such as '1' needs to be translated to this long pattern 0100101. And raw data bit '0' needs to be translated to the negative version of the pattern, such as 1011010. The problem is .... 7 bits is an odd number. So if the raw data bits need to be processed at 1000 bit per second, then we would need a PN clock rate that is at 7000 bits per second.

Due to the odd-valued number of bits, is there generally going to be an issue with coming up with a system for generating the clock rate that is 7 times higher than the raw data rate? I can understand that generating 8 times data rate would be relatively easy to do, because 8 is a 2^N value.

I'm thinking it would have been extremely nice if nature had allowed for maximal length LFSRs to be produced with even-values for maximal lengths.

Would fractional DDS type frequency generation methods be used instead?

Thanks for any comments in advance!!


texts: How frequency response related to a transfer function

texts: Can anyone explain how frequency response related to a transfer function?


texts: could anybody explains me why IIR filters do not have linear phase?

texts: Please tell me. Also I dont know why phase is linear with FIR filters. I would like quantitative analysis. And why linear phase is not achieved by IIR filters ?


texts: DDS generated chirp and antialiasing filter : what is the best suited filter for a chirp?

texts:
I am defining the required antialiasing (analog) filter for a chirp generated by a DDS. The chirp is produced in a FPGA (NCO generation) and forwarded to the DAC for the samples generation (with interpolation from the DAC). Because of a dynamic range lower than 16 bits and the natural behavior of the DAC to produce high frequency nonlinearities, I need to include and antialiasing filter which I try to define.
I guess I need to fulfill these requirements:

I need to low pass my chirp bandwidth (let's say 10-50Mhz) and cut frequencies above the high frequency BW,
I have to ensure that the group delay is flat within my bandwidth,
I have to ensure a given stop band value before the image frequencies (so for instance with a 400MSPS DAC, I would have a 350 MHz image frequency),
I need to push the dB level of such frequencies under the quantization level for the DAC to avoid distorsions so for instance with a 10 bits DAC I need to have a dB margin from the Gain 0dB of roughly 60dB.

As I am not very used to filters I read articles on the web and could determine those few rule of thumbs to design the best suited filter for my application:

Butterworth are good for sharp (brick wall style) low pass filter but the group delay is bad (so my chirp will be distorded in phase domain)
Bessel filters are flat for group delay (means that my frequencies will not be phase delayed or at least will have the same delay), but are not as sharped.

For the considered case, with a stopband at 350MHz and a gain ~1 at 50MHz it seems possible to achieve a filtering, especially with Bessel filters (order 3 or 4 are OK).But if I would like to decrease my cost, hence the sampling frequency of my DAC, it turns quickly to be impossible because my stop band and my cut off frequency are getting closer and only a Butterworth filter could do the job? but because it is a group delayed filter it is not suitable for chirp generation am I right?
I tried to simulate this with ADIsimDDS (interesting online software) for instance AD9859 (400MSPS 10 bit) and my case study looks good but i cant see any of the group delay impact with respect to the different proposed external analog filters.
Thanks for your answers and advices.


texts:
In Frequency Division Multiplexing we provide one channel to one user.

Example like BandWidth of user1's voice is 200Khz. I provide one channel of 200KHz in FDM for uplink as shown in the figure.
Now I will provide another 200KHz Bandwidth(channel 2) for user2's voice. Similarly for user3.
I will be having a guard band of 100 Hz for this.

Now What I understand about OFDM is that channel1 will be orthogonal to all other channels. Also, we divide channel 1 into orthogonal sub-carriers with bandwidth less than 200KHz.
Am I correct? If yes then will there be no ISI as my required Bandwidth is 200KHz.


texts: Low pass filtering on short int (16 bit PCM) samples

texts:
I am writing software for processing audio given as 16-bit PCM samples. The first stage of the processing involves calculating the energy (or total variation) in a certain frequency range (above a certain cut-off frequency).

What I am currently doing is subtracting the energy of the low-pass filtered signal from the energy of the original signal. I found out that a lot of the processing is dedicated to converting the integer sampels to a floating point representation.

So my question is, is there a technnique for filtering the integer samples without converting them to floating point?


texts:
Is there a way to convert or somewhat replicate RADAR data from a set of given high speed videos taken from multiple angles.

The problem is quite ill defined but the task I have in hand is to reproduce RADAR data for a set of videos of soccer shootouts. I also have a corresponding file with the coordinates of the ball, speed of it but not quite sure how that will come into play with this.


texts:
Let $g[n] = f[-n]$(n is the time index). Then what will be expression for $g[n+k]$.

Is $g[n+k] = f[-n + k]$ or $g[n+k] = f[-n - k]$. Which one is true and Why?


texts: Understanding the relation between instantaneous frequency and phase of a sinusoid

texts:
Sorry for a basic question but I really wanted to understand the relation between the instantaneous frequency and instantaneous phase of a sinusoid. We know that we can get the the instantaneous frequency by differentiating the instantaneous phase and normalizing with 2*pi. Also, we could get the instantaneous phase by integrating the frequency. But i am not quite understanding how integrating a frequency gives instantaneous phase. I viewed this link - http://mriquestions.com/phase-v-frequency.html. The total area under the graph of Instantaneous frequency gives phase but how to interpret it practically?

For example, if I consider a sinusoid whose frequency is 10Hz and is constant for 10 seconds , it gives me total area as 100. Another sinusoid with 10Hz for 5 seconds and 20Hz for 5 seconds, gives a total area of 150. How these numbers (areas) can be interpreted as phase?


texts: How is channel frequency response/channel state information related to free space path loss?

texts:
As we know, the path loss can be described by the equation as
$$
\frac{P_{r}}{P_{t}}=D_{t} D_{r}\left(\frac{\lambda}{4 \pi d}\right)^{2}
$$
In the OFDM system, such as Wi-Fi, there are infinite paths exist, assume it is in free space, and only one path exist, for the specific path (LoS path), the channel frequency response(CFR)/channel state information(CSI) describes how is the channel affect the transmitted signal, it calculated by:
$$
H = \frac{Y}{X}
$$
where Y is the received signal at receiver and X is the transmitted signal at transmitter. the signal power is square of the amplitude of the signal, that is
$$
P_{t}=|Y|^2
$$
$$
P_{r}=|X|^2
$$
I have two questions:

Is the following equation holds?
$$
\left|H_{}\right|^{2} = \frac{P_{r}}{P_{t}}=D_{t} D_{r}\left(\frac{\lambda}{4 \pi d}\right)^{2}
$$
According to the first equation, is the following equation holds?
$$
\frac{X}{Y}=\sqrt{D_{t} D_{r}\left(\frac{\lambda}{4 \pi d}\right)^{2}}
$$

Thanks in advance.


texts:
I try to decode freqs of 17k & 17.8k which carry on a sinus of 15ms duration.

I try to decode them with a goertzel filter. It seems fine when one of the filters show a magnitude that is around 800.
But, the filter has his own mood and after several hours of checking the system again it produces a very low magnitude. I thought of using a band pass filter so I can decide if the frequency is there or not by extraction the energy inside the BPF.

What is better?

Update:

public class Goertzel
{
    public double GoertzelFilter(float[] samples, int start, int end,double coeff)
    {
        double sPrev = 0.0;
        double sPrev2 = 0.0;
        int i;
        for (i = start; i < end; i++)
        {
            double s = samples[i] + coeff * sPrev - sPrev2;
            sPrev2 = sPrev;
            sPrev = s;
        }
        double power = sPrev2 * sPrev2 + sPrev * sPrev - coeff * sPrev * sPrev2;
        return power;
    }


texts: Isolate g(t) starting from $\int_{-\infty}^{+\infty}g^{2}(t)e^{-i2\pi f t}dt$

texts:
Is it possible to isolate $g(t)$ starting from
$G^2(f)=\int_{-\infty}^{+\infty}g^{2}(t)e^{-i2\pi f t}dt$ ? Can you show me how?


texts: Real time background noise reduction or removal

texts:
I am trying to build a real time simple audio recognition that can recognize few keywords. Following this tensor flow tutorial i was able to train a simple neural network.
Currently the signal flow looks like this

  microphone --> Pulse Code Modulation(PCM - range [-1, 1])  --> stfts
  --> spectrograms--> mel_spectrograms --> log_mel_spectrograms --> mfcc's --> Neural Network.

So far, I just grab the data from the microphone input and preform some steps and input to Neural network. Not performing any kind of back ground noise reduction or some kind of signal filtering techniques. So far the result are very much influenced by the back-ground noises( single channel sampling frequency 16000 Hz).

I am new to this subject and wondering if you can share some valuable insight and techniques/python packages to enrich the speaker voice before feeding it to neural network.


texts: Librosa stft + istft - Understanding my output (which always seems too perfect) at varying window lengths

texts:
I've just started to use Python with Librosa for a DSP project I'll be working on. First thing I've been trying to do is determine my preferred parameters for the FFT window size, and hop-distance.

The domain is music, and my plan is to try a variety of values for the window size and hop distance, and for each of them, do a forward STFT and then an inverse STFT and write the result back out to wav file. I'll then listen to results and choose based on which values I think capture the information in the input the best.

My simple code is as follows:

import librosa.core as lc
import numpy as np
import scipy

_n_fft=80
print(str(_n_fft))
_hop_length=_n_fft/4

data, sampleRate = lc.load("13_Hate_To_See_Your_Heart_Break.wav", sr=44100, duration=20, mono=True)

stftMat = lc.stft(data, n_fft=_n_fft, hop_length=_hop_length, center=True)
iStftMat = lc.istft(stftMat, hop_length=_hop_length)

scipy.io.wavfile.write("testOut.wav", 44100, iStftMat)

powerMat = np.abs(stftMat)
print("powerMat shape = " + str(powerMat.shape))

The behavior I'm experiencing, however, is not what I would have expected.

When I use an incredibly short window length (as in the code above) - I get the correct number of window frames for my FFT length and hop-distance:

powerMat shape = (41, 44101)

44101 window makes sense, and as you can see the frequency resolution is low, with only 41 frequency bands. I would expect the resulting testOut.wav to sound pretty terrible, as the frequency resolution is so low. I can visibly see the effects on a rendered spectrogram as the subtleties in frequency changes are smeared together. Listening back, however, the resulting track sounds great - pretty much like the original input.

Compare this with a much wider window size of 44100 (1 window = 1 second of audio, hop-distance of 1/4*Window size):

powerMat shape = (22051, 81)

Again this output makes sense - in the 20 seconds of audio, with a window length of a second and a hop distance of a quarter second, there would be about 80 window frames. This is pretty poor time resolution, but fairly high frequency resolution with 22051 frequency bins. Again I would expect the resulting testOut.wav to sound poor in the time domain.

Once again the resulting track sounds great - pretty much like the original input. These extreme values, and everything in between, pretty much yield the same output testOut.wav, even though on the real power spectrum I can visibly see the differences when changing the parameters.

Is there a fundamental misunderstanding I'm having with the STFT and it's inverse? Am I simply not understanding the library?


texts: Sending complex signal over a single wire

texts:
The G.hn protocol uses OFDM to transmit data. And it sounds like they are doing it on a single wire. OFDM symbols are a complex number with I and Q components. How are they able to send two separate data streams on a single wire?

If they are not doing it on a single wire, then my question is really how do wired protocols send complex I/Q data over a single wire? I'm looking for a fairly concrete answer (does not have to be specific to G.hn) as I'm interested in implementing something like this myself along a single channel.


texts: How to do this inverse Z-transform? Is this correct?

texts:
It was explained to me here that I need to do an inverse z-transform on a z-based equation in order to get something I can use. That example was quite simple. But I'm not sure how to do the same process on a more complex equation.

I am starting with:

$H(s) = \frac{-ms}{ms+2R}$

Where m=mass and R=impedance. I can do a backward Euler substitution $s=\frac{1−z^{−1}}{T}$:

$H(z) = \frac{m (z^{-1} - 1)}{-m z^{-1} + m + 2 R T}$

How do I then get this in terms of $[n]$ and $[n-1]$? I understand $H(z) = H[n]$ and $H(z)*z^{-1} = H[n-1]$, but how do I mathematically accomplish this and get rid of the $z^{-1}$ terms here?

Here is my best try:

$-H(z) m z^{-1} + H(z) m + 2 R T H(z) = m z^{-1} - m$

$-H[n-1] m - H[n] m + 2 R T H[n] = m z^{-1} - m$

$H[n] (-m + 2 R T) = m z^{-1} - m + H[n-1] m$

$H[n] = \frac{m z^{-1} - m + H[n-1] m}{2 R T - m}$

And I'm stuck there with one remaining $z^{-1}$ term. Multiplying by $z^{-1}$ is supposed to be the same as delaying by a sample right? So if mass is constant, then can I just say for the remaining term $m z^{-1} = m$ and get:

$H[n] = \frac{H[n-1] m}{2 R T - m}$

Is this the right idea or if I screwed it up what was I supposed to do differently?

Thanks.


texts: The Gradient Operator of a Vectorized Image in Matrix Form

texts:
I have this optimization problem:

$$ \arg \min_{ X \left( i, j \right) } \sum_{i, j} \left\| X \left( i, j \right) - 255 \right\|_{2}^{2} + \lambda \sum_{i, j} \left\| \nabla X \left( i, j \right) - \nabla Y \left( i, j \right) \right\|_{2}^{2} $$

Where $ X $ is the output image and $ Y $ is the input image.

Let's say the input image is $ y $ and the output image is $ x $ (Transform image to vector) then the problem can be rewritten:

$$ \hat{x} = \arg \min_{x} \frac{1}{2} {\left\| x - 255 \cdot \boldsymbol{1} \right\|}_{2}^{2} + \frac{\lambda}{2} {\left\| {D}_{h} \left( x - y \right) \right\|}_{2}^{2} + \frac{\lambda}{2} {\left\| {D}_{v} \left( x - y \right) \right\|}_{2}^{2} $$

Where $D_h$ is the horizontal Derivative Operator, $D_v$ is the vertical Derivative Operator and $1$ is vector of ones.

Then the solution is given by:

$$ \hat{x} = { \left( I + \lambda {D}_{h}^{T} {D}_{h} + \lambda {D}_{v}^{T} {D}_{v} \right) }^{-1} \left( \lambda {D}_{h}^{T} {D}_{h} y + \lambda {D}_{v}^{T} {D}_{v} y + 255 \cdot \boldsymbol{1} \right) $$

My question is given the input $ y $ how to apply $ {D}_{h} $ and $ {D}_{v} $ to this specific equation.

Thanks for your reply.


texts: When using the discrete cosine transform are there commonly used alternatives to quantization to decide which dct components to keep/are important? If not, how do people come up with quantization matrices (such as in JPEG), is it purely arbitrary, based on empirical properties of common images, maths, etc.


texts: Rationally related frequencies and the Fourier Series representation

texts:
Suppose that we have the signal $$x(t) = e^{j\omega t} + e^{j\frac{3}{2} \omega t},$$ and we want to find a Fourier Series representation for that signal. Is this possible? According to my understanding, since the ratio of the frequencies of the two complex exponentials above is a rational number, the signal is periodic. Since it is periodic, it is possible to represent the signal as $$x(t) = \sum_{k = -\infty}^{\infty} a_k e^{jk\omega_0t},$$
where $\omega_0$ is the fundamental frequency of the signal?


texts: Convolutional FEC decoding - is it necessary to know where a decoding block begins and ends with convolutional codes?

texts:
I understand that the difference between convolutional and block-based FEC is that convolutional codes can be used in a continuous stream – however every implementation I saw still uses blocks.

So I wrote some code using turbofec's library to see if I could decode a stream of blocks starting from an arbitrary point (so that the decoder's blocks are not in sync with the beginning of a convolutional packet), and it looks like I can't get it to work properly (while it works with zero offset).

Does this mean that Viterbi, turbo codes, etc., require a sync to the beginning/end of the blocks at the decoding phase, or is my problem in the library I'm using? (it's a bit suspect since that some of the status of the decoder is re-initialised at every call, but the library specifically only exposes the function forcing this initialisation)


texts:
I'm experimenting with decimating a signal, in this case a unit impulse.

I'm using Python, with pylab.  First, I create a unit impulse, and decimate it by 5.

x = r_[zeros(0), 1, zeros(100)]
N = 2 ** 14
q = 5

y = decimate(x, q, ftype="fir")
subplot(211)
title("Original")
stem(range(len(x)), x)
subplot(212)
title("Decimated - FIR")
stem(range(len(y)), y)

figure()
subplot(211)
semilogx(log(abs(fft(x, N))))
subplot(212)
y = decimate(x, q, ftype="fir")
semilogx(log(abs(fft(y, N))))

This results with the following plots

I then add a few samples of delay before the impulse, by changing x to:

x = r_[zeros(3), 1, zeros(100)]

This results in the following plots

In the second set of plots, the resulting decimated signal is no longer a single sample, but has been distorted.

If I delay the signal with 5 - and any multiple of q - samples, I get the first set of plots again.

The source code for the decimate function is, https://github.com/scipy/scipy/blob/master/scipy/signal/signaltools.py#L1570

def decimate(x, q, n=None, ftype='iir', axis=-1):
    if not isinstance(q, int):
        raise TypeError("q must be an integer")

    if n is None:
        if ftype == 'fir':
            n = 30
        else:
            n = 8

    if ftype == 'fir':
        b = firwin(n + 1, 1. / q, window='hamming')
        a = 1.
    else:
        b, a = cheby1(n, 0.05, 0.8 / q)

    y = lfilter(b, a, x, axis=axis)

    sl = [slice(None)] * y.ndim
    sl[axis] = slice(None, None, q)
    return y[sl]

I'm using a fir low pass filter before decimating, the impulse response of the filter is

This explains why the impulse is distorted when there is a delay, the decimation is selecting parts of the impulse response, when the delay is a multiple of the decimation, it only selects the zero's of the impulse response, and one non-zero sample at the peak.

Is there a way to decimate a unit sample with an arbitrary delay, which results in a scaled unit sample output?


texts: Reconstruct signal from imprecise sampling?

texts:
I'm trying to digitize a VGA signal with a low-power consumer computer running a consumer OS and am having issues with the stability of the sampling rate.

What I did so far:

grabbing the green channel of the VGA signal analogue signal
converting it to a rectangular wave form (so either fully lit pixel
or totally dark)
sampling it with a computer and
reconstructing the image

Here is an example of a screen I'm trying to capture (640x480x60hz)

And here is a video of the capture my programme made.

The conversion to the rectangular wave loses most luminance information, but that is ok. The issue is that the sample rate is unstable because the sampling programme I wrote is interrupted by OS tasks for a few μs here and there. The timer resolution is also quite low (1 μs).

The image I'm trying to capture has a low rate of change, is mostly still for all practical purposes (so no motion video) and I can take multiple passes at each image.

Is there any way I can reconstruct the image information despite the unreliable sample rate?

edited for legibility


texts: If we FFT a signal with number of points far less than the length of the signal, the result is unreliable?

texts:
For example, there is a very long-term observation and I cut the signal at a sampling rate of 10 into many segments of 1e6-point length. I wanna check the time-varying characteristics of the spectrum, so I fft each segment and compare their spectrum.

When doing the fft for each 1e6-point segment, in case of y = fft(x, 2^nextpow2(1e6)=1048576), we get the spectrum at freqs = 0 : 9.5367e-06 : 5 Hz. But it's time-consuming and I don't wanna store such big data.

So what if y = fft(x, 1024)? Do I get the CORRECT spectrum for freqs = 0 : 0.0098 : 5 Hz?


texts: Suppose my model is reversible in time (e.g. GPS + accelerometers for a vehicle), so that I can run Kalman filter forwards or backwards. Kalman filter, of course, cannot be symmetric, because it is not casual. But will Kalman smoother give the same results when run forwards and backwards (up to numeric errors)? If no, is there a filter that does guarantee this?


texts: What are best practices to compute an audio spectrogram?

texts:
The spectrogram if generally defined with the squared magnitude of the fft. However, in lots of implementation, it seems that people just use the magnitude without square.

Moreover an audio signal is by convention scale between -1 and 1. This scaling often needs a supplementary step in implementations, in python language for example, which is not always do.

Finally, what are best practices to compute an audio spectrogram?
- square magnitude of the fft / magnitude of the fft ?
- Integer audio values / scaling (-1 to 1) audio values

EDIT

As the comments tell, these are questions without consequences if the aim is to plot an image of the spectrogram.

However, I would like to use the matrix of the spectrogram as an entry point for sound analysis and recognition. In this case, the computation process matters and I find curious that the implementations differ so often.


texts: Is it possible to calculate a z-transform for a filter calculated with Parks-McClellan?

texts:
I would like to know whether this can be done and if then how would this feat be acomplished in Matlab given a filter calculated with Remez?

h = remez(...);

If this is not possible then I would appreciate an explanation whether this can be done approximately (approximations of the zeros and poles) or whether this is simply mathematically pointless because a broken rational complex polynomial representation does not exist.


texts:
I have 4 signals: $z,c,d$ and $r$. $r$ is defined by: $r=[c,z,d,z]$

I would like to find signal $d$. In Matlab I do this:

r2=r(size(c,2)+size(z,2)+(0:size(d,2)-1))

Do we have $r2=d$?


texts: Viewpoint dependant deformation of objects in photos

texts:
I have a question concerning the deformation of objects in photos. Which deformations can an object depicted on a photo undergo through viewpoint and condition changes?

Some deformations I have in mind are:

rotation
scale
shearing
translation
illumination
occlusion

Which deformations did I forget?

Best!


texts: Extraction of the phase lag form cross-correlation function

texts:
I would like to find out the phase offset that my signal contains at the receiver side. For this, I use the cross-correlation function, where I cross-correlate signal before and after matched filter. The resulting cross-correlation function is represented in the figure below:

In the figure we can see that there is a pronounced peak at approximately 0.3 * 10^6 samples. I want to use this information to remove the phase error and my approach is following:

calculate the time lag
calculate the phase lag

this I code in the following way
time_lag = peak[0]/Fs # Fs - sampling frequency
phase = 2*np.pi*f_symb*time_lag # f_symb is symbol frequncy
print(phase)

out: 549160.4489439873

then I want to use this phase lag to shift the constellation, however even after the shift, the constellation is still tilted, which indicates phase error.
Can you point out, where I make a mistake?
Thanks!


texts: how to find the frequency of the downsampled signal?

texts:
So, I am trying to solve this question.
Consider the signal, $$x=\cos\left(\left(\dfrac{2\pi}{3} \right)n\right)$$
The signal is downsampled by a factor of two. Indicate the frequency of the resulting output, normalized by $2\pi$
(E.g., if the frequency is $\dfrac{\pi}{2}$, write $\dfrac{1}{4}$)
So, what I understood is,
from the signal, $f = \dfrac{1}{N} \implies \dfrac{1}{3}$  or $\dfrac{2\pi}{3}$ if we consider angular frequency.
So after downsampling,
$$f_d = \dfrac{f}{M} = \frac{1}{3}\cdot \frac{1}{2}  \implies \frac{1}{6}$$.
or, if taking $\dfrac{2\pi}{3}$ and downsampling by factor $2$ then, $\dfrac{2\pi}{3}\cdot\dfrac{1}{2} = \dfrac{\pi}{3}$ or $\dfrac{1}{6}$
But the answer is wrong. How should I solve it?


texts: Changing Coherence function from float to fixed point

texts:
I want to calculate the coherence between two audio signals. After referring a few websites, I found that the coherence is calculated by using the equation $(1)$ which is as follows
$$\rm Coherence = \frac{Cross \ PSD}{PSD_{signal_1}\cdot  PSD_{signal_2}}\tag{1}$$
So, I have written a function that calculates coherence which is follows
(ftemp1 and ftemp2 variables correspond to real and imaginary values of cross PSD function)
void coherence_calc(float* real,
             float * imag,
             float * psd1,
             float * psd2,
             float * output,
             int length)
{
   float ftemp1 = 0.0f,ftemp2 = 0.0f,ftemp3 = 0.0f;

   for (i = 0; i < Length; i++)
   {
       ftemp1 = real[i] * real[i];
       ftemp2 = imag[i] * imag[i];
       ftemp3 = psd1[i] * psd2[i];

       if( ftemp3 == 0.0f)
          output[i] = (ftemp1 + ftemp2) / (ftemp3 + 1e-12);
       else
          output[i] = (ftemp1 + ftemp2) / ftemp3;

    }
}

I am trying to convert this function into a fixed point code. I observed that the input and output float values to and from this function are always in the range of $(-1, 1)$. Just to note, some of the values of ftemp1, ftemp2, ftemp3 in the float code are in the range of 10e-20 and 10e-25.
After converting this function into a fixed point, I observed a lot of deviation between the float code output and the fixed code output due to one particular issue which is as follows.
The minimum Q format I have to use for ftemp1, ftemp2, ftemp3 variables is $\rm Q26.6$ format (in fixed-point code). So, when the values of the above-said variables are less than $1/64$, the corresponding values in the fixed-point code are becoming $0$, which results to $0$ (when both ftemp1 and ftemp2 are $0$) or infinity (when ftemp3 is $0$) as the overall output. Is there any way to overcome this problem i.e. to reduce the deviation between the outputs?
Note: I have tried scaling down and scaling up the inputs passing to this function, but neither of the methods didn't solve the problem.


texts: Design Lowpass Filter With -7.5 dB/Octave Rolloff

texts:
I am working on a project that needs a lowpass filter with a -7.5 dB/Octave rolloff. This is somewhere between the rolloff of a one-pole and two-pole filter, so I wanted to ask what some standard methods are for generating this type of response.

Is it appropriate to have a two pole filter (or two one-pole filters in series) and do a wet/dry mix? Or would is there a more robust method I should try instead?

I am hoping I am able to accomplish this using a simple IIR filter like a biquad.


texts: Sending a real number over a noisy channel with limited energy budget

texts:
Note: My question is theoretical and my goal is to apply the intuition from the answer to a different field.

Imagine I have a real number $X$ which I want to send it over some noisy channel. (The metric that should be optimized is probably squared error).

I have a limited amount of energy $E$ that I can use to send the signal.

What would be the distribution of the received number $R$ and how would it be affected by E?

Just an example: A kind of formula I'm expecting as an answer ():

$R(E) = X + Noise/E$.
$R(E) = X + Noise/\sqrt E$.
$R(E) = X + Noise/ln(E)$.
something else...

I want to know the correct formula. The most important part for me is the effect of $E$.

P.S. I know that I've omitted some information that might turn out useful. If that's true, I'd like to know how the answer is affected by that information. The noise is... say, some "common" type of noise. The transmission/encoding/correction method is the optimum one given the optimization metric (SE) and the noise. (What would that method be BTW, for some common types of noise?) Does the answer change is the time to send a signal is limited?

Update: Trying to state the question in a more formal way:

We're transmitting a real number.

There is a metric $loss(x_{sent}, x_{received})$ that the transmission should minimize. The $loss$ is a non-negative, symmetric and monotonously increases when  $|x_{sent} - x_{received}|$ increases. An example would be $loss(x_{sent}, x_{received}) = (x_{sent} - x_{received})^2$

There is some transmission algorithm (encoding, transmission, decoding, error correction) that uses energy to send the signal over the noisy channel/medium.
The algorithm must be optimal in that it minimizes mean $loss$ when transmitting over a given noisy channel and using the specified amount of energy $E$: $best\_transmitter:=argmin(mean(loss(x, transmit(x))))$

What would be the relation between the following distributions?: $$(best\_transmitter(x, \alpha*E) - x)$$ and $$(best\_transmitter(x, E) - x) $$

If I spend 10 times more energy on transmission, would the error be 100 times smaller, 10 times smaller, 3.1 times smaller or 2.3 times smaller? (given the optimal transmission algorithm)


texts:
What does it mean that the bandwidth of PSK modulated signal without applying any filtering or shaping of the pulse, is equal to the sampling rate with "1st lobe" equal to two times of symbol rate? What is "1st lobe" here? And how it equals to two times of symbol rate?
I've also read, that with applying pulse shaping techniques, "the null-to-null bandwidth is approximately equal to two times of symbol rate", but I don't quite understand what the null-to-null bandwidth is here, and how it equals two times of symbol rate (although I read that null-to-null bandwidth for PSK is $ 2/T $ but I don't know what it comes from).


texts: Huffman coding is a widely used method of entropy coding used for data compression. It assumes that we have complete knowledge of a signal's statistics. However, there are versions of Huffman coding that are used with streaming media and cannot possibly know everything about the signal's statistics. How do these adaptive Huffman encoders work?


texts: Hexagonal Modulator Comparison with Square Modulator

texts:
Hexagonal shaped Modulator is designed to get better BER than Square Modulator. The constellation diagram is like the figure:

It is supposed to give better BER measurement than Square as it has wider decision boundary. I have designed the modulator in this way.

Modulator for hexagonal

a2=[-2 -2 0 0 2 2 4 4];
a2=a2(:);
d=[1 -3 1 -3 1 -3 1 -3];
z1=a2+j*d(:);
z=[z;z1];
%plot(z,'O')

for i=1:length(s)
lodd=s(i);
ModDat(i)=z(lodd+1);

Demodulator for Hexagonal

a=[-3:2:3];
b=[3 -1 3 -1 3 -1 3 -1];
a=[a;-a];
a=a(:);
z=a+j*b(:);
%a2=[a2;-a2];

a2=[-2 -2 0 0 2 2 4 4];
a2=a2(:);
d=[1 -3 1 -3 1 -3 1 -3];
z1=a2+j*d(:);
z=[z;z1];
for fd=1:length(s)

for l=1:16; tes(l)=z(l)-s(fd); end
abs_dat_c=((abs(tes)).^2)';
min_dat=min(abs_dat_c);

for ds=1:16; if min_dat==abs_dat_c(ds); demoddat(fd)=ds-1;
    end;
end
demoddat=demoddat(:);

BER Measurement

N=170000;                       % No Of Symbols
M=16;
Sr=randint(N,1,[0,(M-1)]);      % random data form 0-15
s1=hexmod(Sr,M);  s1=s1(:);             % generate 16-qam data
% s2=qammod(Sr,M,0,'gray');s2=s2(:);
s2=qammod(Sr,M);s2=s2(:);

SNR=1:1:15
for k=1:length(SNR)
%% add noise---> LPN; CD; AWGN for ASE %%
Square_AWGN_Theory=awgn(s2,(SNR(k)+(10*log10(log2(M)))),'measured'); % Square Modulation
Hexagonal_AWGN_Theory= awgn(s1,(SNR(ppn)+(10*log10(log2(M)))),'measured'); % Hexagonal modulation

%% Demodulation Hexagonal
y1_Theory_hex=hexdemod(Hexagonal_AWGN_Theory,M);
y1_Theory_hex=y1_Theory_hex(:);
% [no_of_error_Theory_hex(ppn)

BER_Theory_hex(ppn)]=biterr(Sr(20000:length(y1_Theory_hex)-100),y1_Theory_hex(20000:
(length(y1_Theory_hex)-100)))
[no_of_error_Theory_hex(ppn)
BER_Theory_hex(ppn)]=symerr(Sr(20000:length(y1_Theory_hex)-100),
y1_Theory_hex(20000:(length(y1_Theory_hex)-100)))

%% Square Demodulation
y1_Theory_sq=qamdemod(Square_AWGN_Theory,M);
y1_Theory_sq=y1_Theory_sq(:);
% [no_of_error_Theory_sq(ppn)
BER_Theory_sq(ppn)]=biterr(Sr(20000:length(y1_Theory_sq)-100),
y1_Theory_sq(20000:(length(y1_Theory_sq)-100)))
[no_of_error_Theory_sq(ppn)

BER_Theory_sq(ppn)]=symerr(Sr(20000:length(y1_Theory_sq)-100),
y1_Theory_sq(20000:(length(y1_Theory_sq)-100)))
end

Output BER Comparison

Symbol error Rate Measurement

My Questions/Query

It is supposed that Hexagonal must give better result but i am not getting. although SER (symbol error rate is almost same ) but BER is not perfect. so please give me some suggestion by which i can get better result.

How to make differential coding for this Hexagonal Modulator ?

How to make the theoretical calculation to get a proper equation for this hexagonal modulator ?


texts:
Suppose we have the z-transform of $x[n]$ is $X(z)$ and that of $y[n]$ is $Y(z)$. Then we know that the inverse z-transform of $G(z)=X(z)Y(z)$ is $g[n]=x[n]*y[n]$, where $*$ is convolution.

What will be the inverse z-transform of $G(z)=X(z)X^*(z)=|X(z)|^2$ if  (i.e, $Y(z)=X^*(z)$, complex conjugate)?


texts: When should I calculate PSD instead of plain FFT magnitude spectrum?

texts: I have a thirty-second speech signal that was sampled at 44.1 kHz. Now, I would like to show what frequencies the speech has. However, I'm not sure what would be the best way to do that. It seems sometimes one calculates the absolute value of a Fourier transform, and sometimes power spectral density. If I understand correctly, the latter works so that I divide my signal into parts, do FFT part-by-part and somehow sum these. Window functions are somehow involved. Can you clarify this a bit for me? I'm new to DSP.


texts: Why we take different mfcc components in different programs?

texts: Why we take different MFCC components in different programs? Suppose, in a program we take No. of mfcc components = 14.What does it signify?


texts: How to accurately model wideband RF reflections?

texts:
I would like to model a transmitter and received pair, both sampling at the same bandwidth (not clock synchronized), where there are a number of reflectors. The time delay due to the reflectors can be a non-integer multiple of the receiver resolution (1 / sampling bandwidth), and I would like to accurately model that.

This means that if I take the transmitted signal at the nominal sample rate, and sum a bunch of time-delayed versions of the signal (with the time delay equal to the difference in time it takes light to travel the direct path and the reflected path), this will be inaccurate because the time delays will be quantized to the sampling period, which is too coarse.

Obviously I can upsample and then do the sum of the upsampled discrete-time signals, which will decrease the quantization error of the time delay. But I'm wondering if there's a way to model the received digital signal without any quantization error. In other words, I'd like to model the continuous-time reflections.

I'm modeling this for a RADAR application, so I'd like the model to be phase-accurate. I'm assuming that each reflector can be modeled by the distance to the transmitter and the receiver, and some real-valued attenuation constant. Is this assumption accurate for RADAR applications? I'm also assuming that the received signal is a sum of time-delayed signals with time-delay and attenuation from the reflector's distances and attenuation constant. Is this accurate for RF, or do I need to account for a discrete phase jump at each reflection?


texts: Finding the edge pixels on only one side of the object

texts:
For my work on lung images, I get a binary image mostly resembling the pattern shown below. I need to find the pixels on the borders shown by yellow arrows. The edges on the other end are shown in pink color.

the edge function on MATLAB highlights all the edges irrespective of the side.

edge_BW_portionR = edge(BW_portionR)

I also used distance transform in which the lower right corner was used as a reference , and with respect to that, I put some conditions, but in vain.

How can this be solved?


texts: how a signal for which calculate RMS can be filtered and have a fast settling time?

texts:
i designed a sinusoidal pwm amplifier (3KHz to 20KHz) that regulates its output voltage reading the RMS value of output current.

The RMS is obtained squaring the signal sampled by AD converter @200KHz and then applyng a FIR filter with 120 TAPS.

The advantage of this method is that the settling time of the FIR (so the response to amplitude changing) is about 600us so i can correct the pwm duty every 1ms because the value is alread stable.

All works fine but the problem arises when an external signal is added to the signal the amplifier is generating.

Infact a signal of about 600Hz different from original one (i.e. amplifier generates 4950Hz and a 5550Hz signal is added as external noise) causes an oscllation in RMS measure makes the amplidifer works in wrong way.

Applying a bandpass FIR makes the response of FIR slower. I tried downsampling by a factor of 4 and make a FIR of 1KHz bandwith but the fastest settling time i obtained was about 5ms that is too much because i've to regulate every 1ms.

Have you any idea or advice? Is there any algorithm to cancel unwanted component maintaing fast RMS response?

Thank you . Let me know.


texts:
First of all thanks for your patience: it is the first time for me posting a question in this forum. I am not a DSP expert, but I should get by if you give me in depth explanation.

This is an example of my raw data

and a link to the actual dataset (time=t0, acceleration=acc).

My problem is the following: I am measuring accelerometer data for an experiment, but I am having a hard time filtering out the raw acceleration data for double integration of velocity and position. The first thing that I do is to remove the dc component of the data via

#python code
func = interp1d(t0,acc)
dt = 10./1000. # [secs]
ta = np.arange(t0[0],t0[-1],dt)
a = func(ta)
n = len(a)
freq = np.fft.fftfreq(n, d=dt)
freq[0]=1e-16
F = np.fft.fft(a)
F[0]=0
new_acc = np.real(np.fft.ifft(F))

In particular, I have the physical constraint the integrated velocity should be always positive, or equal to zero where the acceleration is equal to zero.
However, when I integrate the new_acc,

v = cumtrapz(new_acc)*dt

this is what I get:

Leaving alone for a minute the position (which is ultimately really what I am interested in)
my question is:

is there any way to design a filter such that the integral of the filtered signal is always >=0 ?

Alternatively, if you believe that the one above is the wrong question to ask:

what is the best way to integrate (twice) this dataset?


texts:
Is it possible to define a scaling property for fourier transform when the scale factor is complex?
Usually the scaling factor is real. What happen when a scaling factor is complex?


texts: How to put specific frequency in a specific bin in frequency domain?

texts:
I have eight tones as represented by f, and I want to the distance between every two tones is different as shown in the figure,
I have the frequency spacing, but I need to put the tones properly, and I need the resolution and the number of samples to be suitable for FFT consideration.

N=8;
r=1;
f_d=1e3;
M=4;
m=0:M-1;
fc=2.45e9;
%% freq spacing
for j=1:M
f_spac(j)=(1+m(j)*r)*f_d;      %freq spacing
end
%% Generate the frequency vector
for i=1:M
    f(:,i)=[fc+((1+m(i)*r)/2)*f_d; fc-((1+m(i)*r)/2)*f_d];
end
B = reshape(f,[1,N]);
fs=20*f(N/2); % Sampling frequency
Ts=1/fs; % Sampling time
t=0:Ts:1e3*Ts; % Time vector


texts: Fast Vocal Tract Length Normalization(VTLN) implementation?

texts:
My team is building a speech recognition model. As far as I know, Vocal Tract Length Normalization (VTLN) is an effective warping method that may help improve the model performance by diminishing spectral variance.

However, most implementations I've seen so far seem to use maximum-likelihood to estimate the warping factor, which could be slow when the model is used to recognize real-time audio streams (we plan to deploy the model on hardware so some computations in calculating probability such as division may be expensive).

Is there a fast implementation of VTLN? It's okay if the performance is slightly worse than the ML implementation.


texts: So I've read here Multi-Stage digital FIR filter vs Single stage FIR filter. Which is better? if you want to interpolate by a great number, it's always better to do so in multi-stage interpolations so it won't be as costly as a single interpolation. Let's say I want to interpolate by 64, and I choose to do it in 3 stages: first time interpolate by 2, next by 4, and last by 8. I'd use the first stage to pulse shape my input signal but my question is what to do in the remaining stages? Any lowpass filter would be good to go?


texts: Can cross correlation be used to see if filtering of a signal has changed it too much?

texts: I am filtering a signal, and want to check if I am not over filtering it. I am doing a low pass filter, for a signal of input frequency of 512Hz, first with 250Hz pass band, then )I was intending to reduce from 250 Hz to lower frequencies. I wanted to use cross correlation , but I am not sure if it is a good technique. usually I get something like the following as Cross Correlation between the signal itself and the filtered one. i sit a good criteria?:


texts: How does a Costas Loop lock to one of multiple BPSK signals

texts:
I've been looking into how GPS receivers work in terms of signal processing. When a GPS receiver tracks the received signal, it often uses a Costas loop to synchronize the carrier.

How that works with the signal of one satellite makes sense to me. A local carrier gets multiplied with the incoming signal and the resulting phase error between the two can be extracted to tune the frequency and phase of the local carrier until they match and the phase error becomes zero.

With GPS, the receiver usually receives at least 4 different signals from different satellites though. They all experience slightly different doppler shifts, so that the receiver "sees" them at different frequencies.

Using a Costas loop on this mix of signals means the phase error never really reaches zero, because even if the local carrier perfectly matches one of the signals, the phase discriminator will pick up the remaining phase errors against all the other received satellite signals.

How does the Costas loop of a GPS receiver get around that?

Is the loop filter supposed to filter these other phase error sources out? Aren't these other phase errors all similar, so that a filter couldn't differentiate between them?


texts: Nyquist rate determination and oversampling

texts:
I'm new to this. I'm using ShannonGui to generate a sine wave with a $1\textrm{ Hz}$ signal frequency.

From what I can tell to determine the Nyquist rate I need to double the highest frequency, since it's a constant $1\textrm{ Hz}$, I just double it and get a Nyquist rate of $2\textrm{ Hz}$ correct?

Now I also read that the Nyquist rate is the lowest frequency that you can use as a sampling frequency to avoid aliasing, but when I use $2\textrm{ Hz}$ as the sample frequency the reconstructed wave is a straight line at 0. So does this mean the Nyquist rate is wrong or my understanding of it is wrong?


texts: Upsampling by zero padding or duplicating sequence

texts: I need to upsample a 2 MHz signal by a factor of 3000 to convert the OQPSK modulated baseband signal to passband. When I upsample by duplicating the elements in the sequence, I seem to get less error compared to padding the sequence with zeros. The frequency spectrum is also better when I duplicate elements whereas with zero padding, the spectrum shows nothing. I am now confused on which way is the right method to upsample a sequence and why.


texts: How to do base-band simulation of coherent detection of M-ary orthogonal signals?

texts:
I currently have a complex base-band simulator for non-coherent detection of M-ary orthogonal waveforms (such as M-FSK).  I run the noisy signal through M correlators at lag=0, compute the magnitude squared of the results and pick the largest.  Everything is perfectly synchronized.

It is just: modulate -> add AWGN -> demod.

Currently, my non-coherent simulation BER performance matches the theoretical equations derived in Proakis.

What do I have to tweak in order to simulate coherent detection given that my received signal is perfectly synchronized?


texts: Can someone show the details of how to apply AIC for sinusoidal models to specific data?

texts:
NOTE: This is a question that another user has been trying (unsuccessfully) to ask. Because the multiple questions asking, essentially, the same thing have either been deleted by me (because they were duplicates of each other) or by the user, I have tried to ask the question in such a way that will help the user and is a good fit for the site.

Suppose I have a vector of data measurements, $x(n)$, and I want to fit a model to that data:
$$
x(n) =  \sum_{p=1}^{P} a_p \cos(2\pi f_p + \phi_p) + \epsilon(n)
$$
where each of the $P$ sinusoids is parameterized by $(a_p, f_p, \phi_p)$ and $\epsilon$ is an i.i.d. Gaussian, white noise process with zero mean and variance $\sigma^2$.

My question is: How do we use AIC (or BIC or MDL) to estimate the model order, $P$ ?

The Wikipedia entry just says:
$$
AIC = 2P - 2\ln(L)
$$
where $L$ is the likelihood function.

How do I calculate $L$ given $x(n)$?


texts: Quadrature signal acquisition simulation

texts:
Bottom-line: how to create a 90 degrees out of phase signal from the real part of the fourier transform of a 1D signal (i.e., fft of a line of an image). ? *(I *(I think the Fourier shift thm can help but mot exactly sure how yet)

In MRI the actual FID echo signal is acquired in quadrature (cf. http://mriquestions.com/real-v-imaginary.html ). Also each line of the k-space (=2D Fourier transform raw data in MRI jargon) is acquired sequentially, i.e., a sampled 1D (temporal) signal (in the receiver coil). Each sample is put in each x,y position in the 2D kspace (which correspond to spatial frequencies), which is the Fourier transformed to get a spatial (visually interpretable for humans) image.

That being said, I want to take any image, for the sake of the example, lets say the artificial 'cameraman' image of Matlab. We can do a DFT of this image and get a real and imaginary image. I want to make as if/simulate that this image was MRI acquired. Therefore, as I understand the description here http://mriquestions.com/real-v-imaginary.html , one could take the real part (but it doesnt matter if it was real, it could be the imaginary, but let's take the real one for the example), the dephase it w.r.t itself by 90 degrees. Then discard the imaginary part and replace it with this "dephased" version of the real part, since the real and imag parts are supposed to be the same but just dephased by 90 degrees.

The special thing is that this will result in a "phase" image e.g.: https://www.researchgate.net/figure/a-A-256-256-MRI-head-phase-image-b-its-corresponding-residue-distribution_fig6_232321363, in the spatial domain too. I thought about the Fourier Shift theorem: https://www.dsprelated.com/freebooks/sasp/Shift_Theorem.html ... but not sure how to use it...

ideas ?


texts:
I am a beginner and maybe I have the false idea but I will thank your understanding, my background is not so on the DSP side.

I have a KX134-1211 accelerometer that delivers a digital output.
It is triaxial 16 bit sensor and delivers at 2 axis 8500 Hz as signal bandwidth.

This means the sensor fmax is 8500 Hz right? Since it is already digital how much sampling rate do I need to get the maximum signal banwidth, 8500 or 17000 Hz?

If I sameple the sensor for at 8500 during 1 second I will get 8500 values, how much bytes is this, I want to calculate how much size each recording will take.


texts: Why Does 2D FFT of Gaussian Looks More Sharper than Gaussian Itself?

texts:
I am trying to understand why 2D FFT is done on a Gaussian process in a particular code. From my understanding from these posts:

https://www.researchgate.net/post/Why_would_we_want_to_do_Fourier_transform_of_a_Gaussian_signal
Why use a gaussian low pass filter, when we can convolve with gaussian kernel
Zero padding effect on a FFT of gaussian noise

It appears that it is used to

reduce noise
reduce the sharpness on the edges

I am working with MATLAB, and the code snippet is as follows. Please note the peak has been moved to the top-left in the gaussian_shaped_label function, with wrap-around:

%window size, taking padding into account
window_sz = floor(target_sz * (1 + padding));

%   we could choose a size that is a power of two, for better FFT
%   performance. in practice it is slower, due to the larger window size.
%   window_sz = 2 .^ nextpow2(window_sz);

%create regression labels, gaussian shaped, with a bandwidth proportional to target size
output_sigma = sqrt(prod(target_sz)) * output_sigma_factor / cell_size;
yf = fft2(gaussian_shaped_labels(output_sigma, floor(window_sz / cell_size)));

I was trying to plot the two results.

The Gaussian (left) zoomed on the top-left edge(right):

Plotting the code:

  gaussian_shaped_labels(output_sigma, floor(window_sz / cell_size)));

The absolute value of the 2D FFT of the Gaussian mentioned in point 1 (left) zoomed on the top-left(right):
Plotting the code-

fft2(gaussian_shaped_labels(output_sigma, floor(window_sz / cell_size)));

The plot of 2D FFT seems sharper than the Gaussian. Shouldn't 2D FFT actually blur the edges and make it smoother or something? I think I am going wrong somewhere and any help will be appreciated.

P. S.
If you can help me understand the mathematically too, it would extra helpful but not a hard requirement here.


texts: Can I use SINAD for THD+N measurements? Are they inverse of each other?

texts:
I'm looking for a clarification, which I haven't really been able to find. It's probably obvious but I'd like to be absolutely sure of what I'm calculating.

I noticed that the formula that calculates THD is:

$THD = \frac{\sqrt{H^2_2 + H^2_3 + H^2_4 + \dots + H^2_n}}{H_1}$

This is seen as the power ratio of the harmonics to the fundamental.

The sinad function in MATLAB calculates the power ratio of the fundamental to the harmonics and noise floor.

$SINAD = \frac{P_{fundamental}}{P_{noise+distortion}}$

Wouldn't THD+N be the inverse of SINAD, since for calculating THD+N we essentially need:

$\frac{P_{noise+distortion}}{P_{fundamental}}$

Both the measurements seem to ignore DC. I use this MATLAB tutorial page as a reference: https://www.mathworks.com/help/signal/ug/distortion-measurements.html

I guess I'm wondering this because I often see SINAD and THD+N listed as separate measurements, but I don't see how they are different.


texts: How to write lowpass filter for sampled signal in Python?

texts: I have some signal that sampled each 1 ns (1e-9 sec) and have, let say, 1e4 points. I need to filter high frequencies from this signal. Let say I need to filter frequencies higher than 10 MHz. I want that for frequencies lower than cutoff frequency signal will be passed unchanged. It means gain of the filter will be 1 for frequencies lower than cutoff frequency. I would like to be able to specify filter order. I mean, first order filter have 20 db/decade slope (power roll off) after cutoff frequency, second order filter have 40 db/dec slope after cutoff frequency and so on. High performance of code is important.